ci: regenerated with OpenAPI Doc , Speakeasy CLI 1.397.2

This commit is contained in:
speakeasybot
2024-09-16 18:44:33 +00:00
parent c0dafdc561
commit 6b54deac02
919 changed files with 16195 additions and 6963 deletions

View File

@@ -1,4 +1,4 @@
// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.
// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
import Foundation
@@ -36,6 +36,24 @@ class _MediaAPI: MediaAPI {
handleResponse: handleUpdatePlayProgressResponse
)
}
public func getBannerImage(request: Operations.GetBannerImageRequest) async throws -> ResponseWithHeaders<Operations.GetBannerImageResponse> {
return try await client.makeRequest(
configureRequest: { configuration in
try configureGetBannerImageRequest(with: configuration, request: request)
},
handleResponse: handleGetBannerImageResponse
)
}
public func getThumbImage(request: Operations.GetThumbImageRequest) async throws -> ResponseWithHeaders<Operations.GetThumbImageResponse> {
return try await client.makeRequest(
configureRequest: { configuration in
try configureGetThumbImageRequest(with: configuration, request: request)
},
handleResponse: handleGetThumbImageResponse
)
}
}
@@ -62,17 +80,41 @@ private func configureUpdatePlayProgressRequest(with configuration: URLRequestCo
configuration.telemetryHeader = .userAgent
}
private func configureGetBannerImageRequest(with configuration: URLRequestConfiguration, request: Operations.GetBannerImageRequest) throws {
configuration.path = "/library/metadata/{ratingKey}/banner"
configuration.method = .get
configuration.pathParameterSerializable = request
configuration.queryParameterSerializable = request
configuration.telemetryHeader = .userAgent
}
private func configureGetThumbImageRequest(with configuration: URLRequestConfiguration, request: Operations.GetThumbImageRequest) throws {
configuration.path = "/library/metadata/{ratingKey}/thumb"
configuration.method = .get
configuration.pathParameterSerializable = request
configuration.queryParameterSerializable = request
configuration.telemetryHeader = .userAgent
}
// MARK: - Response Handlers
private func handleMarkPlayedResponse(response: Client.APIResponse) throws -> Operations.MarkPlayedResponse {
let httpResponse = response.httpResponse
if [200, 400].contains(httpResponse.statusCode) {
if httpResponse.statusCode == 200 {
return .empty
} else if httpResponse.statusCode == 400 {
if httpResponse.contentType.matchContentType(pattern: "application/json"), let data = response.data {
do {
return .badRequest(try JSONDecoder().decode(Operations.MarkPlayedBadRequest.self, from: data))
} catch {
throw ResponseHandlerError.failedToDecodeJSON(error)
}
}
} else if httpResponse.statusCode == 401 {
if httpResponse.contentType.matchContentType(pattern: "application/json"), let data = response.data {
do {
return .object(try JSONDecoder().decode(Operations.MarkPlayedResponseBody.self, from: data))
return .unauthorized(try JSONDecoder().decode(Operations.MarkPlayedUnauthorized.self, from: data))
} catch {
throw ResponseHandlerError.failedToDecodeJSON(error)
}
@@ -85,12 +127,20 @@ private func handleMarkPlayedResponse(response: Client.APIResponse) throws -> Op
private func handleMarkUnplayedResponse(response: Client.APIResponse) throws -> Operations.MarkUnplayedResponse {
let httpResponse = response.httpResponse
if [200, 400].contains(httpResponse.statusCode) {
if httpResponse.statusCode == 200 {
return .empty
} else if httpResponse.statusCode == 400 {
if httpResponse.contentType.matchContentType(pattern: "application/json"), let data = response.data {
do {
return .badRequest(try JSONDecoder().decode(Operations.MarkUnplayedBadRequest.self, from: data))
} catch {
throw ResponseHandlerError.failedToDecodeJSON(error)
}
}
} else if httpResponse.statusCode == 401 {
if httpResponse.contentType.matchContentType(pattern: "application/json"), let data = response.data {
do {
return .object(try JSONDecoder().decode(Operations.MarkUnplayedResponseBody.self, from: data))
return .unauthorized(try JSONDecoder().decode(Operations.MarkUnplayedUnauthorized.self, from: data))
} catch {
throw ResponseHandlerError.failedToDecodeJSON(error)
}
@@ -103,12 +153,76 @@ private func handleMarkUnplayedResponse(response: Client.APIResponse) throws ->
private func handleUpdatePlayProgressResponse(response: Client.APIResponse) throws -> Operations.UpdatePlayProgressResponse {
let httpResponse = response.httpResponse
if [200, 400].contains(httpResponse.statusCode) {
if httpResponse.statusCode == 200 {
return .empty
} else if httpResponse.statusCode == 400 {
if httpResponse.contentType.matchContentType(pattern: "application/json"), let data = response.data {
do {
return .badRequest(try JSONDecoder().decode(Operations.UpdatePlayProgressBadRequest.self, from: data))
} catch {
throw ResponseHandlerError.failedToDecodeJSON(error)
}
}
} else if httpResponse.statusCode == 401 {
if httpResponse.contentType.matchContentType(pattern: "application/json"), let data = response.data {
do {
return .object(try JSONDecoder().decode(Operations.UpdatePlayProgressResponseBody.self, from: data))
return .unauthorized(try JSONDecoder().decode(Operations.UpdatePlayProgressUnauthorized.self, from: data))
} catch {
throw ResponseHandlerError.failedToDecodeJSON(error)
}
}
}
return .empty
}
private func handleGetBannerImageResponse(response: Client.APIResponse) throws -> Operations.GetBannerImageResponse {
let httpResponse = response.httpResponse
if httpResponse.statusCode == 200 {
if httpResponse.contentType.matchContentType(pattern: "image/jpeg"), let data = response.data {
return .bytes(data)
}
} else if httpResponse.statusCode == 400 {
if httpResponse.contentType.matchContentType(pattern: "application/json"), let data = response.data {
do {
return .badRequest(try JSONDecoder().decode(Operations.GetBannerImageBadRequest.self, from: data))
} catch {
throw ResponseHandlerError.failedToDecodeJSON(error)
}
}
} else if httpResponse.statusCode == 401 {
if httpResponse.contentType.matchContentType(pattern: "application/json"), let data = response.data {
do {
return .unauthorized(try JSONDecoder().decode(Operations.GetBannerImageUnauthorized.self, from: data))
} catch {
throw ResponseHandlerError.failedToDecodeJSON(error)
}
}
}
return .empty
}
private func handleGetThumbImageResponse(response: Client.APIResponse) throws -> Operations.GetThumbImageResponse {
let httpResponse = response.httpResponse
if httpResponse.statusCode == 200 {
if httpResponse.contentType.matchContentType(pattern: "image/jpeg"), let data = response.data {
return .bytes(data)
}
} else if httpResponse.statusCode == 400 {
if httpResponse.contentType.matchContentType(pattern: "application/json"), let data = response.data {
do {
return .badRequest(try JSONDecoder().decode(Operations.GetThumbImageBadRequest.self, from: data))
} catch {
throw ResponseHandlerError.failedToDecodeJSON(error)
}
}
} else if httpResponse.statusCode == 401 {
if httpResponse.contentType.matchContentType(pattern: "application/json"), let data = response.data {
do {
return .unauthorized(try JSONDecoder().decode(Operations.GetThumbImageUnauthorized.self, from: data))
} catch {
throw ResponseHandlerError.failedToDecodeJSON(error)
}