mirror of
https://github.com/LukeHagar/plexswift.git
synced 2025-12-07 12:47:45 +00:00
ci: regenerated with OpenAPI Doc , Speakeasy CLI 1.397.2
This commit is contained in:
@@ -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
|
||||
@@ -73,6 +73,15 @@ class _ServerAPI: ServerAPI {
|
||||
)
|
||||
}
|
||||
|
||||
public func getMediaProviders(request: Operations.GetMediaProvidersRequest) async throws -> Response<Operations.GetMediaProvidersResponse> {
|
||||
return try await client.makeRequest(
|
||||
configureRequest: { configuration in
|
||||
try configureGetMediaProvidersRequest(with: configuration, request: request)
|
||||
},
|
||||
handleResponse: handleGetMediaProvidersResponse
|
||||
)
|
||||
}
|
||||
|
||||
public func getServerList() async throws -> Response<Operations.GetServerListResponse> {
|
||||
return try await client.makeRequest(
|
||||
configureRequest: { configuration in
|
||||
@@ -129,6 +138,13 @@ private func configureGetResizedPhotoRequest(with configuration: URLRequestConfi
|
||||
configuration.telemetryHeader = .userAgent
|
||||
}
|
||||
|
||||
private func configureGetMediaProvidersRequest(with configuration: URLRequestConfiguration, request: Operations.GetMediaProvidersRequest) throws {
|
||||
configuration.path = "/media/providers"
|
||||
configuration.method = .get
|
||||
configuration.queryParameterSerializable = request
|
||||
configuration.telemetryHeader = .userAgent
|
||||
}
|
||||
|
||||
private func configureGetServerListRequest(with configuration: URLRequestConfiguration) throws {
|
||||
configuration.path = "/servers"
|
||||
configuration.method = .get
|
||||
@@ -143,17 +159,23 @@ private func handleGetServerCapabilitiesResponse(response: Client.APIResponse) t
|
||||
if httpResponse.statusCode == 200 {
|
||||
if httpResponse.contentType.matchContentType(pattern: "application/json"), let data = response.data {
|
||||
do {
|
||||
return .twoHundredApplicationJsonObject(try JSONDecoder().decode(Operations.GetServerCapabilitiesResponseBody.self, from: data))
|
||||
return .object(try JSONDecoder().decode(Operations.GetServerCapabilitiesResponseBody.self, from: data))
|
||||
} catch {
|
||||
throw ResponseHandlerError.failedToDecodeJSON(error)
|
||||
}
|
||||
}
|
||||
} else if httpResponse.statusCode == 400 {
|
||||
return .empty
|
||||
if httpResponse.contentType.matchContentType(pattern: "application/json"), let data = response.data {
|
||||
do {
|
||||
return .badRequest(try JSONDecoder().decode(Operations.GetServerCapabilitiesBadRequest.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 .fourHundredAndOneApplicationJsonObject(try JSONDecoder().decode(Operations.GetServerCapabilitiesServerResponseBody.self, from: data))
|
||||
return .unauthorized(try JSONDecoder().decode(Operations.GetServerCapabilitiesUnauthorized.self, from: data))
|
||||
} catch {
|
||||
throw ResponseHandlerError.failedToDecodeJSON(error)
|
||||
}
|
||||
@@ -169,17 +191,23 @@ private func handleGetServerPreferencesResponse(response: Client.APIResponse) th
|
||||
if httpResponse.statusCode == 200 {
|
||||
if httpResponse.contentType.matchContentType(pattern: "application/json"), let data = response.data {
|
||||
do {
|
||||
return .twoHundredApplicationJsonObject(try JSONDecoder().decode(Operations.GetServerPreferencesResponseBody.self, from: data))
|
||||
return .object(try JSONDecoder().decode(Operations.GetServerPreferencesResponseBody.self, from: data))
|
||||
} catch {
|
||||
throw ResponseHandlerError.failedToDecodeJSON(error)
|
||||
}
|
||||
}
|
||||
} else if httpResponse.statusCode == 400 {
|
||||
return .empty
|
||||
if httpResponse.contentType.matchContentType(pattern: "application/json"), let data = response.data {
|
||||
do {
|
||||
return .badRequest(try JSONDecoder().decode(Operations.GetServerPreferencesBadRequest.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 .fourHundredAndOneApplicationJsonObject(try JSONDecoder().decode(Operations.GetServerPreferencesServerResponseBody.self, from: data))
|
||||
return .unauthorized(try JSONDecoder().decode(Operations.GetServerPreferencesUnauthorized.self, from: data))
|
||||
} catch {
|
||||
throw ResponseHandlerError.failedToDecodeJSON(error)
|
||||
}
|
||||
@@ -195,17 +223,23 @@ private func handleGetAvailableClientsResponse(response: Client.APIResponse) thr
|
||||
if httpResponse.statusCode == 200 {
|
||||
if httpResponse.contentType.matchContentType(pattern: "application/json"), let data = response.data {
|
||||
do {
|
||||
return .twoHundredApplicationJsonObject(try JSONDecoder().decode(Operations.GetAvailableClientsResponseBody.self, from: data))
|
||||
return .object(try JSONDecoder().decode(Operations.GetAvailableClientsResponseBody.self, from: data))
|
||||
} catch {
|
||||
throw ResponseHandlerError.failedToDecodeJSON(error)
|
||||
}
|
||||
}
|
||||
} else if httpResponse.statusCode == 400 {
|
||||
return .empty
|
||||
if httpResponse.contentType.matchContentType(pattern: "application/json"), let data = response.data {
|
||||
do {
|
||||
return .badRequest(try JSONDecoder().decode(Operations.GetAvailableClientsBadRequest.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 .fourHundredAndOneApplicationJsonObject(try JSONDecoder().decode(Operations.GetAvailableClientsServerResponseBody.self, from: data))
|
||||
return .unauthorized(try JSONDecoder().decode(Operations.GetAvailableClientsUnauthorized.self, from: data))
|
||||
} catch {
|
||||
throw ResponseHandlerError.failedToDecodeJSON(error)
|
||||
}
|
||||
@@ -221,17 +255,23 @@ private func handleGetDevicesResponse(response: Client.APIResponse) throws -> Op
|
||||
if httpResponse.statusCode == 200 {
|
||||
if httpResponse.contentType.matchContentType(pattern: "application/json"), let data = response.data {
|
||||
do {
|
||||
return .twoHundredApplicationJsonObject(try JSONDecoder().decode(Operations.GetDevicesResponseBody.self, from: data))
|
||||
return .object(try JSONDecoder().decode(Operations.GetDevicesResponseBody.self, from: data))
|
||||
} catch {
|
||||
throw ResponseHandlerError.failedToDecodeJSON(error)
|
||||
}
|
||||
}
|
||||
} else if httpResponse.statusCode == 400 {
|
||||
return .empty
|
||||
if httpResponse.contentType.matchContentType(pattern: "application/json"), let data = response.data {
|
||||
do {
|
||||
return .badRequest(try JSONDecoder().decode(Operations.GetDevicesBadRequest.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 .fourHundredAndOneApplicationJsonObject(try JSONDecoder().decode(Operations.GetDevicesServerResponseBody.self, from: data))
|
||||
return .unauthorized(try JSONDecoder().decode(Operations.GetDevicesUnauthorized.self, from: data))
|
||||
} catch {
|
||||
throw ResponseHandlerError.failedToDecodeJSON(error)
|
||||
}
|
||||
@@ -247,17 +287,15 @@ private func handleGetServerIdentityResponse(response: Client.APIResponse) throw
|
||||
if httpResponse.statusCode == 200 {
|
||||
if httpResponse.contentType.matchContentType(pattern: "application/json"), let data = response.data {
|
||||
do {
|
||||
return .twoHundredApplicationJsonObject(try JSONDecoder().decode(Operations.GetServerIdentityResponseBody.self, from: data))
|
||||
return .object(try JSONDecoder().decode(Operations.GetServerIdentityResponseBody.self, from: data))
|
||||
} catch {
|
||||
throw ResponseHandlerError.failedToDecodeJSON(error)
|
||||
}
|
||||
}
|
||||
} else if httpResponse.statusCode == 400 {
|
||||
return .empty
|
||||
} else if httpResponse.statusCode == 401 {
|
||||
} else if httpResponse.statusCode == 408 {
|
||||
if httpResponse.contentType.matchContentType(pattern: "application/json"), let data = response.data {
|
||||
do {
|
||||
return .fourHundredAndOneApplicationJsonObject(try JSONDecoder().decode(Operations.GetServerIdentityServerResponseBody.self, from: data))
|
||||
return .requestTimeout(try JSONDecoder().decode(Operations.GetServerIdentityRequestTimeout.self, from: data))
|
||||
} catch {
|
||||
throw ResponseHandlerError.failedToDecodeJSON(error)
|
||||
}
|
||||
@@ -273,17 +311,23 @@ private func handleGetMyPlexAccountResponse(response: Client.APIResponse) throws
|
||||
if httpResponse.statusCode == 200 {
|
||||
if httpResponse.contentType.matchContentType(pattern: "application/json"), let data = response.data {
|
||||
do {
|
||||
return .twoHundredApplicationJsonObject(try JSONDecoder().decode(Operations.GetMyPlexAccountResponseBody.self, from: data))
|
||||
return .object(try JSONDecoder().decode(Operations.GetMyPlexAccountResponseBody.self, from: data))
|
||||
} catch {
|
||||
throw ResponseHandlerError.failedToDecodeJSON(error)
|
||||
}
|
||||
}
|
||||
} else if httpResponse.statusCode == 400 {
|
||||
return .empty
|
||||
if httpResponse.contentType.matchContentType(pattern: "application/json"), let data = response.data {
|
||||
do {
|
||||
return .badRequest(try JSONDecoder().decode(Operations.GetMyPlexAccountBadRequest.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 .fourHundredAndOneApplicationJsonObject(try JSONDecoder().decode(Operations.GetMyPlexAccountServerResponseBody.self, from: data))
|
||||
return .unauthorized(try JSONDecoder().decode(Operations.GetMyPlexAccountUnauthorized.self, from: data))
|
||||
} catch {
|
||||
throw ResponseHandlerError.failedToDecodeJSON(error)
|
||||
}
|
||||
@@ -296,12 +340,52 @@ private func handleGetMyPlexAccountResponse(response: Client.APIResponse) throws
|
||||
private func handleGetResizedPhotoResponse(response: Client.APIResponse) throws -> Operations.GetResizedPhotoResponse {
|
||||
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.GetResizedPhotoBadRequest.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.GetResizedPhotoResponseBody.self, from: data))
|
||||
return .unauthorized(try JSONDecoder().decode(Operations.GetResizedPhotoUnauthorized.self, from: data))
|
||||
} catch {
|
||||
throw ResponseHandlerError.failedToDecodeJSON(error)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return .empty
|
||||
}
|
||||
|
||||
private func handleGetMediaProvidersResponse(response: Client.APIResponse) throws -> Operations.GetMediaProvidersResponse {
|
||||
let httpResponse = response.httpResponse
|
||||
|
||||
if httpResponse.statusCode == 200 {
|
||||
if httpResponse.contentType.matchContentType(pattern: "application/json"), let data = response.data {
|
||||
do {
|
||||
return .object(try JSONDecoder().decode(Operations.GetMediaProvidersResponseBody.self, from: data))
|
||||
} catch {
|
||||
throw ResponseHandlerError.failedToDecodeJSON(error)
|
||||
}
|
||||
}
|
||||
} else if httpResponse.statusCode == 400 {
|
||||
if httpResponse.contentType.matchContentType(pattern: "application/json"), let data = response.data {
|
||||
do {
|
||||
return .badRequest(try JSONDecoder().decode(Operations.GetMediaProvidersBadRequest.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.GetMediaProvidersUnauthorized.self, from: data))
|
||||
} catch {
|
||||
throw ResponseHandlerError.failedToDecodeJSON(error)
|
||||
}
|
||||
@@ -317,17 +401,23 @@ private func handleGetServerListResponse(response: Client.APIResponse) throws ->
|
||||
if httpResponse.statusCode == 200 {
|
||||
if httpResponse.contentType.matchContentType(pattern: "application/json"), let data = response.data {
|
||||
do {
|
||||
return .twoHundredApplicationJsonObject(try JSONDecoder().decode(Operations.GetServerListResponseBody.self, from: data))
|
||||
return .object(try JSONDecoder().decode(Operations.GetServerListResponseBody.self, from: data))
|
||||
} catch {
|
||||
throw ResponseHandlerError.failedToDecodeJSON(error)
|
||||
}
|
||||
}
|
||||
} else if httpResponse.statusCode == 400 {
|
||||
return .empty
|
||||
if httpResponse.contentType.matchContentType(pattern: "application/json"), let data = response.data {
|
||||
do {
|
||||
return .badRequest(try JSONDecoder().decode(Operations.GetServerListBadRequest.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 .fourHundredAndOneApplicationJsonObject(try JSONDecoder().decode(Operations.GetServerListServerResponseBody.self, from: data))
|
||||
return .unauthorized(try JSONDecoder().decode(Operations.GetServerListUnauthorized.self, from: data))
|
||||
} catch {
|
||||
throw ResponseHandlerError.failedToDecodeJSON(error)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user