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
@@ -10,6 +10,36 @@ class _PlexAPI: PlexAPI {
self.client = client
}
public func getCompanionsData(server: PlexServers.GetCompanionsData?) async throws -> Response<Operations.GetCompanionsDataResponse> {
return try await client.makeRequest(
with: try server?.server() ?? PlexServers.GetCompanionsData.default(),
configureRequest: { configuration in
try configureGetCompanionsDataRequest(with: configuration)
},
handleResponse: handleGetCompanionsDataResponse
)
}
public func getUserFriends(server: PlexServers.GetUserFriends?) async throws -> Response<Operations.GetUserFriendsResponse> {
return try await client.makeRequest(
with: try server?.server() ?? PlexServers.GetUserFriends.default(),
configureRequest: { configuration in
try configureGetUserFriendsRequest(with: configuration)
},
handleResponse: handleGetUserFriendsResponse
)
}
public func getGeoData(server: PlexServers.GetGeoData?) async throws -> Response<Operations.GetGeoDataResponse> {
return try await client.makeRequest(
with: try server?.server() ?? PlexServers.GetGeoData.default(),
configureRequest: { configuration in
try configureGetGeoDataRequest(with: configuration)
},
handleResponse: handleGetGeoDataResponse
)
}
public func getHomeData() async throws -> Response<Operations.GetHomeDataResponse> {
return try await client.makeRequest(
configureRequest: { configuration in
@@ -19,6 +49,16 @@ class _PlexAPI: PlexAPI {
)
}
public func getServerResources(request: Operations.GetServerResourcesRequest, server: PlexServers.GetServerResources?) async throws -> Response<Operations.GetServerResourcesResponse> {
return try await client.makeRequest(
with: try server?.server() ?? PlexServers.GetServerResources.default(),
configureRequest: { configuration in
try configureGetServerResourcesRequest(with: configuration, request: request)
},
handleResponse: handleGetServerResourcesResponse
)
}
public func getPin(request: Operations.GetPinRequest, server: PlexServers.GetPin?) async throws -> Response<Operations.GetPinResponse> {
return try await client.makeRequest(
with: try server?.server() ?? PlexServers.GetPin.default(),
@@ -29,13 +69,13 @@ class _PlexAPI: PlexAPI {
)
}
public func getToken(request: Operations.GetTokenRequest, server: PlexServers.GetToken?) async throws -> Response<Operations.GetTokenResponse> {
public func getTokenByPinId(request: Operations.GetTokenByPinIdRequest, server: PlexServers.GetTokenByPinId?) async throws -> Response<Operations.GetTokenByPinIdResponse> {
return try await client.makeRequest(
with: try server?.server() ?? PlexServers.GetToken.default(),
with: try server?.server() ?? PlexServers.GetTokenByPinId.default(),
configureRequest: { configuration in
try configureGetTokenRequest(with: configuration, request: request)
try configureGetTokenByPinIdRequest(with: configuration, request: request)
},
handleResponse: handleGetTokenResponse
handleResponse: handleGetTokenByPinIdResponse
)
}
@@ -43,47 +83,205 @@ class _PlexAPI: PlexAPI {
// MARK: - Request Configuration
private func configureGetCompanionsDataRequest(with configuration: URLRequestConfiguration) throws {
configuration.path = "/companions"
configuration.method = .get
configuration.telemetryHeader = .userAgent
}
private func configureGetUserFriendsRequest(with configuration: URLRequestConfiguration) throws {
configuration.path = "/friends"
configuration.method = .get
configuration.telemetryHeader = .userAgent
}
private func configureGetGeoDataRequest(with configuration: URLRequestConfiguration) throws {
configuration.path = "/geoip"
configuration.method = .get
configuration.telemetryHeader = .userAgent
}
private func configureGetHomeDataRequest(with configuration: URLRequestConfiguration) throws {
configuration.path = "/home"
configuration.method = .get
configuration.telemetryHeader = .userAgent
}
private func configureGetServerResourcesRequest(with configuration: URLRequestConfiguration, request: Operations.GetServerResourcesRequest) throws {
configuration.path = "/resources"
configuration.method = .get
configuration.queryParameterSerializable = request
configuration.telemetryHeader = .userAgent
}
private func configureGetPinRequest(with configuration: URLRequestConfiguration, request: Operations.GetPinRequest) throws {
configuration.path = "/pins"
configuration.method = .post
configuration.queryParameterSerializable = request
configuration.headerParameterSerializable = request
configuration.telemetryHeader = .userAgent
}
private func configureGetTokenRequest(with configuration: URLRequestConfiguration, request: Operations.GetTokenRequest) throws {
private func configureGetTokenByPinIdRequest(with configuration: URLRequestConfiguration, request: Operations.GetTokenByPinIdRequest) throws {
configuration.path = "/pins/{pinID}"
configuration.method = .get
configuration.pathParameterSerializable = request
configuration.headerParameterSerializable = request
configuration.queryParameterSerializable = request
configuration.telemetryHeader = .userAgent
}
// MARK: - Response Handlers
private func handleGetCompanionsDataResponse(response: Client.APIResponse) throws -> Operations.GetCompanionsDataResponse {
let httpResponse = response.httpResponse
if httpResponse.statusCode == 200 {
if httpResponse.contentType.matchContentType(pattern: "application/json"), let data = response.data {
do {
return .responseBodies(try JSONDecoder().decode([Operations.ResponseBody].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.GetCompanionsDataBadRequest.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.GetCompanionsDataUnauthorized.self, from: data))
} catch {
throw ResponseHandlerError.failedToDecodeJSON(error)
}
}
}
return .empty
}
private func handleGetUserFriendsResponse(response: Client.APIResponse) throws -> Operations.GetUserFriendsResponse {
let httpResponse = response.httpResponse
if httpResponse.statusCode == 200 {
if httpResponse.contentType.matchContentType(pattern: "application/json"), let data = response.data {
do {
return .friends(try JSONDecoder().decode([Operations.Friend].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.GetUserFriendsBadRequest.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.GetUserFriendsUnauthorized.self, from: data))
} catch {
throw ResponseHandlerError.failedToDecodeJSON(error)
}
}
}
return .empty
}
private func handleGetGeoDataResponse(response: Client.APIResponse) throws -> Operations.GetGeoDataResponse {
let httpResponse = response.httpResponse
if httpResponse.statusCode == 200 {
if httpResponse.contentType.matchContentType(pattern: "application/json"), let data = response.data {
do {
return .geoData(try JSONDecoder().decode(Operations.GetGeoDataGeoData.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.GetGeoDataBadRequest.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.GetGeoDataUnauthorized.self, from: data))
} catch {
throw ResponseHandlerError.failedToDecodeJSON(error)
}
}
}
return .empty
}
private func handleGetHomeDataResponse(response: Client.APIResponse) throws -> Operations.GetHomeDataResponse {
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.GetHomeDataResponseBody.self, from: data))
return .object(try JSONDecoder().decode(Operations.GetHomeDataResponseBody.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.GetHomeDataBadRequest.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.GetHomeDataPlexResponseBody.self, from: data))
return .unauthorized(try JSONDecoder().decode(Operations.GetHomeDataUnauthorized.self, from: data))
} catch {
throw ResponseHandlerError.failedToDecodeJSON(error)
}
}
}
return .empty
}
private func handleGetServerResourcesResponse(response: Client.APIResponse) throws -> Operations.GetServerResourcesResponse {
let httpResponse = response.httpResponse
if httpResponse.statusCode == 200 {
if httpResponse.contentType.matchContentType(pattern: "application/json"), let data = response.data {
do {
return .plexDevices(try JSONDecoder().decode([Operations.PlexDevice].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.GetServerResourcesBadRequest.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.GetServerResourcesUnauthorized.self, from: data))
} catch {
throw ResponseHandlerError.failedToDecodeJSON(error)
}
@@ -96,10 +294,10 @@ private func handleGetHomeDataResponse(response: Client.APIResponse) throws -> O
private func handleGetPinResponse(response: Client.APIResponse) throws -> Operations.GetPinResponse {
let httpResponse = response.httpResponse
if httpResponse.statusCode == 201 {
if httpResponse.statusCode == 200 {
if httpResponse.contentType.matchContentType(pattern: "application/json"), let data = response.data {
do {
return .twoHundredAndOneApplicationJsonObject(try JSONDecoder().decode(Operations.GetPinResponseBody.self, from: data))
return .authPinContainer(try JSONDecoder().decode(Operations.GetPinAuthPinContainer.self, from: data))
} catch {
throw ResponseHandlerError.failedToDecodeJSON(error)
}
@@ -107,7 +305,7 @@ private func handleGetPinResponse(response: Client.APIResponse) throws -> Operat
} else if httpResponse.statusCode == 400 {
if httpResponse.contentType.matchContentType(pattern: "application/json"), let data = response.data {
do {
return .fourHundredApplicationJsonObject(try JSONDecoder().decode(Operations.GetPinPlexResponseBody.self, from: data))
return .badRequest(try JSONDecoder().decode(Operations.GetPinBadRequest.self, from: data))
} catch {
throw ResponseHandlerError.failedToDecodeJSON(error)
}
@@ -117,13 +315,13 @@ private func handleGetPinResponse(response: Client.APIResponse) throws -> Operat
return .empty
}
private func handleGetTokenResponse(response: Client.APIResponse) throws -> Operations.GetTokenResponse {
private func handleGetTokenByPinIdResponse(response: Client.APIResponse) throws -> Operations.GetTokenByPinIdResponse {
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.GetTokenResponseBody.self, from: data))
return .authPinContainer(try JSONDecoder().decode(Operations.GetTokenByPinIdAuthPinContainer.self, from: data))
} catch {
throw ResponseHandlerError.failedToDecodeJSON(error)
}
@@ -131,7 +329,15 @@ private func handleGetTokenResponse(response: Client.APIResponse) throws -> Oper
} else if httpResponse.statusCode == 400 {
if httpResponse.contentType.matchContentType(pattern: "application/json"), let data = response.data {
do {
return .fourHundredApplicationJsonObject(try JSONDecoder().decode(Operations.GetTokenPlexResponseBody.self, from: data))
return .badRequest(try JSONDecoder().decode(Operations.GetTokenByPinIdBadRequest.self, from: data))
} catch {
throw ResponseHandlerError.failedToDecodeJSON(error)
}
}
} else if httpResponse.statusCode == 404 {
if httpResponse.contentType.matchContentType(pattern: "application/json"), let data = response.data {
do {
return .object(try JSONDecoder().decode(Operations.GetTokenByPinIdResponseBody.self, from: data))
} catch {
throw ResponseHandlerError.failedToDecodeJSON(error)
}