diff options
Diffstat (limited to 'Sources/LichessClient/LichessClient.swift')
-rw-r--r-- | Sources/LichessClient/LichessClient.swift | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/Sources/LichessClient/LichessClient.swift b/Sources/LichessClient/LichessClient.swift new file mode 100644 index 0000000..d398538 --- /dev/null +++ b/Sources/LichessClient/LichessClient.swift @@ -0,0 +1,29 @@ +import Foundation +import OpenAPIRuntime +import OpenAPIURLSession + +public struct LichessClient { + // Lichess has a separate endpoint for its tablebase server + internal let underlyingClient: any APIProtocol + internal let underlyingTablebaseClient: any APIProtocol + + internal init(underlyingClient: any APIProtocol, underlyingTablebaseClient: any APIProtocol) { + self.underlyingClient = underlyingClient + self.underlyingTablebaseClient = underlyingTablebaseClient + } + + public init() { + self.init( + underlyingClient: Client( + serverURL: URL(string: "https://lichess.org")!, transport: URLSessionTransport()), + underlyingTablebaseClient: Client( + serverURL: URL(string: "https://tablebase.lichess.ovh")!, transport: URLSessionTransport()) + ) + } + + enum LichessClientError: Error { + case undocumentedResponse(statusCode: Int) + case parsingError(error: Error) + } + +} |