getAttachments method

Future<MultiEntityResult<Attachment>> getAttachments({
  1. String? sort,
  2. String? cursor,
  3. List<String>? status,
  4. String? mediaType,
  5. String? filename,
  6. int? limit,
})

Returns all attachments. The number of results is limited by the limit parameter and additional results (if available) will be available through the next URL present in the Link response header.

Permissions required: Permission to view the container of the attachment.

Implementation

Future<MultiEntityResult<Attachment>> getAttachments(
    {String? sort,
    String? cursor,
    List<String>? status,
    String? mediaType,
    String? filename,
    int? limit}) async {
  return MultiEntityResult.fromJson(
    await _client.send(
      'get',
      'attachments',
      queryParameters: {
        if (sort != null) 'sort': sort,
        if (cursor != null) 'cursor': cursor,
        if (status != null) 'status': status.map((e) => e).join(','),
        if (mediaType != null) 'mediaType': mediaType,
        if (filename != null) 'filename': filename,
        if (limit != null) 'limit': '$limit',
      },
    ),
    reviver: (v) => Attachment.fromJson(v as Map<String, Object?>),
  );
}