Skip to content

list_events async

list_events(
    space_id: SpaceId,
    actor_id: ActorId,
    session_id: SessionId,
    *,
    config_overrides: Optional[AsyncOpenSearchMemoryClientConfig] = None,
    event_timestamp_before: Optional[EventTimestamp] = None,
    event_timestamp_after: Optional[EventTimestamp] = None,
    sort_order: Optional[SortOrder] = None,
    metadata_filters: Optional[MetadataMap] = None,
    max_results: Optional[MaxResults] = None,
    next_token: Optional[PaginationToken] = None,
) -> ListEventsOutput

Lists the events in a session, sorted by time. Optionally limit the results to events whose eventTimestamp falls between eventTimestampAfter and eventTimestampBefore. Returns event metadata only. Call GetEvent for the payload. For full-text or relevance search, use SearchEvents.

If the space uses a customer managed AWS KMS key, the call can also fail because of the key. It fails with AccessDeniedException if you aren't allowed to use the key, and with ThrottlingException if AWS KMS throttles the request. It fails with ValidationException if the key is disabled, pending deletion, or deleted.

Parameters:

  • space_id (SpaceId) –

    The ID of the space.

  • actor_id (ActorId) –

    The actor whose events to list.

  • session_id (SessionId) –

    The session whose events to list. To find events across sessions, use SearchEvents.

  • event_timestamp_before (Optional[EventTimestamp], default: None ) –

    Inclusive upper bound on eventTimestamp: only events at or before this time are returned. Omit for no upper bound.

  • event_timestamp_after (Optional[EventTimestamp], default: None ) –

    Inclusive lower bound on eventTimestamp: only events at or after this time are returned. Omit for no lower bound.

    If it's later than eventTimestampBefore, the request fails with ValidationException.

  • sort_order (Optional[SortOrder], default: None ) –

    The order of the results by eventTimestamp: ASC or DESC. The default is DESC, most recent first.

  • metadata_filters (Optional[MetadataMap], default: None ) –

    Returns only events whose metadata contains every one of these key-value pairs. Omit, or leave empty, for no metadata filter. The service applies the filter after it reads events, so a page can hold fewer than maxResults events, or none, and still return a nextToken. Keep paging until nextToken is absent.

  • max_results (Optional[MaxResults], default: None ) –

    The maximum number of events to return, from 1 to 100. The default is 20.

  • next_token (Optional[PaginationToken], default: None ) –

    The token for the next set of results. Use the value returned in the previous response in the next request to retrieve the next set of results.

Raises:

  • AccessDeniedException –

    You don't have sufficient access to perform this operation. To use this operation, you must have AWS Identity and Access Management (IAM) permissions for the operation, and on the resource it acts on. If the space uses a customer managed AWS Key Management Service (AWS KMS) key, you must also have permission to use the key.

  • InternalServerException –

    The service couldn't process the request because of an internal error. Retry the request.

  • ResourceNotFoundException –

    The specified resource doesn't exist. Check the IDs in the request.

  • ThrottlingException –

    The service throttled the request. Retry the request with exponential backoff.

  • ValidationException –

    The request isn't valid. The reason, message, and fieldList members describe the problem. Fix the request, and then try again.

  • UnknownServiceError –

    The service returned an error code this client does not model.

Source code in docs_src/capo_opensearchmemory/_services/async_open_search_memory.py
async def list_events(
    self,
    space_id: "capo_opensearchmemory.types.space_id.SpaceId",
    actor_id: "capo_opensearchmemory.types.actor_id.ActorId",
    session_id: "capo_opensearchmemory.types.session_id.SessionId",
    *,
    config_overrides: Optional[AsyncOpenSearchMemoryClientConfig] = None,
    event_timestamp_before: Optional[
        "capo_opensearchmemory.types.event_timestamp.EventTimestamp"
    ] = None,
    event_timestamp_after: Optional[
        "capo_opensearchmemory.types.event_timestamp.EventTimestamp"
    ] = None,
    sort_order: Optional["capo_opensearchmemory.types.sort_order.SortOrder"] = None,
    metadata_filters: Optional[
        "capo_opensearchmemory.types.metadata_map.MetadataMap"
    ] = None,
    max_results: Optional[
        "capo_opensearchmemory.types.max_results.MaxResults"
    ] = None,
    next_token: Optional[
        "capo_opensearchmemory.types.pagination_token.PaginationToken"
    ] = None,
) -> "capo_opensearchmemory.types.list_events_output.ListEventsOutput":
    """<p>Lists the events in a session, sorted by time. Optionally limit the results to events whose <code>eventTimestamp</code> falls between <code>eventTimestampAfter</code> and <code>eventTimestampBefore</code>. Returns event metadata only. Call <code>GetEvent</code> for the payload. For full-text or relevance search, use <code>SearchEvents</code>.</p> <p>If the space uses a customer managed AWS KMS key, the call can also fail because of the key. It fails with <code>AccessDeniedException</code> if you aren't allowed to use the key, and with <code>ThrottlingException</code> if AWS KMS throttles the request. It fails with <code>ValidationException</code> if the key is disabled, pending deletion, or deleted.</p>

    Args:
        space_id: <p>The ID of the space.</p>
        actor_id: <p>The actor whose events to list.</p>
        session_id: <p>The session whose events to list. To find events across sessions, use <code>SearchEvents</code>.</p>
        event_timestamp_before: <p>Inclusive upper bound on <code>eventTimestamp</code>: only events at or before this time are returned. Omit for no upper bound.</p>
        event_timestamp_after: <p>Inclusive lower bound on <code>eventTimestamp</code>: only events at or after this time are returned. Omit for no lower bound.</p> <p>If it's later than <code>eventTimestampBefore</code>, the request fails with <code>ValidationException</code>.</p>
        sort_order: <p>The order of the results by <code>eventTimestamp</code>: <code>ASC</code> or <code>DESC</code>. The default is <code>DESC</code>, most recent first.</p>
        metadata_filters: <p>Returns only events whose metadata contains every one of these key-value pairs. Omit, or leave empty, for no metadata filter. The service applies the filter after it reads events, so a page can hold fewer than <code>maxResults</code> events, or none, and still return a <code>nextToken</code>. Keep paging until <code>nextToken</code> is absent.</p>
        max_results: <p>The maximum number of events to return, from 1 to 100. The default is 20.</p>
        next_token: <p>The token for the next set of results. Use the value returned in the previous response in the next request to retrieve the next set of results.</p>

    Raises:
        capo_opensearchmemory.errors.access_denied_exception.AccessDeniedException: <p>You don't have sufficient access to perform this operation. To use this operation, you must have AWS Identity and Access Management (IAM) permissions for the operation, and on the resource it acts on. If the space uses a customer managed AWS Key Management Service (AWS KMS) key, you must also have permission to use the key.</p>
        capo_opensearchmemory.errors.internal_server_exception.InternalServerException: <p>The service couldn't process the request because of an internal error. Retry the request.</p>
        capo_opensearchmemory.errors.resource_not_found_exception.ResourceNotFoundException: <p>The specified resource doesn't exist. Check the IDs in the request.</p>
        capo_opensearchmemory.errors.throttling_exception.ThrottlingException: <p>The service throttled the request. Retry the request with exponential backoff.</p>
        capo_opensearchmemory.errors.validation_exception.ValidationException: <p>The request isn't valid. The <code>reason</code>, <code>message</code>, and <code>fieldList</code> members describe the problem. Fix the request, and then try again.</p>
        capo_opensearchmemory.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_opensearchmemory.types.list_events_input.ListEventsInput]",
    ) -> AsyncOperationResponse[
        "capo_opensearchmemory.types.list_events_output.ListEventsOutput"
    ]:
        import capo_opensearchmemory._operations.open_search_memory.list_events

        (
            output,
            http_response,
        ) = await capo_opensearchmemory._operations.open_search_memory.list_events.async_list_events(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("ListEvents")
    )
    input_: capo_opensearchmemory.types.list_events_input.ListEventsInput = {
        "space_id": space_id,
        "actor_id": actor_id,
        "session_id": session_id,
    }
    if event_timestamp_before is not None:
        input_["event_timestamp_before"] = event_timestamp_before
    if event_timestamp_after is not None:
        input_["event_timestamp_after"] = event_timestamp_after
    if sort_order is not None:
        input_["sort_order"] = sort_order
    if metadata_filters is not None:
        input_["metadata_filters"] = metadata_filters
    if max_results is not None:
        input_["max_results"] = max_results
    if next_token is not None:
        input_["next_token"] = next_token

    response = await aexecute_pipeline(
        AsyncOperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    await response.response.aclose()
    return response.output