issueCollaborationToken method
Future<IssueCollaborationToken200Response?>
issueCollaborationToken({
- IssueCollaborationTokenRequest? issueCollaborationTokenRequest,
Exchange a bearer token for a short-lived Yjs collaboration JWT.
The Yjs Cloudflare Worker that powers live document collaboration (wss://realtime-collaboration.<account>.workers.dev) only accepts platform-signed JWTs. Third-party clients holding an OAuth access token or PAT call this endpoint to mint a 5-minute collaboration JWT they can present to the worker. The minted JWT inherits user + workspace identity from the presenting bearer token. Optionally scope it to a single room by supplying room in the request body.
Parameters:
- IssueCollaborationTokenRequest issueCollaborationTokenRequest:
Implementation
Future<IssueCollaborationToken200Response?> issueCollaborationToken({ IssueCollaborationTokenRequest? issueCollaborationTokenRequest, }) async {
final response = await issueCollaborationTokenWithHttpInfo( issueCollaborationTokenRequest: issueCollaborationTokenRequest, );
if (response.statusCode >= HttpStatus.badRequest) {
throw ApiException(response.statusCode, await _decodeBodyBytes(response));
}
// When a remote server returns no body with a status of 204, we shall not decode it.
// At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
// FormatException when trying to decode an empty string.
if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) {
return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'IssueCollaborationToken200Response',) as IssueCollaborationToken200Response;
}
return null;
}