getCustomContentByType method

Future<MultiEntityResult<CustomContentBulk>> getCustomContentByType({
  1. required String type,
  2. List<int>? id,
  3. List<int>? spaceId,
  4. String? sort,
  5. String? cursor,
  6. int? limit,
  7. String? bodyFormat,
})

Returns all custom content for a given type. 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 custom content, the container of the custom content, and the corresponding space (if different from the container).

Implementation

Future<MultiEntityResult<CustomContentBulk>> getCustomContentByType(
    {required String type,
    List<int>? id,
    List<int>? spaceId,
    String? sort,
    String? cursor,
    int? limit,
    String? bodyFormat}) async {
  return MultiEntityResult.fromJson(
    await _client.send(
      'get',
      'custom-content',
      queryParameters: {
        'type': type,
        if (id != null) 'id': id.map((e) => '$e').join(','),
        if (spaceId != null) 'space-id': spaceId.map((e) => '$e').join(','),
        if (sort != null) 'sort': sort,
        if (cursor != null) 'cursor': cursor,
        if (limit != null) 'limit': '$limit',
        if (bodyFormat != null) 'body-format': bodyFormat,
      },
    ),
    reviver: (v) => CustomContentBulk.fromJson(v as Map<String, Object?>),
  );
}