Skip to content

list_purchase_options

list_purchase_options(
    *,
    config_overrides: Optional[MarketplaceDiscoveryClientConfig] = None,
    locale: Optional[Locale] = None,
    filters: Optional[PurchaseOptionFilterList] = None,
    max_results: Optional[MaxResults] = None,
    next_token: Optional[NextToken] = None,
) -> ListPurchaseOptionsOutput

Retrieves the purchase options (offers and offer sets) available to you. You can filter results by product, seller, purchase option type, visibility scope, and availability status. The operation returns results in pages. Use nextToken to retrieve the next page.

You must include at least one of the following filters in the request: a PRODUCT_ID filter to specify the product for which to retrieve purchase options, or a VISIBILITY_SCOPE filter to retrieve purchase options by visibility.

Parameters:

  • locale (Optional[Locale], default: None ) –

    The preferred locale for response content, as a Best Current Practice 47 (BCP 47) language tag or a comma-separated priority list of language tags. See Locale for supported values, constraints, fallback behavior, and the default locale. If you omit this field, the service returns content in the default locale.

  • filters (Optional[PurchaseOptionFilterList], default: None ) –

    Filters to narrow the results. A result must match every filter. Within one filter, a result matches if it has any of the values.

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

    The maximum number of purchase options to return in each call. If you omit this field, the default is 25. Use nextToken to retrieve the next page.

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

    If the service returns nextToken, more results are available. The value of nextToken is a unique pagination token for each page. Make the call again with the returned token to retrieve the next page. Keep all other arguments unchanged. Each pagination token expires after 24 hours. An expired pagination token returns a ValidationException.

Raises:

  • AccessDeniedException –

    You don't have sufficient access to perform this action. Verify that you have the required permissions.

  • InternalServerException –

    Unexpected error during processing of the request.

  • ThrottlingException –

    The request was denied due to request throttling. Reduce the frequency of your requests and retry.

  • ValidationException –

    The input fails to satisfy the constraints specified by the service. Check the reason field for the constraint that failed.

  • UnknownServiceError –

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

Examples:

Filter by Product ID

>>> client.list_purchase_options(locale='en-US', filters=[{'filterType': 'PRODUCT_ID', 'filterValues': ['prod-sampleOfferId']}])
Filter by Seller with Private Offerset
>>> client.list_purchase_options(locale='en-US', filters=[{'filterType': 'SELLER_OF_RECORD_PROFILE_ID', 'filterValues': ['seller-sampleResellerId']}, {'filterType': 'PURCHASE_OPTION_TYPE', 'filterValues': ['OFFERSET']}, {'filterType': 'VISIBILITY_SCOPE', 'filterValues': ['PRIVATE']}])
Source code in docs_src/capo_marketplace_discovery/_services/marketplace_discovery.py
def list_purchase_options(
    self,
    *,
    config_overrides: Optional[MarketplaceDiscoveryClientConfig] = None,
    locale: Optional["capo_marketplace_discovery.types.locale.Locale"] = None,
    filters: Optional[
        "capo_marketplace_discovery.types.purchase_option_filter_list.PurchaseOptionFilterList"
    ] = None,
    max_results: Optional[
        "capo_marketplace_discovery.types.max_results.MaxResults"
    ] = None,
    next_token: Optional[
        "capo_marketplace_discovery.types.next_token.NextToken"
    ] = None,
) -> "capo_marketplace_discovery.types.list_purchase_options_output.ListPurchaseOptionsOutput":
    """<p>Retrieves the purchase options (offers and offer sets) available to you. You can filter results by product, seller, purchase option type, visibility scope, and availability status. The operation returns results in pages. Use <code>nextToken</code> to retrieve the next page.</p> <note> <p>You must include at least one of the following filters in the request: a <code>PRODUCT_ID</code> filter to specify the product for which to retrieve purchase options, or a <code>VISIBILITY_SCOPE</code> filter to retrieve purchase options by visibility.</p> </note>

    Args:
        locale: <p>The preferred locale for response content, as a Best Current Practice 47 (BCP 47) language tag or a comma-separated priority list of language tags. See <code>Locale</code> for supported values, constraints, fallback behavior, and the default locale. If you omit this field, the service returns content in the default locale.</p>
        filters: <p>Filters to narrow the results. A result must match every filter. Within one filter, a result matches if it has any of the values.</p>
        max_results: <p>The maximum number of purchase options to return in each call. If you omit this field, the default is 25. Use <code>nextToken</code> to retrieve the next page.</p>
        next_token: <p>If the service returns <code>nextToken</code>, more results are available. The value of <code>nextToken</code> is a unique pagination token for each page. Make the call again with the returned token to retrieve the next page. Keep all other arguments unchanged. Each pagination token expires after 24 hours. An expired pagination token returns a <code>ValidationException</code>.</p>

    Raises:
        capo_marketplace_discovery.errors.access_denied_exception.AccessDeniedException: <p>You don't have sufficient access to perform this action. Verify that you have the required permissions.</p>
        capo_marketplace_discovery.errors.internal_server_exception.InternalServerException: <p>Unexpected error during processing of the request.</p>
        capo_marketplace_discovery.errors.throttling_exception.ThrottlingException: <p>The request was denied due to request throttling. Reduce the frequency of your requests and retry.</p>
        capo_marketplace_discovery.errors.validation_exception.ValidationException: <p>The input fails to satisfy the constraints specified by the service. Check the <code>reason</code> field for the constraint that failed.</p>
        capo_marketplace_discovery.errors.UnknownServiceError: The service returned an error code this client does not model.

    Examples:
        Filter by Product ID

        >>> client.list_purchase_options(locale='en-US', filters=[{'filterType': 'PRODUCT_ID', 'filterValues': ['prod-sampleOfferId']}])
        Filter by Seller with Private Offerset

        >>> client.list_purchase_options(locale='en-US', filters=[{'filterType': 'SELLER_OF_RECORD_PROFILE_ID', 'filterValues': ['seller-sampleResellerId']}, {'filterType': 'PURCHASE_OPTION_TYPE', 'filterValues': ['OFFERSET']}, {'filterType': 'VISIBILITY_SCOPE', 'filterValues': ['PRIVATE']}])
    """

    def _handler(
        req: "OperationRequest[capo_marketplace_discovery.types.list_purchase_options_input.ListPurchaseOptionsInput]",
    ) -> OperationResponse[
        "capo_marketplace_discovery.types.list_purchase_options_output.ListPurchaseOptionsOutput"
    ]:
        import capo_marketplace_discovery._operations.aws_marketplace_discovery.list_purchase_options

        output, http_response = (
            capo_marketplace_discovery._operations.aws_marketplace_discovery.list_purchase_options.list_purchase_options(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("ListPurchaseOptions")
    )
    input_: capo_marketplace_discovery.types.list_purchase_options_input.ListPurchaseOptionsInput = {}
    if locale is not None:
        input_["locale"] = locale
    if filters is not None:
        input_["filters"] = filters
    if max_results is not None:
        input_["max_results"] = max_results
    if next_token is not None:
        input_["next_token"] = next_token

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