ci: regenerated with OpenAPI Doc 0.0.3, Speakeasy CLI 1.161.0

This commit is contained in:
speakeasybot
2024-02-01 00:56:10 +00:00
parent 9d3c934f78
commit d8fb37fcc3
496 changed files with 25444 additions and 0 deletions

View File

@@ -0,0 +1,193 @@
// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.
import Foundation
class _ButlerAPI: ButlerAPI {
private let client: Client
init(client: Client) {
self.client = client
}
public func getButlerTasks() async throws -> Response<Operations.GetButlerTasksResponse> {
return try await client.makeRequest(
configureRequest: { configuration in
try configureGetButlerTasksRequest(with: configuration)
},
handleResponse: handleGetButlerTasksResponse
)
}
public func startAllTasks() async throws -> Response<Operations.StartAllTasksResponse> {
return try await client.makeRequest(
configureRequest: { configuration in
try configureStartAllTasksRequest(with: configuration)
},
handleResponse: handleStartAllTasksResponse
)
}
public func stopAllTasks() async throws -> Response<Operations.StopAllTasksResponse> {
return try await client.makeRequest(
configureRequest: { configuration in
try configureStopAllTasksRequest(with: configuration)
},
handleResponse: handleStopAllTasksResponse
)
}
public func startTask(request: Operations.StartTaskRequest) async throws -> Response<Operations.StartTaskResponse> {
return try await client.makeRequest(
configureRequest: { configuration in
try configureStartTaskRequest(with: configuration, request: request)
},
handleResponse: handleStartTaskResponse
)
}
public func stopTask(request: Operations.StopTaskRequest) async throws -> Response<Operations.StopTaskResponse> {
return try await client.makeRequest(
configureRequest: { configuration in
try configureStopTaskRequest(with: configuration, request: request)
},
handleResponse: handleStopTaskResponse
)
}
}
// MARK: - Request Configuration
private func configureGetButlerTasksRequest(with configuration: URLRequestConfiguration) throws {
configuration.path = "/butler"
configuration.method = .get
configuration.telemetryHeader = .userAgent
}
private func configureStartAllTasksRequest(with configuration: URLRequestConfiguration) throws {
configuration.path = "/butler"
configuration.method = .post
configuration.telemetryHeader = .userAgent
}
private func configureStopAllTasksRequest(with configuration: URLRequestConfiguration) throws {
configuration.path = "/butler"
configuration.method = .delete
configuration.telemetryHeader = .userAgent
}
private func configureStartTaskRequest(with configuration: URLRequestConfiguration, request: Operations.StartTaskRequest) throws {
configuration.path = "/butler/{taskName}"
configuration.method = .post
configuration.pathParameterSerializable = request
configuration.telemetryHeader = .userAgent
}
private func configureStopTaskRequest(with configuration: URLRequestConfiguration, request: Operations.StopTaskRequest) throws {
configuration.path = "/butler/{taskName}"
configuration.method = .delete
configuration.pathParameterSerializable = request
configuration.telemetryHeader = .userAgent
}
// MARK: - Response Handlers
private func handleGetButlerTasksResponse(response: Client.APIResponse) throws -> Operations.GetButlerTasksResponse {
let httpResponse = response.httpResponse
if httpResponse.statusCode == 200 {
if httpResponse.contentType.matchContentType(pattern: "application/json"), let data = response.data {
do {
return .twoHundredApplicationJsonObject(try JSONDecoder().decode(Operations.GetButlerTasksResponseBody.self, from: data))
} catch {
throw ResponseHandlerError.failedToDecodeJSON(error)
}
}
} else if httpResponse.statusCode == 400 {
return .empty
} else if httpResponse.statusCode == 401 {
if httpResponse.contentType.matchContentType(pattern: "application/json"), let data = response.data {
do {
return .fourHundredAndOneApplicationJsonObject(try JSONDecoder().decode(Operations.GetButlerTasksButlerResponseBody.self, from: data))
} catch {
throw ResponseHandlerError.failedToDecodeJSON(error)
}
}
}
return .empty
}
private func handleStartAllTasksResponse(response: Client.APIResponse) throws -> Operations.StartAllTasksResponse {
let httpResponse = response.httpResponse
if [200, 400].contains(httpResponse.statusCode) {
return .empty
} else if httpResponse.statusCode == 401 {
if httpResponse.contentType.matchContentType(pattern: "application/json"), let data = response.data {
do {
return .object(try JSONDecoder().decode(Operations.StartAllTasksResponseBody.self, from: data))
} catch {
throw ResponseHandlerError.failedToDecodeJSON(error)
}
}
}
return .empty
}
private func handleStopAllTasksResponse(response: Client.APIResponse) throws -> Operations.StopAllTasksResponse {
let httpResponse = response.httpResponse
if [200, 400].contains(httpResponse.statusCode) {
return .empty
} else if httpResponse.statusCode == 401 {
if httpResponse.contentType.matchContentType(pattern: "application/json"), let data = response.data {
do {
return .object(try JSONDecoder().decode(Operations.StopAllTasksResponseBody.self, from: data))
} catch {
throw ResponseHandlerError.failedToDecodeJSON(error)
}
}
}
return .empty
}
private func handleStartTaskResponse(response: Client.APIResponse) throws -> Operations.StartTaskResponse {
let httpResponse = response.httpResponse
if [200, 202, 400].contains(httpResponse.statusCode) {
return .empty
} else if httpResponse.statusCode == 401 {
if httpResponse.contentType.matchContentType(pattern: "application/json"), let data = response.data {
do {
return .object(try JSONDecoder().decode(Operations.StartTaskResponseBody.self, from: data))
} catch {
throw ResponseHandlerError.failedToDecodeJSON(error)
}
}
}
return .empty
}
private func handleStopTaskResponse(response: Client.APIResponse) throws -> Operations.StopTaskResponse {
let httpResponse = response.httpResponse
if [200, 400, 404].contains(httpResponse.statusCode) {
return .empty
} else if httpResponse.statusCode == 401 {
if httpResponse.contentType.matchContentType(pattern: "application/json"), let data = response.data {
do {
return .object(try JSONDecoder().decode(Operations.StopTaskResponseBody.self, from: data))
} catch {
throw ResponseHandlerError.failedToDecodeJSON(error)
}
}
}
return .empty
}