diff options
author | Navan Chauhan <navanchauhan@gmail.com> | 2024-04-24 01:57:08 -0600 |
---|---|---|
committer | Navan Chauhan <navanchauhan@gmail.com> | 2024-04-24 01:57:08 -0600 |
commit | f1cc08c4c3bfbc844047dd7b6b68bc6fab9baedf (patch) | |
tree | a18ec0845c2a360b661aec415709af2cccf74995 /Sources/LichessClient/LichessClient.swift |
initial commit
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) + } + +} |