Skip to content

list_documents

list_documents(
    application_id: ApplicationId,
    index_id: IndexId,
    *,
    config_overrides: Optional[QBusinessClientConfig] = None,
    data_source_ids: Optional[DataSourceIds] = None,
    next_token: Optional[NextToken] = None,
    max_results: Optional[MaxResultsIntegerForListDocuments] = None,
) -> ListDocumentsResponse

A list of documents attached to an index.

Parameters:

  • application_id (ApplicationId) –

    The identifier of the application id the documents are attached to.

  • index_id (IndexId) –

    The identifier of the index the documents are attached to.

  • data_source_ids (Optional[DataSourceIds], default: None ) –

    The identifier of the data sources the documents are attached to.

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

    If the maxResults response was incomplete because there is more data to retrieve, Amazon Q Business returns a pagination token in the response. You can use this pagination token to retrieve the next set of documents.

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

    The maximum number of documents to return.

Raises:

  • AccessDeniedException –

    You don't have access to perform this action. Make sure you have the required permission policies and user accounts and try again.

  • InternalServerException –

    An issue occurred with the internal server used for your Amazon Q Business service. Wait some minutes and try again, or contact Support for help.

  • ResourceNotFoundException –

    The application or plugin resource you want to use doesn’t exist. Make sure you have provided the correct resource and try again.

  • ThrottlingException –

    The request was denied due to throttling. Reduce the number of requests and try again.

  • ValidationException –

    The input doesn't meet the constraints set by the Amazon Q Business service. Provide the correct input and try again.

  • UnknownServiceError –

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

Source code in docs_src/capo_qbusiness/_services/q_business.py
def list_documents(
    self,
    application_id: "capo_qbusiness.types.application_id.ApplicationId",
    index_id: "capo_qbusiness.types.index_id.IndexId",
    *,
    config_overrides: Optional[QBusinessClientConfig] = None,
    data_source_ids: Optional[
        "capo_qbusiness.types.data_source_ids.DataSourceIds"
    ] = None,
    next_token: Optional["capo_qbusiness.types.next_token.NextToken"] = None,
    max_results: Optional[
        "capo_qbusiness.types.max_results_integer_for_list_documents.MaxResultsIntegerForListDocuments"
    ] = None,
) -> "capo_qbusiness.types.list_documents_response.ListDocumentsResponse":
    """<p>A list of documents attached to an index.</p>

    Args:
        application_id: <p>The identifier of the application id the documents are attached to.</p>
        index_id: <p>The identifier of the index the documents are attached to.</p>
        data_source_ids: <p>The identifier of the data sources the documents are attached to.</p>
        next_token: <p>If the <code>maxResults</code> response was incomplete because there is more data to retrieve, Amazon Q Business returns a pagination token in the response. You can use this pagination token to retrieve the next set of documents.</p>
        max_results: <p>The maximum number of documents to return.</p>

    Raises:
        capo_qbusiness.errors.access_denied_exception.AccessDeniedException: <p> You don't have access to perform this action. Make sure you have the required permission policies and user accounts and try again.</p>
        capo_qbusiness.errors.internal_server_exception.InternalServerException: <p>An issue occurred with the internal server used for your Amazon Q Business service. Wait some minutes and try again, or contact <a href="http://aws.amazon.com/contact-us/">Support</a> for help.</p>
        capo_qbusiness.errors.resource_not_found_exception.ResourceNotFoundException: <p>The application or plugin resource you want to use doesn’t exist. Make sure you have provided the correct resource and try again.</p>
        capo_qbusiness.errors.throttling_exception.ThrottlingException: <p>The request was denied due to throttling. Reduce the number of requests and try again.</p>
        capo_qbusiness.errors.validation_exception.ValidationException: <p>The input doesn't meet the constraints set by the Amazon Q Business service. Provide the correct input and try again.</p>
        capo_qbusiness.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_qbusiness.types.list_documents_request.ListDocumentsRequest]",
    ) -> OperationResponse[
        "capo_qbusiness.types.list_documents_response.ListDocumentsResponse"
    ]:
        import capo_qbusiness._operations.expert_q.list_documents

        output, http_response = (
            capo_qbusiness._operations.expert_q.list_documents.list_documents(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("ListDocuments")
    )
    input_: capo_qbusiness.types.list_documents_request.ListDocumentsRequest = {
        "application_id": application_id,
        "index_id": index_id,
    }
    if data_source_ids is not None:
        input_["data_source_ids"] = data_source_ids
    if next_token is not None:
        input_["next_token"] = next_token
    if max_results is not None:
        input_["max_results"] = max_results

    response = execute_pipeline(
        OperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    response.response.close()
    return response.output