• Handler for attachment list by owner

    Parameters

    • ownerId: string

      unique identifier of the owner

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

    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. Add ownerId into filter expression and concat with $filter query

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

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

    5. Get the attachment list (attachmentService.getPaginatedAttachments)

    6. Normalize the attachment list (attachmentService.normalizeAttachments)

    7. Return the normalized attachment list

    Example: example data response

    {
    "@nextLink": "https://api.example.com/userId/attachments?limit=10&offset=10",
    "@previousLink": "https://api.example.com/userId/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