ci: regenerated with OpenAPI Doc 0.0.3, Speakeasy CLI 1.152.1

This commit is contained in:
speakeasybot
2024-01-26 00:54:09 +00:00
parent 9d3c934f78
commit d6b8694f87
483 changed files with 24658 additions and 0 deletions

View File

@@ -0,0 +1,175 @@
// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.
import Foundation
class _SessionsAPI: SessionsAPI {
private let client: Client
init(client: Client) {
self.client = client
}
public func getSessions() async throws -> Response<Operations.GetSessionsResponse> {
return try await client.makeRequest(
configureRequest: { configuration in
try configureGetSessionsRequest(with: configuration)
},
handleResponse: handleGetSessionsResponse
)
}
public func getSessionHistory() async throws -> Response<Operations.GetSessionHistoryResponse> {
return try await client.makeRequest(
configureRequest: { configuration in
try configureGetSessionHistoryRequest(with: configuration)
},
handleResponse: handleGetSessionHistoryResponse
)
}
public func getTranscodeSessions() async throws -> Response<Operations.GetTranscodeSessionsResponse> {
return try await client.makeRequest(
configureRequest: { configuration in
try configureGetTranscodeSessionsRequest(with: configuration)
},
handleResponse: handleGetTranscodeSessionsResponse
)
}
public func stopTranscodeSession(request: Operations.StopTranscodeSessionRequest) async throws -> Response<Operations.StopTranscodeSessionResponse> {
return try await client.makeRequest(
configureRequest: { configuration in
try configureStopTranscodeSessionRequest(with: configuration, request: request)
},
handleResponse: handleStopTranscodeSessionResponse
)
}
}
// MARK: - Request Configuration
private func configureGetSessionsRequest(with configuration: URLRequestConfiguration) throws {
configuration.path = "/status/sessions"
configuration.method = .get
configuration.telemetryHeader = .userAgent
}
private func configureGetSessionHistoryRequest(with configuration: URLRequestConfiguration) throws {
configuration.path = "/status/sessions/history/all"
configuration.method = .get
configuration.telemetryHeader = .userAgent
}
private func configureGetTranscodeSessionsRequest(with configuration: URLRequestConfiguration) throws {
configuration.path = "/transcode/sessions"
configuration.method = .get
configuration.telemetryHeader = .userAgent
}
private func configureStopTranscodeSessionRequest(with configuration: URLRequestConfiguration, request: Operations.StopTranscodeSessionRequest) throws {
configuration.path = "/transcode/sessions/{sessionKey}"
configuration.method = .delete
configuration.pathParameterSerializable = request
configuration.telemetryHeader = .userAgent
}
// MARK: - Response Handlers
private func handleGetSessionsResponse(response: Client.APIResponse) throws -> Operations.GetSessionsResponse {
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.GetSessionsResponseBody.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.GetSessionsSessionsResponseBody.self, from: data))
} catch {
throw ResponseHandlerError.failedToDecodeJSON(error)
}
}
}
return .empty
}
private func handleGetSessionHistoryResponse(response: Client.APIResponse) throws -> Operations.GetSessionHistoryResponse {
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.GetSessionHistoryResponseBody.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.GetSessionHistorySessionsResponseBody.self, from: data))
} catch {
throw ResponseHandlerError.failedToDecodeJSON(error)
}
}
}
return .empty
}
private func handleGetTranscodeSessionsResponse(response: Client.APIResponse) throws -> Operations.GetTranscodeSessionsResponse {
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.GetTranscodeSessionsResponseBody.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.GetTranscodeSessionsSessionsResponseBody.self, from: data))
} catch {
throw ResponseHandlerError.failedToDecodeJSON(error)
}
}
}
return .empty
}
private func handleStopTranscodeSessionResponse(response: Client.APIResponse) throws -> Operations.StopTranscodeSessionResponse {
let httpResponse = response.httpResponse
if [204, 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.StopTranscodeSessionResponseBody.self, from: data))
} catch {
throw ResponseHandlerError.failedToDecodeJSON(error)
}
}
}
return .empty
}