// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. import Foundation class _UsersAPI: UsersAPI { private let client: Client init(client: Client) { self.client = client } public func getUsers(request: Operations.GetUsersRequest, server: UsersServers.GetUsers?) async throws -> Response { return try await client.makeRequest( with: try server?.server() ?? UsersServers.GetUsers.default(), configureRequest: { configuration in try configureGetUsersRequest(with: configuration, request: request) }, handleResponse: handleGetUsersResponse ) } } // MARK: - Request Configuration private func configureGetUsersRequest(with configuration: URLRequestConfiguration, request: Operations.GetUsersRequest) throws { configuration.path = "/users" configuration.method = .get configuration.headerParameterSerializable = request configuration.telemetryHeader = .userAgent } // MARK: - Response Handlers private func handleGetUsersResponse(response: Client.APIResponse) throws -> Operations.GetUsersResponse { let httpResponse = response.httpResponse if httpResponse.statusCode == 200 { if httpResponse.contentType.matchContentType(pattern: "application/xml"), let data = response.data { return .body(data) } } else if httpResponse.statusCode == 400 { if httpResponse.contentType.matchContentType(pattern: "application/json"), let data = response.data { do { return .badRequest(try JSONDecoder().decode(Operations.GetUsersBadRequest.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.GetUsersUnauthorized.self, from: data)) } catch { throw ResponseHandlerError.failedToDecodeJSON(error) } } } return .empty }