api/internal/gamification/game_transport library
Classes
- GameTransportFailure
-
No answer: a timeout, a dead connection, or any other transport failure.
code is
timeoutornetwork(GameBridgeError). - GameTransportResponded
- The backend answered (any status, including 4xx/5xx).
- GameTransportResult
-
One JSON round-trip over NetworkClient. Never throws (except on
cancellation): a transport failure comes back as
GameTransportFailure carrying the
timeout/networkcode, so callers keep the timeout identity instead of collapsing it to null. Shared by the typed gamification calls (grantChance,state,getRewards) and the generic skinhttppass-through. Port of AndroidGameTransport.
Functions
-
gameTransportFailureCode(
Object error) → String -
Maps a transport failure to
timeoutornetwork, walking the cause chain. Shared by the skinhttpbridge and the rewards fetch. Port of AndroidfailureCodeOf(iOSGameTransport.timeoutCode). -
postGameJson(
NetworkClient client, {required String url, Map< String, Object?> ? body, Map<String, String> headers = const {'Content-Type' : 'application/json'}, Duration timeout = const Duration(seconds: 10), HttpMethod method = HttpMethod.post}) → Future<GameTransportResult> -
One POST of a JSON
bodytourl. Cancellation (a TimeoutException aside, an async-cancel error) is rethrown for the caller'sfinallyto run; everything else becomes GameTransportFailure. Never throws otherwise. Port of AndroidNetworkClient.requestJson.