# coding: utf-8

"""
    PAY.JP API v2

    No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)

    The version of the OpenAPI document: 2.0.0
    Contact: support@pay.jp
    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, StrictStr
from typing import Optional
from typing_extensions import Annotated
from payjpv2.models.product_create_request import ProductCreateRequest
from payjpv2.models.product_deleted_response import ProductDeletedResponse
from payjpv2.models.product_details_response import ProductDetailsResponse
from payjpv2.models.product_list_response import ProductListResponse
from payjpv2.models.product_update_request import ProductUpdateRequest

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


class ProductsApi:
    """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 create_product(
        self,
        product_create_request: ProductCreateRequest,
        *,
        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,
        headers: Optional[Dict[StrictStr, Any]] = None,
        idempotency_key: Optional[StrictStr] = None,
        host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
    ) -> ProductDetailsResponse:
        """Create Product


        :param product_create_request: (required)
        :type product_create_request: ProductCreateRequest
        :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 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 idempotency_key: an idempotency key for the request.
                                 used to ensure the request is only processed once.
        :type idempotency_key: str, 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._create_product_serialize(
            product_create_request=product_create_request,
            _request_auth=request_auth,
            _content_type='application/json',
            _headers=headers,
            _idempotency_key=idempotency_key,
            _host_index=host_index
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "ProductDetailsResponse",
            '422': "ErrorResponse",
            '400': "ErrorResponse",
        }
        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 create_product_with_http_info(
        self,
        product_create_request: ProductCreateRequest,
        *,
        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,
        headers: Optional[Dict[StrictStr, Any]] = None,
        idempotency_key: Optional[StrictStr] = None,
        host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
    ) -> ApiResponse[ProductDetailsResponse]:
        """Create Product


        :param product_create_request: (required)
        :type product_create_request: ProductCreateRequest
        :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 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 idempotency_key: an idempotency key for the request.
                                 used to ensure the request is only processed once.
        :type idempotency_key: str, 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._create_product_serialize(
            product_create_request=product_create_request,
            _request_auth=request_auth,
            _content_type='application/json',
            _headers=headers,
            _idempotency_key=idempotency_key,
            _host_index=host_index
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "ProductDetailsResponse",
            '422': "ErrorResponse",
            '400': "ErrorResponse",
        }
        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 create_product_without_preload_content(
        self,
        product_create_request: ProductCreateRequest,
        *,
        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,
        headers: Optional[Dict[StrictStr, Any]] = None,
        idempotency_key: Optional[StrictStr] = None,
        host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
    ) -> RESTResponseType:
        """Create Product


        :param product_create_request: (required)
        :type product_create_request: ProductCreateRequest
        :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 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 idempotency_key: an idempotency key for the request.
                                 used to ensure the request is only processed once.
        :type idempotency_key: str, 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._create_product_serialize(
            product_create_request=product_create_request,
            _request_auth=request_auth,
            _content_type='application/json',
            _headers=headers,
            _idempotency_key=idempotency_key,
            _host_index=host_index
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "ProductDetailsResponse",
            '422': "ErrorResponse",
            '400': "ErrorResponse",
        }
        response_data = self.api_client.call_api(
            *_param,
            _request_timeout=request_timeout
        )
        return response_data.response


    def _create_product_serialize(
        self,
        product_create_request,
        _request_auth,
        _content_type,
        _headers,
        _idempotency_key,
        _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 {}
        if _idempotency_key is not None:
            _header_params['Idempotency-Key'] = _idempotency_key
        _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
        # process the header parameters
        # process the form parameters
        # process the body parameter
        if product_create_request is not None:
            _body_params = product_create_request


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

        # set the HTTP header `Content-Type`
        if _content_type:
            _header_params['Content-Type'] = _content_type
        else:
            _default_content_type = (
                self.api_client.select_header_content_type(
                    [
                        'application/json'
                    ]
                )
            )
            if _default_content_type is not None:
                _header_params['Content-Type'] = _default_content_type

        # authentication setting
        _auth_settings: List[str] = [
            'HTTPBasic', 
            'HTTPBearer'
        ]

        return self.api_client.param_serialize(
            method='POST',
            resource_path='/v2/products',
            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 delete_product(
        self,
        product_id: StrictStr,
        *,
        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,
        headers: Optional[Dict[StrictStr, Any]] = None,
        idempotency_key: Optional[StrictStr] = None,
        host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
    ) -> ProductDeletedResponse:
        """Delete Product


        :param product_id: (required)
        :type product_id: str
        :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 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 idempotency_key: an idempotency key for the request.
                                 used to ensure the request is only processed once.
        :type idempotency_key: str, 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._delete_product_serialize(
            product_id=product_id,
            _request_auth=request_auth,
            _content_type='application/json',
            _headers=headers,
            _idempotency_key=idempotency_key,
            _host_index=host_index
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "ProductDeletedResponse",
            '422': "ErrorResponse",
            '404': "ErrorResponse",
            '400': "ErrorResponse",
        }
        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 delete_product_with_http_info(
        self,
        product_id: StrictStr,
        *,
        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,
        headers: Optional[Dict[StrictStr, Any]] = None,
        idempotency_key: Optional[StrictStr] = None,
        host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
    ) -> ApiResponse[ProductDeletedResponse]:
        """Delete Product


        :param product_id: (required)
        :type product_id: str
        :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 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 idempotency_key: an idempotency key for the request.
                                 used to ensure the request is only processed once.
        :type idempotency_key: str, 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._delete_product_serialize(
            product_id=product_id,
            _request_auth=request_auth,
            _content_type='application/json',
            _headers=headers,
            _idempotency_key=idempotency_key,
            _host_index=host_index
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "ProductDeletedResponse",
            '422': "ErrorResponse",
            '404': "ErrorResponse",
            '400': "ErrorResponse",
        }
        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 delete_product_without_preload_content(
        self,
        product_id: StrictStr,
        *,
        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,
        headers: Optional[Dict[StrictStr, Any]] = None,
        idempotency_key: Optional[StrictStr] = None,
        host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
    ) -> RESTResponseType:
        """Delete Product


        :param product_id: (required)
        :type product_id: str
        :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 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 idempotency_key: an idempotency key for the request.
                                 used to ensure the request is only processed once.
        :type idempotency_key: str, 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._delete_product_serialize(
            product_id=product_id,
            _request_auth=request_auth,
            _content_type='application/json',
            _headers=headers,
            _idempotency_key=idempotency_key,
            _host_index=host_index
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "ProductDeletedResponse",
            '422': "ErrorResponse",
            '404': "ErrorResponse",
            '400': "ErrorResponse",
        }
        response_data = self.api_client.call_api(
            *_param,
            _request_timeout=request_timeout
        )
        return response_data.response


    def _delete_product_serialize(
        self,
        product_id,
        _request_auth,
        _content_type,
        _headers,
        _idempotency_key,
        _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 {}
        if _idempotency_key is not None:
            _header_params['Idempotency-Key'] = _idempotency_key
        _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
        if product_id is not None:
            _path_params['product_id'] = product_id
        # process the query parameters
        # 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', 
                    'application/problem+json'
                ]
            )


        # authentication setting
        _auth_settings: List[str] = [
            'HTTPBasic', 
            'HTTPBearer'
        ]

        return self.api_client.param_serialize(
            method='DELETE',
            resource_path='/v2/products/{product_id}',
            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 get_all_products(
        self,
        limit: Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="取得するデータの最大件数")] = None,
        starting_after: Annotated[Optional[StrictStr], Field(description="このIDより後のデータを取得")] = None,
        ending_before: Annotated[Optional[StrictStr], Field(description="このIDより前のデータを取得")] = 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,
        headers: Optional[Dict[StrictStr, Any]] = None,
        idempotency_key: Optional[StrictStr] = None,
        host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
    ) -> ProductListResponse:
        """Get All Products


        :param limit: 取得するデータの最大件数
        :type limit: int
        :param starting_after: このIDより後のデータを取得
        :type starting_after: str
        :param ending_before: このIDより前のデータを取得
        :type ending_before: str
        :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 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 idempotency_key: an idempotency key for the request.
                                 used to ensure the request is only processed once.
        :type idempotency_key: str, 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._get_all_products_serialize(
            limit=limit,
            starting_after=starting_after,
            ending_before=ending_before,
            _request_auth=request_auth,
            _content_type='application/json',
            _headers=headers,
            _idempotency_key=idempotency_key,
            _host_index=host_index
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "ProductListResponse",
            '422': "ErrorResponse",
            '400': "ErrorResponse",
        }
        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 get_all_products_with_http_info(
        self,
        limit: Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="取得するデータの最大件数")] = None,
        starting_after: Annotated[Optional[StrictStr], Field(description="このIDより後のデータを取得")] = None,
        ending_before: Annotated[Optional[StrictStr], Field(description="このIDより前のデータを取得")] = 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,
        headers: Optional[Dict[StrictStr, Any]] = None,
        idempotency_key: Optional[StrictStr] = None,
        host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
    ) -> ApiResponse[ProductListResponse]:
        """Get All Products


        :param limit: 取得するデータの最大件数
        :type limit: int
        :param starting_after: このIDより後のデータを取得
        :type starting_after: str
        :param ending_before: このIDより前のデータを取得
        :type ending_before: str
        :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 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 idempotency_key: an idempotency key for the request.
                                 used to ensure the request is only processed once.
        :type idempotency_key: str, 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._get_all_products_serialize(
            limit=limit,
            starting_after=starting_after,
            ending_before=ending_before,
            _request_auth=request_auth,
            _content_type='application/json',
            _headers=headers,
            _idempotency_key=idempotency_key,
            _host_index=host_index
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "ProductListResponse",
            '422': "ErrorResponse",
            '400': "ErrorResponse",
        }
        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 get_all_products_without_preload_content(
        self,
        limit: Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="取得するデータの最大件数")] = None,
        starting_after: Annotated[Optional[StrictStr], Field(description="このIDより後のデータを取得")] = None,
        ending_before: Annotated[Optional[StrictStr], Field(description="このIDより前のデータを取得")] = 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,
        headers: Optional[Dict[StrictStr, Any]] = None,
        idempotency_key: Optional[StrictStr] = None,
        host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
    ) -> RESTResponseType:
        """Get All Products


        :param limit: 取得するデータの最大件数
        :type limit: int
        :param starting_after: このIDより後のデータを取得
        :type starting_after: str
        :param ending_before: このIDより前のデータを取得
        :type ending_before: str
        :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 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 idempotency_key: an idempotency key for the request.
                                 used to ensure the request is only processed once.
        :type idempotency_key: str, 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._get_all_products_serialize(
            limit=limit,
            starting_after=starting_after,
            ending_before=ending_before,
            _request_auth=request_auth,
            _content_type='application/json',
            _headers=headers,
            _idempotency_key=idempotency_key,
            _host_index=host_index
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "ProductListResponse",
            '422': "ErrorResponse",
            '400': "ErrorResponse",
        }
        response_data = self.api_client.call_api(
            *_param,
            _request_timeout=request_timeout
        )
        return response_data.response


    def _get_all_products_serialize(
        self,
        limit,
        starting_after,
        ending_before,
        _request_auth,
        _content_type,
        _headers,
        _idempotency_key,
        _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 {}
        if _idempotency_key is not None:
            _header_params['Idempotency-Key'] = _idempotency_key
        _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 limit is not None:
            
            _query_params.append(('limit', limit))
            
        if starting_after is not None:
            
            _query_params.append(('starting_after', starting_after))
            
        if ending_before is not None:
            
            _query_params.append(('ending_before', ending_before))
            
        # 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', 
                    'application/problem+json'
                ]
            )


        # authentication setting
        _auth_settings: List[str] = [
            'HTTPBasic', 
            'HTTPBearer'
        ]

        return self.api_client.param_serialize(
            method='GET',
            resource_path='/v2/products',
            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 get_product(
        self,
        product_id: StrictStr,
        *,
        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,
        headers: Optional[Dict[StrictStr, Any]] = None,
        idempotency_key: Optional[StrictStr] = None,
        host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
    ) -> ProductDetailsResponse:
        """Get Product


        :param product_id: (required)
        :type product_id: str
        :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 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 idempotency_key: an idempotency key for the request.
                                 used to ensure the request is only processed once.
        :type idempotency_key: str, 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._get_product_serialize(
            product_id=product_id,
            _request_auth=request_auth,
            _content_type='application/json',
            _headers=headers,
            _idempotency_key=idempotency_key,
            _host_index=host_index
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "ProductDetailsResponse",
            '422': "ErrorResponse",
            '404': "ErrorResponse",
        }
        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 get_product_with_http_info(
        self,
        product_id: StrictStr,
        *,
        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,
        headers: Optional[Dict[StrictStr, Any]] = None,
        idempotency_key: Optional[StrictStr] = None,
        host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
    ) -> ApiResponse[ProductDetailsResponse]:
        """Get Product


        :param product_id: (required)
        :type product_id: str
        :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 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 idempotency_key: an idempotency key for the request.
                                 used to ensure the request is only processed once.
        :type idempotency_key: str, 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._get_product_serialize(
            product_id=product_id,
            _request_auth=request_auth,
            _content_type='application/json',
            _headers=headers,
            _idempotency_key=idempotency_key,
            _host_index=host_index
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "ProductDetailsResponse",
            '422': "ErrorResponse",
            '404': "ErrorResponse",
        }
        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 get_product_without_preload_content(
        self,
        product_id: StrictStr,
        *,
        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,
        headers: Optional[Dict[StrictStr, Any]] = None,
        idempotency_key: Optional[StrictStr] = None,
        host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
    ) -> RESTResponseType:
        """Get Product


        :param product_id: (required)
        :type product_id: str
        :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 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 idempotency_key: an idempotency key for the request.
                                 used to ensure the request is only processed once.
        :type idempotency_key: str, 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._get_product_serialize(
            product_id=product_id,
            _request_auth=request_auth,
            _content_type='application/json',
            _headers=headers,
            _idempotency_key=idempotency_key,
            _host_index=host_index
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "ProductDetailsResponse",
            '422': "ErrorResponse",
            '404': "ErrorResponse",
        }
        response_data = self.api_client.call_api(
            *_param,
            _request_timeout=request_timeout
        )
        return response_data.response


    def _get_product_serialize(
        self,
        product_id,
        _request_auth,
        _content_type,
        _headers,
        _idempotency_key,
        _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 {}
        if _idempotency_key is not None:
            _header_params['Idempotency-Key'] = _idempotency_key
        _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
        if product_id is not None:
            _path_params['product_id'] = product_id
        # process the query parameters
        # 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', 
                    'application/problem+json'
                ]
            )


        # authentication setting
        _auth_settings: List[str] = [
            'HTTPBasic', 
            'HTTPBearer'
        ]

        return self.api_client.param_serialize(
            method='GET',
            resource_path='/v2/products/{product_id}',
            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 update_product(
        self,
        product_id: StrictStr,
        product_update_request: ProductUpdateRequest,
        *,
        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,
        headers: Optional[Dict[StrictStr, Any]] = None,
        idempotency_key: Optional[StrictStr] = None,
        host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
    ) -> ProductDetailsResponse:
        """Update Product


        :param product_id: (required)
        :type product_id: str
        :param product_update_request: (required)
        :type product_update_request: ProductUpdateRequest
        :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 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 idempotency_key: an idempotency key for the request.
                                 used to ensure the request is only processed once.
        :type idempotency_key: str, 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._update_product_serialize(
            product_id=product_id,
            product_update_request=product_update_request,
            _request_auth=request_auth,
            _content_type='application/json',
            _headers=headers,
            _idempotency_key=idempotency_key,
            _host_index=host_index
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "ProductDetailsResponse",
            '422': "ErrorResponse",
            '404': "ErrorResponse",
            '400': "ErrorResponse",
        }
        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 update_product_with_http_info(
        self,
        product_id: StrictStr,
        product_update_request: ProductUpdateRequest,
        *,
        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,
        headers: Optional[Dict[StrictStr, Any]] = None,
        idempotency_key: Optional[StrictStr] = None,
        host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
    ) -> ApiResponse[ProductDetailsResponse]:
        """Update Product


        :param product_id: (required)
        :type product_id: str
        :param product_update_request: (required)
        :type product_update_request: ProductUpdateRequest
        :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 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 idempotency_key: an idempotency key for the request.
                                 used to ensure the request is only processed once.
        :type idempotency_key: str, 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._update_product_serialize(
            product_id=product_id,
            product_update_request=product_update_request,
            _request_auth=request_auth,
            _content_type='application/json',
            _headers=headers,
            _idempotency_key=idempotency_key,
            _host_index=host_index
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "ProductDetailsResponse",
            '422': "ErrorResponse",
            '404': "ErrorResponse",
            '400': "ErrorResponse",
        }
        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 update_product_without_preload_content(
        self,
        product_id: StrictStr,
        product_update_request: ProductUpdateRequest,
        *,
        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,
        headers: Optional[Dict[StrictStr, Any]] = None,
        idempotency_key: Optional[StrictStr] = None,
        host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
    ) -> RESTResponseType:
        """Update Product


        :param product_id: (required)
        :type product_id: str
        :param product_update_request: (required)
        :type product_update_request: ProductUpdateRequest
        :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 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 idempotency_key: an idempotency key for the request.
                                 used to ensure the request is only processed once.
        :type idempotency_key: str, 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._update_product_serialize(
            product_id=product_id,
            product_update_request=product_update_request,
            _request_auth=request_auth,
            _content_type='application/json',
            _headers=headers,
            _idempotency_key=idempotency_key,
            _host_index=host_index
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "ProductDetailsResponse",
            '422': "ErrorResponse",
            '404': "ErrorResponse",
            '400': "ErrorResponse",
        }
        response_data = self.api_client.call_api(
            *_param,
            _request_timeout=request_timeout
        )
        return response_data.response


    def _update_product_serialize(
        self,
        product_id,
        product_update_request,
        _request_auth,
        _content_type,
        _headers,
        _idempotency_key,
        _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 {}
        if _idempotency_key is not None:
            _header_params['Idempotency-Key'] = _idempotency_key
        _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
        if product_id is not None:
            _path_params['product_id'] = product_id
        # process the query parameters
        # process the header parameters
        # process the form parameters
        # process the body parameter
        if product_update_request is not None:
            _body_params = product_update_request


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

        # set the HTTP header `Content-Type`
        if _content_type:
            _header_params['Content-Type'] = _content_type
        else:
            _default_content_type = (
                self.api_client.select_header_content_type(
                    [
                        'application/json'
                    ]
                )
            )
            if _default_content_type is not None:
                _header_params['Content-Type'] = _default_content_type

        # authentication setting
        _auth_settings: List[str] = [
            'HTTPBasic', 
            'HTTPBearer'
        ]

        return self.api_client.param_serialize(
            method='POST',
            resource_path='/v2/products/{product_id}',
            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
        )


