listChannelMessagesWithHttpInfo method
List messages in a channel.
Channel ids are provider-scoped; pass ?accountId= (preferred) or ?accountIds= to disambiguate when the same id exists on multiple connected accounts (rare).
Note: This method returns the HTTP Response.
Parameters:
-
String channel (required): Channel id.
-
String accountId:
-
List<String> accountIds: Repeatable. Restrict to these connected-account row ids. Mutually orthogonal to
providers— when both are set the intersection is used. -
List<String> providers: Repeatable. Restrict to these provider ids (
gmail,outlook). -
String xWorkspaceID: Workspace scope for unscoped tokens. Workspace-scoped PATs and OAuth tokens carry this implicitly; for session/JWT auth without a scoped PAT, pass it explicitly.
-
int limit:
-
String cursor:
-
bool oldestFirst:
Implementation
Future<Response> listChannelMessagesWithHttpInfo(String channel, { String? accountId, List<String>? accountIds, List<String>? providers, String? xWorkspaceID, int? limit, String? cursor, bool? oldestFirst, }) async {
// ignore: prefer_const_declarations
final path = r'/v1/channels/messages';
// ignore: prefer_final_locals
Object? postBody;
final queryParams = <QueryParam>[];
final headerParams = <String, String>{};
final formParams = <String, String>{};
queryParams.addAll(_queryParams('', 'channel', channel));
if (accountId != null) {
queryParams.addAll(_queryParams('', 'accountId', accountId));
}
if (accountIds != null) {
queryParams.addAll(_queryParams('multi', 'accountIds', accountIds));
}
if (providers != null) {
queryParams.addAll(_queryParams('multi', 'providers', providers));
}
if (limit != null) {
queryParams.addAll(_queryParams('', 'limit', limit));
}
if (cursor != null) {
queryParams.addAll(_queryParams('', 'cursor', cursor));
}
if (oldestFirst != null) {
queryParams.addAll(_queryParams('', 'oldestFirst', oldestFirst));
}
if (xWorkspaceID != null) {
headerParams[r'X-Workspace-ID'] = parameterToString(xWorkspaceID);
}
const contentTypes = <String>[];
return apiClient.invokeAPI(
path,
'GET',
queryParams,
postBody,
headerParams,
formParams,
contentTypes.isEmpty ? null : contentTypes.first,
);
}