api/internal/gamification/game_transport library

Classes

GameTransportFailure
No answer: a timeout, a dead connection, or any other transport failure. code is timeout or network (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/network code, so callers keep the timeout identity instead of collapsing it to null. Shared by the typed gamification calls (grantChance, state, getRewards) and the generic skin http pass-through. Port of Android GameTransport.

Functions

gameTransportFailureCode(Object error) → String
Maps a transport failure to timeout or network, walking the cause chain. Shared by the skin http bridge and the rewards fetch. Port of Android failureCodeOf (iOS GameTransport.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 body to url. Cancellation (a TimeoutException aside, an async-cancel error) is rethrown for the caller's finally to run; everything else becomes GameTransportFailure. Never throws otherwise. Port of Android NetworkClient.requestJson.