Fauna csharp driver  4.2.0
Classes | Public Member Functions | Static Public Member Functions | List of all members
FaunaDB.Client.FaunaClient Class Reference

C# native client for FaunaDB. More...

Classes

struct  ErrorsWrapper
 

Public Member Functions

 FaunaClient (string secret, string endpoint="https://db.fauna.com:443", TimeSpan? timeout=null, HttpClient httpClient=null, Version httpVersion=null, bool checkNewVersion=true, IReadOnlyDictionary< string, string > customHeaders=null)
 Constructs a new instance of FaunaClient with the specified arguments. More...
 
 FaunaClient (IClientIO clientIO)
 Constructs a new instance of FaunaClient with the specified IClientIO. More...
 
FaunaClient NewSessionClient (string secret)
 Creates a new FaunaClient with the user secret provided. Queries submitted to a session client will be authenticated with the secret provided. A session client shares its parent's internal resources. More...
 
async Task< ValueQuery (Expr expression, TimeSpan? queryTimeout=null)
 Issues a Query to FaunaDB. More...
 
async Task< Value[]> Query (params Expr[] expressions)
 Issues multiple queries to FaunaDB. More...
 
async Task< Value[]> Query (TimeSpan queryTimeout, params Expr[] expressions)
 Issues multiple queries to FaunaDB. More...
 
async Task< IEnumerable< Value > > Query (IEnumerable< Expr > expressions, TimeSpan? queryTimeout=null)
 Issues multiple queries to FaunaDB. More...
 
async Task< string > Ping (string scope=null, int? timeout=null)
 Check service health. More...
 
async Task< StreamingEventHandlerStream (Expr data=null, IReadOnlyList< EventField > fields=null)
 

Static Public Member Functions

static ObjectV FromJson (string json)
 

Detailed Description

C# native client for FaunaDB.

Queries are constructed by using static helpers in Language package.

var client = new FaunaClient(secret: "someAuthToken");
client.Query(Get(Ref("some/ref")));
FaunaClient(string secret, string endpoint="https://db.fauna.com:443", TimeSpan? timeout=null, HttpClient httpClient=null, Version httpVersion=null, bool checkNewVersion=true, IReadOnlyDictionary< string, string > customHeaders=null)
Constructs a new instance of FaunaClient with the specified arguments.
Definition: FaunaClient.cs:37

Definition at line 25 of file FaunaClient.cs.

Constructor & Destructor Documentation

◆ FaunaClient() [1/2]

FaunaDB.Client.FaunaClient.FaunaClient ( string  secret,
string  endpoint = "https://db.fauna.com:443",
TimeSpan?  timeout = null,
HttpClient  httpClient = null,
Version  httpVersion = null,
bool  checkNewVersion = true,
IReadOnlyDictionary< string, string >  customHeaders = null 
)

Constructs a new instance of FaunaClient with the specified arguments.

Parameters
secretAuth token for the FaunaDB server.
endpointURL for the FaunaDB server. Defaults to "https://db.fauna.com:443"
timeoutTimeout for I/O operations. Defaults to 1 minute.
httpVersionVersion of http. Default value is HttpVersion.Version11, is you use .net core 3.0 and above you can enable http/2 support by passing HttpVersion.Version20
checkNewVersionCheck new NuGet package driver version. Default value is true (Check new version).

Definition at line 37 of file FaunaClient.cs.

◆ FaunaClient() [2/2]

FaunaDB.Client.FaunaClient.FaunaClient ( IClientIO  clientIO)

Constructs a new instance of FaunaClient with the specified IClientIO.

Definition at line 51 of file FaunaClient.cs.

Member Function Documentation

◆ FromJson()

static ObjectV FaunaDB.Client.FaunaClient.FromJson ( string  json)
static

Definition at line 238 of file FaunaClient.cs.

◆ NewSessionClient()

FaunaClient FaunaDB.Client.FaunaClient.NewSessionClient ( string  secret)

Creates a new FaunaClient with the user secret provided. Queries submitted to a session client will be authenticated with the secret provided. A session client shares its parent's internal resources.

Parameters
secretAuth token for the FaunaDB server.

◆ Ping()

async Task<string> FaunaDB.Client.FaunaClient.Ping ( string  scope = null,
int?  timeout = null 
)

Check service health.

Parameters
scopeMust be "node", "local", "global", or "all". Defaults to "global"
timeoutTime to wait for the ping to succeed, in milliseconds.
Returns
a Task with the message representing the result operation

◆ Query() [1/4]

async Task<Value> FaunaDB.Client.FaunaClient.Query ( Expr  expression,
TimeSpan?  queryTimeout = null 
)

Issues a Query to FaunaDB.

Queries are modeled through the FaunaDB query language, represented by the helper functions in the Language class.

Responses are modeled as a general response tree. Each node is a Value, and can be coerced to structured types through various methods on that class.

Parameters
expressionExpression generated by methods of Language.
queryTimeoutTimeout for that specific query (it will override the client timetout, if any).

◆ Query() [2/4]

async Task<IEnumerable<Value> > FaunaDB.Client.FaunaClient.Query ( IEnumerable< Expr expressions,
TimeSpan?  queryTimeout = null 
)

Issues multiple queries to FaunaDB.

These queries are sent to FaunaDB in a single request, and are evaluated. The list of response nodes is returned in the same order as the issued queries.

See Query(Expr) for more information on the individual queries.

Parameters
expressionsthe list of query expressions to be sent to FaunaDB.
queryTimeoutTimeout for that specific query (it will override the client timetout, if any).
Returns
a Task containing an ordered list of root response nodes.

Definition at line 130 of file FaunaClient.cs.

◆ Query() [3/4]

async Task<Value[]> FaunaDB.Client.FaunaClient.Query ( params Expr[]  expressions)

Issues multiple queries to FaunaDB.

These queries are sent to FaunaDB in a single request, and are evaluated. The list of response nodes is returned in the same order as the issued queries.

See Query(Expr) for more information on the individual queries.

Parameters
expressionsthe list of query expressions to be sent to FaunaDB.
Returns
a Task containing an ordered list of root response nodes.

Definition at line 92 of file FaunaClient.cs.

◆ Query() [4/4]

async Task<Value[]> FaunaDB.Client.FaunaClient.Query ( TimeSpan  queryTimeout,
params Expr[]  expressions 
)

Issues multiple queries to FaunaDB.

These queries are sent to FaunaDB in a single request, and are evaluated. The list of response nodes is returned in the same order as the issued queries.

See Query(Expr) for more information on the individual queries.

Parameters
queryTimeoutTimeout for that specific query (it will override the client timetout, if any).
expressionsthe list of query expressions to be sent to FaunaDB.
Returns
a Task containing an ordered list of root response nodes.

Definition at line 111 of file FaunaClient.cs.

◆ Stream()

async Task<StreamingEventHandler> FaunaDB.Client.FaunaClient.Stream ( Expr  data = null,
IReadOnlyList< EventField fields = null 
)

Definition at line 156 of file FaunaClient.cs.


The documentation for this class was generated from the following file: