performDataTaskWithRequest

suspend fun performDataTaskWithRequest(endpoint: FrameNetworkingEndpoints, request: Any? = null, usePublishableKey: Boolean = false): 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.

usePublishableKey

When true, the publishable key is used instead of the secret key.


fun <T> performDataTaskWithRequest(endpoint: FrameNetworkingEndpoints, request: T? = null, usePublishableKey: Boolean = false, 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.

usePublishableKey

When true, the publishable key is used instead of the secret key.

completion

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