Calljmp constructor

Calljmp({
  1. String? projectUrl,
  2. String? serviceUrl,
  3. ServiceConfig? service,
  4. AndroidConfig? android,
  5. DevelopmentConfig? development,
})

Creates a new Calljmp client instance with the specified configuration.

Parameters

  • projectUrl: Custom project URL override (optional)
  • serviceUrl: Custom service URL override (optional)
  • service: Service configuration for custom endpoints
  • android: Android-specific configuration including cloud project number
  • development: Development mode configuration for testing

Examples

// Basic initialization
final calljmp = Calljmp();

// With Android configuration
final calljmp = Calljmp(
  android: AndroidConfig(cloudProjectNumber: '123456789'),
);

// Development mode
final calljmp = Calljmp(
  development: DevelopmentConfig(
    enabled: true,
    baseUrl: 'https://dev.calljmp.com',
  ),
);

Implementation

factory Calljmp({
  String? projectUrl,
  String? serviceUrl,
  ServiceConfig? service,
  AndroidConfig? android,
  DevelopmentConfig? development,
}) {
  final baseUrl =
      (development?.enabled == true ? development?.baseUrl : null) ??
      "https://api.calljmp.com";

  final config = Config(
    serviceUrl: "$baseUrl/target/v1",
    projectUrl: "$baseUrl/project",
    service: service,
    android: android,
    development: development,
  );

  final attestation = Attestation(
    cloudProjectNumber: config.android?.cloudProjectNumber,
  );
  final integrity = Integrity(config, attestation);
  final signal = createSignal(config);

  return Calljmp._(
    integrity,
    Users(config, attestation),
    Project(config, attestation),
    Database(config, signal),
    Realtime(signal),
    Service(config, integrity),
    Storage(config),
  );
}