PostgrestClientInterface
in
Interface for both synchronous and asynchronous PostgREST clients.
Table of Contents
Methods
- auth() : bool|PromiseInterface<string|int, bool>
- Authenticate the client.
- call() : PostgrestResponse|PromiseInterface<string|int, PostgrestResponse>
- Call a stored procedure.
- disableAutoAuth() : void
- Disable auto authentication feature
- enableAutoAuth() : void
- Enable auto authentication feature.
- from() : PostgrestRequestBuilder
- Create a new request builder for a table in a schema.
- isAuthenticated() : bool
- Check whether the client is authenticated.
- run() : PostgrestResponse|PromiseInterface<string|int, PostgrestResponse>
- Run a query.
- setAuthToken() : void
- Manually set the authentication token.
Methods
auth()
Authenticate the client.
public
auth() : bool|PromiseInterface<string|int, bool>
Return values
bool|PromiseInterface<string|int, bool> —Whether the authentication was successful.
call()
Call a stored procedure.
public
call(string $functionName[, array<string, mixed> $params = [] ][, string $schemaName = 'public' ][, bool $skipAuth = false ]) : PostgrestResponse|PromiseInterface<string|int, PostgrestResponse>
Parameters
- $functionName : string
-
The name of the stored procedure to call.
- $params : array<string, mixed> = []
-
The parameters to pass to the stored procedure.
- $schemaName : string = 'public'
-
The schema name of the stored procedure.
- $skipAuth : bool = false
-
Whether to skip authentication.
Return values
PostgrestResponse|PromiseInterface<string|int, PostgrestResponse> —The response from the PostgREST server.
disableAutoAuth()
Disable auto authentication feature
public
disableAutoAuth() : void
enableAutoAuth()
Enable auto authentication feature.
public
enableAutoAuth([int $autoAuthGrace = 300 ]) : void
Will check token expiration with every request.
Parameters
- $autoAuthGrace : int = 300
-
The grace period subtracted from the token expiration time.
from()
Create a new request builder for a table in a schema.
public
from(string $schemaName, string $tableName) : PostgrestRequestBuilder
Parameters
- $schemaName : string
-
Name of the schema
- $tableName : string
-
Name of the table
Return values
PostgrestRequestBuilderisAuthenticated()
Check whether the client is authenticated.
public
isAuthenticated() : bool
Return values
boolrun()
Run a query.
public
run(PostgrestRequestBuilder $requestBuilder[, bool $skipAuth = false ]) : PostgrestResponse|PromiseInterface<string|int, PostgrestResponse>
Parameters
- $requestBuilder : PostgrestRequestBuilder
-
The request builder.
- $skipAuth : bool = false
-
Whether to skip authentication.
Return values
PostgrestResponse|PromiseInterface<string|int, PostgrestResponse> —The response from the PostgREST server.
setAuthToken()
Manually set the authentication token.
public
setAuthToken(string $token) : void
Parameters
- $token : string
-
The authentication token.