listDraftsWithHttpInfo method

Future<Response> listDraftsWithHttpInfo({
  1. String? xWorkspaceID,
  2. List<String>? accountIds,
  3. List<String>? providers,
  4. int? limit,
  5. String? nextPageToken,
})

List drafts across connected mail accounts.

Note: This method returns the HTTP Response.

Parameters:

  • 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.

  • 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).

  • int limit:

  • String nextPageToken:

Implementation

Future<Response> listDraftsWithHttpInfo({ String? xWorkspaceID, List<String>? accountIds, List<String>? providers, int? limit, String? nextPageToken, }) async {
  // ignore: prefer_const_declarations
  final path = r'/v1/mail/drafts';

  // ignore: prefer_final_locals
  Object? postBody;

  final queryParams = <QueryParam>[];
  final headerParams = <String, String>{};
  final formParams = <String, String>{};

  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 (nextPageToken != null) {
    queryParams.addAll(_queryParams('', 'nextPageToken', nextPageToken));
  }

  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,
  );
}