# coding: utf-8

"""
    Pinterest REST API

    Pinterest's REST API

    The version of the OpenAPI document: 5.23.0
    Contact: blah+oapicf@cliffano.com
    Generated by OpenAPI Generator (https://openapi-generator.tech)

    Do not edit the class manually.
"""  # noqa: E501

import warnings
from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt
from typing import Any, Dict, List, Optional, Tuple, Union
from typing_extensions import Annotated

from pydantic import Field
from typing import List, Optional
from typing_extensions import Annotated
from pinterestsdk.models.age_trends_bucket import AgeTrendsBucket
from pinterestsdk.models.featured_trend import FeaturedTrend
from pinterestsdk.models.gender_bucket import GenderBucket
from pinterestsdk.models.interests_enum import InterestsEnum
from pinterestsdk.models.product_categories_engagement_type import ProductCategoriesEngagementType
from pinterestsdk.models.product_category_detail_lookback_window import ProductCategoryDetailLookbackWindow
from pinterestsdk.models.product_category_details import ProductCategoryDetails
from pinterestsdk.models.product_category_enum import ProductCategoryEnum
from pinterestsdk.models.product_category_region import ProductCategoryRegion
from pinterestsdk.models.trending_product_category import TrendingProductCategory
from pinterestsdk.models.vertical_product_category import VerticalProductCategory

from pinterestsdk.api_client import ApiClient, RequestSerialized
from pinterestsdk.api_response import ApiResponse
from pinterestsdk.rest import RESTResponseType


class ProductCategoriesApi:
    """NOTE: This class is auto generated by OpenAPI Generator
    Ref: https://openapi-generator.tech

    Do not edit the class manually.
    """

    def __init__(self, api_client=None) -> None:
        if api_client is None:
            api_client = ApiClient.get_default()
        self.api_client = api_client


    @validate_call
    def trends_featured_topics_list(
        self,
        region: Annotated[ProductCategoryRegion, Field(description="      The geographic region of interest. Only top product categories within the specified region will be returned.      The `region` parameter is formatted as ISO 3166-2 country codes delimited by `+`.      - `US` - United States     - `GB+IE` - Great Britain & Ireland     - `CA` - Canada")],
        interest: Annotated[Optional[InterestsEnum], Field(description="Interest to filter by")] = None,
        _request_timeout: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)],
                Annotated[StrictFloat, Field(gt=0)]
            ]
        ] = None,
        _request_auth: Optional[Dict[StrictStr, Any]] = None,
        _content_type: Optional[StrictStr] = None,
        _headers: Optional[Dict[StrictStr, Any]] = None,
        _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
    ) -> List[FeaturedTrend]:
        """Get featured topics

          Enables advertisers to pull top five trending topics by interest and market, at full parity with the Pinterest Trends UI.

        :param region:       The geographic region of interest. Only top product categories within the specified region will be returned.      The `region` parameter is formatted as ISO 3166-2 country codes delimited by `+`.      - `US` - United States     - `GB+IE` - Great Britain & Ireland     - `CA` - Canada (required)
        :type region: ProductCategoryRegion
        :param interest: Interest to filter by
        :type interest: InterestsEnum
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        :param _request_auth: set to override the auth_settings for an a single
                              request; this effectively ignores the
                              authentication in the spec for a single request.
        :type _request_auth: dict, optional
        :param _content_type: force content-type for the request.
        :type _content_type: str, Optional
        :param _headers: set to override the headers for a single
                         request; this effectively ignores the headers
                         in the spec for a single request.
        :type _headers: dict, optional
        :param _host_index: set to override the host_index for a single
                            request; this effectively ignores the host_index
                            in the spec for a single request.
        :type _host_index: int, optional
        :return: Returns the result object.
        """ # noqa: E501

        _param = self._trends_featured_topics_list_serialize(
            region=region,
            interest=interest,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "List[FeaturedTrend]",
            '400': "PinterestLibError",
            '401': "PinterestLibError",
            '403': "PinterestLibError",
            '404': "PinterestLibError",
            '429': "PinterestLibError",
        }
        response_data = self.api_client.call_api(
            *_param,
            _request_timeout=_request_timeout
        )
        response_data.read()
        return self.api_client.response_deserialize(
            response_data=response_data,
            response_types_map=_response_types_map,
        ).data


    @validate_call
    def trends_featured_topics_list_with_http_info(
        self,
        region: Annotated[ProductCategoryRegion, Field(description="      The geographic region of interest. Only top product categories within the specified region will be returned.      The `region` parameter is formatted as ISO 3166-2 country codes delimited by `+`.      - `US` - United States     - `GB+IE` - Great Britain & Ireland     - `CA` - Canada")],
        interest: Annotated[Optional[InterestsEnum], Field(description="Interest to filter by")] = None,
        _request_timeout: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)],
                Annotated[StrictFloat, Field(gt=0)]
            ]
        ] = None,
        _request_auth: Optional[Dict[StrictStr, Any]] = None,
        _content_type: Optional[StrictStr] = None,
        _headers: Optional[Dict[StrictStr, Any]] = None,
        _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
    ) -> ApiResponse[List[FeaturedTrend]]:
        """Get featured topics

          Enables advertisers to pull top five trending topics by interest and market, at full parity with the Pinterest Trends UI.

        :param region:       The geographic region of interest. Only top product categories within the specified region will be returned.      The `region` parameter is formatted as ISO 3166-2 country codes delimited by `+`.      - `US` - United States     - `GB+IE` - Great Britain & Ireland     - `CA` - Canada (required)
        :type region: ProductCategoryRegion
        :param interest: Interest to filter by
        :type interest: InterestsEnum
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        :param _request_auth: set to override the auth_settings for an a single
                              request; this effectively ignores the
                              authentication in the spec for a single request.
        :type _request_auth: dict, optional
        :param _content_type: force content-type for the request.
        :type _content_type: str, Optional
        :param _headers: set to override the headers for a single
                         request; this effectively ignores the headers
                         in the spec for a single request.
        :type _headers: dict, optional
        :param _host_index: set to override the host_index for a single
                            request; this effectively ignores the host_index
                            in the spec for a single request.
        :type _host_index: int, optional
        :return: Returns the result object.
        """ # noqa: E501

        _param = self._trends_featured_topics_list_serialize(
            region=region,
            interest=interest,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "List[FeaturedTrend]",
            '400': "PinterestLibError",
            '401': "PinterestLibError",
            '403': "PinterestLibError",
            '404': "PinterestLibError",
            '429': "PinterestLibError",
        }
        response_data = self.api_client.call_api(
            *_param,
            _request_timeout=_request_timeout
        )
        response_data.read()
        return self.api_client.response_deserialize(
            response_data=response_data,
            response_types_map=_response_types_map,
        )


    @validate_call
    def trends_featured_topics_list_without_preload_content(
        self,
        region: Annotated[ProductCategoryRegion, Field(description="      The geographic region of interest. Only top product categories within the specified region will be returned.      The `region` parameter is formatted as ISO 3166-2 country codes delimited by `+`.      - `US` - United States     - `GB+IE` - Great Britain & Ireland     - `CA` - Canada")],
        interest: Annotated[Optional[InterestsEnum], Field(description="Interest to filter by")] = None,
        _request_timeout: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)],
                Annotated[StrictFloat, Field(gt=0)]
            ]
        ] = None,
        _request_auth: Optional[Dict[StrictStr, Any]] = None,
        _content_type: Optional[StrictStr] = None,
        _headers: Optional[Dict[StrictStr, Any]] = None,
        _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
    ) -> RESTResponseType:
        """Get featured topics

          Enables advertisers to pull top five trending topics by interest and market, at full parity with the Pinterest Trends UI.

        :param region:       The geographic region of interest. Only top product categories within the specified region will be returned.      The `region` parameter is formatted as ISO 3166-2 country codes delimited by `+`.      - `US` - United States     - `GB+IE` - Great Britain & Ireland     - `CA` - Canada (required)
        :type region: ProductCategoryRegion
        :param interest: Interest to filter by
        :type interest: InterestsEnum
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        :param _request_auth: set to override the auth_settings for an a single
                              request; this effectively ignores the
                              authentication in the spec for a single request.
        :type _request_auth: dict, optional
        :param _content_type: force content-type for the request.
        :type _content_type: str, Optional
        :param _headers: set to override the headers for a single
                         request; this effectively ignores the headers
                         in the spec for a single request.
        :type _headers: dict, optional
        :param _host_index: set to override the host_index for a single
                            request; this effectively ignores the host_index
                            in the spec for a single request.
        :type _host_index: int, optional
        :return: Returns the result object.
        """ # noqa: E501

        _param = self._trends_featured_topics_list_serialize(
            region=region,
            interest=interest,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "List[FeaturedTrend]",
            '400': "PinterestLibError",
            '401': "PinterestLibError",
            '403': "PinterestLibError",
            '404': "PinterestLibError",
            '429': "PinterestLibError",
        }
        response_data = self.api_client.call_api(
            *_param,
            _request_timeout=_request_timeout
        )
        return response_data.response


    def _trends_featured_topics_list_serialize(
        self,
        region,
        interest,
        _request_auth,
        _content_type,
        _headers,
        _host_index,
    ) -> RequestSerialized:

        _host = None

        _collection_formats: Dict[str, str] = {
        }

        _path_params: Dict[str, str] = {}
        _query_params: List[Tuple[str, str]] = []
        _header_params: Dict[str, Optional[str]] = _headers or {}
        _form_params: List[Tuple[str, str]] = []
        _files: Dict[
            str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
        ] = {}
        _body_params: Optional[bytes] = None

        # process the path parameters
        # process the query parameters
        if interest is not None:
            
            _query_params.append(('interest', interest.value))
            
        if region is not None:
            
            _query_params.append(('region', region.value))
            
        # process the header parameters
        # process the form parameters
        # process the body parameter


        # set the HTTP header `Accept`
        if 'Accept' not in _header_params:
            _header_params['Accept'] = self.api_client.select_header_accept(
                [
                    'application/json'
                ]
            )


        # authentication setting
        _auth_settings: List[str] = [
            'pinterest_oauth2', 
            'client_credentials'
        ]

        return self.api_client.param_serialize(
            method='GET',
            resource_path='/trends/topics/featured',
            path_params=_path_params,
            query_params=_query_params,
            header_params=_header_params,
            body=_body_params,
            post_params=_form_params,
            files=_files,
            auth_settings=_auth_settings,
            collection_formats=_collection_formats,
            _host=_host,
            _request_auth=_request_auth
        )




    @validate_call
    def trends_product_categories_details_list(
        self,
        product_categories: Annotated[List[ProductCategoryEnum], Field(min_length=1, max_length=20, description="List of product categories")],
        region: Annotated[ProductCategoryRegion, Field(description="      The geographic region of interest. Only top product categories within the specified region will be returned.      The `region` parameter is formatted as ISO 3166-2 country codes delimited by `+`.      - `US` - United States     - `GB+IE` - Great Britain & Ireland     - `CA` - Canada")],
        lookback_window: Annotated[Optional[ProductCategoryDetailLookbackWindow], Field(description="   Time period for historical data analysis in days. The lookback window defines how far back in time the API will analyze data to compute trend metrics.   - `90` - Last 90 days (3 months)   - `180` - Last 180 days (6 months)   - `365` - Last 365 days (1 year)   - `730` - Last 730 days (2 years)")] = None,
        engagement_type: Annotated[Optional[ProductCategoriesEngagementType], Field(description="     Type of engagement metric to analyze. - `ENGAGEMENT` - Overall engagement metric - `OUTBOUND_CLICK` - Number of outbound clicks - `SAVE` - Number of pin saves")] = None,
        _request_timeout: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)],
                Annotated[StrictFloat, Field(gt=0)]
            ]
        ] = None,
        _request_auth: Optional[Dict[StrictStr, Any]] = None,
        _content_type: Optional[StrictStr] = None,
        _headers: Optional[Dict[StrictStr, Any]] = None,
        _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
    ) -> List[ProductCategoryDetails]:
        """Get product category details

          Enables advertisers to retrieve demographic information, related pins, and trend lines for specified product categories

        :param product_categories: List of product categories (required)
        :type product_categories: List[ProductCategoryEnum]
        :param region:       The geographic region of interest. Only top product categories within the specified region will be returned.      The `region` parameter is formatted as ISO 3166-2 country codes delimited by `+`.      - `US` - United States     - `GB+IE` - Great Britain & Ireland     - `CA` - Canada (required)
        :type region: ProductCategoryRegion
        :param lookback_window:    Time period for historical data analysis in days. The lookback window defines how far back in time the API will analyze data to compute trend metrics.   - `90` - Last 90 days (3 months)   - `180` - Last 180 days (6 months)   - `365` - Last 365 days (1 year)   - `730` - Last 730 days (2 years)
        :type lookback_window: ProductCategoryDetailLookbackWindow
        :param engagement_type:      Type of engagement metric to analyze. - `ENGAGEMENT` - Overall engagement metric - `OUTBOUND_CLICK` - Number of outbound clicks - `SAVE` - Number of pin saves
        :type engagement_type: ProductCategoriesEngagementType
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        :param _request_auth: set to override the auth_settings for an a single
                              request; this effectively ignores the
                              authentication in the spec for a single request.
        :type _request_auth: dict, optional
        :param _content_type: force content-type for the request.
        :type _content_type: str, Optional
        :param _headers: set to override the headers for a single
                         request; this effectively ignores the headers
                         in the spec for a single request.
        :type _headers: dict, optional
        :param _host_index: set to override the host_index for a single
                            request; this effectively ignores the host_index
                            in the spec for a single request.
        :type _host_index: int, optional
        :return: Returns the result object.
        """ # noqa: E501

        _param = self._trends_product_categories_details_list_serialize(
            product_categories=product_categories,
            region=region,
            lookback_window=lookback_window,
            engagement_type=engagement_type,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "List[ProductCategoryDetails]",
            '400': "PinterestLibError",
            '401': "PinterestLibError",
            '403': "PinterestLibError",
            '404': "PinterestLibError",
            '429': "PinterestLibError",
        }
        response_data = self.api_client.call_api(
            *_param,
            _request_timeout=_request_timeout
        )
        response_data.read()
        return self.api_client.response_deserialize(
            response_data=response_data,
            response_types_map=_response_types_map,
        ).data


    @validate_call
    def trends_product_categories_details_list_with_http_info(
        self,
        product_categories: Annotated[List[ProductCategoryEnum], Field(min_length=1, max_length=20, description="List of product categories")],
        region: Annotated[ProductCategoryRegion, Field(description="      The geographic region of interest. Only top product categories within the specified region will be returned.      The `region` parameter is formatted as ISO 3166-2 country codes delimited by `+`.      - `US` - United States     - `GB+IE` - Great Britain & Ireland     - `CA` - Canada")],
        lookback_window: Annotated[Optional[ProductCategoryDetailLookbackWindow], Field(description="   Time period for historical data analysis in days. The lookback window defines how far back in time the API will analyze data to compute trend metrics.   - `90` - Last 90 days (3 months)   - `180` - Last 180 days (6 months)   - `365` - Last 365 days (1 year)   - `730` - Last 730 days (2 years)")] = None,
        engagement_type: Annotated[Optional[ProductCategoriesEngagementType], Field(description="     Type of engagement metric to analyze. - `ENGAGEMENT` - Overall engagement metric - `OUTBOUND_CLICK` - Number of outbound clicks - `SAVE` - Number of pin saves")] = None,
        _request_timeout: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)],
                Annotated[StrictFloat, Field(gt=0)]
            ]
        ] = None,
        _request_auth: Optional[Dict[StrictStr, Any]] = None,
        _content_type: Optional[StrictStr] = None,
        _headers: Optional[Dict[StrictStr, Any]] = None,
        _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
    ) -> ApiResponse[List[ProductCategoryDetails]]:
        """Get product category details

          Enables advertisers to retrieve demographic information, related pins, and trend lines for specified product categories

        :param product_categories: List of product categories (required)
        :type product_categories: List[ProductCategoryEnum]
        :param region:       The geographic region of interest. Only top product categories within the specified region will be returned.      The `region` parameter is formatted as ISO 3166-2 country codes delimited by `+`.      - `US` - United States     - `GB+IE` - Great Britain & Ireland     - `CA` - Canada (required)
        :type region: ProductCategoryRegion
        :param lookback_window:    Time period for historical data analysis in days. The lookback window defines how far back in time the API will analyze data to compute trend metrics.   - `90` - Last 90 days (3 months)   - `180` - Last 180 days (6 months)   - `365` - Last 365 days (1 year)   - `730` - Last 730 days (2 years)
        :type lookback_window: ProductCategoryDetailLookbackWindow
        :param engagement_type:      Type of engagement metric to analyze. - `ENGAGEMENT` - Overall engagement metric - `OUTBOUND_CLICK` - Number of outbound clicks - `SAVE` - Number of pin saves
        :type engagement_type: ProductCategoriesEngagementType
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        :param _request_auth: set to override the auth_settings for an a single
                              request; this effectively ignores the
                              authentication in the spec for a single request.
        :type _request_auth: dict, optional
        :param _content_type: force content-type for the request.
        :type _content_type: str, Optional
        :param _headers: set to override the headers for a single
                         request; this effectively ignores the headers
                         in the spec for a single request.
        :type _headers: dict, optional
        :param _host_index: set to override the host_index for a single
                            request; this effectively ignores the host_index
                            in the spec for a single request.
        :type _host_index: int, optional
        :return: Returns the result object.
        """ # noqa: E501

        _param = self._trends_product_categories_details_list_serialize(
            product_categories=product_categories,
            region=region,
            lookback_window=lookback_window,
            engagement_type=engagement_type,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "List[ProductCategoryDetails]",
            '400': "PinterestLibError",
            '401': "PinterestLibError",
            '403': "PinterestLibError",
            '404': "PinterestLibError",
            '429': "PinterestLibError",
        }
        response_data = self.api_client.call_api(
            *_param,
            _request_timeout=_request_timeout
        )
        response_data.read()
        return self.api_client.response_deserialize(
            response_data=response_data,
            response_types_map=_response_types_map,
        )


    @validate_call
    def trends_product_categories_details_list_without_preload_content(
        self,
        product_categories: Annotated[List[ProductCategoryEnum], Field(min_length=1, max_length=20, description="List of product categories")],
        region: Annotated[ProductCategoryRegion, Field(description="      The geographic region of interest. Only top product categories within the specified region will be returned.      The `region` parameter is formatted as ISO 3166-2 country codes delimited by `+`.      - `US` - United States     - `GB+IE` - Great Britain & Ireland     - `CA` - Canada")],
        lookback_window: Annotated[Optional[ProductCategoryDetailLookbackWindow], Field(description="   Time period for historical data analysis in days. The lookback window defines how far back in time the API will analyze data to compute trend metrics.   - `90` - Last 90 days (3 months)   - `180` - Last 180 days (6 months)   - `365` - Last 365 days (1 year)   - `730` - Last 730 days (2 years)")] = None,
        engagement_type: Annotated[Optional[ProductCategoriesEngagementType], Field(description="     Type of engagement metric to analyze. - `ENGAGEMENT` - Overall engagement metric - `OUTBOUND_CLICK` - Number of outbound clicks - `SAVE` - Number of pin saves")] = None,
        _request_timeout: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)],
                Annotated[StrictFloat, Field(gt=0)]
            ]
        ] = None,
        _request_auth: Optional[Dict[StrictStr, Any]] = None,
        _content_type: Optional[StrictStr] = None,
        _headers: Optional[Dict[StrictStr, Any]] = None,
        _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
    ) -> RESTResponseType:
        """Get product category details

          Enables advertisers to retrieve demographic information, related pins, and trend lines for specified product categories

        :param product_categories: List of product categories (required)
        :type product_categories: List[ProductCategoryEnum]
        :param region:       The geographic region of interest. Only top product categories within the specified region will be returned.      The `region` parameter is formatted as ISO 3166-2 country codes delimited by `+`.      - `US` - United States     - `GB+IE` - Great Britain & Ireland     - `CA` - Canada (required)
        :type region: ProductCategoryRegion
        :param lookback_window:    Time period for historical data analysis in days. The lookback window defines how far back in time the API will analyze data to compute trend metrics.   - `90` - Last 90 days (3 months)   - `180` - Last 180 days (6 months)   - `365` - Last 365 days (1 year)   - `730` - Last 730 days (2 years)
        :type lookback_window: ProductCategoryDetailLookbackWindow
        :param engagement_type:      Type of engagement metric to analyze. - `ENGAGEMENT` - Overall engagement metric - `OUTBOUND_CLICK` - Number of outbound clicks - `SAVE` - Number of pin saves
        :type engagement_type: ProductCategoriesEngagementType
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        :param _request_auth: set to override the auth_settings for an a single
                              request; this effectively ignores the
                              authentication in the spec for a single request.
        :type _request_auth: dict, optional
        :param _content_type: force content-type for the request.
        :type _content_type: str, Optional
        :param _headers: set to override the headers for a single
                         request; this effectively ignores the headers
                         in the spec for a single request.
        :type _headers: dict, optional
        :param _host_index: set to override the host_index for a single
                            request; this effectively ignores the host_index
                            in the spec for a single request.
        :type _host_index: int, optional
        :return: Returns the result object.
        """ # noqa: E501

        _param = self._trends_product_categories_details_list_serialize(
            product_categories=product_categories,
            region=region,
            lookback_window=lookback_window,
            engagement_type=engagement_type,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "List[ProductCategoryDetails]",
            '400': "PinterestLibError",
            '401': "PinterestLibError",
            '403': "PinterestLibError",
            '404': "PinterestLibError",
            '429': "PinterestLibError",
        }
        response_data = self.api_client.call_api(
            *_param,
            _request_timeout=_request_timeout
        )
        return response_data.response


    def _trends_product_categories_details_list_serialize(
        self,
        product_categories,
        region,
        lookback_window,
        engagement_type,
        _request_auth,
        _content_type,
        _headers,
        _host_index,
    ) -> RequestSerialized:

        _host = None

        _collection_formats: Dict[str, str] = {
            'product_categories': 'multi',
        }

        _path_params: Dict[str, str] = {}
        _query_params: List[Tuple[str, str]] = []
        _header_params: Dict[str, Optional[str]] = _headers or {}
        _form_params: List[Tuple[str, str]] = []
        _files: Dict[
            str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
        ] = {}
        _body_params: Optional[bytes] = None

        # process the path parameters
        # process the query parameters
        if product_categories is not None:
            
            _query_params.append(('product_categories', product_categories))
            
        if region is not None:
            
            _query_params.append(('region', region.value))
            
        if lookback_window is not None:
            
            _query_params.append(('lookback_window', lookback_window.value))
            
        if engagement_type is not None:
            
            _query_params.append(('engagement_type', engagement_type.value))
            
        # process the header parameters
        # process the form parameters
        # process the body parameter


        # set the HTTP header `Accept`
        if 'Accept' not in _header_params:
            _header_params['Accept'] = self.api_client.select_header_accept(
                [
                    'application/json'
                ]
            )


        # authentication setting
        _auth_settings: List[str] = [
            'pinterest_oauth2', 
            'client_credentials'
        ]

        return self.api_client.param_serialize(
            method='GET',
            resource_path='/trends/product_categories/details',
            path_params=_path_params,
            query_params=_query_params,
            header_params=_header_params,
            body=_body_params,
            post_params=_form_params,
            files=_files,
            auth_settings=_auth_settings,
            collection_formats=_collection_formats,
            _host=_host,
            _request_auth=_request_auth
        )




    @validate_call
    def trends_product_categories_trending_list(
        self,
        region: Annotated[ProductCategoryRegion, Field(description="      The geographic region of interest. Only top product categories within the specified region will be returned.      The `region` parameter is formatted as ISO 3166-2 country codes delimited by `+`.      - `US` - United States     - `GB+IE` - Great Britain & Ireland     - `CA` - Canada")],
        verticals: Annotated[Optional[List[VerticalProductCategory]], Field(description="List of verticals to filter by")] = None,
        ages: Annotated[Optional[List[AgeTrendsBucket]], Field(description="Age to filter by. If not provided, the results will be filtered by all ages.")] = None,
        genders: Annotated[Optional[List[GenderBucket]], Field(description="Gender to filter by, If not provided, the results will be filtered by all genders.")] = None,
        engagement_type: Annotated[Optional[ProductCategoriesEngagementType], Field(description="     Type of engagement metric to analyze. - `ENGAGEMENT` - Overall engagement metric - `OUTBOUND_CLICK` - Number of outbound clicks - `SAVE` - Number of pin saves")] = None,
        _request_timeout: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)],
                Annotated[StrictFloat, Field(gt=0)]
            ]
        ] = None,
        _request_auth: Optional[Dict[StrictStr, Any]] = None,
        _content_type: Optional[StrictStr] = None,
        _headers: Optional[Dict[StrictStr, Any]] = None,
        _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
    ) -> List[TrendingProductCategory]:
        """Get a list of growing Shopping Product Categories

          Get a list of growing Shopping Product Categories in ranked order allowing filtering by engagement type, vertical, age, and gender.

        :param region:       The geographic region of interest. Only top product categories within the specified region will be returned.      The `region` parameter is formatted as ISO 3166-2 country codes delimited by `+`.      - `US` - United States     - `GB+IE` - Great Britain & Ireland     - `CA` - Canada (required)
        :type region: ProductCategoryRegion
        :param verticals: List of verticals to filter by
        :type verticals: List[VerticalProductCategory]
        :param ages: Age to filter by. If not provided, the results will be filtered by all ages.
        :type ages: List[AgeTrendsBucket]
        :param genders: Gender to filter by, If not provided, the results will be filtered by all genders.
        :type genders: List[GenderBucket]
        :param engagement_type:      Type of engagement metric to analyze. - `ENGAGEMENT` - Overall engagement metric - `OUTBOUND_CLICK` - Number of outbound clicks - `SAVE` - Number of pin saves
        :type engagement_type: ProductCategoriesEngagementType
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        :param _request_auth: set to override the auth_settings for an a single
                              request; this effectively ignores the
                              authentication in the spec for a single request.
        :type _request_auth: dict, optional
        :param _content_type: force content-type for the request.
        :type _content_type: str, Optional
        :param _headers: set to override the headers for a single
                         request; this effectively ignores the headers
                         in the spec for a single request.
        :type _headers: dict, optional
        :param _host_index: set to override the host_index for a single
                            request; this effectively ignores the host_index
                            in the spec for a single request.
        :type _host_index: int, optional
        :return: Returns the result object.
        """ # noqa: E501

        _param = self._trends_product_categories_trending_list_serialize(
            region=region,
            verticals=verticals,
            ages=ages,
            genders=genders,
            engagement_type=engagement_type,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "List[TrendingProductCategory]",
            '400': "PinterestLibError",
            '401': "PinterestLibError",
            '403': "PinterestLibError",
            '404': "PinterestLibError",
            '429': "PinterestLibError",
        }
        response_data = self.api_client.call_api(
            *_param,
            _request_timeout=_request_timeout
        )
        response_data.read()
        return self.api_client.response_deserialize(
            response_data=response_data,
            response_types_map=_response_types_map,
        ).data


    @validate_call
    def trends_product_categories_trending_list_with_http_info(
        self,
        region: Annotated[ProductCategoryRegion, Field(description="      The geographic region of interest. Only top product categories within the specified region will be returned.      The `region` parameter is formatted as ISO 3166-2 country codes delimited by `+`.      - `US` - United States     - `GB+IE` - Great Britain & Ireland     - `CA` - Canada")],
        verticals: Annotated[Optional[List[VerticalProductCategory]], Field(description="List of verticals to filter by")] = None,
        ages: Annotated[Optional[List[AgeTrendsBucket]], Field(description="Age to filter by. If not provided, the results will be filtered by all ages.")] = None,
        genders: Annotated[Optional[List[GenderBucket]], Field(description="Gender to filter by, If not provided, the results will be filtered by all genders.")] = None,
        engagement_type: Annotated[Optional[ProductCategoriesEngagementType], Field(description="     Type of engagement metric to analyze. - `ENGAGEMENT` - Overall engagement metric - `OUTBOUND_CLICK` - Number of outbound clicks - `SAVE` - Number of pin saves")] = None,
        _request_timeout: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)],
                Annotated[StrictFloat, Field(gt=0)]
            ]
        ] = None,
        _request_auth: Optional[Dict[StrictStr, Any]] = None,
        _content_type: Optional[StrictStr] = None,
        _headers: Optional[Dict[StrictStr, Any]] = None,
        _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
    ) -> ApiResponse[List[TrendingProductCategory]]:
        """Get a list of growing Shopping Product Categories

          Get a list of growing Shopping Product Categories in ranked order allowing filtering by engagement type, vertical, age, and gender.

        :param region:       The geographic region of interest. Only top product categories within the specified region will be returned.      The `region` parameter is formatted as ISO 3166-2 country codes delimited by `+`.      - `US` - United States     - `GB+IE` - Great Britain & Ireland     - `CA` - Canada (required)
        :type region: ProductCategoryRegion
        :param verticals: List of verticals to filter by
        :type verticals: List[VerticalProductCategory]
        :param ages: Age to filter by. If not provided, the results will be filtered by all ages.
        :type ages: List[AgeTrendsBucket]
        :param genders: Gender to filter by, If not provided, the results will be filtered by all genders.
        :type genders: List[GenderBucket]
        :param engagement_type:      Type of engagement metric to analyze. - `ENGAGEMENT` - Overall engagement metric - `OUTBOUND_CLICK` - Number of outbound clicks - `SAVE` - Number of pin saves
        :type engagement_type: ProductCategoriesEngagementType
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        :param _request_auth: set to override the auth_settings for an a single
                              request; this effectively ignores the
                              authentication in the spec for a single request.
        :type _request_auth: dict, optional
        :param _content_type: force content-type for the request.
        :type _content_type: str, Optional
        :param _headers: set to override the headers for a single
                         request; this effectively ignores the headers
                         in the spec for a single request.
        :type _headers: dict, optional
        :param _host_index: set to override the host_index for a single
                            request; this effectively ignores the host_index
                            in the spec for a single request.
        :type _host_index: int, optional
        :return: Returns the result object.
        """ # noqa: E501

        _param = self._trends_product_categories_trending_list_serialize(
            region=region,
            verticals=verticals,
            ages=ages,
            genders=genders,
            engagement_type=engagement_type,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "List[TrendingProductCategory]",
            '400': "PinterestLibError",
            '401': "PinterestLibError",
            '403': "PinterestLibError",
            '404': "PinterestLibError",
            '429': "PinterestLibError",
        }
        response_data = self.api_client.call_api(
            *_param,
            _request_timeout=_request_timeout
        )
        response_data.read()
        return self.api_client.response_deserialize(
            response_data=response_data,
            response_types_map=_response_types_map,
        )


    @validate_call
    def trends_product_categories_trending_list_without_preload_content(
        self,
        region: Annotated[ProductCategoryRegion, Field(description="      The geographic region of interest. Only top product categories within the specified region will be returned.      The `region` parameter is formatted as ISO 3166-2 country codes delimited by `+`.      - `US` - United States     - `GB+IE` - Great Britain & Ireland     - `CA` - Canada")],
        verticals: Annotated[Optional[List[VerticalProductCategory]], Field(description="List of verticals to filter by")] = None,
        ages: Annotated[Optional[List[AgeTrendsBucket]], Field(description="Age to filter by. If not provided, the results will be filtered by all ages.")] = None,
        genders: Annotated[Optional[List[GenderBucket]], Field(description="Gender to filter by, If not provided, the results will be filtered by all genders.")] = None,
        engagement_type: Annotated[Optional[ProductCategoriesEngagementType], Field(description="     Type of engagement metric to analyze. - `ENGAGEMENT` - Overall engagement metric - `OUTBOUND_CLICK` - Number of outbound clicks - `SAVE` - Number of pin saves")] = None,
        _request_timeout: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)],
                Annotated[StrictFloat, Field(gt=0)]
            ]
        ] = None,
        _request_auth: Optional[Dict[StrictStr, Any]] = None,
        _content_type: Optional[StrictStr] = None,
        _headers: Optional[Dict[StrictStr, Any]] = None,
        _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
    ) -> RESTResponseType:
        """Get a list of growing Shopping Product Categories

          Get a list of growing Shopping Product Categories in ranked order allowing filtering by engagement type, vertical, age, and gender.

        :param region:       The geographic region of interest. Only top product categories within the specified region will be returned.      The `region` parameter is formatted as ISO 3166-2 country codes delimited by `+`.      - `US` - United States     - `GB+IE` - Great Britain & Ireland     - `CA` - Canada (required)
        :type region: ProductCategoryRegion
        :param verticals: List of verticals to filter by
        :type verticals: List[VerticalProductCategory]
        :param ages: Age to filter by. If not provided, the results will be filtered by all ages.
        :type ages: List[AgeTrendsBucket]
        :param genders: Gender to filter by, If not provided, the results will be filtered by all genders.
        :type genders: List[GenderBucket]
        :param engagement_type:      Type of engagement metric to analyze. - `ENGAGEMENT` - Overall engagement metric - `OUTBOUND_CLICK` - Number of outbound clicks - `SAVE` - Number of pin saves
        :type engagement_type: ProductCategoriesEngagementType
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        :param _request_auth: set to override the auth_settings for an a single
                              request; this effectively ignores the
                              authentication in the spec for a single request.
        :type _request_auth: dict, optional
        :param _content_type: force content-type for the request.
        :type _content_type: str, Optional
        :param _headers: set to override the headers for a single
                         request; this effectively ignores the headers
                         in the spec for a single request.
        :type _headers: dict, optional
        :param _host_index: set to override the host_index for a single
                            request; this effectively ignores the host_index
                            in the spec for a single request.
        :type _host_index: int, optional
        :return: Returns the result object.
        """ # noqa: E501

        _param = self._trends_product_categories_trending_list_serialize(
            region=region,
            verticals=verticals,
            ages=ages,
            genders=genders,
            engagement_type=engagement_type,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "List[TrendingProductCategory]",
            '400': "PinterestLibError",
            '401': "PinterestLibError",
            '403': "PinterestLibError",
            '404': "PinterestLibError",
            '429': "PinterestLibError",
        }
        response_data = self.api_client.call_api(
            *_param,
            _request_timeout=_request_timeout
        )
        return response_data.response


    def _trends_product_categories_trending_list_serialize(
        self,
        region,
        verticals,
        ages,
        genders,
        engagement_type,
        _request_auth,
        _content_type,
        _headers,
        _host_index,
    ) -> RequestSerialized:

        _host = None

        _collection_formats: Dict[str, str] = {
            'verticals': 'multi',
            'ages': 'multi',
            'genders': 'multi',
        }

        _path_params: Dict[str, str] = {}
        _query_params: List[Tuple[str, str]] = []
        _header_params: Dict[str, Optional[str]] = _headers or {}
        _form_params: List[Tuple[str, str]] = []
        _files: Dict[
            str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
        ] = {}
        _body_params: Optional[bytes] = None

        # process the path parameters
        # process the query parameters
        if region is not None:
            
            _query_params.append(('region', region.value))
            
        if verticals is not None:
            
            _query_params.append(('verticals', verticals))
            
        if ages is not None:
            
            _query_params.append(('ages', ages))
            
        if genders is not None:
            
            _query_params.append(('genders', genders))
            
        if engagement_type is not None:
            
            _query_params.append(('engagement_type', engagement_type.value))
            
        # process the header parameters
        # process the form parameters
        # process the body parameter


        # set the HTTP header `Accept`
        if 'Accept' not in _header_params:
            _header_params['Accept'] = self.api_client.select_header_accept(
                [
                    'application/json'
                ]
            )


        # authentication setting
        _auth_settings: List[str] = [
            'pinterest_oauth2', 
            'client_credentials'
        ]

        return self.api_client.param_serialize(
            method='GET',
            resource_path='/trends/product_categories/trending',
            path_params=_path_params,
            query_params=_query_params,
            header_params=_header_params,
            body=_body_params,
            post_params=_form_params,
            files=_files,
            auth_settings=_auth_settings,
            collection_formats=_collection_formats,
            _host=_host,
            _request_auth=_request_auth
        )


