tek_omni_bff_service_flutter 1.1.0-MOBCOMMON9084.2
tek_omni_bff_service_flutter: ^1.1.0-MOBCOMMON9084.2 copied to clipboard
A service to handle the omni BFF (consumer & staff) for Terra applications.
tek_omni_bff_service_flutter #
A Terra service that talks to the Omni BFF (omni_bff) for both consumer and
staff apps. It is built on top of tek_core_service_flutter and authenticates
through tek_credential_service_flutter.
TekOmniBffService is the parent facade. It exposes two sub-services, each
bound to its own base URL:
| Sub-service | Backed by | Accessor |
|---|---|---|
| Consumer BFF | consumerBffUrl |
service.consumer |
| Staff BFF | staffBffUrl |
service.staff |
Configuration #
Configured from the Terra omni_bff service config:
| Field | Description |
|---|---|
consumerBffUrl |
Base URL for the consumer BFF sub-service. |
staffBffUrl |
Base URL for the staff BFF sub-service. |
import 'package:tek_omni_bff_service_flutter/tek_omni_bff_service_flutter.dart';
await TekOmniBffService.configureWith(app);
final OmniBffServiceInterface? service =
TekOmniBffService.getInstance(app.appName);
API #
Consumer — service.consumer.getOfflineVouchers (GET /api/v1/offline-vouchers) #
final result = await service!.consumer.getOfflineVouchers(
languageCode: 'vi', // Accept-Language: en | vi (default: en)
limit: 20, // 1..100 (default 20)
offset: 0, // >= 0 (default 0)
status: OfflineVoucherStatus.active, // ACTIVE | USED | EXPIRED (optional)
);
result.when(
success: (OfflineVoucherList list) {
// list.vouchers, list.pagination
},
failure: (OmniBffServiceError error) {
// error.code, error.message
},
);
Staff — service.staff #
Placeholder for upcoming staff endpoints (backed by staffBffUrl).
Code generation #
This package uses freezed and json_serializable. Generated files
(*.freezed.dart, *.g.dart) are not committed to git — run the generator
after checkout:
dart run build_runner build --delete-conflicting-outputs