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
|
||||
@@ -19,30 +19,30 @@ class _LibraryAPI: LibraryAPI {
|
||||
)
|
||||
}
|
||||
|
||||
public func getRecentlyAdded() async throws -> Response<Operations.GetRecentlyAddedResponse> {
|
||||
public func getRecentlyAdded(request: Operations.GetRecentlyAddedRequest) async throws -> Response<Operations.GetRecentlyAddedResponse> {
|
||||
return try await client.makeRequest(
|
||||
configureRequest: { configuration in
|
||||
try configureGetRecentlyAddedRequest(with: configuration)
|
||||
try configureGetRecentlyAddedRequest(with: configuration, request: request)
|
||||
},
|
||||
handleResponse: handleGetRecentlyAddedResponse
|
||||
)
|
||||
}
|
||||
|
||||
public func getLibraries() async throws -> Response<Operations.GetLibrariesResponse> {
|
||||
public func getAllLibraries() async throws -> Response<Operations.GetAllLibrariesResponse> {
|
||||
return try await client.makeRequest(
|
||||
configureRequest: { configuration in
|
||||
try configureGetLibrariesRequest(with: configuration)
|
||||
try configureGetAllLibrariesRequest(with: configuration)
|
||||
},
|
||||
handleResponse: handleGetLibrariesResponse
|
||||
handleResponse: handleGetAllLibrariesResponse
|
||||
)
|
||||
}
|
||||
|
||||
public func getLibrary(request: Operations.GetLibraryRequest) async throws -> Response<Operations.GetLibraryResponse> {
|
||||
public func getLibraryDetails(request: Operations.GetLibraryDetailsRequest) async throws -> Response<Operations.GetLibraryDetailsResponse> {
|
||||
return try await client.makeRequest(
|
||||
configureRequest: { configuration in
|
||||
try configureGetLibraryRequest(with: configuration, request: request)
|
||||
try configureGetLibraryDetailsRequest(with: configuration, request: request)
|
||||
},
|
||||
handleResponse: handleGetLibraryResponse
|
||||
handleResponse: handleGetLibraryDetailsResponse
|
||||
)
|
||||
}
|
||||
|
||||
@@ -64,30 +64,30 @@ class _LibraryAPI: LibraryAPI {
|
||||
)
|
||||
}
|
||||
|
||||
public func refreshLibrary(request: Operations.RefreshLibraryRequest) async throws -> Response<Operations.RefreshLibraryResponse> {
|
||||
public func getRefreshLibraryMetadata(request: Operations.GetRefreshLibraryMetadataRequest) async throws -> Response<Operations.GetRefreshLibraryMetadataResponse> {
|
||||
return try await client.makeRequest(
|
||||
configureRequest: { configuration in
|
||||
try configureRefreshLibraryRequest(with: configuration, request: request)
|
||||
try configureGetRefreshLibraryMetadataRequest(with: configuration, request: request)
|
||||
},
|
||||
handleResponse: handleRefreshLibraryResponse
|
||||
handleResponse: handleGetRefreshLibraryMetadataResponse
|
||||
)
|
||||
}
|
||||
|
||||
public func searchLibrary(request: Operations.SearchLibraryRequest) async throws -> Response<Operations.SearchLibraryResponse> {
|
||||
public func getSearchLibrary(request: Operations.GetSearchLibraryRequest) async throws -> Response<Operations.GetSearchLibraryResponse> {
|
||||
return try await client.makeRequest(
|
||||
configureRequest: { configuration in
|
||||
try configureSearchLibraryRequest(with: configuration, request: request)
|
||||
try configureGetSearchLibraryRequest(with: configuration, request: request)
|
||||
},
|
||||
handleResponse: handleSearchLibraryResponse
|
||||
handleResponse: handleGetSearchLibraryResponse
|
||||
)
|
||||
}
|
||||
|
||||
public func getMetadata(request: Operations.GetMetadataRequest) async throws -> Response<Operations.GetMetadataResponse> {
|
||||
public func getMetaDataByRatingKey(request: Operations.GetMetaDataByRatingKeyRequest) async throws -> Response<Operations.GetMetaDataByRatingKeyResponse> {
|
||||
return try await client.makeRequest(
|
||||
configureRequest: { configuration in
|
||||
try configureGetMetadataRequest(with: configuration, request: request)
|
||||
try configureGetMetaDataByRatingKeyRequest(with: configuration, request: request)
|
||||
},
|
||||
handleResponse: handleGetMetadataResponse
|
||||
handleResponse: handleGetMetaDataByRatingKeyResponse
|
||||
)
|
||||
}
|
||||
|
||||
@@ -129,20 +129,21 @@ private func configureGetFileHashRequest(with configuration: URLRequestConfigura
|
||||
configuration.telemetryHeader = .userAgent
|
||||
}
|
||||
|
||||
private func configureGetRecentlyAddedRequest(with configuration: URLRequestConfiguration) throws {
|
||||
private func configureGetRecentlyAddedRequest(with configuration: URLRequestConfiguration, request: Operations.GetRecentlyAddedRequest) throws {
|
||||
configuration.path = "/library/recentlyAdded"
|
||||
configuration.method = .get
|
||||
configuration.queryParameterSerializable = request
|
||||
configuration.telemetryHeader = .userAgent
|
||||
}
|
||||
|
||||
private func configureGetLibrariesRequest(with configuration: URLRequestConfiguration) throws {
|
||||
private func configureGetAllLibrariesRequest(with configuration: URLRequestConfiguration) throws {
|
||||
configuration.path = "/library/sections"
|
||||
configuration.method = .get
|
||||
configuration.telemetryHeader = .userAgent
|
||||
}
|
||||
|
||||
private func configureGetLibraryRequest(with configuration: URLRequestConfiguration, request: Operations.GetLibraryRequest) throws {
|
||||
configuration.path = "/library/sections/{sectionId}"
|
||||
private func configureGetLibraryDetailsRequest(with configuration: URLRequestConfiguration, request: Operations.GetLibraryDetailsRequest) throws {
|
||||
configuration.path = "/library/sections/{sectionKey}"
|
||||
configuration.method = .get
|
||||
configuration.pathParameterSerializable = request
|
||||
configuration.queryParameterSerializable = request
|
||||
@@ -150,36 +151,37 @@ private func configureGetLibraryRequest(with configuration: URLRequestConfigurat
|
||||
}
|
||||
|
||||
private func configureDeleteLibraryRequest(with configuration: URLRequestConfiguration, request: Operations.DeleteLibraryRequest) throws {
|
||||
configuration.path = "/library/sections/{sectionId}"
|
||||
configuration.path = "/library/sections/{sectionKey}"
|
||||
configuration.method = .delete
|
||||
configuration.pathParameterSerializable = request
|
||||
configuration.telemetryHeader = .userAgent
|
||||
}
|
||||
|
||||
private func configureGetLibraryItemsRequest(with configuration: URLRequestConfiguration, request: Operations.GetLibraryItemsRequest) throws {
|
||||
configuration.path = "/library/sections/{sectionId}/{tag}"
|
||||
configuration.path = "/library/sections/{sectionKey}/{tag}"
|
||||
configuration.method = .get
|
||||
configuration.pathParameterSerializable = request
|
||||
configuration.queryParameterSerializable = request
|
||||
configuration.telemetryHeader = .userAgent
|
||||
}
|
||||
|
||||
private func configureRefreshLibraryRequest(with configuration: URLRequestConfiguration, request: Operations.RefreshLibraryRequest) throws {
|
||||
configuration.path = "/library/sections/{sectionId}/refresh"
|
||||
configuration.method = .get
|
||||
configuration.pathParameterSerializable = request
|
||||
configuration.telemetryHeader = .userAgent
|
||||
}
|
||||
|
||||
private func configureSearchLibraryRequest(with configuration: URLRequestConfiguration, request: Operations.SearchLibraryRequest) throws {
|
||||
configuration.path = "/library/sections/{sectionId}/search"
|
||||
private func configureGetRefreshLibraryMetadataRequest(with configuration: URLRequestConfiguration, request: Operations.GetRefreshLibraryMetadataRequest) throws {
|
||||
configuration.path = "/library/sections/{sectionKey}/refresh"
|
||||
configuration.method = .get
|
||||
configuration.pathParameterSerializable = request
|
||||
configuration.queryParameterSerializable = request
|
||||
configuration.telemetryHeader = .userAgent
|
||||
}
|
||||
|
||||
private func configureGetMetadataRequest(with configuration: URLRequestConfiguration, request: Operations.GetMetadataRequest) throws {
|
||||
private func configureGetSearchLibraryRequest(with configuration: URLRequestConfiguration, request: Operations.GetSearchLibraryRequest) throws {
|
||||
configuration.path = "/library/sections/{sectionKey}/search"
|
||||
configuration.method = .get
|
||||
configuration.pathParameterSerializable = request
|
||||
configuration.queryParameterSerializable = request
|
||||
configuration.telemetryHeader = .userAgent
|
||||
}
|
||||
|
||||
private func configureGetMetaDataByRatingKeyRequest(with configuration: URLRequestConfiguration, request: Operations.GetMetaDataByRatingKeyRequest) throws {
|
||||
configuration.path = "/library/metadata/{ratingKey}"
|
||||
configuration.method = .get
|
||||
configuration.pathParameterSerializable = request
|
||||
@@ -212,12 +214,20 @@ private func configureGetOnDeckRequest(with configuration: URLRequestConfigurati
|
||||
private func handleGetFileHashResponse(response: Client.APIResponse) throws -> Operations.GetFileHashResponse {
|
||||
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.GetFileHashBadRequest.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.GetFileHashResponseBody.self, from: data))
|
||||
return .unauthorized(try JSONDecoder().decode(Operations.GetFileHashUnauthorized.self, from: data))
|
||||
} catch {
|
||||
throw ResponseHandlerError.failedToDecodeJSON(error)
|
||||
}
|
||||
@@ -233,17 +243,23 @@ private func handleGetRecentlyAddedResponse(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.GetRecentlyAddedResponseBody.self, from: data))
|
||||
return .object(try JSONDecoder().decode(Operations.GetRecentlyAddedResponseBody.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.GetRecentlyAddedBadRequest.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.GetRecentlyAddedLibraryResponseBody.self, from: data))
|
||||
return .unauthorized(try JSONDecoder().decode(Operations.GetRecentlyAddedUnauthorized.self, from: data))
|
||||
} catch {
|
||||
throw ResponseHandlerError.failedToDecodeJSON(error)
|
||||
}
|
||||
@@ -253,23 +269,29 @@ private func handleGetRecentlyAddedResponse(response: Client.APIResponse) throws
|
||||
return .empty
|
||||
}
|
||||
|
||||
private func handleGetLibrariesResponse(response: Client.APIResponse) throws -> Operations.GetLibrariesResponse {
|
||||
private func handleGetAllLibrariesResponse(response: Client.APIResponse) throws -> Operations.GetAllLibrariesResponse {
|
||||
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.GetLibrariesResponseBody.self, from: data))
|
||||
return .object(try JSONDecoder().decode(Operations.GetAllLibrariesResponseBody.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.GetAllLibrariesBadRequest.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.GetLibrariesLibraryResponseBody.self, from: data))
|
||||
return .unauthorized(try JSONDecoder().decode(Operations.GetAllLibrariesUnauthorized.self, from: data))
|
||||
} catch {
|
||||
throw ResponseHandlerError.failedToDecodeJSON(error)
|
||||
}
|
||||
@@ -279,23 +301,29 @@ private func handleGetLibrariesResponse(response: Client.APIResponse) throws ->
|
||||
return .empty
|
||||
}
|
||||
|
||||
private func handleGetLibraryResponse(response: Client.APIResponse) throws -> Operations.GetLibraryResponse {
|
||||
private func handleGetLibraryDetailsResponse(response: Client.APIResponse) throws -> Operations.GetLibraryDetailsResponse {
|
||||
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.GetLibraryResponseBody.self, from: data))
|
||||
return .object(try JSONDecoder().decode(Operations.GetLibraryDetailsResponseBody.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.GetLibraryDetailsBadRequest.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.GetLibraryLibraryResponseBody.self, from: data))
|
||||
return .unauthorized(try JSONDecoder().decode(Operations.GetLibraryDetailsUnauthorized.self, from: data))
|
||||
} catch {
|
||||
throw ResponseHandlerError.failedToDecodeJSON(error)
|
||||
}
|
||||
@@ -308,12 +336,20 @@ private func handleGetLibraryResponse(response: Client.APIResponse) throws -> Op
|
||||
private func handleDeleteLibraryResponse(response: Client.APIResponse) throws -> Operations.DeleteLibraryResponse {
|
||||
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.DeleteLibraryBadRequest.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.DeleteLibraryResponseBody.self, from: data))
|
||||
return .unauthorized(try JSONDecoder().decode(Operations.DeleteLibraryUnauthorized.self, from: data))
|
||||
} catch {
|
||||
throw ResponseHandlerError.failedToDecodeJSON(error)
|
||||
}
|
||||
@@ -329,17 +365,23 @@ private func handleGetLibraryItemsResponse(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.GetLibraryItemsResponseBody.self, from: data))
|
||||
return .object(try JSONDecoder().decode(Operations.GetLibraryItemsResponseBody.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.GetLibraryItemsBadRequest.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.GetLibraryItemsLibraryResponseBody.self, from: data))
|
||||
return .unauthorized(try JSONDecoder().decode(Operations.GetLibraryItemsUnauthorized.self, from: data))
|
||||
} catch {
|
||||
throw ResponseHandlerError.failedToDecodeJSON(error)
|
||||
}
|
||||
@@ -349,15 +391,23 @@ private func handleGetLibraryItemsResponse(response: Client.APIResponse) throws
|
||||
return .empty
|
||||
}
|
||||
|
||||
private func handleRefreshLibraryResponse(response: Client.APIResponse) throws -> Operations.RefreshLibraryResponse {
|
||||
private func handleGetRefreshLibraryMetadataResponse(response: Client.APIResponse) throws -> Operations.GetRefreshLibraryMetadataResponse {
|
||||
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.GetRefreshLibraryMetadataBadRequest.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.RefreshLibraryResponseBody.self, from: data))
|
||||
return .unauthorized(try JSONDecoder().decode(Operations.GetRefreshLibraryMetadataUnauthorized.self, from: data))
|
||||
} catch {
|
||||
throw ResponseHandlerError.failedToDecodeJSON(error)
|
||||
}
|
||||
@@ -367,23 +417,29 @@ private func handleRefreshLibraryResponse(response: Client.APIResponse) throws -
|
||||
return .empty
|
||||
}
|
||||
|
||||
private func handleSearchLibraryResponse(response: Client.APIResponse) throws -> Operations.SearchLibraryResponse {
|
||||
private func handleGetSearchLibraryResponse(response: Client.APIResponse) throws -> Operations.GetSearchLibraryResponse {
|
||||
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.SearchLibraryResponseBody.self, from: data))
|
||||
return .object(try JSONDecoder().decode(Operations.GetSearchLibraryResponseBody.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.GetSearchLibraryBadRequest.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.SearchLibraryLibraryResponseBody.self, from: data))
|
||||
return .unauthorized(try JSONDecoder().decode(Operations.GetSearchLibraryUnauthorized.self, from: data))
|
||||
} catch {
|
||||
throw ResponseHandlerError.failedToDecodeJSON(error)
|
||||
}
|
||||
@@ -393,23 +449,29 @@ private func handleSearchLibraryResponse(response: Client.APIResponse) throws ->
|
||||
return .empty
|
||||
}
|
||||
|
||||
private func handleGetMetadataResponse(response: Client.APIResponse) throws -> Operations.GetMetadataResponse {
|
||||
private func handleGetMetaDataByRatingKeyResponse(response: Client.APIResponse) throws -> Operations.GetMetaDataByRatingKeyResponse {
|
||||
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.GetMetadataResponseBody.self, from: data))
|
||||
return .object(try JSONDecoder().decode(Operations.GetMetaDataByRatingKeyResponseBody.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.GetMetaDataByRatingKeyBadRequest.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.GetMetadataLibraryResponseBody.self, from: data))
|
||||
return .unauthorized(try JSONDecoder().decode(Operations.GetMetaDataByRatingKeyUnauthorized.self, from: data))
|
||||
} catch {
|
||||
throw ResponseHandlerError.failedToDecodeJSON(error)
|
||||
}
|
||||
@@ -425,17 +487,23 @@ private func handleGetMetadataChildrenResponse(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.GetMetadataChildrenResponseBody.self, from: data))
|
||||
return .object(try JSONDecoder().decode(Operations.GetMetadataChildrenResponseBody.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.GetMetadataChildrenBadRequest.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.GetMetadataChildrenLibraryResponseBody.self, from: data))
|
||||
return .unauthorized(try JSONDecoder().decode(Operations.GetMetadataChildrenUnauthorized.self, from: data))
|
||||
} catch {
|
||||
throw ResponseHandlerError.failedToDecodeJSON(error)
|
||||
}
|
||||
@@ -456,6 +524,22 @@ private func handleGetTopWatchedContentResponse(response: Client.APIResponse) th
|
||||
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.GetTopWatchedContentBadRequest.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.GetTopWatchedContentUnauthorized.self, from: data))
|
||||
} catch {
|
||||
throw ResponseHandlerError.failedToDecodeJSON(error)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return .empty
|
||||
@@ -467,17 +551,23 @@ private func handleGetOnDeckResponse(response: Client.APIResponse) throws -> Ope
|
||||
if httpResponse.statusCode == 200 {
|
||||
if httpResponse.contentType.matchContentType(pattern: "application/json"), let data = response.data {
|
||||
do {
|
||||
return .twoHundredApplicationJsonObject(try JSONDecoder().decode(Operations.GetOnDeckResponseBody.self, from: data))
|
||||
return .object(try JSONDecoder().decode(Operations.GetOnDeckResponseBody.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.GetOnDeckBadRequest.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.GetOnDeckLibraryResponseBody.self, from: data))
|
||||
return .unauthorized(try JSONDecoder().decode(Operations.GetOnDeckUnauthorized.self, from: data))
|
||||
} catch {
|
||||
throw ResponseHandlerError.failedToDecodeJSON(error)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user