# This file was auto-generated by Fern from our API Definition.

import datetime as dt
import typing
from json.decoder import JSONDecodeError

from ..core.api_error import ApiError as core_api_error_ApiError
from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
from ..core.http_response import AsyncHttpResponse, HttpResponse
from ..core.jsonable_encoder import jsonable_encoder
from ..core.pydantic_utilities import parse_obj_as
from ..core.request_options import RequestOptions
from ..errors.bad_request_error import BadRequestError
from ..errors.forbidden_error import ForbiddenError
from ..errors.internal_server_error import InternalServerError
from ..errors.not_found_error import NotFoundError
from ..errors.unauthorized_error import UnauthorizedError
from ..types.api_error import ApiError as types_api_error_ApiError
from .types.count_company_overrides_response import CountCompanyOverridesResponse
from .types.count_feature_companies_response import CountFeatureCompaniesResponse
from .types.count_feature_usage_response import CountFeatureUsageResponse
from .types.count_feature_users_response import CountFeatureUsersResponse
from .types.count_plan_entitlements_response import CountPlanEntitlementsResponse
from .types.create_company_override_request_body_metric_period import CreateCompanyOverrideRequestBodyMetricPeriod
from .types.create_company_override_request_body_metric_period_month_reset import (
    CreateCompanyOverrideRequestBodyMetricPeriodMonthReset,
)
from .types.create_company_override_request_body_value_type import CreateCompanyOverrideRequestBodyValueType
from .types.create_company_override_response import CreateCompanyOverrideResponse
from .types.create_plan_entitlement_request_body_metric_period import CreatePlanEntitlementRequestBodyMetricPeriod
from .types.create_plan_entitlement_request_body_metric_period_month_reset import (
    CreatePlanEntitlementRequestBodyMetricPeriodMonthReset,
)
from .types.create_plan_entitlement_request_body_value_type import CreatePlanEntitlementRequestBodyValueType
from .types.create_plan_entitlement_response import CreatePlanEntitlementResponse
from .types.delete_company_override_response import DeleteCompanyOverrideResponse
from .types.delete_plan_entitlement_response import DeletePlanEntitlementResponse
from .types.get_company_override_response import GetCompanyOverrideResponse
from .types.get_feature_usage_by_company_response import GetFeatureUsageByCompanyResponse
from .types.get_plan_entitlement_response import GetPlanEntitlementResponse
from .types.list_company_overrides_response import ListCompanyOverridesResponse
from .types.list_feature_companies_response import ListFeatureCompaniesResponse
from .types.list_feature_usage_response import ListFeatureUsageResponse
from .types.list_feature_users_response import ListFeatureUsersResponse
from .types.list_plan_entitlements_response import ListPlanEntitlementsResponse
from .types.update_company_override_request_body_metric_period import UpdateCompanyOverrideRequestBodyMetricPeriod
from .types.update_company_override_request_body_metric_period_month_reset import (
    UpdateCompanyOverrideRequestBodyMetricPeriodMonthReset,
)
from .types.update_company_override_request_body_value_type import UpdateCompanyOverrideRequestBodyValueType
from .types.update_company_override_response import UpdateCompanyOverrideResponse
from .types.update_plan_entitlement_request_body_metric_period import UpdatePlanEntitlementRequestBodyMetricPeriod
from .types.update_plan_entitlement_request_body_metric_period_month_reset import (
    UpdatePlanEntitlementRequestBodyMetricPeriodMonthReset,
)
from .types.update_plan_entitlement_request_body_value_type import UpdatePlanEntitlementRequestBodyValueType
from .types.update_plan_entitlement_response import UpdatePlanEntitlementResponse

# this is used as the default value for optional parameters
OMIT = typing.cast(typing.Any, ...)


class RawEntitlementsClient:
    def __init__(self, *, client_wrapper: SyncClientWrapper):
        self._client_wrapper = client_wrapper

    def list_company_overrides(
        self,
        *,
        company_id: typing.Optional[str] = None,
        company_ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
        feature_id: typing.Optional[str] = None,
        feature_ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
        ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
        without_expired: typing.Optional[bool] = None,
        q: typing.Optional[str] = None,
        limit: typing.Optional[int] = None,
        offset: typing.Optional[int] = None,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> HttpResponse[ListCompanyOverridesResponse]:
        """
        Parameters
        ----------
        company_id : typing.Optional[str]
            Filter company overrides by a single company ID (starting with comp_)

        company_ids : typing.Optional[typing.Union[str, typing.Sequence[str]]]
            Filter company overrides by multiple company IDs (starting with comp_)

        feature_id : typing.Optional[str]
            Filter company overrides by a single feature ID (starting with feat_)

        feature_ids : typing.Optional[typing.Union[str, typing.Sequence[str]]]
            Filter company overrides by multiple feature IDs (starting with feat_)

        ids : typing.Optional[typing.Union[str, typing.Sequence[str]]]
            Filter company overrides by multiple company override IDs (starting with cmov_)

        without_expired : typing.Optional[bool]
            Filter company overrides by whether they have not expired

        q : typing.Optional[str]
            Search for company overrides by feature or company name

        limit : typing.Optional[int]
            Page limit (default 100)

        offset : typing.Optional[int]
            Page offset (default 0)

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        HttpResponse[ListCompanyOverridesResponse]
            OK
        """
        _response = self._client_wrapper.httpx_client.request(
            "company-overrides",
            method="GET",
            params={
                "company_id": company_id,
                "company_ids": company_ids,
                "feature_id": feature_id,
                "feature_ids": feature_ids,
                "ids": ids,
                "without_expired": without_expired,
                "q": q,
                "limit": limit,
                "offset": offset,
            },
            request_options=request_options,
        )
        try:
            if 200 <= _response.status_code < 300:
                _data = typing.cast(
                    ListCompanyOverridesResponse,
                    parse_obj_as(
                        type_=ListCompanyOverridesResponse,  # type: ignore
                        object_=_response.json(),
                    ),
                )
                return HttpResponse(response=_response, data=_data)
            if _response.status_code == 400:
                raise BadRequestError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        types_api_error_ApiError,
                        parse_obj_as(
                            type_=types_api_error_ApiError,  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            if _response.status_code == 401:
                raise UnauthorizedError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        types_api_error_ApiError,
                        parse_obj_as(
                            type_=types_api_error_ApiError,  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            if _response.status_code == 403:
                raise ForbiddenError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        types_api_error_ApiError,
                        parse_obj_as(
                            type_=types_api_error_ApiError,  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            if _response.status_code == 404:
                raise NotFoundError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        types_api_error_ApiError,
                        parse_obj_as(
                            type_=types_api_error_ApiError,  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            if _response.status_code == 500:
                raise InternalServerError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        types_api_error_ApiError,
                        parse_obj_as(
                            type_=types_api_error_ApiError,  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            _response_json = _response.json()
        except JSONDecodeError:
            raise core_api_error_ApiError(
                status_code=_response.status_code, headers=dict(_response.headers), body=_response.text
            )
        raise core_api_error_ApiError(
            status_code=_response.status_code, headers=dict(_response.headers), body=_response_json
        )

    def create_company_override(
        self,
        *,
        company_id: str,
        feature_id: str,
        value_type: CreateCompanyOverrideRequestBodyValueType,
        expiration_date: typing.Optional[dt.datetime] = OMIT,
        metric_period: typing.Optional[CreateCompanyOverrideRequestBodyMetricPeriod] = OMIT,
        metric_period_month_reset: typing.Optional[CreateCompanyOverrideRequestBodyMetricPeriodMonthReset] = OMIT,
        value_bool: typing.Optional[bool] = OMIT,
        value_numeric: typing.Optional[int] = OMIT,
        value_trait_id: typing.Optional[str] = OMIT,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> HttpResponse[CreateCompanyOverrideResponse]:
        """
        Parameters
        ----------
        company_id : str

        feature_id : str

        value_type : CreateCompanyOverrideRequestBodyValueType

        expiration_date : typing.Optional[dt.datetime]

        metric_period : typing.Optional[CreateCompanyOverrideRequestBodyMetricPeriod]

        metric_period_month_reset : typing.Optional[CreateCompanyOverrideRequestBodyMetricPeriodMonthReset]

        value_bool : typing.Optional[bool]

        value_numeric : typing.Optional[int]

        value_trait_id : typing.Optional[str]

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        HttpResponse[CreateCompanyOverrideResponse]
            Created
        """
        _response = self._client_wrapper.httpx_client.request(
            "company-overrides",
            method="POST",
            json={
                "company_id": company_id,
                "expiration_date": expiration_date,
                "feature_id": feature_id,
                "metric_period": metric_period,
                "metric_period_month_reset": metric_period_month_reset,
                "value_bool": value_bool,
                "value_numeric": value_numeric,
                "value_trait_id": value_trait_id,
                "value_type": value_type,
            },
            headers={
                "content-type": "application/json",
            },
            request_options=request_options,
            omit=OMIT,
        )
        try:
            if 200 <= _response.status_code < 300:
                _data = typing.cast(
                    CreateCompanyOverrideResponse,
                    parse_obj_as(
                        type_=CreateCompanyOverrideResponse,  # type: ignore
                        object_=_response.json(),
                    ),
                )
                return HttpResponse(response=_response, data=_data)
            if _response.status_code == 400:
                raise BadRequestError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        types_api_error_ApiError,
                        parse_obj_as(
                            type_=types_api_error_ApiError,  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            if _response.status_code == 401:
                raise UnauthorizedError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        types_api_error_ApiError,
                        parse_obj_as(
                            type_=types_api_error_ApiError,  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            if _response.status_code == 403:
                raise ForbiddenError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        types_api_error_ApiError,
                        parse_obj_as(
                            type_=types_api_error_ApiError,  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            if _response.status_code == 404:
                raise NotFoundError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        types_api_error_ApiError,
                        parse_obj_as(
                            type_=types_api_error_ApiError,  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            if _response.status_code == 500:
                raise InternalServerError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        types_api_error_ApiError,
                        parse_obj_as(
                            type_=types_api_error_ApiError,  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            _response_json = _response.json()
        except JSONDecodeError:
            raise core_api_error_ApiError(
                status_code=_response.status_code, headers=dict(_response.headers), body=_response.text
            )
        raise core_api_error_ApiError(
            status_code=_response.status_code, headers=dict(_response.headers), body=_response_json
        )

    def get_company_override(
        self, company_override_id: str, *, request_options: typing.Optional[RequestOptions] = None
    ) -> HttpResponse[GetCompanyOverrideResponse]:
        """
        Parameters
        ----------
        company_override_id : str
            company_override_id

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        HttpResponse[GetCompanyOverrideResponse]
            OK
        """
        _response = self._client_wrapper.httpx_client.request(
            f"company-overrides/{jsonable_encoder(company_override_id)}",
            method="GET",
            request_options=request_options,
        )
        try:
            if 200 <= _response.status_code < 300:
                _data = typing.cast(
                    GetCompanyOverrideResponse,
                    parse_obj_as(
                        type_=GetCompanyOverrideResponse,  # type: ignore
                        object_=_response.json(),
                    ),
                )
                return HttpResponse(response=_response, data=_data)
            if _response.status_code == 401:
                raise UnauthorizedError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        types_api_error_ApiError,
                        parse_obj_as(
                            type_=types_api_error_ApiError,  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            if _response.status_code == 403:
                raise ForbiddenError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        types_api_error_ApiError,
                        parse_obj_as(
                            type_=types_api_error_ApiError,  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            if _response.status_code == 404:
                raise NotFoundError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        types_api_error_ApiError,
                        parse_obj_as(
                            type_=types_api_error_ApiError,  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            if _response.status_code == 500:
                raise InternalServerError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        types_api_error_ApiError,
                        parse_obj_as(
                            type_=types_api_error_ApiError,  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            _response_json = _response.json()
        except JSONDecodeError:
            raise core_api_error_ApiError(
                status_code=_response.status_code, headers=dict(_response.headers), body=_response.text
            )
        raise core_api_error_ApiError(
            status_code=_response.status_code, headers=dict(_response.headers), body=_response_json
        )

    def update_company_override(
        self,
        company_override_id: str,
        *,
        value_type: UpdateCompanyOverrideRequestBodyValueType,
        expiration_date: typing.Optional[dt.datetime] = OMIT,
        metric_period: typing.Optional[UpdateCompanyOverrideRequestBodyMetricPeriod] = OMIT,
        metric_period_month_reset: typing.Optional[UpdateCompanyOverrideRequestBodyMetricPeriodMonthReset] = OMIT,
        value_bool: typing.Optional[bool] = OMIT,
        value_numeric: typing.Optional[int] = OMIT,
        value_trait_id: typing.Optional[str] = OMIT,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> HttpResponse[UpdateCompanyOverrideResponse]:
        """
        Parameters
        ----------
        company_override_id : str
            company_override_id

        value_type : UpdateCompanyOverrideRequestBodyValueType

        expiration_date : typing.Optional[dt.datetime]

        metric_period : typing.Optional[UpdateCompanyOverrideRequestBodyMetricPeriod]

        metric_period_month_reset : typing.Optional[UpdateCompanyOverrideRequestBodyMetricPeriodMonthReset]

        value_bool : typing.Optional[bool]

        value_numeric : typing.Optional[int]

        value_trait_id : typing.Optional[str]

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        HttpResponse[UpdateCompanyOverrideResponse]
            OK
        """
        _response = self._client_wrapper.httpx_client.request(
            f"company-overrides/{jsonable_encoder(company_override_id)}",
            method="PUT",
            json={
                "expiration_date": expiration_date,
                "metric_period": metric_period,
                "metric_period_month_reset": metric_period_month_reset,
                "value_bool": value_bool,
                "value_numeric": value_numeric,
                "value_trait_id": value_trait_id,
                "value_type": value_type,
            },
            headers={
                "content-type": "application/json",
            },
            request_options=request_options,
            omit=OMIT,
        )
        try:
            if 200 <= _response.status_code < 300:
                _data = typing.cast(
                    UpdateCompanyOverrideResponse,
                    parse_obj_as(
                        type_=UpdateCompanyOverrideResponse,  # type: ignore
                        object_=_response.json(),
                    ),
                )
                return HttpResponse(response=_response, data=_data)
            if _response.status_code == 400:
                raise BadRequestError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        types_api_error_ApiError,
                        parse_obj_as(
                            type_=types_api_error_ApiError,  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            if _response.status_code == 401:
                raise UnauthorizedError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        types_api_error_ApiError,
                        parse_obj_as(
                            type_=types_api_error_ApiError,  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            if _response.status_code == 403:
                raise ForbiddenError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        types_api_error_ApiError,
                        parse_obj_as(
                            type_=types_api_error_ApiError,  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            if _response.status_code == 404:
                raise NotFoundError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        types_api_error_ApiError,
                        parse_obj_as(
                            type_=types_api_error_ApiError,  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            if _response.status_code == 500:
                raise InternalServerError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        types_api_error_ApiError,
                        parse_obj_as(
                            type_=types_api_error_ApiError,  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            _response_json = _response.json()
        except JSONDecodeError:
            raise core_api_error_ApiError(
                status_code=_response.status_code, headers=dict(_response.headers), body=_response.text
            )
        raise core_api_error_ApiError(
            status_code=_response.status_code, headers=dict(_response.headers), body=_response_json
        )

    def delete_company_override(
        self, company_override_id: str, *, request_options: typing.Optional[RequestOptions] = None
    ) -> HttpResponse[DeleteCompanyOverrideResponse]:
        """
        Parameters
        ----------
        company_override_id : str
            company_override_id

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        HttpResponse[DeleteCompanyOverrideResponse]
            OK
        """
        _response = self._client_wrapper.httpx_client.request(
            f"company-overrides/{jsonable_encoder(company_override_id)}",
            method="DELETE",
            request_options=request_options,
        )
        try:
            if 200 <= _response.status_code < 300:
                _data = typing.cast(
                    DeleteCompanyOverrideResponse,
                    parse_obj_as(
                        type_=DeleteCompanyOverrideResponse,  # type: ignore
                        object_=_response.json(),
                    ),
                )
                return HttpResponse(response=_response, data=_data)
            if _response.status_code == 400:
                raise BadRequestError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        types_api_error_ApiError,
                        parse_obj_as(
                            type_=types_api_error_ApiError,  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            if _response.status_code == 401:
                raise UnauthorizedError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        types_api_error_ApiError,
                        parse_obj_as(
                            type_=types_api_error_ApiError,  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            if _response.status_code == 403:
                raise ForbiddenError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        types_api_error_ApiError,
                        parse_obj_as(
                            type_=types_api_error_ApiError,  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            if _response.status_code == 404:
                raise NotFoundError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        types_api_error_ApiError,
                        parse_obj_as(
                            type_=types_api_error_ApiError,  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            if _response.status_code == 500:
                raise InternalServerError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        types_api_error_ApiError,
                        parse_obj_as(
                            type_=types_api_error_ApiError,  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            _response_json = _response.json()
        except JSONDecodeError:
            raise core_api_error_ApiError(
                status_code=_response.status_code, headers=dict(_response.headers), body=_response.text
            )
        raise core_api_error_ApiError(
            status_code=_response.status_code, headers=dict(_response.headers), body=_response_json
        )

    def count_company_overrides(
        self,
        *,
        company_id: typing.Optional[str] = None,
        company_ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
        feature_id: typing.Optional[str] = None,
        feature_ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
        ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
        without_expired: typing.Optional[bool] = None,
        q: typing.Optional[str] = None,
        limit: typing.Optional[int] = None,
        offset: typing.Optional[int] = None,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> HttpResponse[CountCompanyOverridesResponse]:
        """
        Parameters
        ----------
        company_id : typing.Optional[str]
            Filter company overrides by a single company ID (starting with comp_)

        company_ids : typing.Optional[typing.Union[str, typing.Sequence[str]]]
            Filter company overrides by multiple company IDs (starting with comp_)

        feature_id : typing.Optional[str]
            Filter company overrides by a single feature ID (starting with feat_)

        feature_ids : typing.Optional[typing.Union[str, typing.Sequence[str]]]
            Filter company overrides by multiple feature IDs (starting with feat_)

        ids : typing.Optional[typing.Union[str, typing.Sequence[str]]]
            Filter company overrides by multiple company override IDs (starting with cmov_)

        without_expired : typing.Optional[bool]
            Filter company overrides by whether they have not expired

        q : typing.Optional[str]
            Search for company overrides by feature or company name

        limit : typing.Optional[int]
            Page limit (default 100)

        offset : typing.Optional[int]
            Page offset (default 0)

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        HttpResponse[CountCompanyOverridesResponse]
            OK
        """
        _response = self._client_wrapper.httpx_client.request(
            "company-overrides/count",
            method="GET",
            params={
                "company_id": company_id,
                "company_ids": company_ids,
                "feature_id": feature_id,
                "feature_ids": feature_ids,
                "ids": ids,
                "without_expired": without_expired,
                "q": q,
                "limit": limit,
                "offset": offset,
            },
            request_options=request_options,
        )
        try:
            if 200 <= _response.status_code < 300:
                _data = typing.cast(
                    CountCompanyOverridesResponse,
                    parse_obj_as(
                        type_=CountCompanyOverridesResponse,  # type: ignore
                        object_=_response.json(),
                    ),
                )
                return HttpResponse(response=_response, data=_data)
            if _response.status_code == 400:
                raise BadRequestError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        types_api_error_ApiError,
                        parse_obj_as(
                            type_=types_api_error_ApiError,  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            if _response.status_code == 401:
                raise UnauthorizedError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        types_api_error_ApiError,
                        parse_obj_as(
                            type_=types_api_error_ApiError,  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            if _response.status_code == 403:
                raise ForbiddenError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        types_api_error_ApiError,
                        parse_obj_as(
                            type_=types_api_error_ApiError,  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            if _response.status_code == 404:
                raise NotFoundError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        types_api_error_ApiError,
                        parse_obj_as(
                            type_=types_api_error_ApiError,  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            if _response.status_code == 500:
                raise InternalServerError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        types_api_error_ApiError,
                        parse_obj_as(
                            type_=types_api_error_ApiError,  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            _response_json = _response.json()
        except JSONDecodeError:
            raise core_api_error_ApiError(
                status_code=_response.status_code, headers=dict(_response.headers), body=_response.text
            )
        raise core_api_error_ApiError(
            status_code=_response.status_code, headers=dict(_response.headers), body=_response_json
        )

    def list_feature_companies(
        self,
        *,
        feature_id: str,
        q: typing.Optional[str] = None,
        limit: typing.Optional[int] = None,
        offset: typing.Optional[int] = None,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> HttpResponse[ListFeatureCompaniesResponse]:
        """
        Parameters
        ----------
        feature_id : str

        q : typing.Optional[str]

        limit : typing.Optional[int]
            Page limit (default 100)

        offset : typing.Optional[int]
            Page offset (default 0)

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        HttpResponse[ListFeatureCompaniesResponse]
            OK
        """
        _response = self._client_wrapper.httpx_client.request(
            "feature-companies",
            method="GET",
            params={
                "feature_id": feature_id,
                "q": q,
                "limit": limit,
                "offset": offset,
            },
            request_options=request_options,
        )
        try:
            if 200 <= _response.status_code < 300:
                _data = typing.cast(
                    ListFeatureCompaniesResponse,
                    parse_obj_as(
                        type_=ListFeatureCompaniesResponse,  # type: ignore
                        object_=_response.json(),
                    ),
                )
                return HttpResponse(response=_response, data=_data)
            if _response.status_code == 400:
                raise BadRequestError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        types_api_error_ApiError,
                        parse_obj_as(
                            type_=types_api_error_ApiError,  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            if _response.status_code == 401:
                raise UnauthorizedError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        types_api_error_ApiError,
                        parse_obj_as(
                            type_=types_api_error_ApiError,  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            if _response.status_code == 403:
                raise ForbiddenError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        types_api_error_ApiError,
                        parse_obj_as(
                            type_=types_api_error_ApiError,  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            if _response.status_code == 404:
                raise NotFoundError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        types_api_error_ApiError,
                        parse_obj_as(
                            type_=types_api_error_ApiError,  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            if _response.status_code == 500:
                raise InternalServerError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        types_api_error_ApiError,
                        parse_obj_as(
                            type_=types_api_error_ApiError,  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            _response_json = _response.json()
        except JSONDecodeError:
            raise core_api_error_ApiError(
                status_code=_response.status_code, headers=dict(_response.headers), body=_response.text
            )
        raise core_api_error_ApiError(
            status_code=_response.status_code, headers=dict(_response.headers), body=_response_json
        )

    def count_feature_companies(
        self,
        *,
        feature_id: str,
        q: typing.Optional[str] = None,
        limit: typing.Optional[int] = None,
        offset: typing.Optional[int] = None,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> HttpResponse[CountFeatureCompaniesResponse]:
        """
        Parameters
        ----------
        feature_id : str

        q : typing.Optional[str]

        limit : typing.Optional[int]
            Page limit (default 100)

        offset : typing.Optional[int]
            Page offset (default 0)

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        HttpResponse[CountFeatureCompaniesResponse]
            OK
        """
        _response = self._client_wrapper.httpx_client.request(
            "feature-companies/count",
            method="GET",
            params={
                "feature_id": feature_id,
                "q": q,
                "limit": limit,
                "offset": offset,
            },
            request_options=request_options,
        )
        try:
            if 200 <= _response.status_code < 300:
                _data = typing.cast(
                    CountFeatureCompaniesResponse,
                    parse_obj_as(
                        type_=CountFeatureCompaniesResponse,  # type: ignore
                        object_=_response.json(),
                    ),
                )
                return HttpResponse(response=_response, data=_data)
            if _response.status_code == 400:
                raise BadRequestError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        types_api_error_ApiError,
                        parse_obj_as(
                            type_=types_api_error_ApiError,  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            if _response.status_code == 401:
                raise UnauthorizedError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        types_api_error_ApiError,
                        parse_obj_as(
                            type_=types_api_error_ApiError,  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            if _response.status_code == 403:
                raise ForbiddenError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        types_api_error_ApiError,
                        parse_obj_as(
                            type_=types_api_error_ApiError,  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            if _response.status_code == 404:
                raise NotFoundError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        types_api_error_ApiError,
                        parse_obj_as(
                            type_=types_api_error_ApiError,  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            if _response.status_code == 500:
                raise InternalServerError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        types_api_error_ApiError,
                        parse_obj_as(
                            type_=types_api_error_ApiError,  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            _response_json = _response.json()
        except JSONDecodeError:
            raise core_api_error_ApiError(
                status_code=_response.status_code, headers=dict(_response.headers), body=_response.text
            )
        raise core_api_error_ApiError(
            status_code=_response.status_code, headers=dict(_response.headers), body=_response_json
        )

    def list_feature_usage(
        self,
        *,
        company_id: typing.Optional[str] = None,
        company_keys: typing.Optional[typing.Dict[str, str]] = None,
        feature_ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
        q: typing.Optional[str] = None,
        without_negative_entitlements: typing.Optional[bool] = None,
        limit: typing.Optional[int] = None,
        offset: typing.Optional[int] = None,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> HttpResponse[ListFeatureUsageResponse]:
        """
        Parameters
        ----------
        company_id : typing.Optional[str]

        company_keys : typing.Optional[typing.Dict[str, str]]

        feature_ids : typing.Optional[typing.Union[str, typing.Sequence[str]]]

        q : typing.Optional[str]

        without_negative_entitlements : typing.Optional[bool]

        limit : typing.Optional[int]
            Page limit (default 100)

        offset : typing.Optional[int]
            Page offset (default 0)

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        HttpResponse[ListFeatureUsageResponse]
            OK
        """
        _response = self._client_wrapper.httpx_client.request(
            "feature-usage",
            method="GET",
            params={
                "company_id": company_id,
                "company_keys": company_keys,
                "feature_ids": feature_ids,
                "q": q,
                "without_negative_entitlements": without_negative_entitlements,
                "limit": limit,
                "offset": offset,
            },
            request_options=request_options,
        )
        try:
            if 200 <= _response.status_code < 300:
                _data = typing.cast(
                    ListFeatureUsageResponse,
                    parse_obj_as(
                        type_=ListFeatureUsageResponse,  # type: ignore
                        object_=_response.json(),
                    ),
                )
                return HttpResponse(response=_response, data=_data)
            if _response.status_code == 400:
                raise BadRequestError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        types_api_error_ApiError,
                        parse_obj_as(
                            type_=types_api_error_ApiError,  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            if _response.status_code == 401:
                raise UnauthorizedError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        types_api_error_ApiError,
                        parse_obj_as(
                            type_=types_api_error_ApiError,  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            if _response.status_code == 403:
                raise ForbiddenError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        types_api_error_ApiError,
                        parse_obj_as(
                            type_=types_api_error_ApiError,  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            if _response.status_code == 404:
                raise NotFoundError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        types_api_error_ApiError,
                        parse_obj_as(
                            type_=types_api_error_ApiError,  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            if _response.status_code == 500:
                raise InternalServerError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        types_api_error_ApiError,
                        parse_obj_as(
                            type_=types_api_error_ApiError,  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            _response_json = _response.json()
        except JSONDecodeError:
            raise core_api_error_ApiError(
                status_code=_response.status_code, headers=dict(_response.headers), body=_response.text
            )
        raise core_api_error_ApiError(
            status_code=_response.status_code, headers=dict(_response.headers), body=_response_json
        )

    def count_feature_usage(
        self,
        *,
        company_id: typing.Optional[str] = None,
        company_keys: typing.Optional[typing.Dict[str, str]] = None,
        feature_ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
        q: typing.Optional[str] = None,
        without_negative_entitlements: typing.Optional[bool] = None,
        limit: typing.Optional[int] = None,
        offset: typing.Optional[int] = None,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> HttpResponse[CountFeatureUsageResponse]:
        """
        Parameters
        ----------
        company_id : typing.Optional[str]

        company_keys : typing.Optional[typing.Dict[str, str]]

        feature_ids : typing.Optional[typing.Union[str, typing.Sequence[str]]]

        q : typing.Optional[str]

        without_negative_entitlements : typing.Optional[bool]

        limit : typing.Optional[int]
            Page limit (default 100)

        offset : typing.Optional[int]
            Page offset (default 0)

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        HttpResponse[CountFeatureUsageResponse]
            OK
        """
        _response = self._client_wrapper.httpx_client.request(
            "feature-usage/count",
            method="GET",
            params={
                "company_id": company_id,
                "company_keys": company_keys,
                "feature_ids": feature_ids,
                "q": q,
                "without_negative_entitlements": without_negative_entitlements,
                "limit": limit,
                "offset": offset,
            },
            request_options=request_options,
        )
        try:
            if 200 <= _response.status_code < 300:
                _data = typing.cast(
                    CountFeatureUsageResponse,
                    parse_obj_as(
                        type_=CountFeatureUsageResponse,  # type: ignore
                        object_=_response.json(),
                    ),
                )
                return HttpResponse(response=_response, data=_data)
            if _response.status_code == 400:
                raise BadRequestError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        types_api_error_ApiError,
                        parse_obj_as(
                            type_=types_api_error_ApiError,  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            if _response.status_code == 401:
                raise UnauthorizedError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        types_api_error_ApiError,
                        parse_obj_as(
                            type_=types_api_error_ApiError,  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            if _response.status_code == 403:
                raise ForbiddenError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        types_api_error_ApiError,
                        parse_obj_as(
                            type_=types_api_error_ApiError,  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            if _response.status_code == 404:
                raise NotFoundError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        types_api_error_ApiError,
                        parse_obj_as(
                            type_=types_api_error_ApiError,  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            if _response.status_code == 500:
                raise InternalServerError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        types_api_error_ApiError,
                        parse_obj_as(
                            type_=types_api_error_ApiError,  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            _response_json = _response.json()
        except JSONDecodeError:
            raise core_api_error_ApiError(
                status_code=_response.status_code, headers=dict(_response.headers), body=_response.text
            )
        raise core_api_error_ApiError(
            status_code=_response.status_code, headers=dict(_response.headers), body=_response_json
        )

    def list_feature_users(
        self,
        *,
        feature_id: str,
        q: typing.Optional[str] = None,
        limit: typing.Optional[int] = None,
        offset: typing.Optional[int] = None,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> HttpResponse[ListFeatureUsersResponse]:
        """
        Parameters
        ----------
        feature_id : str

        q : typing.Optional[str]

        limit : typing.Optional[int]
            Page limit (default 100)

        offset : typing.Optional[int]
            Page offset (default 0)

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        HttpResponse[ListFeatureUsersResponse]
            OK
        """
        _response = self._client_wrapper.httpx_client.request(
            "feature-users",
            method="GET",
            params={
                "feature_id": feature_id,
                "q": q,
                "limit": limit,
                "offset": offset,
            },
            request_options=request_options,
        )
        try:
            if 200 <= _response.status_code < 300:
                _data = typing.cast(
                    ListFeatureUsersResponse,
                    parse_obj_as(
                        type_=ListFeatureUsersResponse,  # type: ignore
                        object_=_response.json(),
                    ),
                )
                return HttpResponse(response=_response, data=_data)
            if _response.status_code == 400:
                raise BadRequestError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        types_api_error_ApiError,
                        parse_obj_as(
                            type_=types_api_error_ApiError,  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            if _response.status_code == 401:
                raise UnauthorizedError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        types_api_error_ApiError,
                        parse_obj_as(
                            type_=types_api_error_ApiError,  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            if _response.status_code == 403:
                raise ForbiddenError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        types_api_error_ApiError,
                        parse_obj_as(
                            type_=types_api_error_ApiError,  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            if _response.status_code == 404:
                raise NotFoundError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        types_api_error_ApiError,
                        parse_obj_as(
                            type_=types_api_error_ApiError,  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            if _response.status_code == 500:
                raise InternalServerError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        types_api_error_ApiError,
                        parse_obj_as(
                            type_=types_api_error_ApiError,  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            _response_json = _response.json()
        except JSONDecodeError:
            raise core_api_error_ApiError(
                status_code=_response.status_code, headers=dict(_response.headers), body=_response.text
            )
        raise core_api_error_ApiError(
            status_code=_response.status_code, headers=dict(_response.headers), body=_response_json
        )

    def count_feature_users(
        self,
        *,
        feature_id: str,
        q: typing.Optional[str] = None,
        limit: typing.Optional[int] = None,
        offset: typing.Optional[int] = None,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> HttpResponse[CountFeatureUsersResponse]:
        """
        Parameters
        ----------
        feature_id : str

        q : typing.Optional[str]

        limit : typing.Optional[int]
            Page limit (default 100)

        offset : typing.Optional[int]
            Page offset (default 0)

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        HttpResponse[CountFeatureUsersResponse]
            OK
        """
        _response = self._client_wrapper.httpx_client.request(
            "feature-users/count",
            method="GET",
            params={
                "feature_id": feature_id,
                "q": q,
                "limit": limit,
                "offset": offset,
            },
            request_options=request_options,
        )
        try:
            if 200 <= _response.status_code < 300:
                _data = typing.cast(
                    CountFeatureUsersResponse,
                    parse_obj_as(
                        type_=CountFeatureUsersResponse,  # type: ignore
                        object_=_response.json(),
                    ),
                )
                return HttpResponse(response=_response, data=_data)
            if _response.status_code == 400:
                raise BadRequestError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        types_api_error_ApiError,
                        parse_obj_as(
                            type_=types_api_error_ApiError,  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            if _response.status_code == 401:
                raise UnauthorizedError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        types_api_error_ApiError,
                        parse_obj_as(
                            type_=types_api_error_ApiError,  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            if _response.status_code == 403:
                raise ForbiddenError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        types_api_error_ApiError,
                        parse_obj_as(
                            type_=types_api_error_ApiError,  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            if _response.status_code == 404:
                raise NotFoundError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        types_api_error_ApiError,
                        parse_obj_as(
                            type_=types_api_error_ApiError,  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            if _response.status_code == 500:
                raise InternalServerError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        types_api_error_ApiError,
                        parse_obj_as(
                            type_=types_api_error_ApiError,  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            _response_json = _response.json()
        except JSONDecodeError:
            raise core_api_error_ApiError(
                status_code=_response.status_code, headers=dict(_response.headers), body=_response.text
            )
        raise core_api_error_ApiError(
            status_code=_response.status_code, headers=dict(_response.headers), body=_response_json
        )

    def list_plan_entitlements(
        self,
        *,
        feature_id: typing.Optional[str] = None,
        feature_ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
        ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
        plan_id: typing.Optional[str] = None,
        plan_ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
        q: typing.Optional[str] = None,
        with_metered_products: typing.Optional[bool] = None,
        limit: typing.Optional[int] = None,
        offset: typing.Optional[int] = None,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> HttpResponse[ListPlanEntitlementsResponse]:
        """
        Parameters
        ----------
        feature_id : typing.Optional[str]
            Filter plan entitlements by a single feature ID (starting with feat_)

        feature_ids : typing.Optional[typing.Union[str, typing.Sequence[str]]]
            Filter plan entitlements by multiple feature IDs (starting with feat_)

        ids : typing.Optional[typing.Union[str, typing.Sequence[str]]]
            Filter plan entitlements by multiple plan entitlement IDs (starting with pltl_)

        plan_id : typing.Optional[str]
            Filter plan entitlements by a single plan ID (starting with plan_)

        plan_ids : typing.Optional[typing.Union[str, typing.Sequence[str]]]
            Filter plan entitlements by multiple plan IDs (starting with plan_)

        q : typing.Optional[str]
            Search for plan entitlements by feature or company name

        with_metered_products : typing.Optional[bool]
            Filter plan entitlements only with metered products

        limit : typing.Optional[int]
            Page limit (default 100)

        offset : typing.Optional[int]
            Page offset (default 0)

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        HttpResponse[ListPlanEntitlementsResponse]
            OK
        """
        _response = self._client_wrapper.httpx_client.request(
            "plan-entitlements",
            method="GET",
            params={
                "feature_id": feature_id,
                "feature_ids": feature_ids,
                "ids": ids,
                "plan_id": plan_id,
                "plan_ids": plan_ids,
                "q": q,
                "with_metered_products": with_metered_products,
                "limit": limit,
                "offset": offset,
            },
            request_options=request_options,
        )
        try:
            if 200 <= _response.status_code < 300:
                _data = typing.cast(
                    ListPlanEntitlementsResponse,
                    parse_obj_as(
                        type_=ListPlanEntitlementsResponse,  # type: ignore
                        object_=_response.json(),
                    ),
                )
                return HttpResponse(response=_response, data=_data)
            if _response.status_code == 400:
                raise BadRequestError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        types_api_error_ApiError,
                        parse_obj_as(
                            type_=types_api_error_ApiError,  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            if _response.status_code == 401:
                raise UnauthorizedError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        types_api_error_ApiError,
                        parse_obj_as(
                            type_=types_api_error_ApiError,  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            if _response.status_code == 403:
                raise ForbiddenError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        types_api_error_ApiError,
                        parse_obj_as(
                            type_=types_api_error_ApiError,  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            if _response.status_code == 404:
                raise NotFoundError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        types_api_error_ApiError,
                        parse_obj_as(
                            type_=types_api_error_ApiError,  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            if _response.status_code == 500:
                raise InternalServerError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        types_api_error_ApiError,
                        parse_obj_as(
                            type_=types_api_error_ApiError,  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            _response_json = _response.json()
        except JSONDecodeError:
            raise core_api_error_ApiError(
                status_code=_response.status_code, headers=dict(_response.headers), body=_response.text
            )
        raise core_api_error_ApiError(
            status_code=_response.status_code, headers=dict(_response.headers), body=_response_json
        )

    def create_plan_entitlement(
        self,
        *,
        feature_id: str,
        plan_id: str,
        value_type: CreatePlanEntitlementRequestBodyValueType,
        currency: typing.Optional[str] = OMIT,
        metric_period: typing.Optional[CreatePlanEntitlementRequestBodyMetricPeriod] = OMIT,
        metric_period_month_reset: typing.Optional[CreatePlanEntitlementRequestBodyMetricPeriodMonthReset] = OMIT,
        monthly_metered_price_id: typing.Optional[str] = OMIT,
        monthly_unit_price: typing.Optional[int] = OMIT,
        monthly_unit_price_decimal: typing.Optional[str] = OMIT,
        overage_billing_product_id: typing.Optional[str] = OMIT,
        price_behavior: typing.Optional[str] = OMIT,
        soft_limit: typing.Optional[int] = OMIT,
        value_bool: typing.Optional[bool] = OMIT,
        value_numeric: typing.Optional[int] = OMIT,
        value_trait_id: typing.Optional[str] = OMIT,
        yearly_metered_price_id: typing.Optional[str] = OMIT,
        yearly_unit_price: typing.Optional[int] = OMIT,
        yearly_unit_price_decimal: typing.Optional[str] = OMIT,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> HttpResponse[CreatePlanEntitlementResponse]:
        """
        Parameters
        ----------
        feature_id : str

        plan_id : str

        value_type : CreatePlanEntitlementRequestBodyValueType

        currency : typing.Optional[str]

        metric_period : typing.Optional[CreatePlanEntitlementRequestBodyMetricPeriod]

        metric_period_month_reset : typing.Optional[CreatePlanEntitlementRequestBodyMetricPeriodMonthReset]

        monthly_metered_price_id : typing.Optional[str]

        monthly_unit_price : typing.Optional[int]

        monthly_unit_price_decimal : typing.Optional[str]

        overage_billing_product_id : typing.Optional[str]

        price_behavior : typing.Optional[str]

        soft_limit : typing.Optional[int]

        value_bool : typing.Optional[bool]

        value_numeric : typing.Optional[int]

        value_trait_id : typing.Optional[str]

        yearly_metered_price_id : typing.Optional[str]

        yearly_unit_price : typing.Optional[int]

        yearly_unit_price_decimal : typing.Optional[str]

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        HttpResponse[CreatePlanEntitlementResponse]
            Created
        """
        _response = self._client_wrapper.httpx_client.request(
            "plan-entitlements",
            method="POST",
            json={
                "currency": currency,
                "feature_id": feature_id,
                "metric_period": metric_period,
                "metric_period_month_reset": metric_period_month_reset,
                "monthly_metered_price_id": monthly_metered_price_id,
                "monthly_unit_price": monthly_unit_price,
                "monthly_unit_price_decimal": monthly_unit_price_decimal,
                "overage_billing_product_id": overage_billing_product_id,
                "plan_id": plan_id,
                "price_behavior": price_behavior,
                "soft_limit": soft_limit,
                "value_bool": value_bool,
                "value_numeric": value_numeric,
                "value_trait_id": value_trait_id,
                "value_type": value_type,
                "yearly_metered_price_id": yearly_metered_price_id,
                "yearly_unit_price": yearly_unit_price,
                "yearly_unit_price_decimal": yearly_unit_price_decimal,
            },
            headers={
                "content-type": "application/json",
            },
            request_options=request_options,
            omit=OMIT,
        )
        try:
            if 200 <= _response.status_code < 300:
                _data = typing.cast(
                    CreatePlanEntitlementResponse,
                    parse_obj_as(
                        type_=CreatePlanEntitlementResponse,  # type: ignore
                        object_=_response.json(),
                    ),
                )
                return HttpResponse(response=_response, data=_data)
            if _response.status_code == 400:
                raise BadRequestError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        types_api_error_ApiError,
                        parse_obj_as(
                            type_=types_api_error_ApiError,  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            if _response.status_code == 401:
                raise UnauthorizedError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        types_api_error_ApiError,
                        parse_obj_as(
                            type_=types_api_error_ApiError,  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            if _response.status_code == 403:
                raise ForbiddenError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        types_api_error_ApiError,
                        parse_obj_as(
                            type_=types_api_error_ApiError,  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            if _response.status_code == 404:
                raise NotFoundError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        types_api_error_ApiError,
                        parse_obj_as(
                            type_=types_api_error_ApiError,  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            if _response.status_code == 500:
                raise InternalServerError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        types_api_error_ApiError,
                        parse_obj_as(
                            type_=types_api_error_ApiError,  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            _response_json = _response.json()
        except JSONDecodeError:
            raise core_api_error_ApiError(
                status_code=_response.status_code, headers=dict(_response.headers), body=_response.text
            )
        raise core_api_error_ApiError(
            status_code=_response.status_code, headers=dict(_response.headers), body=_response_json
        )

    def get_plan_entitlement(
        self, plan_entitlement_id: str, *, request_options: typing.Optional[RequestOptions] = None
    ) -> HttpResponse[GetPlanEntitlementResponse]:
        """
        Parameters
        ----------
        plan_entitlement_id : str
            plan_entitlement_id

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        HttpResponse[GetPlanEntitlementResponse]
            OK
        """
        _response = self._client_wrapper.httpx_client.request(
            f"plan-entitlements/{jsonable_encoder(plan_entitlement_id)}",
            method="GET",
            request_options=request_options,
        )
        try:
            if 200 <= _response.status_code < 300:
                _data = typing.cast(
                    GetPlanEntitlementResponse,
                    parse_obj_as(
                        type_=GetPlanEntitlementResponse,  # type: ignore
                        object_=_response.json(),
                    ),
                )
                return HttpResponse(response=_response, data=_data)
            if _response.status_code == 401:
                raise UnauthorizedError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        types_api_error_ApiError,
                        parse_obj_as(
                            type_=types_api_error_ApiError,  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            if _response.status_code == 403:
                raise ForbiddenError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        types_api_error_ApiError,
                        parse_obj_as(
                            type_=types_api_error_ApiError,  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            if _response.status_code == 404:
                raise NotFoundError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        types_api_error_ApiError,
                        parse_obj_as(
                            type_=types_api_error_ApiError,  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            if _response.status_code == 500:
                raise InternalServerError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        types_api_error_ApiError,
                        parse_obj_as(
                            type_=types_api_error_ApiError,  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            _response_json = _response.json()
        except JSONDecodeError:
            raise core_api_error_ApiError(
                status_code=_response.status_code, headers=dict(_response.headers), body=_response.text
            )
        raise core_api_error_ApiError(
            status_code=_response.status_code, headers=dict(_response.headers), body=_response_json
        )

    def update_plan_entitlement(
        self,
        plan_entitlement_id: str,
        *,
        value_type: UpdatePlanEntitlementRequestBodyValueType,
        currency: typing.Optional[str] = OMIT,
        metric_period: typing.Optional[UpdatePlanEntitlementRequestBodyMetricPeriod] = OMIT,
        metric_period_month_reset: typing.Optional[UpdatePlanEntitlementRequestBodyMetricPeriodMonthReset] = OMIT,
        monthly_metered_price_id: typing.Optional[str] = OMIT,
        monthly_unit_price: typing.Optional[int] = OMIT,
        monthly_unit_price_decimal: typing.Optional[str] = OMIT,
        overage_billing_product_id: typing.Optional[str] = OMIT,
        price_behavior: typing.Optional[str] = OMIT,
        soft_limit: typing.Optional[int] = OMIT,
        value_bool: typing.Optional[bool] = OMIT,
        value_numeric: typing.Optional[int] = OMIT,
        value_trait_id: typing.Optional[str] = OMIT,
        yearly_metered_price_id: typing.Optional[str] = OMIT,
        yearly_unit_price: typing.Optional[int] = OMIT,
        yearly_unit_price_decimal: typing.Optional[str] = OMIT,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> HttpResponse[UpdatePlanEntitlementResponse]:
        """
        Parameters
        ----------
        plan_entitlement_id : str
            plan_entitlement_id

        value_type : UpdatePlanEntitlementRequestBodyValueType

        currency : typing.Optional[str]

        metric_period : typing.Optional[UpdatePlanEntitlementRequestBodyMetricPeriod]

        metric_period_month_reset : typing.Optional[UpdatePlanEntitlementRequestBodyMetricPeriodMonthReset]

        monthly_metered_price_id : typing.Optional[str]

        monthly_unit_price : typing.Optional[int]

        monthly_unit_price_decimal : typing.Optional[str]

        overage_billing_product_id : typing.Optional[str]

        price_behavior : typing.Optional[str]

        soft_limit : typing.Optional[int]

        value_bool : typing.Optional[bool]

        value_numeric : typing.Optional[int]

        value_trait_id : typing.Optional[str]

        yearly_metered_price_id : typing.Optional[str]

        yearly_unit_price : typing.Optional[int]

        yearly_unit_price_decimal : typing.Optional[str]

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        HttpResponse[UpdatePlanEntitlementResponse]
            OK
        """
        _response = self._client_wrapper.httpx_client.request(
            f"plan-entitlements/{jsonable_encoder(plan_entitlement_id)}",
            method="PUT",
            json={
                "currency": currency,
                "metric_period": metric_period,
                "metric_period_month_reset": metric_period_month_reset,
                "monthly_metered_price_id": monthly_metered_price_id,
                "monthly_unit_price": monthly_unit_price,
                "monthly_unit_price_decimal": monthly_unit_price_decimal,
                "overage_billing_product_id": overage_billing_product_id,
                "price_behavior": price_behavior,
                "soft_limit": soft_limit,
                "value_bool": value_bool,
                "value_numeric": value_numeric,
                "value_trait_id": value_trait_id,
                "value_type": value_type,
                "yearly_metered_price_id": yearly_metered_price_id,
                "yearly_unit_price": yearly_unit_price,
                "yearly_unit_price_decimal": yearly_unit_price_decimal,
            },
            headers={
                "content-type": "application/json",
            },
            request_options=request_options,
            omit=OMIT,
        )
        try:
            if 200 <= _response.status_code < 300:
                _data = typing.cast(
                    UpdatePlanEntitlementResponse,
                    parse_obj_as(
                        type_=UpdatePlanEntitlementResponse,  # type: ignore
                        object_=_response.json(),
                    ),
                )
                return HttpResponse(response=_response, data=_data)
            if _response.status_code == 400:
                raise BadRequestError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        types_api_error_ApiError,
                        parse_obj_as(
                            type_=types_api_error_ApiError,  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            if _response.status_code == 401:
                raise UnauthorizedError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        types_api_error_ApiError,
                        parse_obj_as(
                            type_=types_api_error_ApiError,  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            if _response.status_code == 403:
                raise ForbiddenError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        types_api_error_ApiError,
                        parse_obj_as(
                            type_=types_api_error_ApiError,  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            if _response.status_code == 404:
                raise NotFoundError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        types_api_error_ApiError,
                        parse_obj_as(
                            type_=types_api_error_ApiError,  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            if _response.status_code == 500:
                raise InternalServerError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        types_api_error_ApiError,
                        parse_obj_as(
                            type_=types_api_error_ApiError,  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            _response_json = _response.json()
        except JSONDecodeError:
            raise core_api_error_ApiError(
                status_code=_response.status_code, headers=dict(_response.headers), body=_response.text
            )
        raise core_api_error_ApiError(
            status_code=_response.status_code, headers=dict(_response.headers), body=_response_json
        )

    def delete_plan_entitlement(
        self, plan_entitlement_id: str, *, request_options: typing.Optional[RequestOptions] = None
    ) -> HttpResponse[DeletePlanEntitlementResponse]:
        """
        Parameters
        ----------
        plan_entitlement_id : str
            plan_entitlement_id

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        HttpResponse[DeletePlanEntitlementResponse]
            OK
        """
        _response = self._client_wrapper.httpx_client.request(
            f"plan-entitlements/{jsonable_encoder(plan_entitlement_id)}",
            method="DELETE",
            request_options=request_options,
        )
        try:
            if 200 <= _response.status_code < 300:
                _data = typing.cast(
                    DeletePlanEntitlementResponse,
                    parse_obj_as(
                        type_=DeletePlanEntitlementResponse,  # type: ignore
                        object_=_response.json(),
                    ),
                )
                return HttpResponse(response=_response, data=_data)
            if _response.status_code == 400:
                raise BadRequestError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        types_api_error_ApiError,
                        parse_obj_as(
                            type_=types_api_error_ApiError,  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            if _response.status_code == 401:
                raise UnauthorizedError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        types_api_error_ApiError,
                        parse_obj_as(
                            type_=types_api_error_ApiError,  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            if _response.status_code == 403:
                raise ForbiddenError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        types_api_error_ApiError,
                        parse_obj_as(
                            type_=types_api_error_ApiError,  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            if _response.status_code == 404:
                raise NotFoundError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        types_api_error_ApiError,
                        parse_obj_as(
                            type_=types_api_error_ApiError,  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            if _response.status_code == 500:
                raise InternalServerError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        types_api_error_ApiError,
                        parse_obj_as(
                            type_=types_api_error_ApiError,  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            _response_json = _response.json()
        except JSONDecodeError:
            raise core_api_error_ApiError(
                status_code=_response.status_code, headers=dict(_response.headers), body=_response.text
            )
        raise core_api_error_ApiError(
            status_code=_response.status_code, headers=dict(_response.headers), body=_response_json
        )

    def count_plan_entitlements(
        self,
        *,
        feature_id: typing.Optional[str] = None,
        feature_ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
        ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
        plan_id: typing.Optional[str] = None,
        plan_ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
        q: typing.Optional[str] = None,
        with_metered_products: typing.Optional[bool] = None,
        limit: typing.Optional[int] = None,
        offset: typing.Optional[int] = None,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> HttpResponse[CountPlanEntitlementsResponse]:
        """
        Parameters
        ----------
        feature_id : typing.Optional[str]
            Filter plan entitlements by a single feature ID (starting with feat_)

        feature_ids : typing.Optional[typing.Union[str, typing.Sequence[str]]]
            Filter plan entitlements by multiple feature IDs (starting with feat_)

        ids : typing.Optional[typing.Union[str, typing.Sequence[str]]]
            Filter plan entitlements by multiple plan entitlement IDs (starting with pltl_)

        plan_id : typing.Optional[str]
            Filter plan entitlements by a single plan ID (starting with plan_)

        plan_ids : typing.Optional[typing.Union[str, typing.Sequence[str]]]
            Filter plan entitlements by multiple plan IDs (starting with plan_)

        q : typing.Optional[str]
            Search for plan entitlements by feature or company name

        with_metered_products : typing.Optional[bool]
            Filter plan entitlements only with metered products

        limit : typing.Optional[int]
            Page limit (default 100)

        offset : typing.Optional[int]
            Page offset (default 0)

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        HttpResponse[CountPlanEntitlementsResponse]
            OK
        """
        _response = self._client_wrapper.httpx_client.request(
            "plan-entitlements/count",
            method="GET",
            params={
                "feature_id": feature_id,
                "feature_ids": feature_ids,
                "ids": ids,
                "plan_id": plan_id,
                "plan_ids": plan_ids,
                "q": q,
                "with_metered_products": with_metered_products,
                "limit": limit,
                "offset": offset,
            },
            request_options=request_options,
        )
        try:
            if 200 <= _response.status_code < 300:
                _data = typing.cast(
                    CountPlanEntitlementsResponse,
                    parse_obj_as(
                        type_=CountPlanEntitlementsResponse,  # type: ignore
                        object_=_response.json(),
                    ),
                )
                return HttpResponse(response=_response, data=_data)
            if _response.status_code == 400:
                raise BadRequestError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        types_api_error_ApiError,
                        parse_obj_as(
                            type_=types_api_error_ApiError,  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            if _response.status_code == 401:
                raise UnauthorizedError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        types_api_error_ApiError,
                        parse_obj_as(
                            type_=types_api_error_ApiError,  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            if _response.status_code == 403:
                raise ForbiddenError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        types_api_error_ApiError,
                        parse_obj_as(
                            type_=types_api_error_ApiError,  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            if _response.status_code == 404:
                raise NotFoundError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        types_api_error_ApiError,
                        parse_obj_as(
                            type_=types_api_error_ApiError,  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            if _response.status_code == 500:
                raise InternalServerError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        types_api_error_ApiError,
                        parse_obj_as(
                            type_=types_api_error_ApiError,  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            _response_json = _response.json()
        except JSONDecodeError:
            raise core_api_error_ApiError(
                status_code=_response.status_code, headers=dict(_response.headers), body=_response.text
            )
        raise core_api_error_ApiError(
            status_code=_response.status_code, headers=dict(_response.headers), body=_response_json
        )

    def get_feature_usage_by_company(
        self, *, keys: typing.Dict[str, str], request_options: typing.Optional[RequestOptions] = None
    ) -> HttpResponse[GetFeatureUsageByCompanyResponse]:
        """
        Parameters
        ----------
        keys : typing.Dict[str, str]
            Key/value pairs

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        HttpResponse[GetFeatureUsageByCompanyResponse]
            OK
        """
        _response = self._client_wrapper.httpx_client.request(
            "usage-by-company",
            method="GET",
            params={
                "keys": keys,
            },
            request_options=request_options,
        )
        try:
            if 200 <= _response.status_code < 300:
                _data = typing.cast(
                    GetFeatureUsageByCompanyResponse,
                    parse_obj_as(
                        type_=GetFeatureUsageByCompanyResponse,  # type: ignore
                        object_=_response.json(),
                    ),
                )
                return HttpResponse(response=_response, data=_data)
            if _response.status_code == 401:
                raise UnauthorizedError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        types_api_error_ApiError,
                        parse_obj_as(
                            type_=types_api_error_ApiError,  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            if _response.status_code == 403:
                raise ForbiddenError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        types_api_error_ApiError,
                        parse_obj_as(
                            type_=types_api_error_ApiError,  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            if _response.status_code == 404:
                raise NotFoundError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        types_api_error_ApiError,
                        parse_obj_as(
                            type_=types_api_error_ApiError,  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            if _response.status_code == 500:
                raise InternalServerError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        types_api_error_ApiError,
                        parse_obj_as(
                            type_=types_api_error_ApiError,  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            _response_json = _response.json()
        except JSONDecodeError:
            raise core_api_error_ApiError(
                status_code=_response.status_code, headers=dict(_response.headers), body=_response.text
            )
        raise core_api_error_ApiError(
            status_code=_response.status_code, headers=dict(_response.headers), body=_response_json
        )


class AsyncRawEntitlementsClient:
    def __init__(self, *, client_wrapper: AsyncClientWrapper):
        self._client_wrapper = client_wrapper

    async def list_company_overrides(
        self,
        *,
        company_id: typing.Optional[str] = None,
        company_ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
        feature_id: typing.Optional[str] = None,
        feature_ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
        ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
        without_expired: typing.Optional[bool] = None,
        q: typing.Optional[str] = None,
        limit: typing.Optional[int] = None,
        offset: typing.Optional[int] = None,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> AsyncHttpResponse[ListCompanyOverridesResponse]:
        """
        Parameters
        ----------
        company_id : typing.Optional[str]
            Filter company overrides by a single company ID (starting with comp_)

        company_ids : typing.Optional[typing.Union[str, typing.Sequence[str]]]
            Filter company overrides by multiple company IDs (starting with comp_)

        feature_id : typing.Optional[str]
            Filter company overrides by a single feature ID (starting with feat_)

        feature_ids : typing.Optional[typing.Union[str, typing.Sequence[str]]]
            Filter company overrides by multiple feature IDs (starting with feat_)

        ids : typing.Optional[typing.Union[str, typing.Sequence[str]]]
            Filter company overrides by multiple company override IDs (starting with cmov_)

        without_expired : typing.Optional[bool]
            Filter company overrides by whether they have not expired

        q : typing.Optional[str]
            Search for company overrides by feature or company name

        limit : typing.Optional[int]
            Page limit (default 100)

        offset : typing.Optional[int]
            Page offset (default 0)

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        AsyncHttpResponse[ListCompanyOverridesResponse]
            OK
        """
        _response = await self._client_wrapper.httpx_client.request(
            "company-overrides",
            method="GET",
            params={
                "company_id": company_id,
                "company_ids": company_ids,
                "feature_id": feature_id,
                "feature_ids": feature_ids,
                "ids": ids,
                "without_expired": without_expired,
                "q": q,
                "limit": limit,
                "offset": offset,
            },
            request_options=request_options,
        )
        try:
            if 200 <= _response.status_code < 300:
                _data = typing.cast(
                    ListCompanyOverridesResponse,
                    parse_obj_as(
                        type_=ListCompanyOverridesResponse,  # type: ignore
                        object_=_response.json(),
                    ),
                )
                return AsyncHttpResponse(response=_response, data=_data)
            if _response.status_code == 400:
                raise BadRequestError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        types_api_error_ApiError,
                        parse_obj_as(
                            type_=types_api_error_ApiError,  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            if _response.status_code == 401:
                raise UnauthorizedError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        types_api_error_ApiError,
                        parse_obj_as(
                            type_=types_api_error_ApiError,  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            if _response.status_code == 403:
                raise ForbiddenError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        types_api_error_ApiError,
                        parse_obj_as(
                            type_=types_api_error_ApiError,  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            if _response.status_code == 404:
                raise NotFoundError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        types_api_error_ApiError,
                        parse_obj_as(
                            type_=types_api_error_ApiError,  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            if _response.status_code == 500:
                raise InternalServerError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        types_api_error_ApiError,
                        parse_obj_as(
                            type_=types_api_error_ApiError,  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            _response_json = _response.json()
        except JSONDecodeError:
            raise core_api_error_ApiError(
                status_code=_response.status_code, headers=dict(_response.headers), body=_response.text
            )
        raise core_api_error_ApiError(
            status_code=_response.status_code, headers=dict(_response.headers), body=_response_json
        )

    async def create_company_override(
        self,
        *,
        company_id: str,
        feature_id: str,
        value_type: CreateCompanyOverrideRequestBodyValueType,
        expiration_date: typing.Optional[dt.datetime] = OMIT,
        metric_period: typing.Optional[CreateCompanyOverrideRequestBodyMetricPeriod] = OMIT,
        metric_period_month_reset: typing.Optional[CreateCompanyOverrideRequestBodyMetricPeriodMonthReset] = OMIT,
        value_bool: typing.Optional[bool] = OMIT,
        value_numeric: typing.Optional[int] = OMIT,
        value_trait_id: typing.Optional[str] = OMIT,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> AsyncHttpResponse[CreateCompanyOverrideResponse]:
        """
        Parameters
        ----------
        company_id : str

        feature_id : str

        value_type : CreateCompanyOverrideRequestBodyValueType

        expiration_date : typing.Optional[dt.datetime]

        metric_period : typing.Optional[CreateCompanyOverrideRequestBodyMetricPeriod]

        metric_period_month_reset : typing.Optional[CreateCompanyOverrideRequestBodyMetricPeriodMonthReset]

        value_bool : typing.Optional[bool]

        value_numeric : typing.Optional[int]

        value_trait_id : typing.Optional[str]

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        AsyncHttpResponse[CreateCompanyOverrideResponse]
            Created
        """
        _response = await self._client_wrapper.httpx_client.request(
            "company-overrides",
            method="POST",
            json={
                "company_id": company_id,
                "expiration_date": expiration_date,
                "feature_id": feature_id,
                "metric_period": metric_period,
                "metric_period_month_reset": metric_period_month_reset,
                "value_bool": value_bool,
                "value_numeric": value_numeric,
                "value_trait_id": value_trait_id,
                "value_type": value_type,
            },
            headers={
                "content-type": "application/json",
            },
            request_options=request_options,
            omit=OMIT,
        )
        try:
            if 200 <= _response.status_code < 300:
                _data = typing.cast(
                    CreateCompanyOverrideResponse,
                    parse_obj_as(
                        type_=CreateCompanyOverrideResponse,  # type: ignore
                        object_=_response.json(),
                    ),
                )
                return AsyncHttpResponse(response=_response, data=_data)
            if _response.status_code == 400:
                raise BadRequestError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        types_api_error_ApiError,
                        parse_obj_as(
                            type_=types_api_error_ApiError,  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            if _response.status_code == 401:
                raise UnauthorizedError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        types_api_error_ApiError,
                        parse_obj_as(
                            type_=types_api_error_ApiError,  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            if _response.status_code == 403:
                raise ForbiddenError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        types_api_error_ApiError,
                        parse_obj_as(
                            type_=types_api_error_ApiError,  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            if _response.status_code == 404:
                raise NotFoundError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        types_api_error_ApiError,
                        parse_obj_as(
                            type_=types_api_error_ApiError,  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            if _response.status_code == 500:
                raise InternalServerError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        types_api_error_ApiError,
                        parse_obj_as(
                            type_=types_api_error_ApiError,  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            _response_json = _response.json()
        except JSONDecodeError:
            raise core_api_error_ApiError(
                status_code=_response.status_code, headers=dict(_response.headers), body=_response.text
            )
        raise core_api_error_ApiError(
            status_code=_response.status_code, headers=dict(_response.headers), body=_response_json
        )

    async def get_company_override(
        self, company_override_id: str, *, request_options: typing.Optional[RequestOptions] = None
    ) -> AsyncHttpResponse[GetCompanyOverrideResponse]:
        """
        Parameters
        ----------
        company_override_id : str
            company_override_id

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        AsyncHttpResponse[GetCompanyOverrideResponse]
            OK
        """
        _response = await self._client_wrapper.httpx_client.request(
            f"company-overrides/{jsonable_encoder(company_override_id)}",
            method="GET",
            request_options=request_options,
        )
        try:
            if 200 <= _response.status_code < 300:
                _data = typing.cast(
                    GetCompanyOverrideResponse,
                    parse_obj_as(
                        type_=GetCompanyOverrideResponse,  # type: ignore
                        object_=_response.json(),
                    ),
                )
                return AsyncHttpResponse(response=_response, data=_data)
            if _response.status_code == 401:
                raise UnauthorizedError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        types_api_error_ApiError,
                        parse_obj_as(
                            type_=types_api_error_ApiError,  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            if _response.status_code == 403:
                raise ForbiddenError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        types_api_error_ApiError,
                        parse_obj_as(
                            type_=types_api_error_ApiError,  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            if _response.status_code == 404:
                raise NotFoundError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        types_api_error_ApiError,
                        parse_obj_as(
                            type_=types_api_error_ApiError,  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            if _response.status_code == 500:
                raise InternalServerError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        types_api_error_ApiError,
                        parse_obj_as(
                            type_=types_api_error_ApiError,  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            _response_json = _response.json()
        except JSONDecodeError:
            raise core_api_error_ApiError(
                status_code=_response.status_code, headers=dict(_response.headers), body=_response.text
            )
        raise core_api_error_ApiError(
            status_code=_response.status_code, headers=dict(_response.headers), body=_response_json
        )

    async def update_company_override(
        self,
        company_override_id: str,
        *,
        value_type: UpdateCompanyOverrideRequestBodyValueType,
        expiration_date: typing.Optional[dt.datetime] = OMIT,
        metric_period: typing.Optional[UpdateCompanyOverrideRequestBodyMetricPeriod] = OMIT,
        metric_period_month_reset: typing.Optional[UpdateCompanyOverrideRequestBodyMetricPeriodMonthReset] = OMIT,
        value_bool: typing.Optional[bool] = OMIT,
        value_numeric: typing.Optional[int] = OMIT,
        value_trait_id: typing.Optional[str] = OMIT,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> AsyncHttpResponse[UpdateCompanyOverrideResponse]:
        """
        Parameters
        ----------
        company_override_id : str
            company_override_id

        value_type : UpdateCompanyOverrideRequestBodyValueType

        expiration_date : typing.Optional[dt.datetime]

        metric_period : typing.Optional[UpdateCompanyOverrideRequestBodyMetricPeriod]

        metric_period_month_reset : typing.Optional[UpdateCompanyOverrideRequestBodyMetricPeriodMonthReset]

        value_bool : typing.Optional[bool]

        value_numeric : typing.Optional[int]

        value_trait_id : typing.Optional[str]

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        AsyncHttpResponse[UpdateCompanyOverrideResponse]
            OK
        """
        _response = await self._client_wrapper.httpx_client.request(
            f"company-overrides/{jsonable_encoder(company_override_id)}",
            method="PUT",
            json={
                "expiration_date": expiration_date,
                "metric_period": metric_period,
                "metric_period_month_reset": metric_period_month_reset,
                "value_bool": value_bool,
                "value_numeric": value_numeric,
                "value_trait_id": value_trait_id,
                "value_type": value_type,
            },
            headers={
                "content-type": "application/json",
            },
            request_options=request_options,
            omit=OMIT,
        )
        try:
            if 200 <= _response.status_code < 300:
                _data = typing.cast(
                    UpdateCompanyOverrideResponse,
                    parse_obj_as(
                        type_=UpdateCompanyOverrideResponse,  # type: ignore
                        object_=_response.json(),
                    ),
                )
                return AsyncHttpResponse(response=_response, data=_data)
            if _response.status_code == 400:
                raise BadRequestError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        types_api_error_ApiError,
                        parse_obj_as(
                            type_=types_api_error_ApiError,  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            if _response.status_code == 401:
                raise UnauthorizedError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        types_api_error_ApiError,
                        parse_obj_as(
                            type_=types_api_error_ApiError,  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            if _response.status_code == 403:
                raise ForbiddenError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        types_api_error_ApiError,
                        parse_obj_as(
                            type_=types_api_error_ApiError,  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            if _response.status_code == 404:
                raise NotFoundError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        types_api_error_ApiError,
                        parse_obj_as(
                            type_=types_api_error_ApiError,  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            if _response.status_code == 500:
                raise InternalServerError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        types_api_error_ApiError,
                        parse_obj_as(
                            type_=types_api_error_ApiError,  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            _response_json = _response.json()
        except JSONDecodeError:
            raise core_api_error_ApiError(
                status_code=_response.status_code, headers=dict(_response.headers), body=_response.text
            )
        raise core_api_error_ApiError(
            status_code=_response.status_code, headers=dict(_response.headers), body=_response_json
        )

    async def delete_company_override(
        self, company_override_id: str, *, request_options: typing.Optional[RequestOptions] = None
    ) -> AsyncHttpResponse[DeleteCompanyOverrideResponse]:
        """
        Parameters
        ----------
        company_override_id : str
            company_override_id

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        AsyncHttpResponse[DeleteCompanyOverrideResponse]
            OK
        """
        _response = await self._client_wrapper.httpx_client.request(
            f"company-overrides/{jsonable_encoder(company_override_id)}",
            method="DELETE",
            request_options=request_options,
        )
        try:
            if 200 <= _response.status_code < 300:
                _data = typing.cast(
                    DeleteCompanyOverrideResponse,
                    parse_obj_as(
                        type_=DeleteCompanyOverrideResponse,  # type: ignore
                        object_=_response.json(),
                    ),
                )
                return AsyncHttpResponse(response=_response, data=_data)
            if _response.status_code == 400:
                raise BadRequestError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        types_api_error_ApiError,
                        parse_obj_as(
                            type_=types_api_error_ApiError,  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            if _response.status_code == 401:
                raise UnauthorizedError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        types_api_error_ApiError,
                        parse_obj_as(
                            type_=types_api_error_ApiError,  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            if _response.status_code == 403:
                raise ForbiddenError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        types_api_error_ApiError,
                        parse_obj_as(
                            type_=types_api_error_ApiError,  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            if _response.status_code == 404:
                raise NotFoundError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        types_api_error_ApiError,
                        parse_obj_as(
                            type_=types_api_error_ApiError,  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            if _response.status_code == 500:
                raise InternalServerError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        types_api_error_ApiError,
                        parse_obj_as(
                            type_=types_api_error_ApiError,  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            _response_json = _response.json()
        except JSONDecodeError:
            raise core_api_error_ApiError(
                status_code=_response.status_code, headers=dict(_response.headers), body=_response.text
            )
        raise core_api_error_ApiError(
            status_code=_response.status_code, headers=dict(_response.headers), body=_response_json
        )

    async def count_company_overrides(
        self,
        *,
        company_id: typing.Optional[str] = None,
        company_ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
        feature_id: typing.Optional[str] = None,
        feature_ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
        ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
        without_expired: typing.Optional[bool] = None,
        q: typing.Optional[str] = None,
        limit: typing.Optional[int] = None,
        offset: typing.Optional[int] = None,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> AsyncHttpResponse[CountCompanyOverridesResponse]:
        """
        Parameters
        ----------
        company_id : typing.Optional[str]
            Filter company overrides by a single company ID (starting with comp_)

        company_ids : typing.Optional[typing.Union[str, typing.Sequence[str]]]
            Filter company overrides by multiple company IDs (starting with comp_)

        feature_id : typing.Optional[str]
            Filter company overrides by a single feature ID (starting with feat_)

        feature_ids : typing.Optional[typing.Union[str, typing.Sequence[str]]]
            Filter company overrides by multiple feature IDs (starting with feat_)

        ids : typing.Optional[typing.Union[str, typing.Sequence[str]]]
            Filter company overrides by multiple company override IDs (starting with cmov_)

        without_expired : typing.Optional[bool]
            Filter company overrides by whether they have not expired

        q : typing.Optional[str]
            Search for company overrides by feature or company name

        limit : typing.Optional[int]
            Page limit (default 100)

        offset : typing.Optional[int]
            Page offset (default 0)

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        AsyncHttpResponse[CountCompanyOverridesResponse]
            OK
        """
        _response = await self._client_wrapper.httpx_client.request(
            "company-overrides/count",
            method="GET",
            params={
                "company_id": company_id,
                "company_ids": company_ids,
                "feature_id": feature_id,
                "feature_ids": feature_ids,
                "ids": ids,
                "without_expired": without_expired,
                "q": q,
                "limit": limit,
                "offset": offset,
            },
            request_options=request_options,
        )
        try:
            if 200 <= _response.status_code < 300:
                _data = typing.cast(
                    CountCompanyOverridesResponse,
                    parse_obj_as(
                        type_=CountCompanyOverridesResponse,  # type: ignore
                        object_=_response.json(),
                    ),
                )
                return AsyncHttpResponse(response=_response, data=_data)
            if _response.status_code == 400:
                raise BadRequestError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        types_api_error_ApiError,
                        parse_obj_as(
                            type_=types_api_error_ApiError,  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            if _response.status_code == 401:
                raise UnauthorizedError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        types_api_error_ApiError,
                        parse_obj_as(
                            type_=types_api_error_ApiError,  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            if _response.status_code == 403:
                raise ForbiddenError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        types_api_error_ApiError,
                        parse_obj_as(
                            type_=types_api_error_ApiError,  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            if _response.status_code == 404:
                raise NotFoundError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        types_api_error_ApiError,
                        parse_obj_as(
                            type_=types_api_error_ApiError,  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            if _response.status_code == 500:
                raise InternalServerError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        types_api_error_ApiError,
                        parse_obj_as(
                            type_=types_api_error_ApiError,  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            _response_json = _response.json()
        except JSONDecodeError:
            raise core_api_error_ApiError(
                status_code=_response.status_code, headers=dict(_response.headers), body=_response.text
            )
        raise core_api_error_ApiError(
            status_code=_response.status_code, headers=dict(_response.headers), body=_response_json
        )

    async def list_feature_companies(
        self,
        *,
        feature_id: str,
        q: typing.Optional[str] = None,
        limit: typing.Optional[int] = None,
        offset: typing.Optional[int] = None,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> AsyncHttpResponse[ListFeatureCompaniesResponse]:
        """
        Parameters
        ----------
        feature_id : str

        q : typing.Optional[str]

        limit : typing.Optional[int]
            Page limit (default 100)

        offset : typing.Optional[int]
            Page offset (default 0)

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        AsyncHttpResponse[ListFeatureCompaniesResponse]
            OK
        """
        _response = await self._client_wrapper.httpx_client.request(
            "feature-companies",
            method="GET",
            params={
                "feature_id": feature_id,
                "q": q,
                "limit": limit,
                "offset": offset,
            },
            request_options=request_options,
        )
        try:
            if 200 <= _response.status_code < 300:
                _data = typing.cast(
                    ListFeatureCompaniesResponse,
                    parse_obj_as(
                        type_=ListFeatureCompaniesResponse,  # type: ignore
                        object_=_response.json(),
                    ),
                )
                return AsyncHttpResponse(response=_response, data=_data)
            if _response.status_code == 400:
                raise BadRequestError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        types_api_error_ApiError,
                        parse_obj_as(
                            type_=types_api_error_ApiError,  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            if _response.status_code == 401:
                raise UnauthorizedError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        types_api_error_ApiError,
                        parse_obj_as(
                            type_=types_api_error_ApiError,  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            if _response.status_code == 403:
                raise ForbiddenError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        types_api_error_ApiError,
                        parse_obj_as(
                            type_=types_api_error_ApiError,  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            if _response.status_code == 404:
                raise NotFoundError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        types_api_error_ApiError,
                        parse_obj_as(
                            type_=types_api_error_ApiError,  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            if _response.status_code == 500:
                raise InternalServerError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        types_api_error_ApiError,
                        parse_obj_as(
                            type_=types_api_error_ApiError,  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            _response_json = _response.json()
        except JSONDecodeError:
            raise core_api_error_ApiError(
                status_code=_response.status_code, headers=dict(_response.headers), body=_response.text
            )
        raise core_api_error_ApiError(
            status_code=_response.status_code, headers=dict(_response.headers), body=_response_json
        )

    async def count_feature_companies(
        self,
        *,
        feature_id: str,
        q: typing.Optional[str] = None,
        limit: typing.Optional[int] = None,
        offset: typing.Optional[int] = None,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> AsyncHttpResponse[CountFeatureCompaniesResponse]:
        """
        Parameters
        ----------
        feature_id : str

        q : typing.Optional[str]

        limit : typing.Optional[int]
            Page limit (default 100)

        offset : typing.Optional[int]
            Page offset (default 0)

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        AsyncHttpResponse[CountFeatureCompaniesResponse]
            OK
        """
        _response = await self._client_wrapper.httpx_client.request(
            "feature-companies/count",
            method="GET",
            params={
                "feature_id": feature_id,
                "q": q,
                "limit": limit,
                "offset": offset,
            },
            request_options=request_options,
        )
        try:
            if 200 <= _response.status_code < 300:
                _data = typing.cast(
                    CountFeatureCompaniesResponse,
                    parse_obj_as(
                        type_=CountFeatureCompaniesResponse,  # type: ignore
                        object_=_response.json(),
                    ),
                )
                return AsyncHttpResponse(response=_response, data=_data)
            if _response.status_code == 400:
                raise BadRequestError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        types_api_error_ApiError,
                        parse_obj_as(
                            type_=types_api_error_ApiError,  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            if _response.status_code == 401:
                raise UnauthorizedError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        types_api_error_ApiError,
                        parse_obj_as(
                            type_=types_api_error_ApiError,  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            if _response.status_code == 403:
                raise ForbiddenError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        types_api_error_ApiError,
                        parse_obj_as(
                            type_=types_api_error_ApiError,  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            if _response.status_code == 404:
                raise NotFoundError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        types_api_error_ApiError,
                        parse_obj_as(
                            type_=types_api_error_ApiError,  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            if _response.status_code == 500:
                raise InternalServerError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        types_api_error_ApiError,
                        parse_obj_as(
                            type_=types_api_error_ApiError,  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            _response_json = _response.json()
        except JSONDecodeError:
            raise core_api_error_ApiError(
                status_code=_response.status_code, headers=dict(_response.headers), body=_response.text
            )
        raise core_api_error_ApiError(
            status_code=_response.status_code, headers=dict(_response.headers), body=_response_json
        )

    async def list_feature_usage(
        self,
        *,
        company_id: typing.Optional[str] = None,
        company_keys: typing.Optional[typing.Dict[str, str]] = None,
        feature_ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
        q: typing.Optional[str] = None,
        without_negative_entitlements: typing.Optional[bool] = None,
        limit: typing.Optional[int] = None,
        offset: typing.Optional[int] = None,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> AsyncHttpResponse[ListFeatureUsageResponse]:
        """
        Parameters
        ----------
        company_id : typing.Optional[str]

        company_keys : typing.Optional[typing.Dict[str, str]]

        feature_ids : typing.Optional[typing.Union[str, typing.Sequence[str]]]

        q : typing.Optional[str]

        without_negative_entitlements : typing.Optional[bool]

        limit : typing.Optional[int]
            Page limit (default 100)

        offset : typing.Optional[int]
            Page offset (default 0)

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        AsyncHttpResponse[ListFeatureUsageResponse]
            OK
        """
        _response = await self._client_wrapper.httpx_client.request(
            "feature-usage",
            method="GET",
            params={
                "company_id": company_id,
                "company_keys": company_keys,
                "feature_ids": feature_ids,
                "q": q,
                "without_negative_entitlements": without_negative_entitlements,
                "limit": limit,
                "offset": offset,
            },
            request_options=request_options,
        )
        try:
            if 200 <= _response.status_code < 300:
                _data = typing.cast(
                    ListFeatureUsageResponse,
                    parse_obj_as(
                        type_=ListFeatureUsageResponse,  # type: ignore
                        object_=_response.json(),
                    ),
                )
                return AsyncHttpResponse(response=_response, data=_data)
            if _response.status_code == 400:
                raise BadRequestError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        types_api_error_ApiError,
                        parse_obj_as(
                            type_=types_api_error_ApiError,  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            if _response.status_code == 401:
                raise UnauthorizedError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        types_api_error_ApiError,
                        parse_obj_as(
                            type_=types_api_error_ApiError,  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            if _response.status_code == 403:
                raise ForbiddenError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        types_api_error_ApiError,
                        parse_obj_as(
                            type_=types_api_error_ApiError,  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            if _response.status_code == 404:
                raise NotFoundError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        types_api_error_ApiError,
                        parse_obj_as(
                            type_=types_api_error_ApiError,  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            if _response.status_code == 500:
                raise InternalServerError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        types_api_error_ApiError,
                        parse_obj_as(
                            type_=types_api_error_ApiError,  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            _response_json = _response.json()
        except JSONDecodeError:
            raise core_api_error_ApiError(
                status_code=_response.status_code, headers=dict(_response.headers), body=_response.text
            )
        raise core_api_error_ApiError(
            status_code=_response.status_code, headers=dict(_response.headers), body=_response_json
        )

    async def count_feature_usage(
        self,
        *,
        company_id: typing.Optional[str] = None,
        company_keys: typing.Optional[typing.Dict[str, str]] = None,
        feature_ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
        q: typing.Optional[str] = None,
        without_negative_entitlements: typing.Optional[bool] = None,
        limit: typing.Optional[int] = None,
        offset: typing.Optional[int] = None,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> AsyncHttpResponse[CountFeatureUsageResponse]:
        """
        Parameters
        ----------
        company_id : typing.Optional[str]

        company_keys : typing.Optional[typing.Dict[str, str]]

        feature_ids : typing.Optional[typing.Union[str, typing.Sequence[str]]]

        q : typing.Optional[str]

        without_negative_entitlements : typing.Optional[bool]

        limit : typing.Optional[int]
            Page limit (default 100)

        offset : typing.Optional[int]
            Page offset (default 0)

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        AsyncHttpResponse[CountFeatureUsageResponse]
            OK
        """
        _response = await self._client_wrapper.httpx_client.request(
            "feature-usage/count",
            method="GET",
            params={
                "company_id": company_id,
                "company_keys": company_keys,
                "feature_ids": feature_ids,
                "q": q,
                "without_negative_entitlements": without_negative_entitlements,
                "limit": limit,
                "offset": offset,
            },
            request_options=request_options,
        )
        try:
            if 200 <= _response.status_code < 300:
                _data = typing.cast(
                    CountFeatureUsageResponse,
                    parse_obj_as(
                        type_=CountFeatureUsageResponse,  # type: ignore
                        object_=_response.json(),
                    ),
                )
                return AsyncHttpResponse(response=_response, data=_data)
            if _response.status_code == 400:
                raise BadRequestError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        types_api_error_ApiError,
                        parse_obj_as(
                            type_=types_api_error_ApiError,  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            if _response.status_code == 401:
                raise UnauthorizedError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        types_api_error_ApiError,
                        parse_obj_as(
                            type_=types_api_error_ApiError,  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            if _response.status_code == 403:
                raise ForbiddenError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        types_api_error_ApiError,
                        parse_obj_as(
                            type_=types_api_error_ApiError,  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            if _response.status_code == 404:
                raise NotFoundError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        types_api_error_ApiError,
                        parse_obj_as(
                            type_=types_api_error_ApiError,  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            if _response.status_code == 500:
                raise InternalServerError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        types_api_error_ApiError,
                        parse_obj_as(
                            type_=types_api_error_ApiError,  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            _response_json = _response.json()
        except JSONDecodeError:
            raise core_api_error_ApiError(
                status_code=_response.status_code, headers=dict(_response.headers), body=_response.text
            )
        raise core_api_error_ApiError(
            status_code=_response.status_code, headers=dict(_response.headers), body=_response_json
        )

    async def list_feature_users(
        self,
        *,
        feature_id: str,
        q: typing.Optional[str] = None,
        limit: typing.Optional[int] = None,
        offset: typing.Optional[int] = None,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> AsyncHttpResponse[ListFeatureUsersResponse]:
        """
        Parameters
        ----------
        feature_id : str

        q : typing.Optional[str]

        limit : typing.Optional[int]
            Page limit (default 100)

        offset : typing.Optional[int]
            Page offset (default 0)

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        AsyncHttpResponse[ListFeatureUsersResponse]
            OK
        """
        _response = await self._client_wrapper.httpx_client.request(
            "feature-users",
            method="GET",
            params={
                "feature_id": feature_id,
                "q": q,
                "limit": limit,
                "offset": offset,
            },
            request_options=request_options,
        )
        try:
            if 200 <= _response.status_code < 300:
                _data = typing.cast(
                    ListFeatureUsersResponse,
                    parse_obj_as(
                        type_=ListFeatureUsersResponse,  # type: ignore
                        object_=_response.json(),
                    ),
                )
                return AsyncHttpResponse(response=_response, data=_data)
            if _response.status_code == 400:
                raise BadRequestError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        types_api_error_ApiError,
                        parse_obj_as(
                            type_=types_api_error_ApiError,  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            if _response.status_code == 401:
                raise UnauthorizedError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        types_api_error_ApiError,
                        parse_obj_as(
                            type_=types_api_error_ApiError,  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            if _response.status_code == 403:
                raise ForbiddenError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        types_api_error_ApiError,
                        parse_obj_as(
                            type_=types_api_error_ApiError,  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            if _response.status_code == 404:
                raise NotFoundError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        types_api_error_ApiError,
                        parse_obj_as(
                            type_=types_api_error_ApiError,  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            if _response.status_code == 500:
                raise InternalServerError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        types_api_error_ApiError,
                        parse_obj_as(
                            type_=types_api_error_ApiError,  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            _response_json = _response.json()
        except JSONDecodeError:
            raise core_api_error_ApiError(
                status_code=_response.status_code, headers=dict(_response.headers), body=_response.text
            )
        raise core_api_error_ApiError(
            status_code=_response.status_code, headers=dict(_response.headers), body=_response_json
        )

    async def count_feature_users(
        self,
        *,
        feature_id: str,
        q: typing.Optional[str] = None,
        limit: typing.Optional[int] = None,
        offset: typing.Optional[int] = None,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> AsyncHttpResponse[CountFeatureUsersResponse]:
        """
        Parameters
        ----------
        feature_id : str

        q : typing.Optional[str]

        limit : typing.Optional[int]
            Page limit (default 100)

        offset : typing.Optional[int]
            Page offset (default 0)

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        AsyncHttpResponse[CountFeatureUsersResponse]
            OK
        """
        _response = await self._client_wrapper.httpx_client.request(
            "feature-users/count",
            method="GET",
            params={
                "feature_id": feature_id,
                "q": q,
                "limit": limit,
                "offset": offset,
            },
            request_options=request_options,
        )
        try:
            if 200 <= _response.status_code < 300:
                _data = typing.cast(
                    CountFeatureUsersResponse,
                    parse_obj_as(
                        type_=CountFeatureUsersResponse,  # type: ignore
                        object_=_response.json(),
                    ),
                )
                return AsyncHttpResponse(response=_response, data=_data)
            if _response.status_code == 400:
                raise BadRequestError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        types_api_error_ApiError,
                        parse_obj_as(
                            type_=types_api_error_ApiError,  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            if _response.status_code == 401:
                raise UnauthorizedError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        types_api_error_ApiError,
                        parse_obj_as(
                            type_=types_api_error_ApiError,  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            if _response.status_code == 403:
                raise ForbiddenError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        types_api_error_ApiError,
                        parse_obj_as(
                            type_=types_api_error_ApiError,  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            if _response.status_code == 404:
                raise NotFoundError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        types_api_error_ApiError,
                        parse_obj_as(
                            type_=types_api_error_ApiError,  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            if _response.status_code == 500:
                raise InternalServerError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        types_api_error_ApiError,
                        parse_obj_as(
                            type_=types_api_error_ApiError,  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            _response_json = _response.json()
        except JSONDecodeError:
            raise core_api_error_ApiError(
                status_code=_response.status_code, headers=dict(_response.headers), body=_response.text
            )
        raise core_api_error_ApiError(
            status_code=_response.status_code, headers=dict(_response.headers), body=_response_json
        )

    async def list_plan_entitlements(
        self,
        *,
        feature_id: typing.Optional[str] = None,
        feature_ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
        ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
        plan_id: typing.Optional[str] = None,
        plan_ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
        q: typing.Optional[str] = None,
        with_metered_products: typing.Optional[bool] = None,
        limit: typing.Optional[int] = None,
        offset: typing.Optional[int] = None,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> AsyncHttpResponse[ListPlanEntitlementsResponse]:
        """
        Parameters
        ----------
        feature_id : typing.Optional[str]
            Filter plan entitlements by a single feature ID (starting with feat_)

        feature_ids : typing.Optional[typing.Union[str, typing.Sequence[str]]]
            Filter plan entitlements by multiple feature IDs (starting with feat_)

        ids : typing.Optional[typing.Union[str, typing.Sequence[str]]]
            Filter plan entitlements by multiple plan entitlement IDs (starting with pltl_)

        plan_id : typing.Optional[str]
            Filter plan entitlements by a single plan ID (starting with plan_)

        plan_ids : typing.Optional[typing.Union[str, typing.Sequence[str]]]
            Filter plan entitlements by multiple plan IDs (starting with plan_)

        q : typing.Optional[str]
            Search for plan entitlements by feature or company name

        with_metered_products : typing.Optional[bool]
            Filter plan entitlements only with metered products

        limit : typing.Optional[int]
            Page limit (default 100)

        offset : typing.Optional[int]
            Page offset (default 0)

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        AsyncHttpResponse[ListPlanEntitlementsResponse]
            OK
        """
        _response = await self._client_wrapper.httpx_client.request(
            "plan-entitlements",
            method="GET",
            params={
                "feature_id": feature_id,
                "feature_ids": feature_ids,
                "ids": ids,
                "plan_id": plan_id,
                "plan_ids": plan_ids,
                "q": q,
                "with_metered_products": with_metered_products,
                "limit": limit,
                "offset": offset,
            },
            request_options=request_options,
        )
        try:
            if 200 <= _response.status_code < 300:
                _data = typing.cast(
                    ListPlanEntitlementsResponse,
                    parse_obj_as(
                        type_=ListPlanEntitlementsResponse,  # type: ignore
                        object_=_response.json(),
                    ),
                )
                return AsyncHttpResponse(response=_response, data=_data)
            if _response.status_code == 400:
                raise BadRequestError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        types_api_error_ApiError,
                        parse_obj_as(
                            type_=types_api_error_ApiError,  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            if _response.status_code == 401:
                raise UnauthorizedError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        types_api_error_ApiError,
                        parse_obj_as(
                            type_=types_api_error_ApiError,  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            if _response.status_code == 403:
                raise ForbiddenError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        types_api_error_ApiError,
                        parse_obj_as(
                            type_=types_api_error_ApiError,  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            if _response.status_code == 404:
                raise NotFoundError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        types_api_error_ApiError,
                        parse_obj_as(
                            type_=types_api_error_ApiError,  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            if _response.status_code == 500:
                raise InternalServerError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        types_api_error_ApiError,
                        parse_obj_as(
                            type_=types_api_error_ApiError,  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            _response_json = _response.json()
        except JSONDecodeError:
            raise core_api_error_ApiError(
                status_code=_response.status_code, headers=dict(_response.headers), body=_response.text
            )
        raise core_api_error_ApiError(
            status_code=_response.status_code, headers=dict(_response.headers), body=_response_json
        )

    async def create_plan_entitlement(
        self,
        *,
        feature_id: str,
        plan_id: str,
        value_type: CreatePlanEntitlementRequestBodyValueType,
        currency: typing.Optional[str] = OMIT,
        metric_period: typing.Optional[CreatePlanEntitlementRequestBodyMetricPeriod] = OMIT,
        metric_period_month_reset: typing.Optional[CreatePlanEntitlementRequestBodyMetricPeriodMonthReset] = OMIT,
        monthly_metered_price_id: typing.Optional[str] = OMIT,
        monthly_unit_price: typing.Optional[int] = OMIT,
        monthly_unit_price_decimal: typing.Optional[str] = OMIT,
        overage_billing_product_id: typing.Optional[str] = OMIT,
        price_behavior: typing.Optional[str] = OMIT,
        soft_limit: typing.Optional[int] = OMIT,
        value_bool: typing.Optional[bool] = OMIT,
        value_numeric: typing.Optional[int] = OMIT,
        value_trait_id: typing.Optional[str] = OMIT,
        yearly_metered_price_id: typing.Optional[str] = OMIT,
        yearly_unit_price: typing.Optional[int] = OMIT,
        yearly_unit_price_decimal: typing.Optional[str] = OMIT,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> AsyncHttpResponse[CreatePlanEntitlementResponse]:
        """
        Parameters
        ----------
        feature_id : str

        plan_id : str

        value_type : CreatePlanEntitlementRequestBodyValueType

        currency : typing.Optional[str]

        metric_period : typing.Optional[CreatePlanEntitlementRequestBodyMetricPeriod]

        metric_period_month_reset : typing.Optional[CreatePlanEntitlementRequestBodyMetricPeriodMonthReset]

        monthly_metered_price_id : typing.Optional[str]

        monthly_unit_price : typing.Optional[int]

        monthly_unit_price_decimal : typing.Optional[str]

        overage_billing_product_id : typing.Optional[str]

        price_behavior : typing.Optional[str]

        soft_limit : typing.Optional[int]

        value_bool : typing.Optional[bool]

        value_numeric : typing.Optional[int]

        value_trait_id : typing.Optional[str]

        yearly_metered_price_id : typing.Optional[str]

        yearly_unit_price : typing.Optional[int]

        yearly_unit_price_decimal : typing.Optional[str]

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        AsyncHttpResponse[CreatePlanEntitlementResponse]
            Created
        """
        _response = await self._client_wrapper.httpx_client.request(
            "plan-entitlements",
            method="POST",
            json={
                "currency": currency,
                "feature_id": feature_id,
                "metric_period": metric_period,
                "metric_period_month_reset": metric_period_month_reset,
                "monthly_metered_price_id": monthly_metered_price_id,
                "monthly_unit_price": monthly_unit_price,
                "monthly_unit_price_decimal": monthly_unit_price_decimal,
                "overage_billing_product_id": overage_billing_product_id,
                "plan_id": plan_id,
                "price_behavior": price_behavior,
                "soft_limit": soft_limit,
                "value_bool": value_bool,
                "value_numeric": value_numeric,
                "value_trait_id": value_trait_id,
                "value_type": value_type,
                "yearly_metered_price_id": yearly_metered_price_id,
                "yearly_unit_price": yearly_unit_price,
                "yearly_unit_price_decimal": yearly_unit_price_decimal,
            },
            headers={
                "content-type": "application/json",
            },
            request_options=request_options,
            omit=OMIT,
        )
        try:
            if 200 <= _response.status_code < 300:
                _data = typing.cast(
                    CreatePlanEntitlementResponse,
                    parse_obj_as(
                        type_=CreatePlanEntitlementResponse,  # type: ignore
                        object_=_response.json(),
                    ),
                )
                return AsyncHttpResponse(response=_response, data=_data)
            if _response.status_code == 400:
                raise BadRequestError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        types_api_error_ApiError,
                        parse_obj_as(
                            type_=types_api_error_ApiError,  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            if _response.status_code == 401:
                raise UnauthorizedError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        types_api_error_ApiError,
                        parse_obj_as(
                            type_=types_api_error_ApiError,  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            if _response.status_code == 403:
                raise ForbiddenError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        types_api_error_ApiError,
                        parse_obj_as(
                            type_=types_api_error_ApiError,  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            if _response.status_code == 404:
                raise NotFoundError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        types_api_error_ApiError,
                        parse_obj_as(
                            type_=types_api_error_ApiError,  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            if _response.status_code == 500:
                raise InternalServerError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        types_api_error_ApiError,
                        parse_obj_as(
                            type_=types_api_error_ApiError,  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            _response_json = _response.json()
        except JSONDecodeError:
            raise core_api_error_ApiError(
                status_code=_response.status_code, headers=dict(_response.headers), body=_response.text
            )
        raise core_api_error_ApiError(
            status_code=_response.status_code, headers=dict(_response.headers), body=_response_json
        )

    async def get_plan_entitlement(
        self, plan_entitlement_id: str, *, request_options: typing.Optional[RequestOptions] = None
    ) -> AsyncHttpResponse[GetPlanEntitlementResponse]:
        """
        Parameters
        ----------
        plan_entitlement_id : str
            plan_entitlement_id

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        AsyncHttpResponse[GetPlanEntitlementResponse]
            OK
        """
        _response = await self._client_wrapper.httpx_client.request(
            f"plan-entitlements/{jsonable_encoder(plan_entitlement_id)}",
            method="GET",
            request_options=request_options,
        )
        try:
            if 200 <= _response.status_code < 300:
                _data = typing.cast(
                    GetPlanEntitlementResponse,
                    parse_obj_as(
                        type_=GetPlanEntitlementResponse,  # type: ignore
                        object_=_response.json(),
                    ),
                )
                return AsyncHttpResponse(response=_response, data=_data)
            if _response.status_code == 401:
                raise UnauthorizedError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        types_api_error_ApiError,
                        parse_obj_as(
                            type_=types_api_error_ApiError,  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            if _response.status_code == 403:
                raise ForbiddenError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        types_api_error_ApiError,
                        parse_obj_as(
                            type_=types_api_error_ApiError,  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            if _response.status_code == 404:
                raise NotFoundError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        types_api_error_ApiError,
                        parse_obj_as(
                            type_=types_api_error_ApiError,  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            if _response.status_code == 500:
                raise InternalServerError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        types_api_error_ApiError,
                        parse_obj_as(
                            type_=types_api_error_ApiError,  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            _response_json = _response.json()
        except JSONDecodeError:
            raise core_api_error_ApiError(
                status_code=_response.status_code, headers=dict(_response.headers), body=_response.text
            )
        raise core_api_error_ApiError(
            status_code=_response.status_code, headers=dict(_response.headers), body=_response_json
        )

    async def update_plan_entitlement(
        self,
        plan_entitlement_id: str,
        *,
        value_type: UpdatePlanEntitlementRequestBodyValueType,
        currency: typing.Optional[str] = OMIT,
        metric_period: typing.Optional[UpdatePlanEntitlementRequestBodyMetricPeriod] = OMIT,
        metric_period_month_reset: typing.Optional[UpdatePlanEntitlementRequestBodyMetricPeriodMonthReset] = OMIT,
        monthly_metered_price_id: typing.Optional[str] = OMIT,
        monthly_unit_price: typing.Optional[int] = OMIT,
        monthly_unit_price_decimal: typing.Optional[str] = OMIT,
        overage_billing_product_id: typing.Optional[str] = OMIT,
        price_behavior: typing.Optional[str] = OMIT,
        soft_limit: typing.Optional[int] = OMIT,
        value_bool: typing.Optional[bool] = OMIT,
        value_numeric: typing.Optional[int] = OMIT,
        value_trait_id: typing.Optional[str] = OMIT,
        yearly_metered_price_id: typing.Optional[str] = OMIT,
        yearly_unit_price: typing.Optional[int] = OMIT,
        yearly_unit_price_decimal: typing.Optional[str] = OMIT,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> AsyncHttpResponse[UpdatePlanEntitlementResponse]:
        """
        Parameters
        ----------
        plan_entitlement_id : str
            plan_entitlement_id

        value_type : UpdatePlanEntitlementRequestBodyValueType

        currency : typing.Optional[str]

        metric_period : typing.Optional[UpdatePlanEntitlementRequestBodyMetricPeriod]

        metric_period_month_reset : typing.Optional[UpdatePlanEntitlementRequestBodyMetricPeriodMonthReset]

        monthly_metered_price_id : typing.Optional[str]

        monthly_unit_price : typing.Optional[int]

        monthly_unit_price_decimal : typing.Optional[str]

        overage_billing_product_id : typing.Optional[str]

        price_behavior : typing.Optional[str]

        soft_limit : typing.Optional[int]

        value_bool : typing.Optional[bool]

        value_numeric : typing.Optional[int]

        value_trait_id : typing.Optional[str]

        yearly_metered_price_id : typing.Optional[str]

        yearly_unit_price : typing.Optional[int]

        yearly_unit_price_decimal : typing.Optional[str]

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        AsyncHttpResponse[UpdatePlanEntitlementResponse]
            OK
        """
        _response = await self._client_wrapper.httpx_client.request(
            f"plan-entitlements/{jsonable_encoder(plan_entitlement_id)}",
            method="PUT",
            json={
                "currency": currency,
                "metric_period": metric_period,
                "metric_period_month_reset": metric_period_month_reset,
                "monthly_metered_price_id": monthly_metered_price_id,
                "monthly_unit_price": monthly_unit_price,
                "monthly_unit_price_decimal": monthly_unit_price_decimal,
                "overage_billing_product_id": overage_billing_product_id,
                "price_behavior": price_behavior,
                "soft_limit": soft_limit,
                "value_bool": value_bool,
                "value_numeric": value_numeric,
                "value_trait_id": value_trait_id,
                "value_type": value_type,
                "yearly_metered_price_id": yearly_metered_price_id,
                "yearly_unit_price": yearly_unit_price,
                "yearly_unit_price_decimal": yearly_unit_price_decimal,
            },
            headers={
                "content-type": "application/json",
            },
            request_options=request_options,
            omit=OMIT,
        )
        try:
            if 200 <= _response.status_code < 300:
                _data = typing.cast(
                    UpdatePlanEntitlementResponse,
                    parse_obj_as(
                        type_=UpdatePlanEntitlementResponse,  # type: ignore
                        object_=_response.json(),
                    ),
                )
                return AsyncHttpResponse(response=_response, data=_data)
            if _response.status_code == 400:
                raise BadRequestError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        types_api_error_ApiError,
                        parse_obj_as(
                            type_=types_api_error_ApiError,  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            if _response.status_code == 401:
                raise UnauthorizedError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        types_api_error_ApiError,
                        parse_obj_as(
                            type_=types_api_error_ApiError,  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            if _response.status_code == 403:
                raise ForbiddenError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        types_api_error_ApiError,
                        parse_obj_as(
                            type_=types_api_error_ApiError,  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            if _response.status_code == 404:
                raise NotFoundError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        types_api_error_ApiError,
                        parse_obj_as(
                            type_=types_api_error_ApiError,  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            if _response.status_code == 500:
                raise InternalServerError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        types_api_error_ApiError,
                        parse_obj_as(
                            type_=types_api_error_ApiError,  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            _response_json = _response.json()
        except JSONDecodeError:
            raise core_api_error_ApiError(
                status_code=_response.status_code, headers=dict(_response.headers), body=_response.text
            )
        raise core_api_error_ApiError(
            status_code=_response.status_code, headers=dict(_response.headers), body=_response_json
        )

    async def delete_plan_entitlement(
        self, plan_entitlement_id: str, *, request_options: typing.Optional[RequestOptions] = None
    ) -> AsyncHttpResponse[DeletePlanEntitlementResponse]:
        """
        Parameters
        ----------
        plan_entitlement_id : str
            plan_entitlement_id

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        AsyncHttpResponse[DeletePlanEntitlementResponse]
            OK
        """
        _response = await self._client_wrapper.httpx_client.request(
            f"plan-entitlements/{jsonable_encoder(plan_entitlement_id)}",
            method="DELETE",
            request_options=request_options,
        )
        try:
            if 200 <= _response.status_code < 300:
                _data = typing.cast(
                    DeletePlanEntitlementResponse,
                    parse_obj_as(
                        type_=DeletePlanEntitlementResponse,  # type: ignore
                        object_=_response.json(),
                    ),
                )
                return AsyncHttpResponse(response=_response, data=_data)
            if _response.status_code == 400:
                raise BadRequestError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        types_api_error_ApiError,
                        parse_obj_as(
                            type_=types_api_error_ApiError,  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            if _response.status_code == 401:
                raise UnauthorizedError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        types_api_error_ApiError,
                        parse_obj_as(
                            type_=types_api_error_ApiError,  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            if _response.status_code == 403:
                raise ForbiddenError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        types_api_error_ApiError,
                        parse_obj_as(
                            type_=types_api_error_ApiError,  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            if _response.status_code == 404:
                raise NotFoundError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        types_api_error_ApiError,
                        parse_obj_as(
                            type_=types_api_error_ApiError,  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            if _response.status_code == 500:
                raise InternalServerError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        types_api_error_ApiError,
                        parse_obj_as(
                            type_=types_api_error_ApiError,  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            _response_json = _response.json()
        except JSONDecodeError:
            raise core_api_error_ApiError(
                status_code=_response.status_code, headers=dict(_response.headers), body=_response.text
            )
        raise core_api_error_ApiError(
            status_code=_response.status_code, headers=dict(_response.headers), body=_response_json
        )

    async def count_plan_entitlements(
        self,
        *,
        feature_id: typing.Optional[str] = None,
        feature_ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
        ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
        plan_id: typing.Optional[str] = None,
        plan_ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
        q: typing.Optional[str] = None,
        with_metered_products: typing.Optional[bool] = None,
        limit: typing.Optional[int] = None,
        offset: typing.Optional[int] = None,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> AsyncHttpResponse[CountPlanEntitlementsResponse]:
        """
        Parameters
        ----------
        feature_id : typing.Optional[str]
            Filter plan entitlements by a single feature ID (starting with feat_)

        feature_ids : typing.Optional[typing.Union[str, typing.Sequence[str]]]
            Filter plan entitlements by multiple feature IDs (starting with feat_)

        ids : typing.Optional[typing.Union[str, typing.Sequence[str]]]
            Filter plan entitlements by multiple plan entitlement IDs (starting with pltl_)

        plan_id : typing.Optional[str]
            Filter plan entitlements by a single plan ID (starting with plan_)

        plan_ids : typing.Optional[typing.Union[str, typing.Sequence[str]]]
            Filter plan entitlements by multiple plan IDs (starting with plan_)

        q : typing.Optional[str]
            Search for plan entitlements by feature or company name

        with_metered_products : typing.Optional[bool]
            Filter plan entitlements only with metered products

        limit : typing.Optional[int]
            Page limit (default 100)

        offset : typing.Optional[int]
            Page offset (default 0)

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        AsyncHttpResponse[CountPlanEntitlementsResponse]
            OK
        """
        _response = await self._client_wrapper.httpx_client.request(
            "plan-entitlements/count",
            method="GET",
            params={
                "feature_id": feature_id,
                "feature_ids": feature_ids,
                "ids": ids,
                "plan_id": plan_id,
                "plan_ids": plan_ids,
                "q": q,
                "with_metered_products": with_metered_products,
                "limit": limit,
                "offset": offset,
            },
            request_options=request_options,
        )
        try:
            if 200 <= _response.status_code < 300:
                _data = typing.cast(
                    CountPlanEntitlementsResponse,
                    parse_obj_as(
                        type_=CountPlanEntitlementsResponse,  # type: ignore
                        object_=_response.json(),
                    ),
                )
                return AsyncHttpResponse(response=_response, data=_data)
            if _response.status_code == 400:
                raise BadRequestError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        types_api_error_ApiError,
                        parse_obj_as(
                            type_=types_api_error_ApiError,  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            if _response.status_code == 401:
                raise UnauthorizedError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        types_api_error_ApiError,
                        parse_obj_as(
                            type_=types_api_error_ApiError,  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            if _response.status_code == 403:
                raise ForbiddenError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        types_api_error_ApiError,
                        parse_obj_as(
                            type_=types_api_error_ApiError,  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            if _response.status_code == 404:
                raise NotFoundError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        types_api_error_ApiError,
                        parse_obj_as(
                            type_=types_api_error_ApiError,  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            if _response.status_code == 500:
                raise InternalServerError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        types_api_error_ApiError,
                        parse_obj_as(
                            type_=types_api_error_ApiError,  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            _response_json = _response.json()
        except JSONDecodeError:
            raise core_api_error_ApiError(
                status_code=_response.status_code, headers=dict(_response.headers), body=_response.text
            )
        raise core_api_error_ApiError(
            status_code=_response.status_code, headers=dict(_response.headers), body=_response_json
        )

    async def get_feature_usage_by_company(
        self, *, keys: typing.Dict[str, str], request_options: typing.Optional[RequestOptions] = None
    ) -> AsyncHttpResponse[GetFeatureUsageByCompanyResponse]:
        """
        Parameters
        ----------
        keys : typing.Dict[str, str]
            Key/value pairs

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        AsyncHttpResponse[GetFeatureUsageByCompanyResponse]
            OK
        """
        _response = await self._client_wrapper.httpx_client.request(
            "usage-by-company",
            method="GET",
            params={
                "keys": keys,
            },
            request_options=request_options,
        )
        try:
            if 200 <= _response.status_code < 300:
                _data = typing.cast(
                    GetFeatureUsageByCompanyResponse,
                    parse_obj_as(
                        type_=GetFeatureUsageByCompanyResponse,  # type: ignore
                        object_=_response.json(),
                    ),
                )
                return AsyncHttpResponse(response=_response, data=_data)
            if _response.status_code == 401:
                raise UnauthorizedError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        types_api_error_ApiError,
                        parse_obj_as(
                            type_=types_api_error_ApiError,  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            if _response.status_code == 403:
                raise ForbiddenError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        types_api_error_ApiError,
                        parse_obj_as(
                            type_=types_api_error_ApiError,  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            if _response.status_code == 404:
                raise NotFoundError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        types_api_error_ApiError,
                        parse_obj_as(
                            type_=types_api_error_ApiError,  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            if _response.status_code == 500:
                raise InternalServerError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        types_api_error_ApiError,
                        parse_obj_as(
                            type_=types_api_error_ApiError,  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            _response_json = _response.json()
        except JSONDecodeError:
            raise core_api_error_ApiError(
                status_code=_response.status_code, headers=dict(_response.headers), body=_response.text
            )
        raise core_api_error_ApiError(
            status_code=_response.status_code, headers=dict(_response.headers), body=_response_json
        )
