Skip to content

list_event_predictions

list_event_predictions(
    *,
    config_overrides: Optional[FraudDetectorClientConfig] = None,
    event_id: Optional[FilterCondition] = None,
    event_type: Optional[FilterCondition] = None,
    detector_id: Optional[FilterCondition] = None,
    detector_version_id: Optional[FilterCondition] = None,
    prediction_time_range: Optional[PredictionTimeRange] = None,
    next_token: Optional[string] = None,
    max_results: Optional[EventPredictionsMaxResults] = None,
) -> ListEventPredictionsResult

Gets a list of past predictions. The list can be filtered by detector ID, detector version ID, event ID, event type, or by specifying a time period. If filter is not specified, the most recent prediction is returned.

For example, the following filter lists all past predictions for xyz event type - { "eventType":{ "value": "xyz" }” }

This is a paginated API. If you provide a null maxResults, this action will retrieve a maximum of 10 records per page. If you provide a maxResults, the value must be between 50 and 100. To get the next page results, provide the nextToken from the response as part of your request. A null nextToken fetches the records from the beginning.

Parameters:

  • event_id (Optional[FilterCondition], default: None ) –

    The event ID.

  • event_type (Optional[FilterCondition], default: None ) –

    The event type associated with the detector.

  • detector_id (Optional[FilterCondition], default: None ) –

    The detector ID.

  • detector_version_id (Optional[FilterCondition], default: None ) –

    The detector version ID.

  • prediction_time_range (Optional[PredictionTimeRange], default: None ) –

    The time period for when the predictions were generated.

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

    Identifies the next page of results to return. Use the token to make the call again to retrieve the next page. Keep all other arguments unchanged. Each pagination token expires after 24 hours.

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

    The maximum number of predictions to return for the request.

Raises:

  • AccessDeniedException –

    An exception indicating Amazon Fraud Detector does not have the needed permissions. This can occur if you submit a request, such as PutExternalModel, that specifies a role that is not in your account.

  • InternalServerException –

    An exception indicating an internal server error.

  • ThrottlingException –

    An exception indicating a throttling error.

  • ValidationException –

    An exception indicating a specified value is not allowed.

  • UnknownServiceError –

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

Source code in docs_src/capo_frauddetector/_services/fraud_detector.py
def list_event_predictions(
    self,
    *,
    config_overrides: Optional[FraudDetectorClientConfig] = None,
    event_id: Optional[
        "capo_frauddetector.types.filter_condition.FilterCondition"
    ] = None,
    event_type: Optional[
        "capo_frauddetector.types.filter_condition.FilterCondition"
    ] = None,
    detector_id: Optional[
        "capo_frauddetector.types.filter_condition.FilterCondition"
    ] = None,
    detector_version_id: Optional[
        "capo_frauddetector.types.filter_condition.FilterCondition"
    ] = None,
    prediction_time_range: Optional[
        "capo_frauddetector.types.prediction_time_range.PredictionTimeRange"
    ] = None,
    next_token: Optional["capo_frauddetector.types.string.string"] = None,
    max_results: Optional[
        "capo_frauddetector.types.event_predictions_max_results.EventPredictionsMaxResults"
    ] = None,
) -> "capo_frauddetector.types.list_event_predictions_result.ListEventPredictionsResult":
    """<p>Gets a list of past predictions. The list can be filtered by detector ID, detector version ID, event ID, event type, or by specifying a time period. If filter is not specified, the most recent prediction is returned.</p> <p>For example, the following filter lists all past predictions for <code>xyz</code> event type - <code>{ "eventType":{ "value": "xyz" }” } </code> </p> <p>This is a paginated API. If you provide a null <code>maxResults</code>, this action will retrieve a maximum of 10 records per page. If you provide a <code>maxResults</code>, the value must be between 50 and 100. To get the next page results, provide the <code>nextToken</code> from the response as part of your request. A null <code>nextToken</code> fetches the records from the beginning. </p>

    Args:
        event_id: <p> The event ID. </p>
        event_type: <p> The event type associated with the detector. </p>
        detector_id: <p> The detector ID. </p>
        detector_version_id: <p> The detector version ID. </p>
        prediction_time_range: <p> The time period for when the predictions were generated. </p>
        next_token: <p> Identifies the next page of results to return. Use the token to make the call again to retrieve the next page. Keep all other arguments unchanged. Each pagination token expires after 24 hours. </p>
        max_results: <p> The maximum number of predictions to return for the request. </p>

    Raises:
        capo_frauddetector.errors.access_denied_exception.AccessDeniedException: <p>An exception indicating Amazon Fraud Detector does not have the needed permissions. This can occur if you submit a request, such as <code>PutExternalModel</code>, that specifies a role that is not in your account.</p>
        capo_frauddetector.errors.internal_server_exception.InternalServerException: <p>An exception indicating an internal server error.</p>
        capo_frauddetector.errors.throttling_exception.ThrottlingException: <p>An exception indicating a throttling error.</p>
        capo_frauddetector.errors.validation_exception.ValidationException: <p>An exception indicating a specified value is not allowed.</p>
        capo_frauddetector.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_frauddetector.types.list_event_predictions_request.ListEventPredictionsRequest]",
    ) -> OperationResponse[
        "capo_frauddetector.types.list_event_predictions_result.ListEventPredictionsResult"
    ]:
        import capo_frauddetector._operations.aws_hawks_nest_service_facade.list_event_predictions

        output, http_response = (
            capo_frauddetector._operations.aws_hawks_nest_service_facade.list_event_predictions.list_event_predictions(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("ListEventPredictions")
    )
    input_: capo_frauddetector.types.list_event_predictions_request.ListEventPredictionsRequest = {}
    if event_id is not None:
        input_["event_id"] = event_id
    if event_type is not None:
        input_["event_type"] = event_type
    if detector_id is not None:
        input_["detector_id"] = detector_id
    if detector_version_id is not None:
        input_["detector_version_id"] = detector_version_id
    if prediction_time_range is not None:
        input_["prediction_time_range"] = prediction_time_range
    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