mirror of
https://github.com/LukeHagar/plexswift.git
synced 2025-12-09 20:57:45 +00:00
ci: regenerated with OpenAPI Doc , Speakeasy CLI 1.314.2
This commit is contained in:
@@ -100,6 +100,15 @@ class _LibraryAPI: LibraryAPI {
|
||||
)
|
||||
}
|
||||
|
||||
public func getTopWatchedContent(request: Operations.GetTopWatchedContentRequest) async throws -> Response<Operations.GetTopWatchedContentResponse> {
|
||||
return try await client.makeRequest(
|
||||
configureRequest: { configuration in
|
||||
try configureGetTopWatchedContentRequest(with: configuration, request: request)
|
||||
},
|
||||
handleResponse: handleGetTopWatchedContentResponse
|
||||
)
|
||||
}
|
||||
|
||||
public func getOnDeck() async throws -> Response<Operations.GetOnDeckResponse> {
|
||||
return try await client.makeRequest(
|
||||
configureRequest: { configuration in
|
||||
@@ -151,6 +160,7 @@ private func configureGetLibraryItemsRequest(with configuration: URLRequestConfi
|
||||
configuration.path = "/library/sections/{sectionId}/{tag}"
|
||||
configuration.method = .get
|
||||
configuration.pathParameterSerializable = request
|
||||
configuration.queryParameterSerializable = request
|
||||
configuration.telemetryHeader = .userAgent
|
||||
}
|
||||
|
||||
@@ -180,6 +190,14 @@ private func configureGetMetadataChildrenRequest(with configuration: URLRequestC
|
||||
configuration.path = "/library/metadata/{ratingKey}/children"
|
||||
configuration.method = .get
|
||||
configuration.pathParameterSerializable = request
|
||||
configuration.queryParameterSerializable = request
|
||||
configuration.telemetryHeader = .userAgent
|
||||
}
|
||||
|
||||
private func configureGetTopWatchedContentRequest(with configuration: URLRequestConfiguration, request: Operations.GetTopWatchedContentRequest) throws {
|
||||
configuration.path = "/library/all/top"
|
||||
configuration.method = .get
|
||||
configuration.queryParameterSerializable = request
|
||||
configuration.telemetryHeader = .userAgent
|
||||
}
|
||||
|
||||
@@ -427,6 +445,22 @@ private func handleGetMetadataChildrenResponse(response: Client.APIResponse) thr
|
||||
return .empty
|
||||
}
|
||||
|
||||
private func handleGetTopWatchedContentResponse(response: Client.APIResponse) throws -> Operations.GetTopWatchedContentResponse {
|
||||
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.GetTopWatchedContentResponseBody.self, from: data))
|
||||
} catch {
|
||||
throw ResponseHandlerError.failedToDecodeJSON(error)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return .empty
|
||||
}
|
||||
|
||||
private func handleGetOnDeckResponse(response: Client.APIResponse) throws -> Operations.GetOnDeckResponse {
|
||||
let httpResponse = response.httpResponse
|
||||
|
||||
|
||||
@@ -244,7 +244,7 @@ private func handleGetPlaylistResponse(response: Client.APIResponse) throws -> O
|
||||
private func handleDeletePlaylistResponse(response: Client.APIResponse) throws -> Operations.DeletePlaylistResponse {
|
||||
let httpResponse = response.httpResponse
|
||||
|
||||
if [200, 400].contains(httpResponse.statusCode) {
|
||||
if [204, 400].contains(httpResponse.statusCode) {
|
||||
return .empty
|
||||
} else if httpResponse.statusCode == 401 {
|
||||
if httpResponse.contentType.matchContentType(pattern: "application/json"), let data = response.data {
|
||||
|
||||
@@ -19,10 +19,10 @@ class _SessionsAPI: SessionsAPI {
|
||||
)
|
||||
}
|
||||
|
||||
public func getSessionHistory() async throws -> Response<Operations.GetSessionHistoryResponse> {
|
||||
public func getSessionHistory(request: Operations.GetSessionHistoryRequest) async throws -> Response<Operations.GetSessionHistoryResponse> {
|
||||
return try await client.makeRequest(
|
||||
configureRequest: { configuration in
|
||||
try configureGetSessionHistoryRequest(with: configuration)
|
||||
try configureGetSessionHistoryRequest(with: configuration, request: request)
|
||||
},
|
||||
handleResponse: handleGetSessionHistoryResponse
|
||||
)
|
||||
@@ -56,9 +56,10 @@ private func configureGetSessionsRequest(with configuration: URLRequestConfigura
|
||||
configuration.telemetryHeader = .userAgent
|
||||
}
|
||||
|
||||
private func configureGetSessionHistoryRequest(with configuration: URLRequestConfiguration) throws {
|
||||
private func configureGetSessionHistoryRequest(with configuration: URLRequestConfiguration, request: Operations.GetSessionHistoryRequest) throws {
|
||||
configuration.path = "/status/sessions/history/all"
|
||||
configuration.method = .get
|
||||
configuration.queryParameterSerializable = request
|
||||
configuration.telemetryHeader = .userAgent
|
||||
}
|
||||
|
||||
|
||||
@@ -18,6 +18,24 @@ class _StatisticsAPI: StatisticsAPI {
|
||||
handleResponse: handleGetStatisticsResponse
|
||||
)
|
||||
}
|
||||
|
||||
public func getResourcesStatistics(request: Operations.GetResourcesStatisticsRequest) async throws -> Response<Operations.GetResourcesStatisticsResponse> {
|
||||
return try await client.makeRequest(
|
||||
configureRequest: { configuration in
|
||||
try configureGetResourcesStatisticsRequest(with: configuration, request: request)
|
||||
},
|
||||
handleResponse: handleGetResourcesStatisticsResponse
|
||||
)
|
||||
}
|
||||
|
||||
public func getBandwidthStatistics(request: Operations.GetBandwidthStatisticsRequest) async throws -> Response<Operations.GetBandwidthStatisticsResponse> {
|
||||
return try await client.makeRequest(
|
||||
configureRequest: { configuration in
|
||||
try configureGetBandwidthStatisticsRequest(with: configuration, request: request)
|
||||
},
|
||||
handleResponse: handleGetBandwidthStatisticsResponse
|
||||
)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -30,6 +48,20 @@ private func configureGetStatisticsRequest(with configuration: URLRequestConfigu
|
||||
configuration.telemetryHeader = .userAgent
|
||||
}
|
||||
|
||||
private func configureGetResourcesStatisticsRequest(with configuration: URLRequestConfiguration, request: Operations.GetResourcesStatisticsRequest) throws {
|
||||
configuration.path = "/statistics/resources"
|
||||
configuration.method = .get
|
||||
configuration.queryParameterSerializable = request
|
||||
configuration.telemetryHeader = .userAgent
|
||||
}
|
||||
|
||||
private func configureGetBandwidthStatisticsRequest(with configuration: URLRequestConfiguration, request: Operations.GetBandwidthStatisticsRequest) throws {
|
||||
configuration.path = "/statistics/bandwidth"
|
||||
configuration.method = .get
|
||||
configuration.queryParameterSerializable = request
|
||||
configuration.telemetryHeader = .userAgent
|
||||
}
|
||||
|
||||
// MARK: - Response Handlers
|
||||
|
||||
private func handleGetStatisticsResponse(response: Client.APIResponse) throws -> Operations.GetStatisticsResponse {
|
||||
@@ -58,3 +90,55 @@ private func handleGetStatisticsResponse(response: Client.APIResponse) throws ->
|
||||
return .empty
|
||||
}
|
||||
|
||||
private func handleGetResourcesStatisticsResponse(response: Client.APIResponse) throws -> Operations.GetResourcesStatisticsResponse {
|
||||
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.GetResourcesStatisticsResponseBody.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.GetResourcesStatisticsStatisticsResponseBody.self, from: data))
|
||||
} catch {
|
||||
throw ResponseHandlerError.failedToDecodeJSON(error)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return .empty
|
||||
}
|
||||
|
||||
private func handleGetBandwidthStatisticsResponse(response: Client.APIResponse) throws -> Operations.GetBandwidthStatisticsResponse {
|
||||
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.GetBandwidthStatisticsResponseBody.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.GetBandwidthStatisticsStatisticsResponseBody.self, from: data))
|
||||
} catch {
|
||||
throw ResponseHandlerError.failedToDecodeJSON(error)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return .empty
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user