• Handler for get attachment list

    Parameters

    • configurations: PaginationConfigurations

      pagination configurations

      • defaultPageSize : default page size
      • defaultOffset : default offset
      • maxPageSize : max page size
    • attachmentService: AttachmentService

      injected service use to handle the attachment related operations

      • getPaginatedAttachments
      • normalizeAttachments
    • logger: Logger

      injected logger used to handle the logging

    • context: AdapterHandlerContext

      request context [headers, body, params, query].

    Returns Promise<AdapterHandlerResponse>

    200 Status OK

    • data: normalized attachment list

    Description

    This handler is used to get an attachment list by applying the following steps in sequence:

    1. Parse paginated list query (util.parsePaginatedListQuery)

    2. Check if pagination is set (util.parsePaginatedListQuery)

    3. Check if pagination limit is bigger than max page size (configurations.maxPageSize)

    4. Get the attachment list (attachmentService.getPaginatedAttachments)

    5. Normalize the attachment list (attachmentService.normalizeAttachments)

    6. Return the normalized attachment list

    Throws

    400 NBError Bad Request

    • error when parse paginated list query
    • pagination must be set
    • page size exceeds max page size

    Throws

    500 NBError Internal Server Error

    • error getting attachment list

    Example: example data response

    {
    "@nextLink": "https://api.example.com/attachments?limit=10&offset=10",
    "@previousLink": "https://api.example.com/attachments?limit=10&offset=0",
    "count": 10,
    "total": 100,
    "value": [ ...,
    {
    "id": "1",
    "ownerId": "userId",
    "ownerType": "user",
    "name": "image.png",
    "type": "image/png",
    "isPublic": true,
    "url": "https://api.example.com/attachments/objectId",
    },
    ]
    }

Generated using TypeDoc