Service class

Provides access to custom service endpoints.

The Service class allows you to interact with your own custom service endpoints deployed alongside your Calljmp backend. This enables you to extend the core Calljmp functionality with your own business logic while maintaining the same authentication and security model.

Usage

final calljmp = Calljmp();

// Simple GET request
final message = await calljmp.service
  .request(route: '/hello')
  .get()
  .json((json) => json['message'] as String);

// POST request with data
final result = await calljmp.service
  .request(route: '/api/orders')
  .post({'product_id': 123, 'quantity': 2})
  .json((json) => json);

// Custom headers and authentication
final data = await calljmp.service
  .request(route: '/api/protected')
  .header('X-Custom-Header', 'value')
  .get()
  .json((json) => json);

Service Development

Your custom service endpoints are implemented as part of your Calljmp deployment and have access to the same database, user context, and security features as the core Calljmp APIs.

Constructors

Service(Config _config, Integrity _integrity)
Creates a new Service instance.

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
url String
Gets the base URL for service requests.
no setter

Methods

accessToken() Future<AccessToken>
Retrieves and validates the current access token.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
request({String route = '/'}) HttpRequest
Creates a configured HTTP request for a service endpoint.
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited