public final class Client
Client represents a HTTP client for a FaunaDB server. It provides
methods, such as
query(batch:) that you can use to execute
queries in your server.
NoteThis class is meant to be reused as much as possible. If you need to connect to the same server but using a different key’s secret, use
newSessionClientmethod instead of creating a new
public init(secret: String, endpoint: URL = defaultEndpoint, session: URLSession? = nil)
The key’s secret to be used to authenticate requests.
The URL address of your FaunaDB server. Default: https://db.fauna.com.
URLSessionobject to be used while performing HTTP requests to FaunaDB. Default:
Returns a new
Clientinstance for the same FaunaDB server but using a different key’s secret to authenticate HTTP requests. The new client shares its parent’s resources, such as its URLSession.
public func newSessionClient(secret: String) -> Client
The key’s secret to be used to authenticate HTTP requests.
Sends a query to the FaunaDB server. All queries are executed asynchronously.
QueryResultwill be fulfilled once the query finishes to run, or fail.
The query expression to be sent. Check
FaunaDB.Exprfor more information.
Sends a batch of queries to the FaunaDB server. All queries are executed asynchronously.
QueryResultwill be fulfilled once all queries finishes to run, or fail. The result array will be in the same order as the request array.
A sequence of query expressions to be sent to FaunaDB.