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

import datetime as dt
import typing

from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
from ..core.request_options import RequestOptions
from ..types.entity_type import EntityType
from ..types.sort_direction import SortDirection
from ..types.subscription_status import SubscriptionStatus
from ..types.subscription_type import SubscriptionType
from ..types.trait_type import TraitType
from ..types.update_plan_trait_trait_request_body import UpdatePlanTraitTraitRequestBody
from .raw_client import AsyncRawCompaniesClient, RawCompaniesClient
from .types.count_companies_for_advanced_filter_response import CountCompaniesForAdvancedFilterResponse
from .types.count_companies_response import CountCompaniesResponse
from .types.count_entity_key_definitions_response import CountEntityKeyDefinitionsResponse
from .types.count_entity_trait_definitions_response import CountEntityTraitDefinitionsResponse
from .types.count_plan_traits_response import CountPlanTraitsResponse
from .types.count_users_response import CountUsersResponse
from .types.create_company_response import CreateCompanyResponse
from .types.create_plan_trait_response import CreatePlanTraitResponse
from .types.create_user_response import CreateUserResponse
from .types.delete_company_by_keys_response import DeleteCompanyByKeysResponse
from .types.delete_company_membership_response import DeleteCompanyMembershipResponse
from .types.delete_company_response import DeleteCompanyResponse
from .types.delete_plan_trait_response import DeletePlanTraitResponse
from .types.delete_user_by_keys_response import DeleteUserByKeysResponse
from .types.delete_user_response import DeleteUserResponse
from .types.get_active_company_subscription_response import GetActiveCompanySubscriptionResponse
from .types.get_company_response import GetCompanyResponse
from .types.get_entity_trait_definition_response import GetEntityTraitDefinitionResponse
from .types.get_entity_trait_values_response import GetEntityTraitValuesResponse
from .types.get_or_create_company_membership_response import GetOrCreateCompanyMembershipResponse
from .types.get_or_create_entity_trait_definition_response import GetOrCreateEntityTraitDefinitionResponse
from .types.get_plan_change_response import GetPlanChangeResponse
from .types.get_plan_trait_response import GetPlanTraitResponse
from .types.get_user_response import GetUserResponse
from .types.list_companies_for_advanced_filter_response import ListCompaniesForAdvancedFilterResponse
from .types.list_companies_response import ListCompaniesResponse
from .types.list_company_memberships_response import ListCompanyMembershipsResponse
from .types.list_entity_key_definitions_response import ListEntityKeyDefinitionsResponse
from .types.list_entity_trait_definitions_response import ListEntityTraitDefinitionsResponse
from .types.list_plan_changes_response import ListPlanChangesResponse
from .types.list_plan_traits_response import ListPlanTraitsResponse
from .types.list_users_response import ListUsersResponse
from .types.lookup_company_response import LookupCompanyResponse
from .types.lookup_user_response import LookupUserResponse
from .types.update_entity_trait_definition_response import UpdateEntityTraitDefinitionResponse
from .types.update_plan_trait_response import UpdatePlanTraitResponse
from .types.update_plan_traits_bulk_response import UpdatePlanTraitsBulkResponse
from .types.upsert_company_response import UpsertCompanyResponse
from .types.upsert_company_trait_response import UpsertCompanyTraitResponse
from .types.upsert_user_response import UpsertUserResponse
from .types.upsert_user_trait_response import UpsertUserTraitResponse

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


class CompaniesClient:
    def __init__(self, *, client_wrapper: SyncClientWrapper):
        self._raw_client = RawCompaniesClient(client_wrapper=client_wrapper)

    @property
    def with_raw_response(self) -> RawCompaniesClient:
        """
        Retrieves a raw implementation of this client that returns raw responses.

        Returns
        -------
        RawCompaniesClient
        """
        return self._raw_client

    def list_companies(
        self,
        *,
        ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
        plan_id: typing.Optional[str] = None,
        q: typing.Optional[str] = None,
        without_feature_override_for: typing.Optional[str] = None,
        without_plan: typing.Optional[bool] = None,
        with_subscription: typing.Optional[bool] = None,
        limit: typing.Optional[int] = None,
        offset: typing.Optional[int] = None,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> ListCompaniesResponse:
        """
        Parameters
        ----------
        ids : typing.Optional[typing.Union[str, typing.Sequence[str]]]
            Filter companies by multiple company IDs (starts with comp_)

        plan_id : typing.Optional[str]
            Filter companies by plan ID (starts with plan_)

        q : typing.Optional[str]
            Search for companies by name, keys or string traits

        without_feature_override_for : typing.Optional[str]
            Filter out companies that already have a company override for the specified feature ID

        without_plan : typing.Optional[bool]
            Filter out companies that have a plan

        with_subscription : typing.Optional[bool]
            Filter companies that have a subscription

        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
        -------
        ListCompaniesResponse
            OK

        Examples
        --------
        from schematic import Schematic

        client = Schematic(
            api_key="YOUR_API_KEY",
        )
        client.companies.list_companies(
            plan_id="plan_id",
            q="q",
            without_feature_override_for="without_feature_override_for",
            without_plan=True,
            with_subscription=True,
            limit=1,
            offset=1,
        )
        """
        _response = self._raw_client.list_companies(
            ids=ids,
            plan_id=plan_id,
            q=q,
            without_feature_override_for=without_feature_override_for,
            without_plan=without_plan,
            with_subscription=with_subscription,
            limit=limit,
            offset=offset,
            request_options=request_options,
        )
        return _response.data

    def upsert_company(
        self,
        *,
        keys: typing.Dict[str, str],
        id: typing.Optional[str] = OMIT,
        last_seen_at: typing.Optional[dt.datetime] = OMIT,
        name: typing.Optional[str] = OMIT,
        traits: typing.Optional[typing.Dict[str, typing.Any]] = OMIT,
        update_only: typing.Optional[bool] = OMIT,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> UpsertCompanyResponse:
        """
        Parameters
        ----------
        keys : typing.Dict[str, str]
            See [Key Management](https://docs.schematichq.com/developer_resources/key_management) for more information

        id : typing.Optional[str]
            If you know the Schematic ID, you can use that here instead of keys

        last_seen_at : typing.Optional[dt.datetime]

        name : typing.Optional[str]

        traits : typing.Optional[typing.Dict[str, typing.Any]]
            A map of trait names to trait values

        update_only : typing.Optional[bool]

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

        Returns
        -------
        UpsertCompanyResponse
            OK

        Examples
        --------
        from schematic import Schematic

        client = Schematic(
            api_key="YOUR_API_KEY",
        )
        client.companies.upsert_company(
            keys={"key": "value"},
        )
        """
        _response = self._raw_client.upsert_company(
            keys=keys,
            id=id,
            last_seen_at=last_seen_at,
            name=name,
            traits=traits,
            update_only=update_only,
            request_options=request_options,
        )
        return _response.data

    def get_company(
        self, company_id: str, *, request_options: typing.Optional[RequestOptions] = None
    ) -> GetCompanyResponse:
        """
        Parameters
        ----------
        company_id : str
            company_id

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

        Returns
        -------
        GetCompanyResponse
            OK

        Examples
        --------
        from schematic import Schematic

        client = Schematic(
            api_key="YOUR_API_KEY",
        )
        client.companies.get_company(
            company_id="company_id",
        )
        """
        _response = self._raw_client.get_company(company_id, request_options=request_options)
        return _response.data

    def delete_company(
        self,
        company_id: str,
        *,
        cancel_subscription: typing.Optional[bool] = None,
        prorate: typing.Optional[bool] = None,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> DeleteCompanyResponse:
        """
        Parameters
        ----------
        company_id : str
            company_id

        cancel_subscription : typing.Optional[bool]

        prorate : typing.Optional[bool]

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

        Returns
        -------
        DeleteCompanyResponse
            OK

        Examples
        --------
        from schematic import Schematic

        client = Schematic(
            api_key="YOUR_API_KEY",
        )
        client.companies.delete_company(
            company_id="company_id",
            cancel_subscription=True,
            prorate=True,
        )
        """
        _response = self._raw_client.delete_company(
            company_id, cancel_subscription=cancel_subscription, prorate=prorate, request_options=request_options
        )
        return _response.data

    def count_companies(
        self,
        *,
        ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
        plan_id: typing.Optional[str] = None,
        q: typing.Optional[str] = None,
        without_feature_override_for: typing.Optional[str] = None,
        without_plan: typing.Optional[bool] = None,
        with_subscription: typing.Optional[bool] = None,
        limit: typing.Optional[int] = None,
        offset: typing.Optional[int] = None,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> CountCompaniesResponse:
        """
        Parameters
        ----------
        ids : typing.Optional[typing.Union[str, typing.Sequence[str]]]
            Filter companies by multiple company IDs (starts with comp_)

        plan_id : typing.Optional[str]
            Filter companies by plan ID (starts with plan_)

        q : typing.Optional[str]
            Search for companies by name, keys or string traits

        without_feature_override_for : typing.Optional[str]
            Filter out companies that already have a company override for the specified feature ID

        without_plan : typing.Optional[bool]
            Filter out companies that have a plan

        with_subscription : typing.Optional[bool]
            Filter companies that have a subscription

        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
        -------
        CountCompaniesResponse
            OK

        Examples
        --------
        from schematic import Schematic

        client = Schematic(
            api_key="YOUR_API_KEY",
        )
        client.companies.count_companies(
            plan_id="plan_id",
            q="q",
            without_feature_override_for="without_feature_override_for",
            without_plan=True,
            with_subscription=True,
            limit=1,
            offset=1,
        )
        """
        _response = self._raw_client.count_companies(
            ids=ids,
            plan_id=plan_id,
            q=q,
            without_feature_override_for=without_feature_override_for,
            without_plan=without_plan,
            with_subscription=with_subscription,
            limit=limit,
            offset=offset,
            request_options=request_options,
        )
        return _response.data

    def count_companies_for_advanced_filter(
        self,
        *,
        ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
        plan_ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
        feature_ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
        credit_type_ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
        subscription_statuses: typing.Optional[
            typing.Union[SubscriptionStatus, typing.Sequence[SubscriptionStatus]]
        ] = None,
        subscription_types: typing.Optional[typing.Union[SubscriptionType, typing.Sequence[SubscriptionType]]] = None,
        monetized_subscriptions: typing.Optional[bool] = None,
        q: typing.Optional[str] = None,
        without_plan: typing.Optional[bool] = None,
        without_subscription: typing.Optional[bool] = None,
        sort_order_column: typing.Optional[str] = None,
        sort_order_direction: typing.Optional[SortDirection] = None,
        display_properties: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
        limit: typing.Optional[int] = None,
        offset: typing.Optional[int] = None,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> CountCompaniesForAdvancedFilterResponse:
        """
        Parameters
        ----------
        ids : typing.Optional[typing.Union[str, typing.Sequence[str]]]
            Filter companies by multiple company IDs (starts with comp_)

        plan_ids : typing.Optional[typing.Union[str, typing.Sequence[str]]]
            Filter companies by one or more plan IDs (each ID starts with plan_)

        feature_ids : typing.Optional[typing.Union[str, typing.Sequence[str]]]
            Filter companies by one or more feature IDs (each ID starts with feat_)

        credit_type_ids : typing.Optional[typing.Union[str, typing.Sequence[str]]]
            Filter companies by one or more credit type IDs (each ID starts with bcrd_)

        subscription_statuses : typing.Optional[typing.Union[SubscriptionStatus, typing.Sequence[SubscriptionStatus]]]
            Filter companies by one or more subscription statuses (active, canceled, expired, incomplete, incomplete_expired, past_due, paused, trialing, unpaid)

        subscription_types : typing.Optional[typing.Union[SubscriptionType, typing.Sequence[SubscriptionType]]]
            Filter companies by one or more subscription types (paid, free, trial)

        monetized_subscriptions : typing.Optional[bool]
            Filter companies that have monetized subscriptions

        q : typing.Optional[str]
            Search for companies by name, keys or string traits

        without_plan : typing.Optional[bool]
            Filter out companies that have a plan

        without_subscription : typing.Optional[bool]
            Filter out companies that have a subscription

        sort_order_column : typing.Optional[str]
            Column to sort by (e.g. name, created_at, last_seen_at)

        sort_order_direction : typing.Optional[SortDirection]
            Direction to sort by (asc or desc)

        display_properties : typing.Optional[typing.Union[str, typing.Sequence[str]]]
            Select the display columns to return (e.g. plan, subscription, users, last_seen_at)

        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
        -------
        CountCompaniesForAdvancedFilterResponse
            OK

        Examples
        --------
        from schematic import Schematic

        client = Schematic(
            api_key="YOUR_API_KEY",
        )
        client.companies.count_companies_for_advanced_filter(
            monetized_subscriptions=True,
            q="q",
            without_plan=True,
            without_subscription=True,
            sort_order_column="sort_order_column",
            sort_order_direction="asc",
            limit=1,
            offset=1,
        )
        """
        _response = self._raw_client.count_companies_for_advanced_filter(
            ids=ids,
            plan_ids=plan_ids,
            feature_ids=feature_ids,
            credit_type_ids=credit_type_ids,
            subscription_statuses=subscription_statuses,
            subscription_types=subscription_types,
            monetized_subscriptions=monetized_subscriptions,
            q=q,
            without_plan=without_plan,
            without_subscription=without_subscription,
            sort_order_column=sort_order_column,
            sort_order_direction=sort_order_direction,
            display_properties=display_properties,
            limit=limit,
            offset=offset,
            request_options=request_options,
        )
        return _response.data

    def create_company(
        self,
        *,
        keys: typing.Dict[str, str],
        id: typing.Optional[str] = OMIT,
        last_seen_at: typing.Optional[dt.datetime] = OMIT,
        name: typing.Optional[str] = OMIT,
        traits: typing.Optional[typing.Dict[str, typing.Any]] = OMIT,
        update_only: typing.Optional[bool] = OMIT,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> CreateCompanyResponse:
        """
        Parameters
        ----------
        keys : typing.Dict[str, str]
            See [Key Management](https://docs.schematichq.com/developer_resources/key_management) for more information

        id : typing.Optional[str]
            If you know the Schematic ID, you can use that here instead of keys

        last_seen_at : typing.Optional[dt.datetime]

        name : typing.Optional[str]

        traits : typing.Optional[typing.Dict[str, typing.Any]]
            A map of trait names to trait values

        update_only : typing.Optional[bool]

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

        Returns
        -------
        CreateCompanyResponse
            Created

        Examples
        --------
        from schematic import Schematic

        client = Schematic(
            api_key="YOUR_API_KEY",
        )
        client.companies.create_company(
            keys={"key": "value"},
        )
        """
        _response = self._raw_client.create_company(
            keys=keys,
            id=id,
            last_seen_at=last_seen_at,
            name=name,
            traits=traits,
            update_only=update_only,
            request_options=request_options,
        )
        return _response.data

    def delete_company_by_keys(
        self, *, keys: typing.Dict[str, str], request_options: typing.Optional[RequestOptions] = None
    ) -> DeleteCompanyByKeysResponse:
        """
        Parameters
        ----------
        keys : typing.Dict[str, str]

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

        Returns
        -------
        DeleteCompanyByKeysResponse
            OK

        Examples
        --------
        from schematic import Schematic

        client = Schematic(
            api_key="YOUR_API_KEY",
        )
        client.companies.delete_company_by_keys(
            keys={"key": "value"},
        )
        """
        _response = self._raw_client.delete_company_by_keys(keys=keys, request_options=request_options)
        return _response.data

    def list_companies_for_advanced_filter(
        self,
        *,
        ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
        plan_ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
        feature_ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
        credit_type_ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
        subscription_statuses: typing.Optional[
            typing.Union[SubscriptionStatus, typing.Sequence[SubscriptionStatus]]
        ] = None,
        subscription_types: typing.Optional[typing.Union[SubscriptionType, typing.Sequence[SubscriptionType]]] = None,
        monetized_subscriptions: typing.Optional[bool] = None,
        q: typing.Optional[str] = None,
        without_plan: typing.Optional[bool] = None,
        without_subscription: typing.Optional[bool] = None,
        sort_order_column: typing.Optional[str] = None,
        sort_order_direction: typing.Optional[SortDirection] = None,
        display_properties: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
        limit: typing.Optional[int] = None,
        offset: typing.Optional[int] = None,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> ListCompaniesForAdvancedFilterResponse:
        """
        Parameters
        ----------
        ids : typing.Optional[typing.Union[str, typing.Sequence[str]]]
            Filter companies by multiple company IDs (starts with comp_)

        plan_ids : typing.Optional[typing.Union[str, typing.Sequence[str]]]
            Filter companies by one or more plan IDs (each ID starts with plan_)

        feature_ids : typing.Optional[typing.Union[str, typing.Sequence[str]]]
            Filter companies by one or more feature IDs (each ID starts with feat_)

        credit_type_ids : typing.Optional[typing.Union[str, typing.Sequence[str]]]
            Filter companies by one or more credit type IDs (each ID starts with bcrd_)

        subscription_statuses : typing.Optional[typing.Union[SubscriptionStatus, typing.Sequence[SubscriptionStatus]]]
            Filter companies by one or more subscription statuses (active, canceled, expired, incomplete, incomplete_expired, past_due, paused, trialing, unpaid)

        subscription_types : typing.Optional[typing.Union[SubscriptionType, typing.Sequence[SubscriptionType]]]
            Filter companies by one or more subscription types (paid, free, trial)

        monetized_subscriptions : typing.Optional[bool]
            Filter companies that have monetized subscriptions

        q : typing.Optional[str]
            Search for companies by name, keys or string traits

        without_plan : typing.Optional[bool]
            Filter out companies that have a plan

        without_subscription : typing.Optional[bool]
            Filter out companies that have a subscription

        sort_order_column : typing.Optional[str]
            Column to sort by (e.g. name, created_at, last_seen_at)

        sort_order_direction : typing.Optional[SortDirection]
            Direction to sort by (asc or desc)

        display_properties : typing.Optional[typing.Union[str, typing.Sequence[str]]]
            Select the display columns to return (e.g. plan, subscription, users, last_seen_at)

        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
        -------
        ListCompaniesForAdvancedFilterResponse
            OK

        Examples
        --------
        from schematic import Schematic

        client = Schematic(
            api_key="YOUR_API_KEY",
        )
        client.companies.list_companies_for_advanced_filter(
            monetized_subscriptions=True,
            q="q",
            without_plan=True,
            without_subscription=True,
            sort_order_column="sort_order_column",
            sort_order_direction="asc",
            limit=1,
            offset=1,
        )
        """
        _response = self._raw_client.list_companies_for_advanced_filter(
            ids=ids,
            plan_ids=plan_ids,
            feature_ids=feature_ids,
            credit_type_ids=credit_type_ids,
            subscription_statuses=subscription_statuses,
            subscription_types=subscription_types,
            monetized_subscriptions=monetized_subscriptions,
            q=q,
            without_plan=without_plan,
            without_subscription=without_subscription,
            sort_order_column=sort_order_column,
            sort_order_direction=sort_order_direction,
            display_properties=display_properties,
            limit=limit,
            offset=offset,
            request_options=request_options,
        )
        return _response.data

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

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

        Returns
        -------
        LookupCompanyResponse
            OK

        Examples
        --------
        from schematic import Schematic

        client = Schematic(
            api_key="YOUR_API_KEY",
        )
        client.companies.lookup_company(
            keys={"keys": "keys"},
        )
        """
        _response = self._raw_client.lookup_company(keys=keys, request_options=request_options)
        return _response.data

    def list_company_memberships(
        self,
        *,
        company_id: typing.Optional[str] = None,
        user_id: typing.Optional[str] = None,
        limit: typing.Optional[int] = None,
        offset: typing.Optional[int] = None,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> ListCompanyMembershipsResponse:
        """
        Parameters
        ----------
        company_id : typing.Optional[str]

        user_id : 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
        -------
        ListCompanyMembershipsResponse
            OK

        Examples
        --------
        from schematic import Schematic

        client = Schematic(
            api_key="YOUR_API_KEY",
        )
        client.companies.list_company_memberships(
            company_id="company_id",
            user_id="user_id",
            limit=1,
            offset=1,
        )
        """
        _response = self._raw_client.list_company_memberships(
            company_id=company_id, user_id=user_id, limit=limit, offset=offset, request_options=request_options
        )
        return _response.data

    def get_or_create_company_membership(
        self, *, company_id: str, user_id: str, request_options: typing.Optional[RequestOptions] = None
    ) -> GetOrCreateCompanyMembershipResponse:
        """
        Parameters
        ----------
        company_id : str

        user_id : str

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

        Returns
        -------
        GetOrCreateCompanyMembershipResponse
            OK

        Examples
        --------
        from schematic import Schematic

        client = Schematic(
            api_key="YOUR_API_KEY",
        )
        client.companies.get_or_create_company_membership(
            company_id="company_id",
            user_id="user_id",
        )
        """
        _response = self._raw_client.get_or_create_company_membership(
            company_id=company_id, user_id=user_id, request_options=request_options
        )
        return _response.data

    def delete_company_membership(
        self, company_membership_id: str, *, request_options: typing.Optional[RequestOptions] = None
    ) -> DeleteCompanyMembershipResponse:
        """
        Parameters
        ----------
        company_membership_id : str
            company_membership_id

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

        Returns
        -------
        DeleteCompanyMembershipResponse
            OK

        Examples
        --------
        from schematic import Schematic

        client = Schematic(
            api_key="YOUR_API_KEY",
        )
        client.companies.delete_company_membership(
            company_membership_id="company_membership_id",
        )
        """
        _response = self._raw_client.delete_company_membership(company_membership_id, request_options=request_options)
        return _response.data

    def get_active_company_subscription(
        self,
        *,
        company_id: typing.Optional[str] = None,
        company_ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
        limit: typing.Optional[int] = None,
        offset: typing.Optional[int] = None,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> GetActiveCompanySubscriptionResponse:
        """
        Parameters
        ----------
        company_id : typing.Optional[str]

        company_ids : typing.Optional[typing.Union[str, typing.Sequence[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
        -------
        GetActiveCompanySubscriptionResponse
            OK

        Examples
        --------
        from schematic import Schematic

        client = Schematic(
            api_key="YOUR_API_KEY",
        )
        client.companies.get_active_company_subscription(
            company_id="company_id",
            limit=1,
            offset=1,
        )
        """
        _response = self._raw_client.get_active_company_subscription(
            company_id=company_id, company_ids=company_ids, limit=limit, offset=offset, request_options=request_options
        )
        return _response.data

    def upsert_company_trait(
        self,
        *,
        keys: typing.Dict[str, str],
        trait: str,
        incr: typing.Optional[int] = OMIT,
        set_: typing.Optional[str] = OMIT,
        update_only: typing.Optional[bool] = OMIT,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> UpsertCompanyTraitResponse:
        """
        Parameters
        ----------
        keys : typing.Dict[str, str]
            Key/value pairs to identify a company or user

        trait : str
            Name of the trait to update

        incr : typing.Optional[int]
            Amount to increment the trait by (positive or negative)

        set_ : typing.Optional[str]
            Value to set the trait to

        update_only : typing.Optional[bool]
            Unless this is set, the company or user will be created if it does not already exist

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

        Returns
        -------
        UpsertCompanyTraitResponse
            OK

        Examples
        --------
        from schematic import Schematic

        client = Schematic(
            api_key="YOUR_API_KEY",
        )
        client.companies.upsert_company_trait(
            keys={"key": "value"},
            trait="trait",
        )
        """
        _response = self._raw_client.upsert_company_trait(
            keys=keys, trait=trait, incr=incr, set_=set_, update_only=update_only, request_options=request_options
        )
        return _response.data

    def list_entity_key_definitions(
        self,
        *,
        entity_type: typing.Optional[EntityType] = None,
        ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
        q: typing.Optional[str] = None,
        limit: typing.Optional[int] = None,
        offset: typing.Optional[int] = None,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> ListEntityKeyDefinitionsResponse:
        """
        Parameters
        ----------
        entity_type : typing.Optional[EntityType]

        ids : typing.Optional[typing.Union[str, typing.Sequence[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
        -------
        ListEntityKeyDefinitionsResponse
            OK

        Examples
        --------
        from schematic import Schematic

        client = Schematic(
            api_key="YOUR_API_KEY",
        )
        client.companies.list_entity_key_definitions(
            entity_type="company",
            q="q",
            limit=1,
            offset=1,
        )
        """
        _response = self._raw_client.list_entity_key_definitions(
            entity_type=entity_type, ids=ids, q=q, limit=limit, offset=offset, request_options=request_options
        )
        return _response.data

    def count_entity_key_definitions(
        self,
        *,
        entity_type: typing.Optional[EntityType] = None,
        ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
        q: typing.Optional[str] = None,
        limit: typing.Optional[int] = None,
        offset: typing.Optional[int] = None,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> CountEntityKeyDefinitionsResponse:
        """
        Parameters
        ----------
        entity_type : typing.Optional[EntityType]

        ids : typing.Optional[typing.Union[str, typing.Sequence[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
        -------
        CountEntityKeyDefinitionsResponse
            OK

        Examples
        --------
        from schematic import Schematic

        client = Schematic(
            api_key="YOUR_API_KEY",
        )
        client.companies.count_entity_key_definitions(
            entity_type="company",
            q="q",
            limit=1,
            offset=1,
        )
        """
        _response = self._raw_client.count_entity_key_definitions(
            entity_type=entity_type, ids=ids, q=q, limit=limit, offset=offset, request_options=request_options
        )
        return _response.data

    def list_entity_trait_definitions(
        self,
        *,
        entity_type: typing.Optional[EntityType] = None,
        ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
        q: typing.Optional[str] = None,
        trait_type: typing.Optional[TraitType] = None,
        trait_types: typing.Optional[typing.Union[TraitType, typing.Sequence[TraitType]]] = None,
        limit: typing.Optional[int] = None,
        offset: typing.Optional[int] = None,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> ListEntityTraitDefinitionsResponse:
        """
        Parameters
        ----------
        entity_type : typing.Optional[EntityType]

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

        q : typing.Optional[str]

        trait_type : typing.Optional[TraitType]

        trait_types : typing.Optional[typing.Union[TraitType, typing.Sequence[TraitType]]]

        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
        -------
        ListEntityTraitDefinitionsResponse
            OK

        Examples
        --------
        from schematic import Schematic

        client = Schematic(
            api_key="YOUR_API_KEY",
        )
        client.companies.list_entity_trait_definitions(
            entity_type="company",
            q="q",
            trait_type="boolean",
            limit=1,
            offset=1,
        )
        """
        _response = self._raw_client.list_entity_trait_definitions(
            entity_type=entity_type,
            ids=ids,
            q=q,
            trait_type=trait_type,
            trait_types=trait_types,
            limit=limit,
            offset=offset,
            request_options=request_options,
        )
        return _response.data

    def get_or_create_entity_trait_definition(
        self,
        *,
        entity_type: EntityType,
        hierarchy: typing.Sequence[str],
        trait_type: TraitType,
        display_name: typing.Optional[str] = OMIT,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> GetOrCreateEntityTraitDefinitionResponse:
        """
        Parameters
        ----------
        entity_type : EntityType

        hierarchy : typing.Sequence[str]

        trait_type : TraitType

        display_name : typing.Optional[str]

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

        Returns
        -------
        GetOrCreateEntityTraitDefinitionResponse
            OK

        Examples
        --------
        from schematic import Schematic

        client = Schematic(
            api_key="YOUR_API_KEY",
        )
        client.companies.get_or_create_entity_trait_definition(
            entity_type="company",
            hierarchy=["hierarchy"],
            trait_type="boolean",
        )
        """
        _response = self._raw_client.get_or_create_entity_trait_definition(
            entity_type=entity_type,
            hierarchy=hierarchy,
            trait_type=trait_type,
            display_name=display_name,
            request_options=request_options,
        )
        return _response.data

    def get_entity_trait_definition(
        self, entity_trait_definition_id: str, *, request_options: typing.Optional[RequestOptions] = None
    ) -> GetEntityTraitDefinitionResponse:
        """
        Parameters
        ----------
        entity_trait_definition_id : str
            entity_trait_definition_id

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

        Returns
        -------
        GetEntityTraitDefinitionResponse
            OK

        Examples
        --------
        from schematic import Schematic

        client = Schematic(
            api_key="YOUR_API_KEY",
        )
        client.companies.get_entity_trait_definition(
            entity_trait_definition_id="entity_trait_definition_id",
        )
        """
        _response = self._raw_client.get_entity_trait_definition(
            entity_trait_definition_id, request_options=request_options
        )
        return _response.data

    def update_entity_trait_definition(
        self,
        entity_trait_definition_id: str,
        *,
        trait_type: TraitType,
        display_name: typing.Optional[str] = OMIT,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> UpdateEntityTraitDefinitionResponse:
        """
        Parameters
        ----------
        entity_trait_definition_id : str
            entity_trait_definition_id

        trait_type : TraitType

        display_name : typing.Optional[str]

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

        Returns
        -------
        UpdateEntityTraitDefinitionResponse
            OK

        Examples
        --------
        from schematic import Schematic

        client = Schematic(
            api_key="YOUR_API_KEY",
        )
        client.companies.update_entity_trait_definition(
            entity_trait_definition_id="entity_trait_definition_id",
            trait_type="boolean",
        )
        """
        _response = self._raw_client.update_entity_trait_definition(
            entity_trait_definition_id,
            trait_type=trait_type,
            display_name=display_name,
            request_options=request_options,
        )
        return _response.data

    def count_entity_trait_definitions(
        self,
        *,
        entity_type: typing.Optional[EntityType] = None,
        ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
        q: typing.Optional[str] = None,
        trait_type: typing.Optional[TraitType] = None,
        trait_types: typing.Optional[typing.Union[TraitType, typing.Sequence[TraitType]]] = None,
        limit: typing.Optional[int] = None,
        offset: typing.Optional[int] = None,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> CountEntityTraitDefinitionsResponse:
        """
        Parameters
        ----------
        entity_type : typing.Optional[EntityType]

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

        q : typing.Optional[str]

        trait_type : typing.Optional[TraitType]

        trait_types : typing.Optional[typing.Union[TraitType, typing.Sequence[TraitType]]]

        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
        -------
        CountEntityTraitDefinitionsResponse
            OK

        Examples
        --------
        from schematic import Schematic

        client = Schematic(
            api_key="YOUR_API_KEY",
        )
        client.companies.count_entity_trait_definitions(
            entity_type="company",
            q="q",
            trait_type="boolean",
            limit=1,
            offset=1,
        )
        """
        _response = self._raw_client.count_entity_trait_definitions(
            entity_type=entity_type,
            ids=ids,
            q=q,
            trait_type=trait_type,
            trait_types=trait_types,
            limit=limit,
            offset=offset,
            request_options=request_options,
        )
        return _response.data

    def get_entity_trait_values(
        self,
        *,
        definition_id: str,
        q: typing.Optional[str] = None,
        limit: typing.Optional[int] = None,
        offset: typing.Optional[int] = None,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> GetEntityTraitValuesResponse:
        """
        Parameters
        ----------
        definition_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
        -------
        GetEntityTraitValuesResponse
            OK

        Examples
        --------
        from schematic import Schematic

        client = Schematic(
            api_key="YOUR_API_KEY",
        )
        client.companies.get_entity_trait_values(
            definition_id="definition_id",
            q="q",
            limit=1,
            offset=1,
        )
        """
        _response = self._raw_client.get_entity_trait_values(
            definition_id=definition_id, q=q, limit=limit, offset=offset, request_options=request_options
        )
        return _response.data

    def list_plan_changes(
        self,
        *,
        action: typing.Optional[str] = None,
        base_plan_action: typing.Optional[str] = None,
        company_id: typing.Optional[str] = None,
        company_ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
        plan_ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
        limit: typing.Optional[int] = None,
        offset: typing.Optional[int] = None,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> ListPlanChangesResponse:
        """
        Parameters
        ----------
        action : typing.Optional[str]

        base_plan_action : typing.Optional[str]

        company_id : typing.Optional[str]

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

        plan_ids : typing.Optional[typing.Union[str, typing.Sequence[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
        -------
        ListPlanChangesResponse
            OK

        Examples
        --------
        from schematic import Schematic

        client = Schematic(
            api_key="YOUR_API_KEY",
        )
        client.companies.list_plan_changes(
            action="action",
            base_plan_action="base_plan_action",
            company_id="company_id",
            limit=1,
            offset=1,
        )
        """
        _response = self._raw_client.list_plan_changes(
            action=action,
            base_plan_action=base_plan_action,
            company_id=company_id,
            company_ids=company_ids,
            plan_ids=plan_ids,
            limit=limit,
            offset=offset,
            request_options=request_options,
        )
        return _response.data

    def get_plan_change(
        self, plan_change_id: str, *, request_options: typing.Optional[RequestOptions] = None
    ) -> GetPlanChangeResponse:
        """
        Parameters
        ----------
        plan_change_id : str
            plan_change_id

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

        Returns
        -------
        GetPlanChangeResponse
            OK

        Examples
        --------
        from schematic import Schematic

        client = Schematic(
            api_key="YOUR_API_KEY",
        )
        client.companies.get_plan_change(
            plan_change_id="plan_change_id",
        )
        """
        _response = self._raw_client.get_plan_change(plan_change_id, request_options=request_options)
        return _response.data

    def list_plan_traits(
        self,
        *,
        ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
        plan_id: typing.Optional[str] = None,
        trait_id: typing.Optional[str] = None,
        trait_ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
        limit: typing.Optional[int] = None,
        offset: typing.Optional[int] = None,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> ListPlanTraitsResponse:
        """
        Parameters
        ----------
        ids : typing.Optional[typing.Union[str, typing.Sequence[str]]]

        plan_id : typing.Optional[str]

        trait_id : typing.Optional[str]

        trait_ids : typing.Optional[typing.Union[str, typing.Sequence[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
        -------
        ListPlanTraitsResponse
            OK

        Examples
        --------
        from schematic import Schematic

        client = Schematic(
            api_key="YOUR_API_KEY",
        )
        client.companies.list_plan_traits(
            plan_id="plan_id",
            trait_id="trait_id",
            limit=1,
            offset=1,
        )
        """
        _response = self._raw_client.list_plan_traits(
            ids=ids,
            plan_id=plan_id,
            trait_id=trait_id,
            trait_ids=trait_ids,
            limit=limit,
            offset=offset,
            request_options=request_options,
        )
        return _response.data

    def create_plan_trait(
        self, *, plan_id: str, trait_id: str, trait_value: str, request_options: typing.Optional[RequestOptions] = None
    ) -> CreatePlanTraitResponse:
        """
        Parameters
        ----------
        plan_id : str

        trait_id : str

        trait_value : str

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

        Returns
        -------
        CreatePlanTraitResponse
            Created

        Examples
        --------
        from schematic import Schematic

        client = Schematic(
            api_key="YOUR_API_KEY",
        )
        client.companies.create_plan_trait(
            plan_id="plan_id",
            trait_id="trait_id",
            trait_value="trait_value",
        )
        """
        _response = self._raw_client.create_plan_trait(
            plan_id=plan_id, trait_id=trait_id, trait_value=trait_value, request_options=request_options
        )
        return _response.data

    def get_plan_trait(
        self, plan_trait_id: str, *, request_options: typing.Optional[RequestOptions] = None
    ) -> GetPlanTraitResponse:
        """
        Parameters
        ----------
        plan_trait_id : str
            plan_trait_id

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

        Returns
        -------
        GetPlanTraitResponse
            OK

        Examples
        --------
        from schematic import Schematic

        client = Schematic(
            api_key="YOUR_API_KEY",
        )
        client.companies.get_plan_trait(
            plan_trait_id="plan_trait_id",
        )
        """
        _response = self._raw_client.get_plan_trait(plan_trait_id, request_options=request_options)
        return _response.data

    def update_plan_trait(
        self,
        plan_trait_id: str,
        *,
        plan_id: str,
        trait_value: str,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> UpdatePlanTraitResponse:
        """
        Parameters
        ----------
        plan_trait_id : str
            plan_trait_id

        plan_id : str

        trait_value : str

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

        Returns
        -------
        UpdatePlanTraitResponse
            OK

        Examples
        --------
        from schematic import Schematic

        client = Schematic(
            api_key="YOUR_API_KEY",
        )
        client.companies.update_plan_trait(
            plan_trait_id="plan_trait_id",
            plan_id="plan_id",
            trait_value="trait_value",
        )
        """
        _response = self._raw_client.update_plan_trait(
            plan_trait_id, plan_id=plan_id, trait_value=trait_value, request_options=request_options
        )
        return _response.data

    def delete_plan_trait(
        self, plan_trait_id: str, *, request_options: typing.Optional[RequestOptions] = None
    ) -> DeletePlanTraitResponse:
        """
        Parameters
        ----------
        plan_trait_id : str
            plan_trait_id

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

        Returns
        -------
        DeletePlanTraitResponse
            OK

        Examples
        --------
        from schematic import Schematic

        client = Schematic(
            api_key="YOUR_API_KEY",
        )
        client.companies.delete_plan_trait(
            plan_trait_id="plan_trait_id",
        )
        """
        _response = self._raw_client.delete_plan_trait(plan_trait_id, request_options=request_options)
        return _response.data

    def update_plan_traits_bulk(
        self,
        *,
        apply_to_existing_companies: bool,
        plan_id: str,
        traits: typing.Sequence[UpdatePlanTraitTraitRequestBody],
        request_options: typing.Optional[RequestOptions] = None,
    ) -> UpdatePlanTraitsBulkResponse:
        """
        Parameters
        ----------
        apply_to_existing_companies : bool

        plan_id : str

        traits : typing.Sequence[UpdatePlanTraitTraitRequestBody]

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

        Returns
        -------
        UpdatePlanTraitsBulkResponse
            OK

        Examples
        --------
        from schematic import Schematic, UpdatePlanTraitTraitRequestBody

        client = Schematic(
            api_key="YOUR_API_KEY",
        )
        client.companies.update_plan_traits_bulk(
            apply_to_existing_companies=True,
            plan_id="plan_id",
            traits=[
                UpdatePlanTraitTraitRequestBody(
                    trait_id="trait_id",
                    trait_value="trait_value",
                )
            ],
        )
        """
        _response = self._raw_client.update_plan_traits_bulk(
            apply_to_existing_companies=apply_to_existing_companies,
            plan_id=plan_id,
            traits=traits,
            request_options=request_options,
        )
        return _response.data

    def count_plan_traits(
        self,
        *,
        ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
        plan_id: typing.Optional[str] = None,
        trait_id: typing.Optional[str] = None,
        trait_ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
        limit: typing.Optional[int] = None,
        offset: typing.Optional[int] = None,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> CountPlanTraitsResponse:
        """
        Parameters
        ----------
        ids : typing.Optional[typing.Union[str, typing.Sequence[str]]]

        plan_id : typing.Optional[str]

        trait_id : typing.Optional[str]

        trait_ids : typing.Optional[typing.Union[str, typing.Sequence[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
        -------
        CountPlanTraitsResponse
            OK

        Examples
        --------
        from schematic import Schematic

        client = Schematic(
            api_key="YOUR_API_KEY",
        )
        client.companies.count_plan_traits(
            plan_id="plan_id",
            trait_id="trait_id",
            limit=1,
            offset=1,
        )
        """
        _response = self._raw_client.count_plan_traits(
            ids=ids,
            plan_id=plan_id,
            trait_id=trait_id,
            trait_ids=trait_ids,
            limit=limit,
            offset=offset,
            request_options=request_options,
        )
        return _response.data

    def upsert_user_trait(
        self,
        *,
        keys: typing.Dict[str, str],
        trait: str,
        incr: typing.Optional[int] = OMIT,
        set_: typing.Optional[str] = OMIT,
        update_only: typing.Optional[bool] = OMIT,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> UpsertUserTraitResponse:
        """
        Parameters
        ----------
        keys : typing.Dict[str, str]
            Key/value pairs to identify a company or user

        trait : str
            Name of the trait to update

        incr : typing.Optional[int]
            Amount to increment the trait by (positive or negative)

        set_ : typing.Optional[str]
            Value to set the trait to

        update_only : typing.Optional[bool]
            Unless this is set, the company or user will be created if it does not already exist

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

        Returns
        -------
        UpsertUserTraitResponse
            OK

        Examples
        --------
        from schematic import Schematic

        client = Schematic(
            api_key="YOUR_API_KEY",
        )
        client.companies.upsert_user_trait(
            keys={"key": "value"},
            trait="trait",
        )
        """
        _response = self._raw_client.upsert_user_trait(
            keys=keys, trait=trait, incr=incr, set_=set_, update_only=update_only, request_options=request_options
        )
        return _response.data

    def list_users(
        self,
        *,
        company_id: typing.Optional[str] = None,
        ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
        plan_id: typing.Optional[str] = None,
        q: typing.Optional[str] = None,
        limit: typing.Optional[int] = None,
        offset: typing.Optional[int] = None,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> ListUsersResponse:
        """
        Parameters
        ----------
        company_id : typing.Optional[str]
            Filter users by company ID (starts with comp_)

        ids : typing.Optional[typing.Union[str, typing.Sequence[str]]]
            Filter users by multiple user IDs (starts with user_)

        plan_id : typing.Optional[str]
            Filter users by plan ID (starts with plan_)

        q : typing.Optional[str]
            Search for users by name, keys or string traits

        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
        -------
        ListUsersResponse
            OK

        Examples
        --------
        from schematic import Schematic

        client = Schematic(
            api_key="YOUR_API_KEY",
        )
        client.companies.list_users(
            company_id="company_id",
            plan_id="plan_id",
            q="q",
            limit=1,
            offset=1,
        )
        """
        _response = self._raw_client.list_users(
            company_id=company_id,
            ids=ids,
            plan_id=plan_id,
            q=q,
            limit=limit,
            offset=offset,
            request_options=request_options,
        )
        return _response.data

    def upsert_user(
        self,
        *,
        keys: typing.Dict[str, str],
        companies: typing.Optional[typing.Sequence[typing.Dict[str, str]]] = OMIT,
        company: typing.Optional[typing.Dict[str, str]] = OMIT,
        company_id: typing.Optional[str] = OMIT,
        company_ids: typing.Optional[typing.Sequence[str]] = OMIT,
        id: typing.Optional[str] = OMIT,
        last_seen_at: typing.Optional[dt.datetime] = OMIT,
        name: typing.Optional[str] = OMIT,
        traits: typing.Optional[typing.Dict[str, typing.Any]] = OMIT,
        update_only: typing.Optional[bool] = OMIT,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> UpsertUserResponse:
        """
        Parameters
        ----------
        keys : typing.Dict[str, str]
            See [Key Management](https://docs.schematichq.com/developer_resources/key_management) for more information

        companies : typing.Optional[typing.Sequence[typing.Dict[str, str]]]
            Optionally specify companies using array of key/value pairs

        company : typing.Optional[typing.Dict[str, str]]
            Add user to this company. Takes priority over companies. For exhaustive list of companies, use companies

        company_id : typing.Optional[str]
            Add user to this company. Takes priority over company_ids. For exhaustive list of companies, use company_ids

        company_ids : typing.Optional[typing.Sequence[str]]
            Optionally specify companies using Schematic company ID

        id : typing.Optional[str]
            If you know the Schematic ID, you can use that here instead of keys

        last_seen_at : typing.Optional[dt.datetime]

        name : typing.Optional[str]

        traits : typing.Optional[typing.Dict[str, typing.Any]]
            A map of trait names to trait values

        update_only : typing.Optional[bool]

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

        Returns
        -------
        UpsertUserResponse
            OK

        Examples
        --------
        from schematic import Schematic

        client = Schematic(
            api_key="YOUR_API_KEY",
        )
        client.companies.upsert_user(
            keys={"key": "value"},
        )
        """
        _response = self._raw_client.upsert_user(
            keys=keys,
            companies=companies,
            company=company,
            company_id=company_id,
            company_ids=company_ids,
            id=id,
            last_seen_at=last_seen_at,
            name=name,
            traits=traits,
            update_only=update_only,
            request_options=request_options,
        )
        return _response.data

    def get_user(self, user_id: str, *, request_options: typing.Optional[RequestOptions] = None) -> GetUserResponse:
        """
        Parameters
        ----------
        user_id : str
            user_id

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

        Returns
        -------
        GetUserResponse
            OK

        Examples
        --------
        from schematic import Schematic

        client = Schematic(
            api_key="YOUR_API_KEY",
        )
        client.companies.get_user(
            user_id="user_id",
        )
        """
        _response = self._raw_client.get_user(user_id, request_options=request_options)
        return _response.data

    def delete_user(
        self, user_id: str, *, request_options: typing.Optional[RequestOptions] = None
    ) -> DeleteUserResponse:
        """
        Parameters
        ----------
        user_id : str
            user_id

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

        Returns
        -------
        DeleteUserResponse
            OK

        Examples
        --------
        from schematic import Schematic

        client = Schematic(
            api_key="YOUR_API_KEY",
        )
        client.companies.delete_user(
            user_id="user_id",
        )
        """
        _response = self._raw_client.delete_user(user_id, request_options=request_options)
        return _response.data

    def count_users(
        self,
        *,
        company_id: typing.Optional[str] = None,
        ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
        plan_id: typing.Optional[str] = None,
        q: typing.Optional[str] = None,
        limit: typing.Optional[int] = None,
        offset: typing.Optional[int] = None,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> CountUsersResponse:
        """
        Parameters
        ----------
        company_id : typing.Optional[str]
            Filter users by company ID (starts with comp_)

        ids : typing.Optional[typing.Union[str, typing.Sequence[str]]]
            Filter users by multiple user IDs (starts with user_)

        plan_id : typing.Optional[str]
            Filter users by plan ID (starts with plan_)

        q : typing.Optional[str]
            Search for users by name, keys or string traits

        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
        -------
        CountUsersResponse
            OK

        Examples
        --------
        from schematic import Schematic

        client = Schematic(
            api_key="YOUR_API_KEY",
        )
        client.companies.count_users(
            company_id="company_id",
            plan_id="plan_id",
            q="q",
            limit=1,
            offset=1,
        )
        """
        _response = self._raw_client.count_users(
            company_id=company_id,
            ids=ids,
            plan_id=plan_id,
            q=q,
            limit=limit,
            offset=offset,
            request_options=request_options,
        )
        return _response.data

    def create_user(
        self,
        *,
        keys: typing.Dict[str, str],
        companies: typing.Optional[typing.Sequence[typing.Dict[str, str]]] = OMIT,
        company: typing.Optional[typing.Dict[str, str]] = OMIT,
        company_id: typing.Optional[str] = OMIT,
        company_ids: typing.Optional[typing.Sequence[str]] = OMIT,
        id: typing.Optional[str] = OMIT,
        last_seen_at: typing.Optional[dt.datetime] = OMIT,
        name: typing.Optional[str] = OMIT,
        traits: typing.Optional[typing.Dict[str, typing.Any]] = OMIT,
        update_only: typing.Optional[bool] = OMIT,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> CreateUserResponse:
        """
        Parameters
        ----------
        keys : typing.Dict[str, str]
            See [Key Management](https://docs.schematichq.com/developer_resources/key_management) for more information

        companies : typing.Optional[typing.Sequence[typing.Dict[str, str]]]
            Optionally specify companies using array of key/value pairs

        company : typing.Optional[typing.Dict[str, str]]
            Add user to this company. Takes priority over companies. For exhaustive list of companies, use companies

        company_id : typing.Optional[str]
            Add user to this company. Takes priority over company_ids. For exhaustive list of companies, use company_ids

        company_ids : typing.Optional[typing.Sequence[str]]
            Optionally specify companies using Schematic company ID

        id : typing.Optional[str]
            If you know the Schematic ID, you can use that here instead of keys

        last_seen_at : typing.Optional[dt.datetime]

        name : typing.Optional[str]

        traits : typing.Optional[typing.Dict[str, typing.Any]]
            A map of trait names to trait values

        update_only : typing.Optional[bool]

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

        Returns
        -------
        CreateUserResponse
            Created

        Examples
        --------
        from schematic import Schematic

        client = Schematic(
            api_key="YOUR_API_KEY",
        )
        client.companies.create_user(
            keys={"key": "value"},
        )
        """
        _response = self._raw_client.create_user(
            keys=keys,
            companies=companies,
            company=company,
            company_id=company_id,
            company_ids=company_ids,
            id=id,
            last_seen_at=last_seen_at,
            name=name,
            traits=traits,
            update_only=update_only,
            request_options=request_options,
        )
        return _response.data

    def delete_user_by_keys(
        self, *, keys: typing.Dict[str, str], request_options: typing.Optional[RequestOptions] = None
    ) -> DeleteUserByKeysResponse:
        """
        Parameters
        ----------
        keys : typing.Dict[str, str]

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

        Returns
        -------
        DeleteUserByKeysResponse
            OK

        Examples
        --------
        from schematic import Schematic

        client = Schematic(
            api_key="YOUR_API_KEY",
        )
        client.companies.delete_user_by_keys(
            keys={"key": "value"},
        )
        """
        _response = self._raw_client.delete_user_by_keys(keys=keys, request_options=request_options)
        return _response.data

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

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

        Returns
        -------
        LookupUserResponse
            OK

        Examples
        --------
        from schematic import Schematic

        client = Schematic(
            api_key="YOUR_API_KEY",
        )
        client.companies.lookup_user(
            keys={"keys": "keys"},
        )
        """
        _response = self._raw_client.lookup_user(keys=keys, request_options=request_options)
        return _response.data


class AsyncCompaniesClient:
    def __init__(self, *, client_wrapper: AsyncClientWrapper):
        self._raw_client = AsyncRawCompaniesClient(client_wrapper=client_wrapper)

    @property
    def with_raw_response(self) -> AsyncRawCompaniesClient:
        """
        Retrieves a raw implementation of this client that returns raw responses.

        Returns
        -------
        AsyncRawCompaniesClient
        """
        return self._raw_client

    async def list_companies(
        self,
        *,
        ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
        plan_id: typing.Optional[str] = None,
        q: typing.Optional[str] = None,
        without_feature_override_for: typing.Optional[str] = None,
        without_plan: typing.Optional[bool] = None,
        with_subscription: typing.Optional[bool] = None,
        limit: typing.Optional[int] = None,
        offset: typing.Optional[int] = None,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> ListCompaniesResponse:
        """
        Parameters
        ----------
        ids : typing.Optional[typing.Union[str, typing.Sequence[str]]]
            Filter companies by multiple company IDs (starts with comp_)

        plan_id : typing.Optional[str]
            Filter companies by plan ID (starts with plan_)

        q : typing.Optional[str]
            Search for companies by name, keys or string traits

        without_feature_override_for : typing.Optional[str]
            Filter out companies that already have a company override for the specified feature ID

        without_plan : typing.Optional[bool]
            Filter out companies that have a plan

        with_subscription : typing.Optional[bool]
            Filter companies that have a subscription

        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
        -------
        ListCompaniesResponse
            OK

        Examples
        --------
        import asyncio

        from schematic import AsyncSchematic

        client = AsyncSchematic(
            api_key="YOUR_API_KEY",
        )


        async def main() -> None:
            await client.companies.list_companies(
                plan_id="plan_id",
                q="q",
                without_feature_override_for="without_feature_override_for",
                without_plan=True,
                with_subscription=True,
                limit=1,
                offset=1,
            )


        asyncio.run(main())
        """
        _response = await self._raw_client.list_companies(
            ids=ids,
            plan_id=plan_id,
            q=q,
            without_feature_override_for=without_feature_override_for,
            without_plan=without_plan,
            with_subscription=with_subscription,
            limit=limit,
            offset=offset,
            request_options=request_options,
        )
        return _response.data

    async def upsert_company(
        self,
        *,
        keys: typing.Dict[str, str],
        id: typing.Optional[str] = OMIT,
        last_seen_at: typing.Optional[dt.datetime] = OMIT,
        name: typing.Optional[str] = OMIT,
        traits: typing.Optional[typing.Dict[str, typing.Any]] = OMIT,
        update_only: typing.Optional[bool] = OMIT,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> UpsertCompanyResponse:
        """
        Parameters
        ----------
        keys : typing.Dict[str, str]
            See [Key Management](https://docs.schematichq.com/developer_resources/key_management) for more information

        id : typing.Optional[str]
            If you know the Schematic ID, you can use that here instead of keys

        last_seen_at : typing.Optional[dt.datetime]

        name : typing.Optional[str]

        traits : typing.Optional[typing.Dict[str, typing.Any]]
            A map of trait names to trait values

        update_only : typing.Optional[bool]

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

        Returns
        -------
        UpsertCompanyResponse
            OK

        Examples
        --------
        import asyncio

        from schematic import AsyncSchematic

        client = AsyncSchematic(
            api_key="YOUR_API_KEY",
        )


        async def main() -> None:
            await client.companies.upsert_company(
                keys={"key": "value"},
            )


        asyncio.run(main())
        """
        _response = await self._raw_client.upsert_company(
            keys=keys,
            id=id,
            last_seen_at=last_seen_at,
            name=name,
            traits=traits,
            update_only=update_only,
            request_options=request_options,
        )
        return _response.data

    async def get_company(
        self, company_id: str, *, request_options: typing.Optional[RequestOptions] = None
    ) -> GetCompanyResponse:
        """
        Parameters
        ----------
        company_id : str
            company_id

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

        Returns
        -------
        GetCompanyResponse
            OK

        Examples
        --------
        import asyncio

        from schematic import AsyncSchematic

        client = AsyncSchematic(
            api_key="YOUR_API_KEY",
        )


        async def main() -> None:
            await client.companies.get_company(
                company_id="company_id",
            )


        asyncio.run(main())
        """
        _response = await self._raw_client.get_company(company_id, request_options=request_options)
        return _response.data

    async def delete_company(
        self,
        company_id: str,
        *,
        cancel_subscription: typing.Optional[bool] = None,
        prorate: typing.Optional[bool] = None,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> DeleteCompanyResponse:
        """
        Parameters
        ----------
        company_id : str
            company_id

        cancel_subscription : typing.Optional[bool]

        prorate : typing.Optional[bool]

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

        Returns
        -------
        DeleteCompanyResponse
            OK

        Examples
        --------
        import asyncio

        from schematic import AsyncSchematic

        client = AsyncSchematic(
            api_key="YOUR_API_KEY",
        )


        async def main() -> None:
            await client.companies.delete_company(
                company_id="company_id",
                cancel_subscription=True,
                prorate=True,
            )


        asyncio.run(main())
        """
        _response = await self._raw_client.delete_company(
            company_id, cancel_subscription=cancel_subscription, prorate=prorate, request_options=request_options
        )
        return _response.data

    async def count_companies(
        self,
        *,
        ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
        plan_id: typing.Optional[str] = None,
        q: typing.Optional[str] = None,
        without_feature_override_for: typing.Optional[str] = None,
        without_plan: typing.Optional[bool] = None,
        with_subscription: typing.Optional[bool] = None,
        limit: typing.Optional[int] = None,
        offset: typing.Optional[int] = None,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> CountCompaniesResponse:
        """
        Parameters
        ----------
        ids : typing.Optional[typing.Union[str, typing.Sequence[str]]]
            Filter companies by multiple company IDs (starts with comp_)

        plan_id : typing.Optional[str]
            Filter companies by plan ID (starts with plan_)

        q : typing.Optional[str]
            Search for companies by name, keys or string traits

        without_feature_override_for : typing.Optional[str]
            Filter out companies that already have a company override for the specified feature ID

        without_plan : typing.Optional[bool]
            Filter out companies that have a plan

        with_subscription : typing.Optional[bool]
            Filter companies that have a subscription

        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
        -------
        CountCompaniesResponse
            OK

        Examples
        --------
        import asyncio

        from schematic import AsyncSchematic

        client = AsyncSchematic(
            api_key="YOUR_API_KEY",
        )


        async def main() -> None:
            await client.companies.count_companies(
                plan_id="plan_id",
                q="q",
                without_feature_override_for="without_feature_override_for",
                without_plan=True,
                with_subscription=True,
                limit=1,
                offset=1,
            )


        asyncio.run(main())
        """
        _response = await self._raw_client.count_companies(
            ids=ids,
            plan_id=plan_id,
            q=q,
            without_feature_override_for=without_feature_override_for,
            without_plan=without_plan,
            with_subscription=with_subscription,
            limit=limit,
            offset=offset,
            request_options=request_options,
        )
        return _response.data

    async def count_companies_for_advanced_filter(
        self,
        *,
        ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
        plan_ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
        feature_ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
        credit_type_ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
        subscription_statuses: typing.Optional[
            typing.Union[SubscriptionStatus, typing.Sequence[SubscriptionStatus]]
        ] = None,
        subscription_types: typing.Optional[typing.Union[SubscriptionType, typing.Sequence[SubscriptionType]]] = None,
        monetized_subscriptions: typing.Optional[bool] = None,
        q: typing.Optional[str] = None,
        without_plan: typing.Optional[bool] = None,
        without_subscription: typing.Optional[bool] = None,
        sort_order_column: typing.Optional[str] = None,
        sort_order_direction: typing.Optional[SortDirection] = None,
        display_properties: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
        limit: typing.Optional[int] = None,
        offset: typing.Optional[int] = None,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> CountCompaniesForAdvancedFilterResponse:
        """
        Parameters
        ----------
        ids : typing.Optional[typing.Union[str, typing.Sequence[str]]]
            Filter companies by multiple company IDs (starts with comp_)

        plan_ids : typing.Optional[typing.Union[str, typing.Sequence[str]]]
            Filter companies by one or more plan IDs (each ID starts with plan_)

        feature_ids : typing.Optional[typing.Union[str, typing.Sequence[str]]]
            Filter companies by one or more feature IDs (each ID starts with feat_)

        credit_type_ids : typing.Optional[typing.Union[str, typing.Sequence[str]]]
            Filter companies by one or more credit type IDs (each ID starts with bcrd_)

        subscription_statuses : typing.Optional[typing.Union[SubscriptionStatus, typing.Sequence[SubscriptionStatus]]]
            Filter companies by one or more subscription statuses (active, canceled, expired, incomplete, incomplete_expired, past_due, paused, trialing, unpaid)

        subscription_types : typing.Optional[typing.Union[SubscriptionType, typing.Sequence[SubscriptionType]]]
            Filter companies by one or more subscription types (paid, free, trial)

        monetized_subscriptions : typing.Optional[bool]
            Filter companies that have monetized subscriptions

        q : typing.Optional[str]
            Search for companies by name, keys or string traits

        without_plan : typing.Optional[bool]
            Filter out companies that have a plan

        without_subscription : typing.Optional[bool]
            Filter out companies that have a subscription

        sort_order_column : typing.Optional[str]
            Column to sort by (e.g. name, created_at, last_seen_at)

        sort_order_direction : typing.Optional[SortDirection]
            Direction to sort by (asc or desc)

        display_properties : typing.Optional[typing.Union[str, typing.Sequence[str]]]
            Select the display columns to return (e.g. plan, subscription, users, last_seen_at)

        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
        -------
        CountCompaniesForAdvancedFilterResponse
            OK

        Examples
        --------
        import asyncio

        from schematic import AsyncSchematic

        client = AsyncSchematic(
            api_key="YOUR_API_KEY",
        )


        async def main() -> None:
            await client.companies.count_companies_for_advanced_filter(
                monetized_subscriptions=True,
                q="q",
                without_plan=True,
                without_subscription=True,
                sort_order_column="sort_order_column",
                sort_order_direction="asc",
                limit=1,
                offset=1,
            )


        asyncio.run(main())
        """
        _response = await self._raw_client.count_companies_for_advanced_filter(
            ids=ids,
            plan_ids=plan_ids,
            feature_ids=feature_ids,
            credit_type_ids=credit_type_ids,
            subscription_statuses=subscription_statuses,
            subscription_types=subscription_types,
            monetized_subscriptions=monetized_subscriptions,
            q=q,
            without_plan=without_plan,
            without_subscription=without_subscription,
            sort_order_column=sort_order_column,
            sort_order_direction=sort_order_direction,
            display_properties=display_properties,
            limit=limit,
            offset=offset,
            request_options=request_options,
        )
        return _response.data

    async def create_company(
        self,
        *,
        keys: typing.Dict[str, str],
        id: typing.Optional[str] = OMIT,
        last_seen_at: typing.Optional[dt.datetime] = OMIT,
        name: typing.Optional[str] = OMIT,
        traits: typing.Optional[typing.Dict[str, typing.Any]] = OMIT,
        update_only: typing.Optional[bool] = OMIT,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> CreateCompanyResponse:
        """
        Parameters
        ----------
        keys : typing.Dict[str, str]
            See [Key Management](https://docs.schematichq.com/developer_resources/key_management) for more information

        id : typing.Optional[str]
            If you know the Schematic ID, you can use that here instead of keys

        last_seen_at : typing.Optional[dt.datetime]

        name : typing.Optional[str]

        traits : typing.Optional[typing.Dict[str, typing.Any]]
            A map of trait names to trait values

        update_only : typing.Optional[bool]

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

        Returns
        -------
        CreateCompanyResponse
            Created

        Examples
        --------
        import asyncio

        from schematic import AsyncSchematic

        client = AsyncSchematic(
            api_key="YOUR_API_KEY",
        )


        async def main() -> None:
            await client.companies.create_company(
                keys={"key": "value"},
            )


        asyncio.run(main())
        """
        _response = await self._raw_client.create_company(
            keys=keys,
            id=id,
            last_seen_at=last_seen_at,
            name=name,
            traits=traits,
            update_only=update_only,
            request_options=request_options,
        )
        return _response.data

    async def delete_company_by_keys(
        self, *, keys: typing.Dict[str, str], request_options: typing.Optional[RequestOptions] = None
    ) -> DeleteCompanyByKeysResponse:
        """
        Parameters
        ----------
        keys : typing.Dict[str, str]

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

        Returns
        -------
        DeleteCompanyByKeysResponse
            OK

        Examples
        --------
        import asyncio

        from schematic import AsyncSchematic

        client = AsyncSchematic(
            api_key="YOUR_API_KEY",
        )


        async def main() -> None:
            await client.companies.delete_company_by_keys(
                keys={"key": "value"},
            )


        asyncio.run(main())
        """
        _response = await self._raw_client.delete_company_by_keys(keys=keys, request_options=request_options)
        return _response.data

    async def list_companies_for_advanced_filter(
        self,
        *,
        ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
        plan_ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
        feature_ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
        credit_type_ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
        subscription_statuses: typing.Optional[
            typing.Union[SubscriptionStatus, typing.Sequence[SubscriptionStatus]]
        ] = None,
        subscription_types: typing.Optional[typing.Union[SubscriptionType, typing.Sequence[SubscriptionType]]] = None,
        monetized_subscriptions: typing.Optional[bool] = None,
        q: typing.Optional[str] = None,
        without_plan: typing.Optional[bool] = None,
        without_subscription: typing.Optional[bool] = None,
        sort_order_column: typing.Optional[str] = None,
        sort_order_direction: typing.Optional[SortDirection] = None,
        display_properties: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
        limit: typing.Optional[int] = None,
        offset: typing.Optional[int] = None,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> ListCompaniesForAdvancedFilterResponse:
        """
        Parameters
        ----------
        ids : typing.Optional[typing.Union[str, typing.Sequence[str]]]
            Filter companies by multiple company IDs (starts with comp_)

        plan_ids : typing.Optional[typing.Union[str, typing.Sequence[str]]]
            Filter companies by one or more plan IDs (each ID starts with plan_)

        feature_ids : typing.Optional[typing.Union[str, typing.Sequence[str]]]
            Filter companies by one or more feature IDs (each ID starts with feat_)

        credit_type_ids : typing.Optional[typing.Union[str, typing.Sequence[str]]]
            Filter companies by one or more credit type IDs (each ID starts with bcrd_)

        subscription_statuses : typing.Optional[typing.Union[SubscriptionStatus, typing.Sequence[SubscriptionStatus]]]
            Filter companies by one or more subscription statuses (active, canceled, expired, incomplete, incomplete_expired, past_due, paused, trialing, unpaid)

        subscription_types : typing.Optional[typing.Union[SubscriptionType, typing.Sequence[SubscriptionType]]]
            Filter companies by one or more subscription types (paid, free, trial)

        monetized_subscriptions : typing.Optional[bool]
            Filter companies that have monetized subscriptions

        q : typing.Optional[str]
            Search for companies by name, keys or string traits

        without_plan : typing.Optional[bool]
            Filter out companies that have a plan

        without_subscription : typing.Optional[bool]
            Filter out companies that have a subscription

        sort_order_column : typing.Optional[str]
            Column to sort by (e.g. name, created_at, last_seen_at)

        sort_order_direction : typing.Optional[SortDirection]
            Direction to sort by (asc or desc)

        display_properties : typing.Optional[typing.Union[str, typing.Sequence[str]]]
            Select the display columns to return (e.g. plan, subscription, users, last_seen_at)

        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
        -------
        ListCompaniesForAdvancedFilterResponse
            OK

        Examples
        --------
        import asyncio

        from schematic import AsyncSchematic

        client = AsyncSchematic(
            api_key="YOUR_API_KEY",
        )


        async def main() -> None:
            await client.companies.list_companies_for_advanced_filter(
                monetized_subscriptions=True,
                q="q",
                without_plan=True,
                without_subscription=True,
                sort_order_column="sort_order_column",
                sort_order_direction="asc",
                limit=1,
                offset=1,
            )


        asyncio.run(main())
        """
        _response = await self._raw_client.list_companies_for_advanced_filter(
            ids=ids,
            plan_ids=plan_ids,
            feature_ids=feature_ids,
            credit_type_ids=credit_type_ids,
            subscription_statuses=subscription_statuses,
            subscription_types=subscription_types,
            monetized_subscriptions=monetized_subscriptions,
            q=q,
            without_plan=without_plan,
            without_subscription=without_subscription,
            sort_order_column=sort_order_column,
            sort_order_direction=sort_order_direction,
            display_properties=display_properties,
            limit=limit,
            offset=offset,
            request_options=request_options,
        )
        return _response.data

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

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

        Returns
        -------
        LookupCompanyResponse
            OK

        Examples
        --------
        import asyncio

        from schematic import AsyncSchematic

        client = AsyncSchematic(
            api_key="YOUR_API_KEY",
        )


        async def main() -> None:
            await client.companies.lookup_company(
                keys={"keys": "keys"},
            )


        asyncio.run(main())
        """
        _response = await self._raw_client.lookup_company(keys=keys, request_options=request_options)
        return _response.data

    async def list_company_memberships(
        self,
        *,
        company_id: typing.Optional[str] = None,
        user_id: typing.Optional[str] = None,
        limit: typing.Optional[int] = None,
        offset: typing.Optional[int] = None,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> ListCompanyMembershipsResponse:
        """
        Parameters
        ----------
        company_id : typing.Optional[str]

        user_id : 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
        -------
        ListCompanyMembershipsResponse
            OK

        Examples
        --------
        import asyncio

        from schematic import AsyncSchematic

        client = AsyncSchematic(
            api_key="YOUR_API_KEY",
        )


        async def main() -> None:
            await client.companies.list_company_memberships(
                company_id="company_id",
                user_id="user_id",
                limit=1,
                offset=1,
            )


        asyncio.run(main())
        """
        _response = await self._raw_client.list_company_memberships(
            company_id=company_id, user_id=user_id, limit=limit, offset=offset, request_options=request_options
        )
        return _response.data

    async def get_or_create_company_membership(
        self, *, company_id: str, user_id: str, request_options: typing.Optional[RequestOptions] = None
    ) -> GetOrCreateCompanyMembershipResponse:
        """
        Parameters
        ----------
        company_id : str

        user_id : str

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

        Returns
        -------
        GetOrCreateCompanyMembershipResponse
            OK

        Examples
        --------
        import asyncio

        from schematic import AsyncSchematic

        client = AsyncSchematic(
            api_key="YOUR_API_KEY",
        )


        async def main() -> None:
            await client.companies.get_or_create_company_membership(
                company_id="company_id",
                user_id="user_id",
            )


        asyncio.run(main())
        """
        _response = await self._raw_client.get_or_create_company_membership(
            company_id=company_id, user_id=user_id, request_options=request_options
        )
        return _response.data

    async def delete_company_membership(
        self, company_membership_id: str, *, request_options: typing.Optional[RequestOptions] = None
    ) -> DeleteCompanyMembershipResponse:
        """
        Parameters
        ----------
        company_membership_id : str
            company_membership_id

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

        Returns
        -------
        DeleteCompanyMembershipResponse
            OK

        Examples
        --------
        import asyncio

        from schematic import AsyncSchematic

        client = AsyncSchematic(
            api_key="YOUR_API_KEY",
        )


        async def main() -> None:
            await client.companies.delete_company_membership(
                company_membership_id="company_membership_id",
            )


        asyncio.run(main())
        """
        _response = await self._raw_client.delete_company_membership(
            company_membership_id, request_options=request_options
        )
        return _response.data

    async def get_active_company_subscription(
        self,
        *,
        company_id: typing.Optional[str] = None,
        company_ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
        limit: typing.Optional[int] = None,
        offset: typing.Optional[int] = None,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> GetActiveCompanySubscriptionResponse:
        """
        Parameters
        ----------
        company_id : typing.Optional[str]

        company_ids : typing.Optional[typing.Union[str, typing.Sequence[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
        -------
        GetActiveCompanySubscriptionResponse
            OK

        Examples
        --------
        import asyncio

        from schematic import AsyncSchematic

        client = AsyncSchematic(
            api_key="YOUR_API_KEY",
        )


        async def main() -> None:
            await client.companies.get_active_company_subscription(
                company_id="company_id",
                limit=1,
                offset=1,
            )


        asyncio.run(main())
        """
        _response = await self._raw_client.get_active_company_subscription(
            company_id=company_id, company_ids=company_ids, limit=limit, offset=offset, request_options=request_options
        )
        return _response.data

    async def upsert_company_trait(
        self,
        *,
        keys: typing.Dict[str, str],
        trait: str,
        incr: typing.Optional[int] = OMIT,
        set_: typing.Optional[str] = OMIT,
        update_only: typing.Optional[bool] = OMIT,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> UpsertCompanyTraitResponse:
        """
        Parameters
        ----------
        keys : typing.Dict[str, str]
            Key/value pairs to identify a company or user

        trait : str
            Name of the trait to update

        incr : typing.Optional[int]
            Amount to increment the trait by (positive or negative)

        set_ : typing.Optional[str]
            Value to set the trait to

        update_only : typing.Optional[bool]
            Unless this is set, the company or user will be created if it does not already exist

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

        Returns
        -------
        UpsertCompanyTraitResponse
            OK

        Examples
        --------
        import asyncio

        from schematic import AsyncSchematic

        client = AsyncSchematic(
            api_key="YOUR_API_KEY",
        )


        async def main() -> None:
            await client.companies.upsert_company_trait(
                keys={"key": "value"},
                trait="trait",
            )


        asyncio.run(main())
        """
        _response = await self._raw_client.upsert_company_trait(
            keys=keys, trait=trait, incr=incr, set_=set_, update_only=update_only, request_options=request_options
        )
        return _response.data

    async def list_entity_key_definitions(
        self,
        *,
        entity_type: typing.Optional[EntityType] = None,
        ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
        q: typing.Optional[str] = None,
        limit: typing.Optional[int] = None,
        offset: typing.Optional[int] = None,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> ListEntityKeyDefinitionsResponse:
        """
        Parameters
        ----------
        entity_type : typing.Optional[EntityType]

        ids : typing.Optional[typing.Union[str, typing.Sequence[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
        -------
        ListEntityKeyDefinitionsResponse
            OK

        Examples
        --------
        import asyncio

        from schematic import AsyncSchematic

        client = AsyncSchematic(
            api_key="YOUR_API_KEY",
        )


        async def main() -> None:
            await client.companies.list_entity_key_definitions(
                entity_type="company",
                q="q",
                limit=1,
                offset=1,
            )


        asyncio.run(main())
        """
        _response = await self._raw_client.list_entity_key_definitions(
            entity_type=entity_type, ids=ids, q=q, limit=limit, offset=offset, request_options=request_options
        )
        return _response.data

    async def count_entity_key_definitions(
        self,
        *,
        entity_type: typing.Optional[EntityType] = None,
        ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
        q: typing.Optional[str] = None,
        limit: typing.Optional[int] = None,
        offset: typing.Optional[int] = None,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> CountEntityKeyDefinitionsResponse:
        """
        Parameters
        ----------
        entity_type : typing.Optional[EntityType]

        ids : typing.Optional[typing.Union[str, typing.Sequence[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
        -------
        CountEntityKeyDefinitionsResponse
            OK

        Examples
        --------
        import asyncio

        from schematic import AsyncSchematic

        client = AsyncSchematic(
            api_key="YOUR_API_KEY",
        )


        async def main() -> None:
            await client.companies.count_entity_key_definitions(
                entity_type="company",
                q="q",
                limit=1,
                offset=1,
            )


        asyncio.run(main())
        """
        _response = await self._raw_client.count_entity_key_definitions(
            entity_type=entity_type, ids=ids, q=q, limit=limit, offset=offset, request_options=request_options
        )
        return _response.data

    async def list_entity_trait_definitions(
        self,
        *,
        entity_type: typing.Optional[EntityType] = None,
        ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
        q: typing.Optional[str] = None,
        trait_type: typing.Optional[TraitType] = None,
        trait_types: typing.Optional[typing.Union[TraitType, typing.Sequence[TraitType]]] = None,
        limit: typing.Optional[int] = None,
        offset: typing.Optional[int] = None,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> ListEntityTraitDefinitionsResponse:
        """
        Parameters
        ----------
        entity_type : typing.Optional[EntityType]

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

        q : typing.Optional[str]

        trait_type : typing.Optional[TraitType]

        trait_types : typing.Optional[typing.Union[TraitType, typing.Sequence[TraitType]]]

        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
        -------
        ListEntityTraitDefinitionsResponse
            OK

        Examples
        --------
        import asyncio

        from schematic import AsyncSchematic

        client = AsyncSchematic(
            api_key="YOUR_API_KEY",
        )


        async def main() -> None:
            await client.companies.list_entity_trait_definitions(
                entity_type="company",
                q="q",
                trait_type="boolean",
                limit=1,
                offset=1,
            )


        asyncio.run(main())
        """
        _response = await self._raw_client.list_entity_trait_definitions(
            entity_type=entity_type,
            ids=ids,
            q=q,
            trait_type=trait_type,
            trait_types=trait_types,
            limit=limit,
            offset=offset,
            request_options=request_options,
        )
        return _response.data

    async def get_or_create_entity_trait_definition(
        self,
        *,
        entity_type: EntityType,
        hierarchy: typing.Sequence[str],
        trait_type: TraitType,
        display_name: typing.Optional[str] = OMIT,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> GetOrCreateEntityTraitDefinitionResponse:
        """
        Parameters
        ----------
        entity_type : EntityType

        hierarchy : typing.Sequence[str]

        trait_type : TraitType

        display_name : typing.Optional[str]

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

        Returns
        -------
        GetOrCreateEntityTraitDefinitionResponse
            OK

        Examples
        --------
        import asyncio

        from schematic import AsyncSchematic

        client = AsyncSchematic(
            api_key="YOUR_API_KEY",
        )


        async def main() -> None:
            await client.companies.get_or_create_entity_trait_definition(
                entity_type="company",
                hierarchy=["hierarchy"],
                trait_type="boolean",
            )


        asyncio.run(main())
        """
        _response = await self._raw_client.get_or_create_entity_trait_definition(
            entity_type=entity_type,
            hierarchy=hierarchy,
            trait_type=trait_type,
            display_name=display_name,
            request_options=request_options,
        )
        return _response.data

    async def get_entity_trait_definition(
        self, entity_trait_definition_id: str, *, request_options: typing.Optional[RequestOptions] = None
    ) -> GetEntityTraitDefinitionResponse:
        """
        Parameters
        ----------
        entity_trait_definition_id : str
            entity_trait_definition_id

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

        Returns
        -------
        GetEntityTraitDefinitionResponse
            OK

        Examples
        --------
        import asyncio

        from schematic import AsyncSchematic

        client = AsyncSchematic(
            api_key="YOUR_API_KEY",
        )


        async def main() -> None:
            await client.companies.get_entity_trait_definition(
                entity_trait_definition_id="entity_trait_definition_id",
            )


        asyncio.run(main())
        """
        _response = await self._raw_client.get_entity_trait_definition(
            entity_trait_definition_id, request_options=request_options
        )
        return _response.data

    async def update_entity_trait_definition(
        self,
        entity_trait_definition_id: str,
        *,
        trait_type: TraitType,
        display_name: typing.Optional[str] = OMIT,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> UpdateEntityTraitDefinitionResponse:
        """
        Parameters
        ----------
        entity_trait_definition_id : str
            entity_trait_definition_id

        trait_type : TraitType

        display_name : typing.Optional[str]

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

        Returns
        -------
        UpdateEntityTraitDefinitionResponse
            OK

        Examples
        --------
        import asyncio

        from schematic import AsyncSchematic

        client = AsyncSchematic(
            api_key="YOUR_API_KEY",
        )


        async def main() -> None:
            await client.companies.update_entity_trait_definition(
                entity_trait_definition_id="entity_trait_definition_id",
                trait_type="boolean",
            )


        asyncio.run(main())
        """
        _response = await self._raw_client.update_entity_trait_definition(
            entity_trait_definition_id,
            trait_type=trait_type,
            display_name=display_name,
            request_options=request_options,
        )
        return _response.data

    async def count_entity_trait_definitions(
        self,
        *,
        entity_type: typing.Optional[EntityType] = None,
        ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
        q: typing.Optional[str] = None,
        trait_type: typing.Optional[TraitType] = None,
        trait_types: typing.Optional[typing.Union[TraitType, typing.Sequence[TraitType]]] = None,
        limit: typing.Optional[int] = None,
        offset: typing.Optional[int] = None,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> CountEntityTraitDefinitionsResponse:
        """
        Parameters
        ----------
        entity_type : typing.Optional[EntityType]

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

        q : typing.Optional[str]

        trait_type : typing.Optional[TraitType]

        trait_types : typing.Optional[typing.Union[TraitType, typing.Sequence[TraitType]]]

        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
        -------
        CountEntityTraitDefinitionsResponse
            OK

        Examples
        --------
        import asyncio

        from schematic import AsyncSchematic

        client = AsyncSchematic(
            api_key="YOUR_API_KEY",
        )


        async def main() -> None:
            await client.companies.count_entity_trait_definitions(
                entity_type="company",
                q="q",
                trait_type="boolean",
                limit=1,
                offset=1,
            )


        asyncio.run(main())
        """
        _response = await self._raw_client.count_entity_trait_definitions(
            entity_type=entity_type,
            ids=ids,
            q=q,
            trait_type=trait_type,
            trait_types=trait_types,
            limit=limit,
            offset=offset,
            request_options=request_options,
        )
        return _response.data

    async def get_entity_trait_values(
        self,
        *,
        definition_id: str,
        q: typing.Optional[str] = None,
        limit: typing.Optional[int] = None,
        offset: typing.Optional[int] = None,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> GetEntityTraitValuesResponse:
        """
        Parameters
        ----------
        definition_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
        -------
        GetEntityTraitValuesResponse
            OK

        Examples
        --------
        import asyncio

        from schematic import AsyncSchematic

        client = AsyncSchematic(
            api_key="YOUR_API_KEY",
        )


        async def main() -> None:
            await client.companies.get_entity_trait_values(
                definition_id="definition_id",
                q="q",
                limit=1,
                offset=1,
            )


        asyncio.run(main())
        """
        _response = await self._raw_client.get_entity_trait_values(
            definition_id=definition_id, q=q, limit=limit, offset=offset, request_options=request_options
        )
        return _response.data

    async def list_plan_changes(
        self,
        *,
        action: typing.Optional[str] = None,
        base_plan_action: typing.Optional[str] = None,
        company_id: typing.Optional[str] = None,
        company_ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
        plan_ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
        limit: typing.Optional[int] = None,
        offset: typing.Optional[int] = None,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> ListPlanChangesResponse:
        """
        Parameters
        ----------
        action : typing.Optional[str]

        base_plan_action : typing.Optional[str]

        company_id : typing.Optional[str]

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

        plan_ids : typing.Optional[typing.Union[str, typing.Sequence[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
        -------
        ListPlanChangesResponse
            OK

        Examples
        --------
        import asyncio

        from schematic import AsyncSchematic

        client = AsyncSchematic(
            api_key="YOUR_API_KEY",
        )


        async def main() -> None:
            await client.companies.list_plan_changes(
                action="action",
                base_plan_action="base_plan_action",
                company_id="company_id",
                limit=1,
                offset=1,
            )


        asyncio.run(main())
        """
        _response = await self._raw_client.list_plan_changes(
            action=action,
            base_plan_action=base_plan_action,
            company_id=company_id,
            company_ids=company_ids,
            plan_ids=plan_ids,
            limit=limit,
            offset=offset,
            request_options=request_options,
        )
        return _response.data

    async def get_plan_change(
        self, plan_change_id: str, *, request_options: typing.Optional[RequestOptions] = None
    ) -> GetPlanChangeResponse:
        """
        Parameters
        ----------
        plan_change_id : str
            plan_change_id

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

        Returns
        -------
        GetPlanChangeResponse
            OK

        Examples
        --------
        import asyncio

        from schematic import AsyncSchematic

        client = AsyncSchematic(
            api_key="YOUR_API_KEY",
        )


        async def main() -> None:
            await client.companies.get_plan_change(
                plan_change_id="plan_change_id",
            )


        asyncio.run(main())
        """
        _response = await self._raw_client.get_plan_change(plan_change_id, request_options=request_options)
        return _response.data

    async def list_plan_traits(
        self,
        *,
        ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
        plan_id: typing.Optional[str] = None,
        trait_id: typing.Optional[str] = None,
        trait_ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
        limit: typing.Optional[int] = None,
        offset: typing.Optional[int] = None,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> ListPlanTraitsResponse:
        """
        Parameters
        ----------
        ids : typing.Optional[typing.Union[str, typing.Sequence[str]]]

        plan_id : typing.Optional[str]

        trait_id : typing.Optional[str]

        trait_ids : typing.Optional[typing.Union[str, typing.Sequence[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
        -------
        ListPlanTraitsResponse
            OK

        Examples
        --------
        import asyncio

        from schematic import AsyncSchematic

        client = AsyncSchematic(
            api_key="YOUR_API_KEY",
        )


        async def main() -> None:
            await client.companies.list_plan_traits(
                plan_id="plan_id",
                trait_id="trait_id",
                limit=1,
                offset=1,
            )


        asyncio.run(main())
        """
        _response = await self._raw_client.list_plan_traits(
            ids=ids,
            plan_id=plan_id,
            trait_id=trait_id,
            trait_ids=trait_ids,
            limit=limit,
            offset=offset,
            request_options=request_options,
        )
        return _response.data

    async def create_plan_trait(
        self, *, plan_id: str, trait_id: str, trait_value: str, request_options: typing.Optional[RequestOptions] = None
    ) -> CreatePlanTraitResponse:
        """
        Parameters
        ----------
        plan_id : str

        trait_id : str

        trait_value : str

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

        Returns
        -------
        CreatePlanTraitResponse
            Created

        Examples
        --------
        import asyncio

        from schematic import AsyncSchematic

        client = AsyncSchematic(
            api_key="YOUR_API_KEY",
        )


        async def main() -> None:
            await client.companies.create_plan_trait(
                plan_id="plan_id",
                trait_id="trait_id",
                trait_value="trait_value",
            )


        asyncio.run(main())
        """
        _response = await self._raw_client.create_plan_trait(
            plan_id=plan_id, trait_id=trait_id, trait_value=trait_value, request_options=request_options
        )
        return _response.data

    async def get_plan_trait(
        self, plan_trait_id: str, *, request_options: typing.Optional[RequestOptions] = None
    ) -> GetPlanTraitResponse:
        """
        Parameters
        ----------
        plan_trait_id : str
            plan_trait_id

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

        Returns
        -------
        GetPlanTraitResponse
            OK

        Examples
        --------
        import asyncio

        from schematic import AsyncSchematic

        client = AsyncSchematic(
            api_key="YOUR_API_KEY",
        )


        async def main() -> None:
            await client.companies.get_plan_trait(
                plan_trait_id="plan_trait_id",
            )


        asyncio.run(main())
        """
        _response = await self._raw_client.get_plan_trait(plan_trait_id, request_options=request_options)
        return _response.data

    async def update_plan_trait(
        self,
        plan_trait_id: str,
        *,
        plan_id: str,
        trait_value: str,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> UpdatePlanTraitResponse:
        """
        Parameters
        ----------
        plan_trait_id : str
            plan_trait_id

        plan_id : str

        trait_value : str

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

        Returns
        -------
        UpdatePlanTraitResponse
            OK

        Examples
        --------
        import asyncio

        from schematic import AsyncSchematic

        client = AsyncSchematic(
            api_key="YOUR_API_KEY",
        )


        async def main() -> None:
            await client.companies.update_plan_trait(
                plan_trait_id="plan_trait_id",
                plan_id="plan_id",
                trait_value="trait_value",
            )


        asyncio.run(main())
        """
        _response = await self._raw_client.update_plan_trait(
            plan_trait_id, plan_id=plan_id, trait_value=trait_value, request_options=request_options
        )
        return _response.data

    async def delete_plan_trait(
        self, plan_trait_id: str, *, request_options: typing.Optional[RequestOptions] = None
    ) -> DeletePlanTraitResponse:
        """
        Parameters
        ----------
        plan_trait_id : str
            plan_trait_id

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

        Returns
        -------
        DeletePlanTraitResponse
            OK

        Examples
        --------
        import asyncio

        from schematic import AsyncSchematic

        client = AsyncSchematic(
            api_key="YOUR_API_KEY",
        )


        async def main() -> None:
            await client.companies.delete_plan_trait(
                plan_trait_id="plan_trait_id",
            )


        asyncio.run(main())
        """
        _response = await self._raw_client.delete_plan_trait(plan_trait_id, request_options=request_options)
        return _response.data

    async def update_plan_traits_bulk(
        self,
        *,
        apply_to_existing_companies: bool,
        plan_id: str,
        traits: typing.Sequence[UpdatePlanTraitTraitRequestBody],
        request_options: typing.Optional[RequestOptions] = None,
    ) -> UpdatePlanTraitsBulkResponse:
        """
        Parameters
        ----------
        apply_to_existing_companies : bool

        plan_id : str

        traits : typing.Sequence[UpdatePlanTraitTraitRequestBody]

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

        Returns
        -------
        UpdatePlanTraitsBulkResponse
            OK

        Examples
        --------
        import asyncio

        from schematic import AsyncSchematic, UpdatePlanTraitTraitRequestBody

        client = AsyncSchematic(
            api_key="YOUR_API_KEY",
        )


        async def main() -> None:
            await client.companies.update_plan_traits_bulk(
                apply_to_existing_companies=True,
                plan_id="plan_id",
                traits=[
                    UpdatePlanTraitTraitRequestBody(
                        trait_id="trait_id",
                        trait_value="trait_value",
                    )
                ],
            )


        asyncio.run(main())
        """
        _response = await self._raw_client.update_plan_traits_bulk(
            apply_to_existing_companies=apply_to_existing_companies,
            plan_id=plan_id,
            traits=traits,
            request_options=request_options,
        )
        return _response.data

    async def count_plan_traits(
        self,
        *,
        ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
        plan_id: typing.Optional[str] = None,
        trait_id: typing.Optional[str] = None,
        trait_ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
        limit: typing.Optional[int] = None,
        offset: typing.Optional[int] = None,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> CountPlanTraitsResponse:
        """
        Parameters
        ----------
        ids : typing.Optional[typing.Union[str, typing.Sequence[str]]]

        plan_id : typing.Optional[str]

        trait_id : typing.Optional[str]

        trait_ids : typing.Optional[typing.Union[str, typing.Sequence[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
        -------
        CountPlanTraitsResponse
            OK

        Examples
        --------
        import asyncio

        from schematic import AsyncSchematic

        client = AsyncSchematic(
            api_key="YOUR_API_KEY",
        )


        async def main() -> None:
            await client.companies.count_plan_traits(
                plan_id="plan_id",
                trait_id="trait_id",
                limit=1,
                offset=1,
            )


        asyncio.run(main())
        """
        _response = await self._raw_client.count_plan_traits(
            ids=ids,
            plan_id=plan_id,
            trait_id=trait_id,
            trait_ids=trait_ids,
            limit=limit,
            offset=offset,
            request_options=request_options,
        )
        return _response.data

    async def upsert_user_trait(
        self,
        *,
        keys: typing.Dict[str, str],
        trait: str,
        incr: typing.Optional[int] = OMIT,
        set_: typing.Optional[str] = OMIT,
        update_only: typing.Optional[bool] = OMIT,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> UpsertUserTraitResponse:
        """
        Parameters
        ----------
        keys : typing.Dict[str, str]
            Key/value pairs to identify a company or user

        trait : str
            Name of the trait to update

        incr : typing.Optional[int]
            Amount to increment the trait by (positive or negative)

        set_ : typing.Optional[str]
            Value to set the trait to

        update_only : typing.Optional[bool]
            Unless this is set, the company or user will be created if it does not already exist

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

        Returns
        -------
        UpsertUserTraitResponse
            OK

        Examples
        --------
        import asyncio

        from schematic import AsyncSchematic

        client = AsyncSchematic(
            api_key="YOUR_API_KEY",
        )


        async def main() -> None:
            await client.companies.upsert_user_trait(
                keys={"key": "value"},
                trait="trait",
            )


        asyncio.run(main())
        """
        _response = await self._raw_client.upsert_user_trait(
            keys=keys, trait=trait, incr=incr, set_=set_, update_only=update_only, request_options=request_options
        )
        return _response.data

    async def list_users(
        self,
        *,
        company_id: typing.Optional[str] = None,
        ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
        plan_id: typing.Optional[str] = None,
        q: typing.Optional[str] = None,
        limit: typing.Optional[int] = None,
        offset: typing.Optional[int] = None,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> ListUsersResponse:
        """
        Parameters
        ----------
        company_id : typing.Optional[str]
            Filter users by company ID (starts with comp_)

        ids : typing.Optional[typing.Union[str, typing.Sequence[str]]]
            Filter users by multiple user IDs (starts with user_)

        plan_id : typing.Optional[str]
            Filter users by plan ID (starts with plan_)

        q : typing.Optional[str]
            Search for users by name, keys or string traits

        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
        -------
        ListUsersResponse
            OK

        Examples
        --------
        import asyncio

        from schematic import AsyncSchematic

        client = AsyncSchematic(
            api_key="YOUR_API_KEY",
        )


        async def main() -> None:
            await client.companies.list_users(
                company_id="company_id",
                plan_id="plan_id",
                q="q",
                limit=1,
                offset=1,
            )


        asyncio.run(main())
        """
        _response = await self._raw_client.list_users(
            company_id=company_id,
            ids=ids,
            plan_id=plan_id,
            q=q,
            limit=limit,
            offset=offset,
            request_options=request_options,
        )
        return _response.data

    async def upsert_user(
        self,
        *,
        keys: typing.Dict[str, str],
        companies: typing.Optional[typing.Sequence[typing.Dict[str, str]]] = OMIT,
        company: typing.Optional[typing.Dict[str, str]] = OMIT,
        company_id: typing.Optional[str] = OMIT,
        company_ids: typing.Optional[typing.Sequence[str]] = OMIT,
        id: typing.Optional[str] = OMIT,
        last_seen_at: typing.Optional[dt.datetime] = OMIT,
        name: typing.Optional[str] = OMIT,
        traits: typing.Optional[typing.Dict[str, typing.Any]] = OMIT,
        update_only: typing.Optional[bool] = OMIT,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> UpsertUserResponse:
        """
        Parameters
        ----------
        keys : typing.Dict[str, str]
            See [Key Management](https://docs.schematichq.com/developer_resources/key_management) for more information

        companies : typing.Optional[typing.Sequence[typing.Dict[str, str]]]
            Optionally specify companies using array of key/value pairs

        company : typing.Optional[typing.Dict[str, str]]
            Add user to this company. Takes priority over companies. For exhaustive list of companies, use companies

        company_id : typing.Optional[str]
            Add user to this company. Takes priority over company_ids. For exhaustive list of companies, use company_ids

        company_ids : typing.Optional[typing.Sequence[str]]
            Optionally specify companies using Schematic company ID

        id : typing.Optional[str]
            If you know the Schematic ID, you can use that here instead of keys

        last_seen_at : typing.Optional[dt.datetime]

        name : typing.Optional[str]

        traits : typing.Optional[typing.Dict[str, typing.Any]]
            A map of trait names to trait values

        update_only : typing.Optional[bool]

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

        Returns
        -------
        UpsertUserResponse
            OK

        Examples
        --------
        import asyncio

        from schematic import AsyncSchematic

        client = AsyncSchematic(
            api_key="YOUR_API_KEY",
        )


        async def main() -> None:
            await client.companies.upsert_user(
                keys={"key": "value"},
            )


        asyncio.run(main())
        """
        _response = await self._raw_client.upsert_user(
            keys=keys,
            companies=companies,
            company=company,
            company_id=company_id,
            company_ids=company_ids,
            id=id,
            last_seen_at=last_seen_at,
            name=name,
            traits=traits,
            update_only=update_only,
            request_options=request_options,
        )
        return _response.data

    async def get_user(
        self, user_id: str, *, request_options: typing.Optional[RequestOptions] = None
    ) -> GetUserResponse:
        """
        Parameters
        ----------
        user_id : str
            user_id

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

        Returns
        -------
        GetUserResponse
            OK

        Examples
        --------
        import asyncio

        from schematic import AsyncSchematic

        client = AsyncSchematic(
            api_key="YOUR_API_KEY",
        )


        async def main() -> None:
            await client.companies.get_user(
                user_id="user_id",
            )


        asyncio.run(main())
        """
        _response = await self._raw_client.get_user(user_id, request_options=request_options)
        return _response.data

    async def delete_user(
        self, user_id: str, *, request_options: typing.Optional[RequestOptions] = None
    ) -> DeleteUserResponse:
        """
        Parameters
        ----------
        user_id : str
            user_id

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

        Returns
        -------
        DeleteUserResponse
            OK

        Examples
        --------
        import asyncio

        from schematic import AsyncSchematic

        client = AsyncSchematic(
            api_key="YOUR_API_KEY",
        )


        async def main() -> None:
            await client.companies.delete_user(
                user_id="user_id",
            )


        asyncio.run(main())
        """
        _response = await self._raw_client.delete_user(user_id, request_options=request_options)
        return _response.data

    async def count_users(
        self,
        *,
        company_id: typing.Optional[str] = None,
        ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
        plan_id: typing.Optional[str] = None,
        q: typing.Optional[str] = None,
        limit: typing.Optional[int] = None,
        offset: typing.Optional[int] = None,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> CountUsersResponse:
        """
        Parameters
        ----------
        company_id : typing.Optional[str]
            Filter users by company ID (starts with comp_)

        ids : typing.Optional[typing.Union[str, typing.Sequence[str]]]
            Filter users by multiple user IDs (starts with user_)

        plan_id : typing.Optional[str]
            Filter users by plan ID (starts with plan_)

        q : typing.Optional[str]
            Search for users by name, keys or string traits

        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
        -------
        CountUsersResponse
            OK

        Examples
        --------
        import asyncio

        from schematic import AsyncSchematic

        client = AsyncSchematic(
            api_key="YOUR_API_KEY",
        )


        async def main() -> None:
            await client.companies.count_users(
                company_id="company_id",
                plan_id="plan_id",
                q="q",
                limit=1,
                offset=1,
            )


        asyncio.run(main())
        """
        _response = await self._raw_client.count_users(
            company_id=company_id,
            ids=ids,
            plan_id=plan_id,
            q=q,
            limit=limit,
            offset=offset,
            request_options=request_options,
        )
        return _response.data

    async def create_user(
        self,
        *,
        keys: typing.Dict[str, str],
        companies: typing.Optional[typing.Sequence[typing.Dict[str, str]]] = OMIT,
        company: typing.Optional[typing.Dict[str, str]] = OMIT,
        company_id: typing.Optional[str] = OMIT,
        company_ids: typing.Optional[typing.Sequence[str]] = OMIT,
        id: typing.Optional[str] = OMIT,
        last_seen_at: typing.Optional[dt.datetime] = OMIT,
        name: typing.Optional[str] = OMIT,
        traits: typing.Optional[typing.Dict[str, typing.Any]] = OMIT,
        update_only: typing.Optional[bool] = OMIT,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> CreateUserResponse:
        """
        Parameters
        ----------
        keys : typing.Dict[str, str]
            See [Key Management](https://docs.schematichq.com/developer_resources/key_management) for more information

        companies : typing.Optional[typing.Sequence[typing.Dict[str, str]]]
            Optionally specify companies using array of key/value pairs

        company : typing.Optional[typing.Dict[str, str]]
            Add user to this company. Takes priority over companies. For exhaustive list of companies, use companies

        company_id : typing.Optional[str]
            Add user to this company. Takes priority over company_ids. For exhaustive list of companies, use company_ids

        company_ids : typing.Optional[typing.Sequence[str]]
            Optionally specify companies using Schematic company ID

        id : typing.Optional[str]
            If you know the Schematic ID, you can use that here instead of keys

        last_seen_at : typing.Optional[dt.datetime]

        name : typing.Optional[str]

        traits : typing.Optional[typing.Dict[str, typing.Any]]
            A map of trait names to trait values

        update_only : typing.Optional[bool]

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

        Returns
        -------
        CreateUserResponse
            Created

        Examples
        --------
        import asyncio

        from schematic import AsyncSchematic

        client = AsyncSchematic(
            api_key="YOUR_API_KEY",
        )


        async def main() -> None:
            await client.companies.create_user(
                keys={"key": "value"},
            )


        asyncio.run(main())
        """
        _response = await self._raw_client.create_user(
            keys=keys,
            companies=companies,
            company=company,
            company_id=company_id,
            company_ids=company_ids,
            id=id,
            last_seen_at=last_seen_at,
            name=name,
            traits=traits,
            update_only=update_only,
            request_options=request_options,
        )
        return _response.data

    async def delete_user_by_keys(
        self, *, keys: typing.Dict[str, str], request_options: typing.Optional[RequestOptions] = None
    ) -> DeleteUserByKeysResponse:
        """
        Parameters
        ----------
        keys : typing.Dict[str, str]

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

        Returns
        -------
        DeleteUserByKeysResponse
            OK

        Examples
        --------
        import asyncio

        from schematic import AsyncSchematic

        client = AsyncSchematic(
            api_key="YOUR_API_KEY",
        )


        async def main() -> None:
            await client.companies.delete_user_by_keys(
                keys={"key": "value"},
            )


        asyncio.run(main())
        """
        _response = await self._raw_client.delete_user_by_keys(keys=keys, request_options=request_options)
        return _response.data

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

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

        Returns
        -------
        LookupUserResponse
            OK

        Examples
        --------
        import asyncio

        from schematic import AsyncSchematic

        client = AsyncSchematic(
            api_key="YOUR_API_KEY",
        )


        async def main() -> None:
            await client.companies.lookup_user(
                keys={"keys": "keys"},
            )


        asyncio.run(main())
        """
        _response = await self._raw_client.lookup_user(keys=keys, request_options=request_options)
        return _response.data
