performDataTaskWithRequest

suspend fun performDataTaskWithRequest(endpoint: FrameNetworkingEndpoints, request: Any? = null, auth: FrameAuthMode = FrameAuthMode.Secret): Pair<ByteArray?, NetworkingError?>

Executes a POST or PATCH request to endpoint, serializing request as the JSON body.

Return

A pair of (response bytes, error).

Parameters

endpoint

The endpoint to call.

request

Optional request body. Serialized to JSON via Gson.

auth

The credential to use for this request. Defaults to FrameAuthMode.Secret, which fails safe to server-only; client-safe endpoints opt in with FrameAuthMode.Publishable.


fun <T> performDataTaskWithRequest(endpoint: FrameNetworkingEndpoints, request: T? = null, auth: FrameAuthMode = FrameAuthMode.Secret, completion: (data: ByteArray?, error: NetworkingError?) -> Unit)

Callback-based POST/PATCH for callers that cannot use coroutines.

Parameters

endpoint

The endpoint to call.

request

Optional request body. Serialized to JSON via Gson.

auth

The credential to use for this request. Defaults to FrameAuthMode.Secret, which fails safe to server-only; client-safe endpoints opt in with FrameAuthMode.Publishable.

completion

Called on an OkHttp worker thread with the response bytes and any error.