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
@@ -27,6 +27,26 @@ class _AuthenticationAPI: AuthenticationAPI {
handleResponse: handleGetSourceConnectionInformationResponse
)
}
public func getTokenDetails(server: AuthenticationServers.GetTokenDetails?) async throws -> Response<Operations.GetTokenDetailsResponse> {
return try await client.makeRequest(
with: try server?.server() ?? AuthenticationServers.GetTokenDetails.default(),
configureRequest: { configuration in
try configureGetTokenDetailsRequest(with: configuration)
},
handleResponse: handleGetTokenDetailsResponse
)
}
public func postUsersSignInData(request: Operations.PostUsersSignInDataRequest, server: AuthenticationServers.PostUsersSignInData?) async throws -> Response<Operations.PostUsersSignInDataResponse> {
return try await client.makeRequest(
with: try server?.server() ?? AuthenticationServers.PostUsersSignInData.default(),
configureRequest: { configuration in
try configurePostUsersSignInDataRequest(with: configuration, request: request)
},
handleResponse: handlePostUsersSignInDataResponse
)
}
}
@@ -46,17 +66,40 @@ private func configureGetSourceConnectionInformationRequest(with configuration:
configuration.telemetryHeader = .userAgent
}
private func configureGetTokenDetailsRequest(with configuration: URLRequestConfiguration) throws {
configuration.path = "/user"
configuration.method = .get
configuration.telemetryHeader = .userAgent
}
private func configurePostUsersSignInDataRequest(with configuration: URLRequestConfiguration, request: Operations.PostUsersSignInDataRequest) throws {
configuration.path = "/users/signin"
configuration.method = .post
configuration.queryParameterSerializable = request
configuration.contentType = "application/x-www-form-urlencoded"
configuration.body = try serializeFormData(with: request.requestBody)
configuration.telemetryHeader = .userAgent
}
// MARK: - Response Handlers
private func handleGetTransientTokenResponse(response: Client.APIResponse) throws -> Operations.GetTransientTokenResponse {
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.GetTransientTokenBadRequest.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.GetTransientTokenResponseBody.self, from: data))
return .unauthorized(try JSONDecoder().decode(Operations.GetTransientTokenUnauthorized.self, from: data))
} catch {
throw ResponseHandlerError.failedToDecodeJSON(error)
}
@@ -69,12 +112,84 @@ private func handleGetTransientTokenResponse(response: Client.APIResponse) throw
private func handleGetSourceConnectionInformationResponse(response: Client.APIResponse) throws -> Operations.GetSourceConnectionInformationResponse {
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.GetSourceConnectionInformationBadRequest.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.GetSourceConnectionInformationResponseBody.self, from: data))
return .unauthorized(try JSONDecoder().decode(Operations.GetSourceConnectionInformationUnauthorized.self, from: data))
} catch {
throw ResponseHandlerError.failedToDecodeJSON(error)
}
}
}
return .empty
}
private func handleGetTokenDetailsResponse(response: Client.APIResponse) throws -> Operations.GetTokenDetailsResponse {
let httpResponse = response.httpResponse
if httpResponse.statusCode == 200 {
if httpResponse.contentType.matchContentType(pattern: "application/json"), let data = response.data {
do {
return .userPlexAccount(try JSONDecoder().decode(Operations.GetTokenDetailsUserPlexAccount.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.GetTokenDetailsBadRequest.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.GetTokenDetailsUnauthorized.self, from: data))
} catch {
throw ResponseHandlerError.failedToDecodeJSON(error)
}
}
}
return .empty
}
private func handlePostUsersSignInDataResponse(response: Client.APIResponse) throws -> Operations.PostUsersSignInDataResponse {
let httpResponse = response.httpResponse
if httpResponse.statusCode == 201 {
if httpResponse.contentType.matchContentType(pattern: "application/json"), let data = response.data {
do {
return .userPlexAccount(try JSONDecoder().decode(Operations.PostUsersSignInDataUserPlexAccount.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.PostUsersSignInDataBadRequest.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.PostUsersSignInDataUnauthorized.self, from: data))
} catch {
throw ResponseHandlerError.failedToDecodeJSON(error)
}