mirror of
https://github.com/LukeHagar/plexswift.git
synced 2025-12-07 04:20:54 +00:00
ci: regenerated with OpenAPI Doc , Speakeasy CLI 1.314.2
This commit is contained in:
@@ -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