"""
    Mentortools Access Server

    Mentortools service for Access Packages with lazy access resolution

    The version of the OpenAPI document: 0.1.0
    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, StrictBool, StrictInt, StrictStr
from typing import Optional
from typing_extensions import Annotated
from access_server_connector_v2.models.deactivate_in import DeactivateIn
from access_server_connector_v2.models.grant_in import GrantIn
from access_server_connector_v2.models.wrapped_response_id_out import WrappedResponseIdOut
from access_server_connector_v2.models.wrapped_response_int import WrappedResponseInt
from access_server_connector_v2.models.wrapped_response_list_owned_package_out import WrappedResponseListOwnedPackageOut
from access_server_connector_v2.models.wrapped_response_list_ownership_reason_out import WrappedResponseListOwnershipReasonOut

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


class OwnershipApi:
    """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
    async def deactivate_v1_ownership_reasons_reason_id_deactivate_post(
        self,
        reason_id: StrictInt,
        deactivate_in: DeactivateIn,
        origin: Optional[StrictStr] = None,
        referer: Optional[StrictStr] = None,
        portal_id: Optional[StrictInt] = 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,
    ) -> WrappedResponseIdOut:
        """Deactivate (revoke) an ownership reason


        :param reason_id: (required)
        :type reason_id: int
        :param deactivate_in: (required)
        :type deactivate_in: DeactivateIn
        :param origin:
        :type origin: str
        :param referer:
        :type referer: str
        :param portal_id:
        :type portal_id: int
        :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._deactivate_v1_ownership_reasons_reason_id_deactivate_post_serialize(
            reason_id=reason_id,
            deactivate_in=deactivate_in,
            origin=origin,
            referer=referer,
            portal_id=portal_id,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "WrappedResponseIdOut",
            '422': "HTTPValidationError",
        }
        response_data = await self.api_client.call_api(
            *_param,
            _request_timeout=_request_timeout
        )
        await response_data.read()
        return self.api_client.response_deserialize(
            response_data=response_data,
            response_types_map=_response_types_map,
        ).data


    @validate_call
    async def deactivate_v1_ownership_reasons_reason_id_deactivate_post_with_http_info(
        self,
        reason_id: StrictInt,
        deactivate_in: DeactivateIn,
        origin: Optional[StrictStr] = None,
        referer: Optional[StrictStr] = None,
        portal_id: Optional[StrictInt] = 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[WrappedResponseIdOut]:
        """Deactivate (revoke) an ownership reason


        :param reason_id: (required)
        :type reason_id: int
        :param deactivate_in: (required)
        :type deactivate_in: DeactivateIn
        :param origin:
        :type origin: str
        :param referer:
        :type referer: str
        :param portal_id:
        :type portal_id: int
        :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._deactivate_v1_ownership_reasons_reason_id_deactivate_post_serialize(
            reason_id=reason_id,
            deactivate_in=deactivate_in,
            origin=origin,
            referer=referer,
            portal_id=portal_id,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "WrappedResponseIdOut",
            '422': "HTTPValidationError",
        }
        response_data = await self.api_client.call_api(
            *_param,
            _request_timeout=_request_timeout
        )
        await response_data.read()
        return self.api_client.response_deserialize(
            response_data=response_data,
            response_types_map=_response_types_map,
        )


    @validate_call
    async def deactivate_v1_ownership_reasons_reason_id_deactivate_post_without_preload_content(
        self,
        reason_id: StrictInt,
        deactivate_in: DeactivateIn,
        origin: Optional[StrictStr] = None,
        referer: Optional[StrictStr] = None,
        portal_id: Optional[StrictInt] = 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:
        """Deactivate (revoke) an ownership reason


        :param reason_id: (required)
        :type reason_id: int
        :param deactivate_in: (required)
        :type deactivate_in: DeactivateIn
        :param origin:
        :type origin: str
        :param referer:
        :type referer: str
        :param portal_id:
        :type portal_id: int
        :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._deactivate_v1_ownership_reasons_reason_id_deactivate_post_serialize(
            reason_id=reason_id,
            deactivate_in=deactivate_in,
            origin=origin,
            referer=referer,
            portal_id=portal_id,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "WrappedResponseIdOut",
            '422': "HTTPValidationError",
        }
        response_data = await self.api_client.call_api(
            *_param,
            _request_timeout=_request_timeout
        )
        return response_data.response


    def _deactivate_v1_ownership_reasons_reason_id_deactivate_post_serialize(
        self,
        reason_id,
        deactivate_in,
        origin,
        referer,
        portal_id,
        _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
        if reason_id is not None:
            _path_params['reason_id'] = reason_id
        # process the query parameters
        # process the header parameters
        if origin is not None:
            _header_params['origin'] = origin
        if referer is not None:
            _header_params['referer'] = referer
        if portal_id is not None:
            _header_params['portal_id'] = portal_id
        # process the form parameters
        # process the body parameter
        if deactivate_in is not None:
            _body_params = deactivate_in


        # set the HTTP header `Accept`
        if 'Accept' not in _header_params:
            _header_params['Accept'] = self.api_client.select_header_accept(
                [
                    'application/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] = [
            'Bearer Authorization', 
            'ServerName Authorization'
        ]

        return self.api_client.param_serialize(
            method='POST',
            resource_path='/v1/ownership/reasons/{reason_id}/deactivate',
            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
    async def grant_v1_ownership_grant_post(
        self,
        grant_in: GrantIn,
        origin: Optional[StrictStr] = None,
        referer: Optional[StrictStr] = None,
        portal_id: Optional[StrictInt] = 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,
    ) -> WrappedResponseIdOut:
        """Manually grant an access package


        :param grant_in: (required)
        :type grant_in: GrantIn
        :param origin:
        :type origin: str
        :param referer:
        :type referer: str
        :param portal_id:
        :type portal_id: int
        :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._grant_v1_ownership_grant_post_serialize(
            grant_in=grant_in,
            origin=origin,
            referer=referer,
            portal_id=portal_id,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "WrappedResponseIdOut",
            '422': "HTTPValidationError",
        }
        response_data = await self.api_client.call_api(
            *_param,
            _request_timeout=_request_timeout
        )
        await response_data.read()
        return self.api_client.response_deserialize(
            response_data=response_data,
            response_types_map=_response_types_map,
        ).data


    @validate_call
    async def grant_v1_ownership_grant_post_with_http_info(
        self,
        grant_in: GrantIn,
        origin: Optional[StrictStr] = None,
        referer: Optional[StrictStr] = None,
        portal_id: Optional[StrictInt] = 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[WrappedResponseIdOut]:
        """Manually grant an access package


        :param grant_in: (required)
        :type grant_in: GrantIn
        :param origin:
        :type origin: str
        :param referer:
        :type referer: str
        :param portal_id:
        :type portal_id: int
        :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._grant_v1_ownership_grant_post_serialize(
            grant_in=grant_in,
            origin=origin,
            referer=referer,
            portal_id=portal_id,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "WrappedResponseIdOut",
            '422': "HTTPValidationError",
        }
        response_data = await self.api_client.call_api(
            *_param,
            _request_timeout=_request_timeout
        )
        await response_data.read()
        return self.api_client.response_deserialize(
            response_data=response_data,
            response_types_map=_response_types_map,
        )


    @validate_call
    async def grant_v1_ownership_grant_post_without_preload_content(
        self,
        grant_in: GrantIn,
        origin: Optional[StrictStr] = None,
        referer: Optional[StrictStr] = None,
        portal_id: Optional[StrictInt] = 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:
        """Manually grant an access package


        :param grant_in: (required)
        :type grant_in: GrantIn
        :param origin:
        :type origin: str
        :param referer:
        :type referer: str
        :param portal_id:
        :type portal_id: int
        :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._grant_v1_ownership_grant_post_serialize(
            grant_in=grant_in,
            origin=origin,
            referer=referer,
            portal_id=portal_id,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "WrappedResponseIdOut",
            '422': "HTTPValidationError",
        }
        response_data = await self.api_client.call_api(
            *_param,
            _request_timeout=_request_timeout
        )
        return response_data.response


    def _grant_v1_ownership_grant_post_serialize(
        self,
        grant_in,
        origin,
        referer,
        portal_id,
        _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
        # process the header parameters
        if origin is not None:
            _header_params['origin'] = origin
        if referer is not None:
            _header_params['referer'] = referer
        if portal_id is not None:
            _header_params['portal_id'] = portal_id
        # process the form parameters
        # process the body parameter
        if grant_in is not None:
            _body_params = grant_in


        # set the HTTP header `Accept`
        if 'Accept' not in _header_params:
            _header_params['Accept'] = self.api_client.select_header_accept(
                [
                    'application/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] = [
            'Bearer Authorization', 
            'ServerName Authorization'
        ]

        return self.api_client.param_serialize(
            method='POST',
            resource_path='/v1/ownership/grant',
            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
    async def member_packages_count_v1_ownership_members_member_id_packages_count_get(
        self,
        member_id: StrictInt,
        portal_id: StrictInt,
        active_only: Optional[StrictBool] = None,
        origin: Optional[StrictStr] = None,
        referer: Optional[StrictStr] = None,
        portal_id2: Optional[StrictInt] = 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,
    ) -> WrappedResponseInt:
        """Count the access packages a member owns

        Query: portal_id, active_only?. Total matching packages (for pagination).

        :param member_id: (required)
        :type member_id: int
        :param portal_id: (required)
        :type portal_id: int
        :param active_only:
        :type active_only: bool
        :param origin:
        :type origin: str
        :param referer:
        :type referer: str
        :param portal_id2:
        :type portal_id2: int
        :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._member_packages_count_v1_ownership_members_member_id_packages_count_get_serialize(
            member_id=member_id,
            portal_id=portal_id,
            active_only=active_only,
            origin=origin,
            referer=referer,
            portal_id2=portal_id2,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "WrappedResponseInt",
            '422': "HTTPValidationError",
        }
        response_data = await self.api_client.call_api(
            *_param,
            _request_timeout=_request_timeout
        )
        await response_data.read()
        return self.api_client.response_deserialize(
            response_data=response_data,
            response_types_map=_response_types_map,
        ).data


    @validate_call
    async def member_packages_count_v1_ownership_members_member_id_packages_count_get_with_http_info(
        self,
        member_id: StrictInt,
        portal_id: StrictInt,
        active_only: Optional[StrictBool] = None,
        origin: Optional[StrictStr] = None,
        referer: Optional[StrictStr] = None,
        portal_id2: Optional[StrictInt] = 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[WrappedResponseInt]:
        """Count the access packages a member owns

        Query: portal_id, active_only?. Total matching packages (for pagination).

        :param member_id: (required)
        :type member_id: int
        :param portal_id: (required)
        :type portal_id: int
        :param active_only:
        :type active_only: bool
        :param origin:
        :type origin: str
        :param referer:
        :type referer: str
        :param portal_id2:
        :type portal_id2: int
        :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._member_packages_count_v1_ownership_members_member_id_packages_count_get_serialize(
            member_id=member_id,
            portal_id=portal_id,
            active_only=active_only,
            origin=origin,
            referer=referer,
            portal_id2=portal_id2,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "WrappedResponseInt",
            '422': "HTTPValidationError",
        }
        response_data = await self.api_client.call_api(
            *_param,
            _request_timeout=_request_timeout
        )
        await response_data.read()
        return self.api_client.response_deserialize(
            response_data=response_data,
            response_types_map=_response_types_map,
        )


    @validate_call
    async def member_packages_count_v1_ownership_members_member_id_packages_count_get_without_preload_content(
        self,
        member_id: StrictInt,
        portal_id: StrictInt,
        active_only: Optional[StrictBool] = None,
        origin: Optional[StrictStr] = None,
        referer: Optional[StrictStr] = None,
        portal_id2: Optional[StrictInt] = 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:
        """Count the access packages a member owns

        Query: portal_id, active_only?. Total matching packages (for pagination).

        :param member_id: (required)
        :type member_id: int
        :param portal_id: (required)
        :type portal_id: int
        :param active_only:
        :type active_only: bool
        :param origin:
        :type origin: str
        :param referer:
        :type referer: str
        :param portal_id2:
        :type portal_id2: int
        :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._member_packages_count_v1_ownership_members_member_id_packages_count_get_serialize(
            member_id=member_id,
            portal_id=portal_id,
            active_only=active_only,
            origin=origin,
            referer=referer,
            portal_id2=portal_id2,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "WrappedResponseInt",
            '422': "HTTPValidationError",
        }
        response_data = await self.api_client.call_api(
            *_param,
            _request_timeout=_request_timeout
        )
        return response_data.response


    def _member_packages_count_v1_ownership_members_member_id_packages_count_get_serialize(
        self,
        member_id,
        portal_id,
        active_only,
        origin,
        referer,
        portal_id2,
        _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
        if member_id is not None:
            _path_params['member_id'] = member_id
        # process the query parameters
        if portal_id is not None:
            
            _query_params.append(('portal_id', portal_id))
            
        if active_only is not None:
            
            _query_params.append(('active_only', active_only))
            
        # process the header parameters
        if origin is not None:
            _header_params['origin'] = origin
        if referer is not None:
            _header_params['referer'] = referer
        if portal_id2 is not None:
            _header_params['portal_id'] = portal_id2
        # 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] = [
            'Bearer Authorization', 
            'ServerName Authorization'
        ]

        return self.api_client.param_serialize(
            method='GET',
            resource_path='/v1/ownership/members/{member_id}/packages/count',
            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
    async def member_packages_v1_ownership_members_member_id_packages_get(
        self,
        member_id: StrictInt,
        portal_id: StrictInt,
        active_only: Optional[StrictBool] = None,
        limit: Optional[Annotated[int, Field(le=200, strict=True, ge=1)]] = None,
        offset: Optional[Annotated[int, Field(strict=True, ge=0)]] = None,
        origin: Optional[StrictStr] = None,
        referer: Optional[StrictStr] = None,
        portal_id2: Optional[StrictInt] = 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,
    ) -> WrappedResponseListOwnedPackageOut:
        """List the access packages a member owns (paginated)

        Query: portal_id, active_only?, limit, offset. active_only=true returns only currently-owned packages. Use …/packages/count for the total.

        :param member_id: (required)
        :type member_id: int
        :param portal_id: (required)
        :type portal_id: int
        :param active_only:
        :type active_only: bool
        :param limit:
        :type limit: int
        :param offset:
        :type offset: int
        :param origin:
        :type origin: str
        :param referer:
        :type referer: str
        :param portal_id2:
        :type portal_id2: int
        :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._member_packages_v1_ownership_members_member_id_packages_get_serialize(
            member_id=member_id,
            portal_id=portal_id,
            active_only=active_only,
            limit=limit,
            offset=offset,
            origin=origin,
            referer=referer,
            portal_id2=portal_id2,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "WrappedResponseListOwnedPackageOut",
            '422': "HTTPValidationError",
        }
        response_data = await self.api_client.call_api(
            *_param,
            _request_timeout=_request_timeout
        )
        await response_data.read()
        return self.api_client.response_deserialize(
            response_data=response_data,
            response_types_map=_response_types_map,
        ).data


    @validate_call
    async def member_packages_v1_ownership_members_member_id_packages_get_with_http_info(
        self,
        member_id: StrictInt,
        portal_id: StrictInt,
        active_only: Optional[StrictBool] = None,
        limit: Optional[Annotated[int, Field(le=200, strict=True, ge=1)]] = None,
        offset: Optional[Annotated[int, Field(strict=True, ge=0)]] = None,
        origin: Optional[StrictStr] = None,
        referer: Optional[StrictStr] = None,
        portal_id2: Optional[StrictInt] = 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[WrappedResponseListOwnedPackageOut]:
        """List the access packages a member owns (paginated)

        Query: portal_id, active_only?, limit, offset. active_only=true returns only currently-owned packages. Use …/packages/count for the total.

        :param member_id: (required)
        :type member_id: int
        :param portal_id: (required)
        :type portal_id: int
        :param active_only:
        :type active_only: bool
        :param limit:
        :type limit: int
        :param offset:
        :type offset: int
        :param origin:
        :type origin: str
        :param referer:
        :type referer: str
        :param portal_id2:
        :type portal_id2: int
        :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._member_packages_v1_ownership_members_member_id_packages_get_serialize(
            member_id=member_id,
            portal_id=portal_id,
            active_only=active_only,
            limit=limit,
            offset=offset,
            origin=origin,
            referer=referer,
            portal_id2=portal_id2,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "WrappedResponseListOwnedPackageOut",
            '422': "HTTPValidationError",
        }
        response_data = await self.api_client.call_api(
            *_param,
            _request_timeout=_request_timeout
        )
        await response_data.read()
        return self.api_client.response_deserialize(
            response_data=response_data,
            response_types_map=_response_types_map,
        )


    @validate_call
    async def member_packages_v1_ownership_members_member_id_packages_get_without_preload_content(
        self,
        member_id: StrictInt,
        portal_id: StrictInt,
        active_only: Optional[StrictBool] = None,
        limit: Optional[Annotated[int, Field(le=200, strict=True, ge=1)]] = None,
        offset: Optional[Annotated[int, Field(strict=True, ge=0)]] = None,
        origin: Optional[StrictStr] = None,
        referer: Optional[StrictStr] = None,
        portal_id2: Optional[StrictInt] = 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:
        """List the access packages a member owns (paginated)

        Query: portal_id, active_only?, limit, offset. active_only=true returns only currently-owned packages. Use …/packages/count for the total.

        :param member_id: (required)
        :type member_id: int
        :param portal_id: (required)
        :type portal_id: int
        :param active_only:
        :type active_only: bool
        :param limit:
        :type limit: int
        :param offset:
        :type offset: int
        :param origin:
        :type origin: str
        :param referer:
        :type referer: str
        :param portal_id2:
        :type portal_id2: int
        :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._member_packages_v1_ownership_members_member_id_packages_get_serialize(
            member_id=member_id,
            portal_id=portal_id,
            active_only=active_only,
            limit=limit,
            offset=offset,
            origin=origin,
            referer=referer,
            portal_id2=portal_id2,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "WrappedResponseListOwnedPackageOut",
            '422': "HTTPValidationError",
        }
        response_data = await self.api_client.call_api(
            *_param,
            _request_timeout=_request_timeout
        )
        return response_data.response


    def _member_packages_v1_ownership_members_member_id_packages_get_serialize(
        self,
        member_id,
        portal_id,
        active_only,
        limit,
        offset,
        origin,
        referer,
        portal_id2,
        _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
        if member_id is not None:
            _path_params['member_id'] = member_id
        # process the query parameters
        if portal_id is not None:
            
            _query_params.append(('portal_id', portal_id))
            
        if active_only is not None:
            
            _query_params.append(('active_only', active_only))
            
        if limit is not None:
            
            _query_params.append(('limit', limit))
            
        if offset is not None:
            
            _query_params.append(('offset', offset))
            
        # process the header parameters
        if origin is not None:
            _header_params['origin'] = origin
        if referer is not None:
            _header_params['referer'] = referer
        if portal_id2 is not None:
            _header_params['portal_id'] = portal_id2
        # 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] = [
            'Bearer Authorization', 
            'ServerName Authorization'
        ]

        return self.api_client.param_serialize(
            method='GET',
            resource_path='/v1/ownership/members/{member_id}/packages',
            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
    async def ownership_list_v1_ownership_members_member_id_reasons_get(
        self,
        member_id: StrictInt,
        portal_id: StrictInt,
        origin: Optional[StrictStr] = None,
        referer: Optional[StrictStr] = None,
        portal_id2: Optional[StrictInt] = 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,
    ) -> WrappedResponseListOwnershipReasonOut:
        """List a member's ownership reasons

        Query: portal_id.

        :param member_id: (required)
        :type member_id: int
        :param portal_id: (required)
        :type portal_id: int
        :param origin:
        :type origin: str
        :param referer:
        :type referer: str
        :param portal_id2:
        :type portal_id2: int
        :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._ownership_list_v1_ownership_members_member_id_reasons_get_serialize(
            member_id=member_id,
            portal_id=portal_id,
            origin=origin,
            referer=referer,
            portal_id2=portal_id2,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "WrappedResponseListOwnershipReasonOut",
            '422': "HTTPValidationError",
        }
        response_data = await self.api_client.call_api(
            *_param,
            _request_timeout=_request_timeout
        )
        await response_data.read()
        return self.api_client.response_deserialize(
            response_data=response_data,
            response_types_map=_response_types_map,
        ).data


    @validate_call
    async def ownership_list_v1_ownership_members_member_id_reasons_get_with_http_info(
        self,
        member_id: StrictInt,
        portal_id: StrictInt,
        origin: Optional[StrictStr] = None,
        referer: Optional[StrictStr] = None,
        portal_id2: Optional[StrictInt] = 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[WrappedResponseListOwnershipReasonOut]:
        """List a member's ownership reasons

        Query: portal_id.

        :param member_id: (required)
        :type member_id: int
        :param portal_id: (required)
        :type portal_id: int
        :param origin:
        :type origin: str
        :param referer:
        :type referer: str
        :param portal_id2:
        :type portal_id2: int
        :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._ownership_list_v1_ownership_members_member_id_reasons_get_serialize(
            member_id=member_id,
            portal_id=portal_id,
            origin=origin,
            referer=referer,
            portal_id2=portal_id2,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "WrappedResponseListOwnershipReasonOut",
            '422': "HTTPValidationError",
        }
        response_data = await self.api_client.call_api(
            *_param,
            _request_timeout=_request_timeout
        )
        await response_data.read()
        return self.api_client.response_deserialize(
            response_data=response_data,
            response_types_map=_response_types_map,
        )


    @validate_call
    async def ownership_list_v1_ownership_members_member_id_reasons_get_without_preload_content(
        self,
        member_id: StrictInt,
        portal_id: StrictInt,
        origin: Optional[StrictStr] = None,
        referer: Optional[StrictStr] = None,
        portal_id2: Optional[StrictInt] = 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:
        """List a member's ownership reasons

        Query: portal_id.

        :param member_id: (required)
        :type member_id: int
        :param portal_id: (required)
        :type portal_id: int
        :param origin:
        :type origin: str
        :param referer:
        :type referer: str
        :param portal_id2:
        :type portal_id2: int
        :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._ownership_list_v1_ownership_members_member_id_reasons_get_serialize(
            member_id=member_id,
            portal_id=portal_id,
            origin=origin,
            referer=referer,
            portal_id2=portal_id2,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "WrappedResponseListOwnershipReasonOut",
            '422': "HTTPValidationError",
        }
        response_data = await self.api_client.call_api(
            *_param,
            _request_timeout=_request_timeout
        )
        return response_data.response


    def _ownership_list_v1_ownership_members_member_id_reasons_get_serialize(
        self,
        member_id,
        portal_id,
        origin,
        referer,
        portal_id2,
        _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
        if member_id is not None:
            _path_params['member_id'] = member_id
        # process the query parameters
        if portal_id is not None:
            
            _query_params.append(('portal_id', portal_id))
            
        # process the header parameters
        if origin is not None:
            _header_params['origin'] = origin
        if referer is not None:
            _header_params['referer'] = referer
        if portal_id2 is not None:
            _header_params['portal_id'] = portal_id2
        # 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] = [
            'Bearer Authorization', 
            'ServerName Authorization'
        ]

        return self.api_client.param_serialize(
            method='GET',
            resource_path='/v1/ownership/members/{member_id}/reasons',
            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
        )


