postIntegrationsTelegramConnect method

Future<AuthorizeOut?> postIntegrationsTelegramConnect()

Mints a short, single-use deep-link code bound to the caller's org and returns the t.me link the console navigates to.

Mints a short, single-use deep-link code bound to the caller's org and returns the t.me link the console navigates to. Org-authed: a caller with no validated principal is 403 (same gate as the framework connect). The code is stored as an oauth_nonce (org,telegram); the webhook's /start handler claims it to bind chat→org. It is short (128-bit hex) so it fits Telegram's 64-char start payload limit.

Implementation

Future<AuthorizeOut?> postIntegrationsTelegramConnect() async {
  final response = await postIntegrationsTelegramConnectWithHttpInfo();
  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), 'AuthorizeOut',) as AuthorizeOut;

  }
  return null;
}