# 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 .raw_client import AsyncRawCompaniesClient, RawCompaniesClient
from .types.count_companies_response import CountCompaniesResponse
from .types.count_entity_key_definitions_request_entity_type import CountEntityKeyDefinitionsRequestEntityType
from .types.count_entity_key_definitions_response import CountEntityKeyDefinitionsResponse
from .types.count_entity_trait_definitions_request_entity_type import CountEntityTraitDefinitionsRequestEntityType
from .types.count_entity_trait_definitions_request_trait_type import CountEntityTraitDefinitionsRequestTraitType
from .types.count_entity_trait_definitions_response import CountEntityTraitDefinitionsResponse
from .types.count_users_response import CountUsersResponse
from .types.create_company_response import CreateCompanyResponse
from .types.create_entity_trait_definition_request_body_entity_type import (
    CreateEntityTraitDefinitionRequestBodyEntityType,
)
from .types.create_entity_trait_definition_request_body_trait_type import (
    CreateEntityTraitDefinitionRequestBodyTraitType,
)
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_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_active_deals_response import GetActiveDealsResponse
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_user_response import GetUserResponse
from .types.list_companies_response import ListCompaniesResponse
from .types.list_company_memberships_response import ListCompanyMembershipsResponse
from .types.list_entity_key_definitions_request_entity_type import ListEntityKeyDefinitionsRequestEntityType
from .types.list_entity_key_definitions_response import ListEntityKeyDefinitionsResponse
from .types.list_entity_trait_definitions_request_entity_type import ListEntityTraitDefinitionsRequestEntityType
from .types.list_entity_trait_definitions_request_trait_type import ListEntityTraitDefinitionsRequestTraitType
from .types.list_entity_trait_definitions_response import ListEntityTraitDefinitionsResponse
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_request_body_trait_type import (
    UpdateEntityTraitDefinitionRequestBodyTraitType,
)
from .types.update_entity_trait_definition_response import UpdateEntityTraitDefinitionResponse
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()
        """
        _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.Optional[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.Optional[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, *, request_options: typing.Optional[RequestOptions] = None
    ) -> DeleteCompanyResponse:
        """
        Parameters
        ----------
        company_id : str
            company_id

        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",
        )
        """
        _response = self._raw_client.delete_company(company_id, 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()
        """
        _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 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.Optional[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.Optional[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 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 get_active_deals(
        self,
        *,
        company_id: str,
        deal_stage: str,
        limit: typing.Optional[int] = None,
        offset: typing.Optional[int] = None,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> GetActiveDealsResponse:
        """
        Parameters
        ----------
        company_id : str

        deal_stage : 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
        -------
        GetActiveDealsResponse
            OK

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

        client = Schematic(
            api_key="YOUR_API_KEY",
        )
        client.companies.get_active_deals(
            company_id="company_id",
            deal_stage="deal_stage",
        )
        """
        _response = self._raw_client.get_active_deals(
            company_id=company_id, deal_stage=deal_stage, limit=limit, offset=offset, 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()
        """
        _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()
        """
        _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[ListEntityKeyDefinitionsRequestEntityType] = 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[ListEntityKeyDefinitionsRequestEntityType]

        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()
        """
        _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[CountEntityKeyDefinitionsRequestEntityType] = 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[CountEntityKeyDefinitionsRequestEntityType]

        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()
        """
        _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[ListEntityTraitDefinitionsRequestEntityType] = None,
        ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
        q: typing.Optional[str] = None,
        trait_type: typing.Optional[ListEntityTraitDefinitionsRequestTraitType] = None,
        limit: typing.Optional[int] = None,
        offset: typing.Optional[int] = None,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> ListEntityTraitDefinitionsResponse:
        """
        Parameters
        ----------
        entity_type : typing.Optional[ListEntityTraitDefinitionsRequestEntityType]

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

        q : typing.Optional[str]

        trait_type : typing.Optional[ListEntityTraitDefinitionsRequestTraitType]

        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()
        """
        _response = self._raw_client.list_entity_trait_definitions(
            entity_type=entity_type,
            ids=ids,
            q=q,
            trait_type=trait_type,
            limit=limit,
            offset=offset,
            request_options=request_options,
        )
        return _response.data

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

        hierarchy : typing.Sequence[str]

        trait_type : CreateEntityTraitDefinitionRequestBodyTraitType

        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: UpdateEntityTraitDefinitionRequestBodyTraitType,
        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 : UpdateEntityTraitDefinitionRequestBodyTraitType

        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[CountEntityTraitDefinitionsRequestEntityType] = None,
        ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
        q: typing.Optional[str] = None,
        trait_type: typing.Optional[CountEntityTraitDefinitionsRequestTraitType] = None,
        limit: typing.Optional[int] = None,
        offset: typing.Optional[int] = None,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> CountEntityTraitDefinitionsResponse:
        """
        Parameters
        ----------
        entity_type : typing.Optional[CountEntityTraitDefinitionsRequestEntityType]

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

        q : typing.Optional[str]

        trait_type : typing.Optional[CountEntityTraitDefinitionsRequestTraitType]

        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()
        """
        _response = self._raw_client.count_entity_trait_definitions(
            entity_type=entity_type,
            ids=ids,
            q=q,
            trait_type=trait_type,
            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",
        )
        """
        _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 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()
        """
        _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.Optional[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.Optional[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()
        """
        _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.Optional[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.Optional[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()


        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.Optional[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.Optional[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, *, request_options: typing.Optional[RequestOptions] = None
    ) -> DeleteCompanyResponse:
        """
        Parameters
        ----------
        company_id : str
            company_id

        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",
            )


        asyncio.run(main())
        """
        _response = await self._raw_client.delete_company(company_id, 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()


        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 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.Optional[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.Optional[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 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 get_active_deals(
        self,
        *,
        company_id: str,
        deal_stage: str,
        limit: typing.Optional[int] = None,
        offset: typing.Optional[int] = None,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> GetActiveDealsResponse:
        """
        Parameters
        ----------
        company_id : str

        deal_stage : 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
        -------
        GetActiveDealsResponse
            OK

        Examples
        --------
        import asyncio

        from schematic import AsyncSchematic

        client = AsyncSchematic(
            api_key="YOUR_API_KEY",
        )


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


        asyncio.run(main())
        """
        _response = await self._raw_client.get_active_deals(
            company_id=company_id, deal_stage=deal_stage, limit=limit, offset=offset, 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()


        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()


        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[ListEntityKeyDefinitionsRequestEntityType] = 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[ListEntityKeyDefinitionsRequestEntityType]

        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()


        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[CountEntityKeyDefinitionsRequestEntityType] = 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[CountEntityKeyDefinitionsRequestEntityType]

        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()


        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[ListEntityTraitDefinitionsRequestEntityType] = None,
        ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
        q: typing.Optional[str] = None,
        trait_type: typing.Optional[ListEntityTraitDefinitionsRequestTraitType] = None,
        limit: typing.Optional[int] = None,
        offset: typing.Optional[int] = None,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> ListEntityTraitDefinitionsResponse:
        """
        Parameters
        ----------
        entity_type : typing.Optional[ListEntityTraitDefinitionsRequestEntityType]

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

        q : typing.Optional[str]

        trait_type : typing.Optional[ListEntityTraitDefinitionsRequestTraitType]

        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()


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

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

        hierarchy : typing.Sequence[str]

        trait_type : CreateEntityTraitDefinitionRequestBodyTraitType

        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: UpdateEntityTraitDefinitionRequestBodyTraitType,
        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 : UpdateEntityTraitDefinitionRequestBodyTraitType

        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[CountEntityTraitDefinitionsRequestEntityType] = None,
        ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
        q: typing.Optional[str] = None,
        trait_type: typing.Optional[CountEntityTraitDefinitionsRequestTraitType] = None,
        limit: typing.Optional[int] = None,
        offset: typing.Optional[int] = None,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> CountEntityTraitDefinitionsResponse:
        """
        Parameters
        ----------
        entity_type : typing.Optional[CountEntityTraitDefinitionsRequestEntityType]

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

        q : typing.Optional[str]

        trait_type : typing.Optional[CountEntityTraitDefinitionsRequestTraitType]

        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()


        asyncio.run(main())
        """
        _response = await self._raw_client.count_entity_trait_definitions(
            entity_type=entity_type,
            ids=ids,
            q=q,
            trait_type=trait_type,
            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",
            )


        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 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()


        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.Optional[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.Optional[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()


        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.Optional[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.Optional[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
