EasyLanisClient.ephemeral constructor

EasyLanisClient.ephemeral({
  1. required int schoolId,
  2. required String username,
  3. required String password,
  4. AccountType? accountType,
  5. HttpClientAdapter? httpAdapter,
  6. String userAgent = 'liblanis/0.1.0',
  7. UnexpectedErrorHandler? onUnexpectedError,
})

Credentials in memory only — no persistent accounts (smoke tests).

Implementation

factory EasyLanisClient.ephemeral({
  required int schoolId,
  required String username,
  required String password,
  AccountType? accountType,
  HttpClientAdapter? httpAdapter,
  String userAgent = 'liblanis/0.1.0',
  UnexpectedErrorHandler? onUnexpectedError,
}) {
  LanisClient.configure(
    httpAdapter: httpAdapter,
    userAgent: userAgent,
    onUnexpectedError: onUnexpectedError,
  );
  final config = LanisClient.config!;
  final db = LanisDatabase.open(
    path: config.databasePath,
    secretStore: config.secretStore,
  );
  return EasyLanisClient._(
    config: config,
    db: db,
    ephemeral: true,
    ephemeralAccount: ClearTextAccount(
      localId: 1,
      schoolID: schoolId,
      schoolName: '',
      username: username,
      password: password,
      accountType: accountType,
    ),
  );
}