Squid class
The main entry point to the Squid Client SDK.
The Squid class provides a comprehensive array of functionality for accessing the different integrations, executing backend functions, managing data, and more. Upon instantiating the Squid class, you will have access to all of these capabilities.
Constructors
- Squid.new(SquidOptions _options)
-
Squid.getInstance({required AppId appId, required SupportedSquidRegion region, ApiKey? apiKey, EnvironmentId? environmentId, SquidDeveloperId? squidDeveloperId, MessageNotificationWrapper? messageNotificationWrapper, Map<
IntegrationId, String> ? apiServerUrlOverrideMapping}) -
Enables debug logging for the Squid Client SDK.
Returns the global Squid instance with the given options, creating a new
Squid instance if one with the same options does not exist.
factory
Properties
- ai → AiClient
-
Returns a set of AI specific clients. Currently, the only supported client
is the AI Assistant, which is accessed through the
assistant
.no setter - hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- secrets → SecretClient
-
no setter
Methods
-
acquireLock(
String mutex, {bool exclusive = true}) → Future< DistributedLock> -
Returns a
DistributedLock
for the givenmutex
. The lock can be used to synchronize access to a shared resource. The lock will be released when the release method on the returned object is invoked or whenever the connection with the server is lost. -
callApi<
T> (ApiEndpointId apiEndpointId, {required IntegrationId integrationId, Map< String, dynamic> request = const {}}) → Future<T> -
Invokes the HTTP API (defined by the given
integrationId
andapiEndpointId
) with the given request parameters and returns a future with the response. The structure of the request and the response is defined in the integration's schema page. -
collection(
String collectionName, {IntegrationId integrationId = defaultBuiltInDb}) → CollectionReference - Returns a reference to the collection in the provided integration.
-
destruct(
) → Future< void> - Destructs the Squid Client. Unsubscribes from all ongoing queries or requests, and clears the local data. After invoking this method, the Squid client will not be usable.
-
executeFunction<
T> (FunctionName functionName, {Iterable args = const []}) → Future< T> -
Executes the backend function with the given
functionName
the givenargs
and returns a Future with the result. -
executeNamedQuery<
T> (QueryName queryName, {Map< String, dynamic> params = const {}, required IntegrationId integrationId}) → Future<T> -
Executes the given
queryName
with the givenparams
and returns a future with the result. -
graphql(
IntegrationId integrationId) → GraphQLClient -
Returns a GraphQL client for the given
integrationId
. The GraphQL client can be used to execute GraphQL queries and mutations. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
runInTransaction(
FutureOr< void> fn(TransactionId?)) → Future<void> -
Runs the given
fn
as an atomic change. All the mutations that are executed using the provided transactionId will be atomic. -
setAuthIdToken(
{String? fromString, Future< String> ? fromFuture, Observable<String> ? fromObservable, IntegrationId? integrationId}) → void -
Sets the auth
idToken
(OpenId) that will be sent to the server and will be used for providing theauth
object to the security rules. -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited