server library

Classes

AuthenticationInfo
Holds the id for an authenticated user and which scopes it can access. Allowed scopes are defined for each Endpoint.
Endpoint
The Endpoint is an entrypoint to the Server. To add a custom Endpoint to a Server, create a subclass and place it in the endpoints directory. Code will generated that builds the corresponding client library. To add methods that can be accessed from the client, make sure that the first argument of the method is a Session parameter.
EndpointConnector
The EndpointConnector associates a name with and endpoint and its EndpointMethodConnectors.
EndpointDispatch
The EndpointDispatch is responsible for directing requests to the Server to the correct Endpoint and method. Typically, this class is overridden by an Endpoints class that is generated.
EndpointMethodConnector
The EndpointMethodConnector is a base class for connectors that connect methods their implementation.
ExceptionResult<T extends SerializableException>
The result of a failed Endpoint method call, with a custom exception.
FutureCall<T extends SerializableModel>
Superclass of a FutureCall, override the invoke method to create a custom FutureCall. The call also needs to be registered with the top ServerPod object before starting the Server.
FutureCallSession
Created when a FutureCall is being made. It contains all data associated with the current call and provides easy access to the database.
InternalSession
A Session used internally in the ServerPod. Typically used to access the database and do logging for events that are not triggered from a call, or a stream.
MessageCentral
The MessageCentral handles communication within the server, and between servers in a cluster. It is especially useful when working with streaming endpoints. The message central can pass on any serializable to a channel. The channel can be listened to by from any place in the server.
MessageCentralAccess
Provides access to the Serverpod's MessageCentral.
MessageCentralServerpodChannels
Channels that are listened to by the Serverpod Framework.
MethodCallContext
Context for a MethodConnector call
MethodCallSession
When a call is made to the Server a MethodCallSession object is created. It contains all data associated with the current connection and provides easy access to the database.
MethodConnector
The MethodConnector hooks up a method with its name and the actual call to the method.
MethodStreamCallContext
Context for a MethodStreamConnector call
MethodStreamConnector
The MethodStreamConnector hooks up a method with its name and implementation. The method communicates with the client using a websocket connection. Enabling support for streaming return values or parameters.
MethodStreamSession
When a connection is made to the Server to an endpoint method that uses a stream MethodStreamSession object is created. It contains all data associated with the current connection and provides easy access to the database.
ParameterDescription
Defines a parameter in a MethodConnector.
Result
The Result of an Endpoint method call.
ResultAuthenticationFailed
The result of a failed Endpoint method call where authentication failed.
ResultInternalServerError
The result of a failed Endpoint method call where an Exception was thrown during execution of the method.
ResultInvalidParams
The result of a failed Endpoint method call where the parameters where not valid.
ResultNoSuchEndpoint
The result of a failed Endpoint method call where the endpoint was not found.
ResultStatusCode
The result of a failed Endpoint method call, with a custom status code, and an optional message.
ResultSuccess
A successful result from an Endpoint method call containing the return value of the call.
Scope
Used to define who can access an Endpoint. Authenticated users can be associated with a Scope, if the same scope is defined in the Endpoint the user is granted access. The scope is defined by its name.
SerializationManagerServer
The SerializationManager is responsible for creating objects from a serialization, but also for serializing objects. This class is typically overridden by generated code. SerializationManagerServer is an extension to also handle Tables.
Server
Handling incoming calls and routing them to the correct Endpoint methods.
ServerHealthMetric
Represents a snapshot of a specific health metric. An entry is written every minute for each server. All health data can be accessed through Serverpod Insights.
ServerHealthMetricInclude
ServerHealthMetricIncludeList
ServerHealthMetricRepository
ServerHealthMetricTable
Serverpod
The Serverpod handles all setup and manages the main Server. In addition to the user managed server, it also runs a server for handling the DistributedCache and other connections through the InsightsEndpoint.
ServerpodRunMode
Defines valid run modes for the Serverpod.
Session
When a call is made to the Server a Session object is created. It contains all data associated with the current connection and provides easy access to the database.
StorageAccess
Collects methods for accessing cloud storage.
StreamingSession
When a web socket connection is opened to the Server a StreamingSession object is created. It contains all data associated with the current connection and provides easy access to the database.
StreamParameterDescription<T>
Description of a stream parameter.
WebCallSession
When a request is made to the web server a WebCallSession object is created. It contains all data associated with the current connection and provides easy access to the database.

Enums

AuthenticationFailureReason
The type of failures that can occur during authentication.
MethodStreamReturnType
The type of return value from a MethodStreamConnector.
ServerpodLoggingMode
The overarching logging mode of the server. This can be set to either normal or verbose. In normal mode, only important messages are logged, which is the default.

Typedefs

AuthenticationHandler = Future<AuthenticationInfo?> Function(Session session, String token)
Returns authentication information for a given Session and token or null if the key is invalid.
HealthCheckHandler = Future<List<ServerHealthMetric>> Function(Serverpod pod, DateTime timestamp)
Performs a set of custom health checks on a Serverpod.
MessageCentralListenerCallback = void Function(SerializableModel message)
The callback used by listeners of the MessageCentral.
MethodCall = Future Function(Session session, Map<String, dynamic> params)
Calls a named method referenced in a MethodConnector.
MethodStream = dynamic Function(Session session, Map<String, dynamic> params, Map<String, Stream> streamParams)
Calls a named method referenced in a MethodStreamConnector.
WillCloseListener = FutureOr<void> Function(Session session)
A listener that will be called when the session is about to close.

Exceptions / Errors

EndpointDispatchException
The result of a failed EndpointDispatch.getMethodStreamCallContext, EndpointDispatch.getMethodCallContext or EndpointDispatch.getEndpointConnector call.
EndpointNotFoundException
The endpoint was not found.
ExitException
Exception used to signal a
InvalidEndpointMethodTypeException
The found endpoint method was not of the expected type.
InvalidParametersException
The input parameters were invalid.
MethodNotFoundException
The endpoint method was not found.
NotAuthorizedException
The user is not authorized to access the endpoint.