diff --git a/.fern/replay.lock b/.fern/replay.lock index 6be5ee4..9c4b29f 100644 --- a/.fern/replay.lock +++ b/.fern/replay.lock @@ -12,5 +12,11 @@ generations: cli_version: unknown generator_versions: fernapi/fern-python-sdk: 4.25.5 -current_generation: a7d57c567987a6cfead733b64cd20d025c4ea593 + - commit_sha: 06329e0a67f5396af716b0f9065bf54ff9b4e613 + tree_hash: f736bb9cd3ec813048fa6bdc02e54e1f974fb959 + timestamp: 2026-08-04T17:50:26.852Z + cli_version: unknown + generator_versions: + fernapi/fern-python-sdk: 4.25.5 +current_generation: 06329e0a67f5396af716b0f9065bf54ff9b4e613 patches: [] diff --git a/pyproject.toml b/pyproject.toml index e88b9e7..2dae47b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,10 +1,10 @@ [project] name = "zep-cloud" -version = "3.26.0" +version = "3.27.0" [tool.poetry] name = "zep-cloud" -version = "3.26.0" +version = "3.27.0" description = "" readme = "README.md" authors = [] diff --git a/reference.md b/reference.md index 50ea65c..9158587 100644 --- a/reference.md +++ b/reference.md @@ -1,4 +1,1065 @@ # Reference +## UserGroup +
client.user_group.list_policy_sets(...) +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from zep_cloud import Zep + +client = Zep( + api_key="YOUR_API_KEY", +) +client.user_group.list_policy_sets( + group_uuid="groupUUID", + project_id="projectId", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**group_uuid:** `str` — UserGroup UUID + +
+
+ +
+
+ +**project_id:** `str` — Project UUID + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.user_group.attach_policy_set(...) +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from zep_cloud import Zep + +client = Zep( + api_key="YOUR_API_KEY", +) +client.user_group.attach_policy_set( + group_uuid="groupUUID", + project_id="projectId", + policy_set_uuid="policy_set_uuid", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**group_uuid:** `str` — UserGroup UUID + +
+
+ +
+
+ +**project_id:** `str` — Project UUID + +
+
+ +
+
+ +**policy_set_uuid:** `str` + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.user_group.detach_policy_set(...) +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from zep_cloud import Zep + +client = Zep( + api_key="YOUR_API_KEY", +) +client.user_group.detach_policy_set( + group_uuid="groupUUID", + policy_set_uuid="policySetUUID", + project_id="projectId", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**group_uuid:** `str` — UserGroup UUID + +
+
+ +
+
+ +**policy_set_uuid:** `str` — Policy set UUID + +
+
+ +
+
+ +**project_id:** `str` — Project UUID + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.user_group.list(...) +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from zep_cloud import Zep + +client = Zep( + api_key="YOUR_API_KEY", +) +client.user_group.list( + project_id="projectId", + page_number=1, + page_size=1, + search="search", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**project_id:** `str` — Project UUID + +
+
+ +
+
+ +**page_number:** `int` — Page number + +
+
+ +
+
+ +**page_size:** `int` — Page size + +
+
+ +
+
+ +**search:** `typing.Optional[str]` — Name search + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.user_group.create(...) +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from zep_cloud import Zep + +client = Zep( + api_key="YOUR_API_KEY", +) +client.user_group.create( + project_id="projectId", + name="name", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**project_id:** `str` — Project UUID + +
+
+ +
+
+ +**name:** `str` + +
+
+ +
+
+ +**description:** `typing.Optional[str]` + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.user_group.list_for_user(...) +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from zep_cloud import Zep + +client = Zep( + api_key="YOUR_API_KEY", +) +client.user_group.list_for_user( + user_uuid="userUUID", + project_id="projectId", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**user_uuid:** `str` — User UUID + +
+
+ +
+
+ +**project_id:** `str` — Project UUID + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.user_group.get(...) +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from zep_cloud import Zep + +client = Zep( + api_key="YOUR_API_KEY", +) +client.user_group.get( + group_uuid="groupUUID", + project_id="projectId", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**group_uuid:** `str` — UserGroup UUID + +
+
+ +
+
+ +**project_id:** `str` — Project UUID + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.user_group.delete(...) +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from zep_cloud import Zep + +client = Zep( + api_key="YOUR_API_KEY", +) +client.user_group.delete( + group_uuid="groupUUID", + project_id="projectId", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**group_uuid:** `str` — UserGroup UUID + +
+
+ +
+
+ +**project_id:** `str` — Project UUID + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.user_group.update(...) +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from zep_cloud import Zep + +client = Zep( + api_key="YOUR_API_KEY", +) +client.user_group.update( + group_uuid="groupUUID", + project_id="projectId", + expected_version=1, +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**group_uuid:** `str` — UserGroup UUID + +
+
+ +
+
+ +**project_id:** `str` — Project UUID + +
+
+ +
+
+ +**expected_version:** `int` + +
+
+ +
+
+ +**description:** `typing.Optional[str]` + +
+
+ +
+
+ +**name:** `typing.Optional[str]` + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.user_group.list_members(...) +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from zep_cloud import Zep + +client = Zep( + api_key="YOUR_API_KEY", +) +client.user_group.list_members( + group_uuid="groupUUID", + project_id="projectId", + page_number=1, + page_size=1, + search="search", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**group_uuid:** `str` — UserGroup UUID + +
+
+ +
+
+ +**project_id:** `str` — Project UUID + +
+
+ +
+
+ +**page_number:** `int` — Page number + +
+
+ +
+
+ +**page_size:** `int` — Page size + +
+
+ +
+
+ +**search:** `typing.Optional[str]` — User search + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.user_group.add_members(...) +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from zep_cloud import Zep + +client = Zep( + api_key="YOUR_API_KEY", +) +client.user_group.add_members( + group_uuid="groupUUID", + project_id="projectId", + user_uuids=["user_uuids"], +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**group_uuid:** `str` — UserGroup UUID + +
+
+ +
+
+ +**project_id:** `str` — Project UUID + +
+
+ +
+
+ +**user_uuids:** `typing.Sequence[str]` + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.user_group.remove_members(...) +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from zep_cloud import Zep + +client = Zep( + api_key="YOUR_API_KEY", +) +client.user_group.remove_members( + group_uuid="groupUUID", + project_id="projectId", + user_uuids=["user_uuids"], +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**group_uuid:** `str` — UserGroup UUID + +
+
+ +
+
+ +**project_id:** `str` — Project UUID + +
+
+ +
+
+ +**user_uuids:** `typing.Sequence[str]` + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.user_group.list_member_candidates(...) +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from zep_cloud import Zep + +client = Zep( + api_key="YOUR_API_KEY", +) +client.user_group.list_member_candidates( + group_uuid="groupUUID", + project_id="projectId", + page_number=1, + page_size=1, + search="search", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**group_uuid:** `str` — UserGroup UUID + +
+
+ +
+
+ +**project_id:** `str` — Project UUID + +
+
+ +
+
+ +**page_number:** `int` — Page number + +
+
+ +
+
+ +**page_size:** `int` — Page size + +
+
+ +
+
+ +**search:** `typing.Optional[str]` — User search + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.user_group.remove_member(...) +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from zep_cloud import Zep + +client = Zep( + api_key="YOUR_API_KEY", +) +client.user_group.remove_member( + group_uuid="groupUUID", + user_uuid="userUUID", + project_id="projectId", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**group_uuid:** `str` — UserGroup UUID + +
+
+ +
+
+ +**user_uuid:** `str` — User UUID + +
+
+ +
+
+ +**project_id:** `str` — Project UUID + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ ## Batch
client.batch.list(...)
@@ -2067,7 +3128,7 @@ client.graph.list_all(
-**page_size:** `typing.Optional[int]` — Number of graphs to retrieve per page. +**page_size:** `typing.Optional[int]` — Number of graphs to retrieve per page (default 50, range 1-100; explicit 0 is invalid).
@@ -2075,7 +3136,7 @@ client.graph.list_all(
-**search:** `typing.Optional[str]` — Search term for filtering graphs by graph_id. +**search:** `typing.Optional[str]` — Search term for filtering graphs by graph_id, name, or description. Queries longer than 200 Unicode code points after whitespace normalization are invalid.
@@ -2083,7 +3144,7 @@ client.graph.list_all(
-**order_by:** `typing.Optional[str]` — Column to sort by (created_at, group_id, name). +**order_by:** `typing.Optional[str]` — Column to sort by (created_at, graph_id, name).
diff --git a/src/zep_cloud/__init__.py b/src/zep_cloud/__init__.py index 57aa7d2..9c9f3fb 100644 --- a/src/zep_cloud/__init__.py +++ b/src/zep_cloud/__init__.py @@ -12,6 +12,7 @@ ApiError, ApidataBatchAddItemRole, ApidataBatchAddItemType, + AttachedPolicySetsResponse, BatchAddItem, BatchItemDetail, BatchItemKind, @@ -64,12 +65,14 @@ Message, MessageListResponse, MetadataFilterGroup, + MutateUserGroupMembersRequest, ObservationSteeringConfig, ObservationType, PathDetectConfig, PatternMetadata, PatternResult, PatternSeeds, + PolicySetSummaryResponse, ProjectInfo, ProjectInfoResponse, PropertyFilter, @@ -86,12 +89,20 @@ ThreadListResponse, ThreadSummary, User, + UserGroup, + UserGroupKind, + UserGroupListResponse, + UserGroupMembersResponse, + UserGroupMembershipResponse, + UserGroupQuota, + UserGroupResponse, UserInstruction, UserListResponse, + UserMembershipGroupsResponse, UserNodeResponse, ) from .errors import BadRequestError, ConflictError, ForbiddenError, InternalServerError, NotFoundError -from . import batch, context, graph, project, task, thread, user +from . import batch, context, graph, project, task, thread, user, user_group from .client import AsyncZep, Zep from .environment import ZepEnvironment from .version import __version__ @@ -107,6 +118,7 @@ "ApidataBatchAddItemRole", "ApidataBatchAddItemType", "AsyncZep", + "AttachedPolicySetsResponse", "BadRequestError", "BatchAddItem", "BatchItemDetail", @@ -163,6 +175,7 @@ "Message", "MessageListResponse", "MetadataFilterGroup", + "MutateUserGroupMembersRequest", "NotFoundError", "ObservationSteeringConfig", "ObservationType", @@ -170,6 +183,7 @@ "PatternMetadata", "PatternResult", "PatternSeeds", + "PolicySetSummaryResponse", "ProjectInfo", "ProjectInfoResponse", "PropertyFilter", @@ -186,8 +200,16 @@ "ThreadListResponse", "ThreadSummary", "User", + "UserGroup", + "UserGroupKind", + "UserGroupListResponse", + "UserGroupMembersResponse", + "UserGroupMembershipResponse", + "UserGroupQuota", + "UserGroupResponse", "UserInstruction", "UserListResponse", + "UserMembershipGroupsResponse", "UserNodeResponse", "Zep", "ZepEnvironment", @@ -199,4 +221,5 @@ "task", "thread", "user", + "user_group", ] diff --git a/src/zep_cloud/base_client.py b/src/zep_cloud/base_client.py index e59bb3c..e95c27b 100644 --- a/src/zep_cloud/base_client.py +++ b/src/zep_cloud/base_client.py @@ -14,6 +14,7 @@ from .task.client import AsyncTaskClient, TaskClient from .thread.client import AsyncThreadClient, ThreadClient from .user.client import AsyncUserClient, UserClient +from .user_group.client import AsyncUserGroupClient, UserGroupClient class BaseClient: @@ -83,6 +84,7 @@ def __init__( else httpx.Client(timeout=_defaulted_timeout), timeout=_defaulted_timeout, ) + self.user_group = UserGroupClient(client_wrapper=self._client_wrapper) self.batch = BatchClient(client_wrapper=self._client_wrapper) self.context = ContextClient(client_wrapper=self._client_wrapper) self.graph = GraphClient(client_wrapper=self._client_wrapper) @@ -159,6 +161,7 @@ def __init__( else httpx.AsyncClient(timeout=_defaulted_timeout), timeout=_defaulted_timeout, ) + self.user_group = AsyncUserGroupClient(client_wrapper=self._client_wrapper) self.batch = AsyncBatchClient(client_wrapper=self._client_wrapper) self.context = AsyncContextClient(client_wrapper=self._client_wrapper) self.graph = AsyncGraphClient(client_wrapper=self._client_wrapper) diff --git a/src/zep_cloud/core/client_wrapper.py b/src/zep_cloud/core/client_wrapper.py index acb66ce..9706024 100644 --- a/src/zep_cloud/core/client_wrapper.py +++ b/src/zep_cloud/core/client_wrapper.py @@ -22,10 +22,10 @@ def __init__( def get_headers(self) -> typing.Dict[str, str]: headers: typing.Dict[str, str] = { - "User-Agent": "zep-cloud/3.26.0", + "User-Agent": "zep-cloud/3.27.0", "X-Fern-Language": "Python", "X-Fern-SDK-Name": "zep-cloud", - "X-Fern-SDK-Version": "3.26.0", + "X-Fern-SDK-Version": "3.27.0", **(self.get_custom_headers() or {}), } headers["Authorization"] = f"Api-Key {self.api_key}" diff --git a/src/zep_cloud/graph/client.py b/src/zep_cloud/graph/client.py index ec9543e..93fe499 100644 --- a/src/zep_cloud/graph/client.py +++ b/src/zep_cloud/graph/client.py @@ -685,13 +685,13 @@ def list_all( Page number for pagination, starting from 1. page_size : typing.Optional[int] - Number of graphs to retrieve per page. + Number of graphs to retrieve per page (default 50, range 1-100; explicit 0 is invalid). search : typing.Optional[str] - Search term for filtering graphs by graph_id. + Search term for filtering graphs by graph_id, name, or description. Queries longer than 200 Unicode code points after whitespace normalization are invalid. order_by : typing.Optional[str] - Column to sort by (created_at, group_id, name). + Column to sort by (created_at, graph_id, name). asc : typing.Optional[bool] Sort in ascending order. @@ -1838,13 +1838,13 @@ async def list_all( Page number for pagination, starting from 1. page_size : typing.Optional[int] - Number of graphs to retrieve per page. + Number of graphs to retrieve per page (default 50, range 1-100; explicit 0 is invalid). search : typing.Optional[str] - Search term for filtering graphs by graph_id. + Search term for filtering graphs by graph_id, name, or description. Queries longer than 200 Unicode code points after whitespace normalization are invalid. order_by : typing.Optional[str] - Column to sort by (created_at, group_id, name). + Column to sort by (created_at, graph_id, name). asc : typing.Optional[bool] Sort in ascending order. diff --git a/src/zep_cloud/graph/raw_client.py b/src/zep_cloud/graph/raw_client.py index 9056b30..ca4908e 100644 --- a/src/zep_cloud/graph/raw_client.py +++ b/src/zep_cloud/graph/raw_client.py @@ -1091,13 +1091,13 @@ def list_all( Page number for pagination, starting from 1. page_size : typing.Optional[int] - Number of graphs to retrieve per page. + Number of graphs to retrieve per page (default 50, range 1-100; explicit 0 is invalid). search : typing.Optional[str] - Search term for filtering graphs by graph_id. + Search term for filtering graphs by graph_id, name, or description. Queries longer than 200 Unicode code points after whitespace normalization are invalid. order_by : typing.Optional[str] - Column to sort by (created_at, group_id, name). + Column to sort by (created_at, graph_id, name). asc : typing.Optional[bool] Sort in ascending order. @@ -2895,13 +2895,13 @@ async def list_all( Page number for pagination, starting from 1. page_size : typing.Optional[int] - Number of graphs to retrieve per page. + Number of graphs to retrieve per page (default 50, range 1-100; explicit 0 is invalid). search : typing.Optional[str] - Search term for filtering graphs by graph_id. + Search term for filtering graphs by graph_id, name, or description. Queries longer than 200 Unicode code points after whitespace normalization are invalid. order_by : typing.Optional[str] - Column to sort by (created_at, group_id, name). + Column to sort by (created_at, graph_id, name). asc : typing.Optional[bool] Sort in ascending order. diff --git a/src/zep_cloud/types/__init__.py b/src/zep_cloud/types/__init__.py index 4b786fd..f393620 100644 --- a/src/zep_cloud/types/__init__.py +++ b/src/zep_cloud/types/__init__.py @@ -11,6 +11,7 @@ from .api_error import ApiError from .apidata_batch_add_item_role import ApidataBatchAddItemRole from .apidata_batch_add_item_type import ApidataBatchAddItemType +from .attached_policy_sets_response import AttachedPolicySetsResponse from .batch_add_item import BatchAddItem from .batch_item_detail import BatchItemDetail from .batch_item_kind import BatchItemKind @@ -63,12 +64,14 @@ from .message import Message from .message_list_response import MessageListResponse from .metadata_filter_group import MetadataFilterGroup +from .mutate_user_group_members_request import MutateUserGroupMembersRequest from .observation_steering_config import ObservationSteeringConfig from .observation_type import ObservationType from .path_detect_config import PathDetectConfig from .pattern_metadata import PatternMetadata from .pattern_result import PatternResult from .pattern_seeds import PatternSeeds +from .policy_set_summary_response import PolicySetSummaryResponse from .project_info import ProjectInfo from .project_info_response import ProjectInfoResponse from .property_filter import PropertyFilter @@ -85,8 +88,16 @@ from .thread_list_response import ThreadListResponse from .thread_summary import ThreadSummary from .user import User +from .user_group import UserGroup +from .user_group_kind import UserGroupKind +from .user_group_list_response import UserGroupListResponse +from .user_group_members_response import UserGroupMembersResponse +from .user_group_membership_response import UserGroupMembershipResponse +from .user_group_quota import UserGroupQuota +from .user_group_response import UserGroupResponse from .user_instruction import UserInstruction from .user_list_response import UserListResponse +from .user_membership_groups_response import UserMembershipGroupsResponse from .user_node_response import UserNodeResponse __all__ = [ @@ -99,6 +110,7 @@ "ApiError", "ApidataBatchAddItemRole", "ApidataBatchAddItemType", + "AttachedPolicySetsResponse", "BatchAddItem", "BatchItemDetail", "BatchItemKind", @@ -151,12 +163,14 @@ "Message", "MessageListResponse", "MetadataFilterGroup", + "MutateUserGroupMembersRequest", "ObservationSteeringConfig", "ObservationType", "PathDetectConfig", "PatternMetadata", "PatternResult", "PatternSeeds", + "PolicySetSummaryResponse", "ProjectInfo", "ProjectInfoResponse", "PropertyFilter", @@ -173,7 +187,15 @@ "ThreadListResponse", "ThreadSummary", "User", + "UserGroup", + "UserGroupKind", + "UserGroupListResponse", + "UserGroupMembersResponse", + "UserGroupMembershipResponse", + "UserGroupQuota", + "UserGroupResponse", "UserInstruction", "UserListResponse", + "UserMembershipGroupsResponse", "UserNodeResponse", ] diff --git a/src/zep_cloud/types/attached_policy_sets_response.py b/src/zep_cloud/types/attached_policy_sets_response.py new file mode 100644 index 0000000..6a53fed --- /dev/null +++ b/src/zep_cloud/types/attached_policy_sets_response.py @@ -0,0 +1,20 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel +from .policy_set_summary_response import PolicySetSummaryResponse + + +class AttachedPolicySetsResponse(UniversalBaseModel): + policy_sets: typing.Optional[typing.List[PolicySetSummaryResponse]] = None + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/zep_cloud/types/graph.py b/src/zep_cloud/types/graph.py index 8ae534e..dd05ec3 100644 --- a/src/zep_cloud/types/graph.py +++ b/src/zep_cloud/types/graph.py @@ -16,6 +16,7 @@ class Graph(UniversalBaseModel): name: typing.Optional[str] = None project_uuid: typing.Optional[str] = None time_zone: typing.Optional[str] = None + updated_at: typing.Optional[str] = None uuid_: typing_extensions.Annotated[typing.Optional[str], FieldMetadata(alias="uuid")] = None if IS_PYDANTIC_V2: diff --git a/src/zep_cloud/types/graph_list_response.py b/src/zep_cloud/types/graph_list_response.py index 5b7386c..eab1a25 100644 --- a/src/zep_cloud/types/graph_list_response.py +++ b/src/zep_cloud/types/graph_list_response.py @@ -9,6 +9,8 @@ class GraphListResponse(UniversalBaseModel): graphs: typing.Optional[typing.List[Graph]] = None + page_number: typing.Optional[int] = None + page_size: typing.Optional[int] = None row_count: typing.Optional[int] = None total_count: typing.Optional[int] = None diff --git a/src/zep_cloud/types/mutate_user_group_members_request.py b/src/zep_cloud/types/mutate_user_group_members_request.py new file mode 100644 index 0000000..2604282 --- /dev/null +++ b/src/zep_cloud/types/mutate_user_group_members_request.py @@ -0,0 +1,19 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel + + +class MutateUserGroupMembersRequest(UniversalBaseModel): + user_uuids: typing.List[str] + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/zep_cloud/types/policy_set_summary_response.py b/src/zep_cloud/types/policy_set_summary_response.py new file mode 100644 index 0000000..a8cb071 --- /dev/null +++ b/src/zep_cloud/types/policy_set_summary_response.py @@ -0,0 +1,24 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +import typing_extensions +from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel +from ..core.serialization import FieldMetadata + + +class PolicySetSummaryResponse(UniversalBaseModel): + mode: typing.Optional[str] = None + name: typing.Optional[str] = None + uuid_: typing_extensions.Annotated[typing.Optional[str], FieldMetadata(alias="uuid")] = None + version: typing.Optional[int] = None + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/zep_cloud/types/user_group.py b/src/zep_cloud/types/user_group.py new file mode 100644 index 0000000..dbae6de --- /dev/null +++ b/src/zep_cloud/types/user_group.py @@ -0,0 +1,31 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +import typing_extensions +from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel +from ..core.serialization import FieldMetadata +from .user_group_kind import UserGroupKind + + +class UserGroup(UniversalBaseModel): + attached_policy_set_count: typing.Optional[int] = None + created_at: typing.Optional[str] = None + description: typing.Optional[str] = None + kind: typing.Optional[UserGroupKind] = None + member_count: typing.Optional[int] = None + name: typing.Optional[str] = None + project_uuid: typing.Optional[str] = None + updated_at: typing.Optional[str] = None + uuid_: typing_extensions.Annotated[typing.Optional[str], FieldMetadata(alias="uuid")] = None + version: typing.Optional[int] = None + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/zep_cloud/types/user_group_kind.py b/src/zep_cloud/types/user_group_kind.py new file mode 100644 index 0000000..5691b04 --- /dev/null +++ b/src/zep_cloud/types/user_group_kind.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +UserGroupKind = typing.Union[typing.Literal["managed", "virtual"], typing.Any] diff --git a/src/zep_cloud/types/user_group_list_response.py b/src/zep_cloud/types/user_group_list_response.py new file mode 100644 index 0000000..8cc9ee4 --- /dev/null +++ b/src/zep_cloud/types/user_group_list_response.py @@ -0,0 +1,24 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel +from .user_group import UserGroup +from .user_group_quota import UserGroupQuota + + +class UserGroupListResponse(UniversalBaseModel): + quota: typing.Optional[UserGroupQuota] = None + row_count: typing.Optional[int] = None + total_count: typing.Optional[int] = None + user_groups: typing.Optional[typing.List[UserGroup]] = None + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/zep_cloud/types/user_group_members_response.py b/src/zep_cloud/types/user_group_members_response.py new file mode 100644 index 0000000..5e6aba8 --- /dev/null +++ b/src/zep_cloud/types/user_group_members_response.py @@ -0,0 +1,22 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel +from .user import User + + +class UserGroupMembersResponse(UniversalBaseModel): + row_count: typing.Optional[int] = None + total_count: typing.Optional[int] = None + users: typing.Optional[typing.List[User]] = None + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/zep_cloud/types/user_group_membership_response.py b/src/zep_cloud/types/user_group_membership_response.py new file mode 100644 index 0000000..202da5e --- /dev/null +++ b/src/zep_cloud/types/user_group_membership_response.py @@ -0,0 +1,21 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel + + +class UserGroupMembershipResponse(UniversalBaseModel): + added_count: typing.Optional[int] = None + no_op_count: typing.Optional[int] = None + removed_count: typing.Optional[int] = None + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/zep_cloud/types/user_group_quota.py b/src/zep_cloud/types/user_group_quota.py new file mode 100644 index 0000000..c5c13ca --- /dev/null +++ b/src/zep_cloud/types/user_group_quota.py @@ -0,0 +1,23 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel + + +class UserGroupQuota(UniversalBaseModel): + active_managed: typing.Optional[int] = None + allocation: typing.Optional[int] = None + has_feature: typing.Optional[bool] = None + resolved: typing.Optional[bool] = None + unlimited: typing.Optional[bool] = None + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/zep_cloud/types/user_group_response.py b/src/zep_cloud/types/user_group_response.py new file mode 100644 index 0000000..74e7c8d --- /dev/null +++ b/src/zep_cloud/types/user_group_response.py @@ -0,0 +1,31 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +import typing_extensions +from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel +from ..core.serialization import FieldMetadata +from .user_group_kind import UserGroupKind + + +class UserGroupResponse(UniversalBaseModel): + attached_policy_set_count: typing.Optional[int] = None + created_at: typing.Optional[str] = None + description: typing.Optional[str] = None + kind: typing.Optional[UserGroupKind] = None + member_count: typing.Optional[int] = None + name: typing.Optional[str] = None + project_uuid: typing.Optional[str] = None + updated_at: typing.Optional[str] = None + uuid_: typing_extensions.Annotated[typing.Optional[str], FieldMetadata(alias="uuid")] = None + version: typing.Optional[int] = None + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/zep_cloud/types/user_membership_groups_response.py b/src/zep_cloud/types/user_membership_groups_response.py new file mode 100644 index 0000000..a087d99 --- /dev/null +++ b/src/zep_cloud/types/user_membership_groups_response.py @@ -0,0 +1,20 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel +from .user_group import UserGroup + + +class UserMembershipGroupsResponse(UniversalBaseModel): + user_groups: typing.Optional[typing.List[UserGroup]] = None + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/zep_cloud/user_group/__init__.py b/src/zep_cloud/user_group/__init__.py new file mode 100644 index 0000000..5cde020 --- /dev/null +++ b/src/zep_cloud/user_group/__init__.py @@ -0,0 +1,4 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + diff --git a/src/zep_cloud/user_group/client.py b/src/zep_cloud/user_group/client.py new file mode 100644 index 0000000..631a7b4 --- /dev/null +++ b/src/zep_cloud/user_group/client.py @@ -0,0 +1,1450 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ..core.request_options import RequestOptions +from ..types.attached_policy_sets_response import AttachedPolicySetsResponse +from ..types.user_group_list_response import UserGroupListResponse +from ..types.user_group_members_response import UserGroupMembersResponse +from ..types.user_group_membership_response import UserGroupMembershipResponse +from ..types.user_group_response import UserGroupResponse +from ..types.user_membership_groups_response import UserMembershipGroupsResponse +from .raw_client import AsyncRawUserGroupClient, RawUserGroupClient + +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class UserGroupClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._raw_client = RawUserGroupClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> RawUserGroupClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + RawUserGroupClient + """ + return self._raw_client + + def list_policy_sets( + self, group_uuid: str, *, project_id: str, request_options: typing.Optional[RequestOptions] = None + ) -> AttachedPolicySetsResponse: + """ + Parameters + ---------- + group_uuid : str + UserGroup UUID + + project_id : str + Project UUID + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AttachedPolicySetsResponse + OK + + Examples + -------- + from zep_cloud import Zep + + client = Zep( + api_key="YOUR_API_KEY", + ) + client.user_group.list_policy_sets( + group_uuid="groupUUID", + project_id="projectId", + ) + """ + _response = self._raw_client.list_policy_sets( + group_uuid, project_id=project_id, request_options=request_options + ) + return _response.data + + def attach_policy_set( + self, + group_uuid: str, + *, + project_id: str, + policy_set_uuid: str, + request_options: typing.Optional[RequestOptions] = None, + ) -> AttachedPolicySetsResponse: + """ + Parameters + ---------- + group_uuid : str + UserGroup UUID + + project_id : str + Project UUID + + policy_set_uuid : str + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AttachedPolicySetsResponse + OK + + Examples + -------- + from zep_cloud import Zep + + client = Zep( + api_key="YOUR_API_KEY", + ) + client.user_group.attach_policy_set( + group_uuid="groupUUID", + project_id="projectId", + policy_set_uuid="policy_set_uuid", + ) + """ + _response = self._raw_client.attach_policy_set( + group_uuid, project_id=project_id, policy_set_uuid=policy_set_uuid, request_options=request_options + ) + return _response.data + + def detach_policy_set( + self, + group_uuid: str, + policy_set_uuid: str, + *, + project_id: str, + request_options: typing.Optional[RequestOptions] = None, + ) -> AttachedPolicySetsResponse: + """ + Parameters + ---------- + group_uuid : str + UserGroup UUID + + policy_set_uuid : str + Policy set UUID + + project_id : str + Project UUID + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AttachedPolicySetsResponse + OK + + Examples + -------- + from zep_cloud import Zep + + client = Zep( + api_key="YOUR_API_KEY", + ) + client.user_group.detach_policy_set( + group_uuid="groupUUID", + policy_set_uuid="policySetUUID", + project_id="projectId", + ) + """ + _response = self._raw_client.detach_policy_set( + group_uuid, policy_set_uuid, project_id=project_id, request_options=request_options + ) + return _response.data + + def list( + self, + *, + project_id: str, + page_number: int, + page_size: int, + search: typing.Optional[str] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> UserGroupListResponse: + """ + Parameters + ---------- + project_id : str + Project UUID + + page_number : int + Page number + + page_size : int + Page size + + search : typing.Optional[str] + Name search + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + UserGroupListResponse + OK + + Examples + -------- + from zep_cloud import Zep + + client = Zep( + api_key="YOUR_API_KEY", + ) + client.user_group.list( + project_id="projectId", + page_number=1, + page_size=1, + search="search", + ) + """ + _response = self._raw_client.list( + project_id=project_id, + page_number=page_number, + page_size=page_size, + search=search, + request_options=request_options, + ) + return _response.data + + def create( + self, + *, + project_id: str, + name: str, + description: typing.Optional[str] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> UserGroupResponse: + """ + Parameters + ---------- + project_id : str + Project UUID + + name : str + + description : typing.Optional[str] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + UserGroupResponse + Created + + Examples + -------- + from zep_cloud import Zep + + client = Zep( + api_key="YOUR_API_KEY", + ) + client.user_group.create( + project_id="projectId", + name="name", + ) + """ + _response = self._raw_client.create( + project_id=project_id, name=name, description=description, request_options=request_options + ) + return _response.data + + def list_for_user( + self, user_uuid: str, *, project_id: str, request_options: typing.Optional[RequestOptions] = None + ) -> UserMembershipGroupsResponse: + """ + Parameters + ---------- + user_uuid : str + User UUID + + project_id : str + Project UUID + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + UserMembershipGroupsResponse + OK + + Examples + -------- + from zep_cloud import Zep + + client = Zep( + api_key="YOUR_API_KEY", + ) + client.user_group.list_for_user( + user_uuid="userUUID", + project_id="projectId", + ) + """ + _response = self._raw_client.list_for_user(user_uuid, project_id=project_id, request_options=request_options) + return _response.data + + def get( + self, group_uuid: str, *, project_id: str, request_options: typing.Optional[RequestOptions] = None + ) -> UserGroupResponse: + """ + Parameters + ---------- + group_uuid : str + UserGroup UUID + + project_id : str + Project UUID + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + UserGroupResponse + OK + + Examples + -------- + from zep_cloud import Zep + + client = Zep( + api_key="YOUR_API_KEY", + ) + client.user_group.get( + group_uuid="groupUUID", + project_id="projectId", + ) + """ + _response = self._raw_client.get(group_uuid, project_id=project_id, request_options=request_options) + return _response.data + + def delete( + self, group_uuid: str, *, project_id: str, request_options: typing.Optional[RequestOptions] = None + ) -> None: + """ + Parameters + ---------- + group_uuid : str + UserGroup UUID + + project_id : str + Project UUID + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + None + + Examples + -------- + from zep_cloud import Zep + + client = Zep( + api_key="YOUR_API_KEY", + ) + client.user_group.delete( + group_uuid="groupUUID", + project_id="projectId", + ) + """ + _response = self._raw_client.delete(group_uuid, project_id=project_id, request_options=request_options) + return _response.data + + def update( + self, + group_uuid: str, + *, + project_id: str, + expected_version: int, + description: typing.Optional[str] = OMIT, + name: typing.Optional[str] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> UserGroupResponse: + """ + Parameters + ---------- + group_uuid : str + UserGroup UUID + + project_id : str + Project UUID + + expected_version : int + + description : typing.Optional[str] + + name : typing.Optional[str] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + UserGroupResponse + OK + + Examples + -------- + from zep_cloud import Zep + + client = Zep( + api_key="YOUR_API_KEY", + ) + client.user_group.update( + group_uuid="groupUUID", + project_id="projectId", + expected_version=1, + ) + """ + _response = self._raw_client.update( + group_uuid, + project_id=project_id, + expected_version=expected_version, + description=description, + name=name, + request_options=request_options, + ) + return _response.data + + def list_members( + self, + group_uuid: str, + *, + project_id: str, + page_number: int, + page_size: int, + search: typing.Optional[str] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> UserGroupMembersResponse: + """ + Parameters + ---------- + group_uuid : str + UserGroup UUID + + project_id : str + Project UUID + + page_number : int + Page number + + page_size : int + Page size + + search : typing.Optional[str] + User search + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + UserGroupMembersResponse + OK + + Examples + -------- + from zep_cloud import Zep + + client = Zep( + api_key="YOUR_API_KEY", + ) + client.user_group.list_members( + group_uuid="groupUUID", + project_id="projectId", + page_number=1, + page_size=1, + search="search", + ) + """ + _response = self._raw_client.list_members( + group_uuid, + project_id=project_id, + page_number=page_number, + page_size=page_size, + search=search, + request_options=request_options, + ) + return _response.data + + def add_members( + self, + group_uuid: str, + *, + project_id: str, + user_uuids: typing.Sequence[str], + request_options: typing.Optional[RequestOptions] = None, + ) -> UserGroupMembershipResponse: + """ + Parameters + ---------- + group_uuid : str + UserGroup UUID + + project_id : str + Project UUID + + user_uuids : typing.Sequence[str] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + UserGroupMembershipResponse + OK + + Examples + -------- + from zep_cloud import Zep + + client = Zep( + api_key="YOUR_API_KEY", + ) + client.user_group.add_members( + group_uuid="groupUUID", + project_id="projectId", + user_uuids=["user_uuids"], + ) + """ + _response = self._raw_client.add_members( + group_uuid, project_id=project_id, user_uuids=user_uuids, request_options=request_options + ) + return _response.data + + def remove_members( + self, + group_uuid: str, + *, + project_id: str, + user_uuids: typing.Sequence[str], + request_options: typing.Optional[RequestOptions] = None, + ) -> UserGroupMembershipResponse: + """ + Parameters + ---------- + group_uuid : str + UserGroup UUID + + project_id : str + Project UUID + + user_uuids : typing.Sequence[str] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + UserGroupMembershipResponse + OK + + Examples + -------- + from zep_cloud import Zep + + client = Zep( + api_key="YOUR_API_KEY", + ) + client.user_group.remove_members( + group_uuid="groupUUID", + project_id="projectId", + user_uuids=["user_uuids"], + ) + """ + _response = self._raw_client.remove_members( + group_uuid, project_id=project_id, user_uuids=user_uuids, request_options=request_options + ) + return _response.data + + def list_member_candidates( + self, + group_uuid: str, + *, + project_id: str, + page_number: int, + page_size: int, + search: typing.Optional[str] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> UserGroupMembersResponse: + """ + Parameters + ---------- + group_uuid : str + UserGroup UUID + + project_id : str + Project UUID + + page_number : int + Page number + + page_size : int + Page size + + search : typing.Optional[str] + User search + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + UserGroupMembersResponse + OK + + Examples + -------- + from zep_cloud import Zep + + client = Zep( + api_key="YOUR_API_KEY", + ) + client.user_group.list_member_candidates( + group_uuid="groupUUID", + project_id="projectId", + page_number=1, + page_size=1, + search="search", + ) + """ + _response = self._raw_client.list_member_candidates( + group_uuid, + project_id=project_id, + page_number=page_number, + page_size=page_size, + search=search, + request_options=request_options, + ) + return _response.data + + def remove_member( + self, + group_uuid: str, + user_uuid: str, + *, + project_id: str, + request_options: typing.Optional[RequestOptions] = None, + ) -> UserGroupMembershipResponse: + """ + Parameters + ---------- + group_uuid : str + UserGroup UUID + + user_uuid : str + User UUID + + project_id : str + Project UUID + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + UserGroupMembershipResponse + OK + + Examples + -------- + from zep_cloud import Zep + + client = Zep( + api_key="YOUR_API_KEY", + ) + client.user_group.remove_member( + group_uuid="groupUUID", + user_uuid="userUUID", + project_id="projectId", + ) + """ + _response = self._raw_client.remove_member( + group_uuid, user_uuid, project_id=project_id, request_options=request_options + ) + return _response.data + + +class AsyncUserGroupClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._raw_client = AsyncRawUserGroupClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> AsyncRawUserGroupClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + AsyncRawUserGroupClient + """ + return self._raw_client + + async def list_policy_sets( + self, group_uuid: str, *, project_id: str, request_options: typing.Optional[RequestOptions] = None + ) -> AttachedPolicySetsResponse: + """ + Parameters + ---------- + group_uuid : str + UserGroup UUID + + project_id : str + Project UUID + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AttachedPolicySetsResponse + OK + + Examples + -------- + import asyncio + + from zep_cloud import AsyncZep + + client = AsyncZep( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.user_group.list_policy_sets( + group_uuid="groupUUID", + project_id="projectId", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.list_policy_sets( + group_uuid, project_id=project_id, request_options=request_options + ) + return _response.data + + async def attach_policy_set( + self, + group_uuid: str, + *, + project_id: str, + policy_set_uuid: str, + request_options: typing.Optional[RequestOptions] = None, + ) -> AttachedPolicySetsResponse: + """ + Parameters + ---------- + group_uuid : str + UserGroup UUID + + project_id : str + Project UUID + + policy_set_uuid : str + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AttachedPolicySetsResponse + OK + + Examples + -------- + import asyncio + + from zep_cloud import AsyncZep + + client = AsyncZep( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.user_group.attach_policy_set( + group_uuid="groupUUID", + project_id="projectId", + policy_set_uuid="policy_set_uuid", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.attach_policy_set( + group_uuid, project_id=project_id, policy_set_uuid=policy_set_uuid, request_options=request_options + ) + return _response.data + + async def detach_policy_set( + self, + group_uuid: str, + policy_set_uuid: str, + *, + project_id: str, + request_options: typing.Optional[RequestOptions] = None, + ) -> AttachedPolicySetsResponse: + """ + Parameters + ---------- + group_uuid : str + UserGroup UUID + + policy_set_uuid : str + Policy set UUID + + project_id : str + Project UUID + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AttachedPolicySetsResponse + OK + + Examples + -------- + import asyncio + + from zep_cloud import AsyncZep + + client = AsyncZep( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.user_group.detach_policy_set( + group_uuid="groupUUID", + policy_set_uuid="policySetUUID", + project_id="projectId", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.detach_policy_set( + group_uuid, policy_set_uuid, project_id=project_id, request_options=request_options + ) + return _response.data + + async def list( + self, + *, + project_id: str, + page_number: int, + page_size: int, + search: typing.Optional[str] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> UserGroupListResponse: + """ + Parameters + ---------- + project_id : str + Project UUID + + page_number : int + Page number + + page_size : int + Page size + + search : typing.Optional[str] + Name search + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + UserGroupListResponse + OK + + Examples + -------- + import asyncio + + from zep_cloud import AsyncZep + + client = AsyncZep( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.user_group.list( + project_id="projectId", + page_number=1, + page_size=1, + search="search", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.list( + project_id=project_id, + page_number=page_number, + page_size=page_size, + search=search, + request_options=request_options, + ) + return _response.data + + async def create( + self, + *, + project_id: str, + name: str, + description: typing.Optional[str] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> UserGroupResponse: + """ + Parameters + ---------- + project_id : str + Project UUID + + name : str + + description : typing.Optional[str] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + UserGroupResponse + Created + + Examples + -------- + import asyncio + + from zep_cloud import AsyncZep + + client = AsyncZep( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.user_group.create( + project_id="projectId", + name="name", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.create( + project_id=project_id, name=name, description=description, request_options=request_options + ) + return _response.data + + async def list_for_user( + self, user_uuid: str, *, project_id: str, request_options: typing.Optional[RequestOptions] = None + ) -> UserMembershipGroupsResponse: + """ + Parameters + ---------- + user_uuid : str + User UUID + + project_id : str + Project UUID + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + UserMembershipGroupsResponse + OK + + Examples + -------- + import asyncio + + from zep_cloud import AsyncZep + + client = AsyncZep( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.user_group.list_for_user( + user_uuid="userUUID", + project_id="projectId", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.list_for_user( + user_uuid, project_id=project_id, request_options=request_options + ) + return _response.data + + async def get( + self, group_uuid: str, *, project_id: str, request_options: typing.Optional[RequestOptions] = None + ) -> UserGroupResponse: + """ + Parameters + ---------- + group_uuid : str + UserGroup UUID + + project_id : str + Project UUID + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + UserGroupResponse + OK + + Examples + -------- + import asyncio + + from zep_cloud import AsyncZep + + client = AsyncZep( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.user_group.get( + group_uuid="groupUUID", + project_id="projectId", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.get(group_uuid, project_id=project_id, request_options=request_options) + return _response.data + + async def delete( + self, group_uuid: str, *, project_id: str, request_options: typing.Optional[RequestOptions] = None + ) -> None: + """ + Parameters + ---------- + group_uuid : str + UserGroup UUID + + project_id : str + Project UUID + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + None + + Examples + -------- + import asyncio + + from zep_cloud import AsyncZep + + client = AsyncZep( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.user_group.delete( + group_uuid="groupUUID", + project_id="projectId", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.delete(group_uuid, project_id=project_id, request_options=request_options) + return _response.data + + async def update( + self, + group_uuid: str, + *, + project_id: str, + expected_version: int, + description: typing.Optional[str] = OMIT, + name: typing.Optional[str] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> UserGroupResponse: + """ + Parameters + ---------- + group_uuid : str + UserGroup UUID + + project_id : str + Project UUID + + expected_version : int + + description : typing.Optional[str] + + name : typing.Optional[str] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + UserGroupResponse + OK + + Examples + -------- + import asyncio + + from zep_cloud import AsyncZep + + client = AsyncZep( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.user_group.update( + group_uuid="groupUUID", + project_id="projectId", + expected_version=1, + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.update( + group_uuid, + project_id=project_id, + expected_version=expected_version, + description=description, + name=name, + request_options=request_options, + ) + return _response.data + + async def list_members( + self, + group_uuid: str, + *, + project_id: str, + page_number: int, + page_size: int, + search: typing.Optional[str] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> UserGroupMembersResponse: + """ + Parameters + ---------- + group_uuid : str + UserGroup UUID + + project_id : str + Project UUID + + page_number : int + Page number + + page_size : int + Page size + + search : typing.Optional[str] + User search + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + UserGroupMembersResponse + OK + + Examples + -------- + import asyncio + + from zep_cloud import AsyncZep + + client = AsyncZep( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.user_group.list_members( + group_uuid="groupUUID", + project_id="projectId", + page_number=1, + page_size=1, + search="search", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.list_members( + group_uuid, + project_id=project_id, + page_number=page_number, + page_size=page_size, + search=search, + request_options=request_options, + ) + return _response.data + + async def add_members( + self, + group_uuid: str, + *, + project_id: str, + user_uuids: typing.Sequence[str], + request_options: typing.Optional[RequestOptions] = None, + ) -> UserGroupMembershipResponse: + """ + Parameters + ---------- + group_uuid : str + UserGroup UUID + + project_id : str + Project UUID + + user_uuids : typing.Sequence[str] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + UserGroupMembershipResponse + OK + + Examples + -------- + import asyncio + + from zep_cloud import AsyncZep + + client = AsyncZep( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.user_group.add_members( + group_uuid="groupUUID", + project_id="projectId", + user_uuids=["user_uuids"], + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.add_members( + group_uuid, project_id=project_id, user_uuids=user_uuids, request_options=request_options + ) + return _response.data + + async def remove_members( + self, + group_uuid: str, + *, + project_id: str, + user_uuids: typing.Sequence[str], + request_options: typing.Optional[RequestOptions] = None, + ) -> UserGroupMembershipResponse: + """ + Parameters + ---------- + group_uuid : str + UserGroup UUID + + project_id : str + Project UUID + + user_uuids : typing.Sequence[str] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + UserGroupMembershipResponse + OK + + Examples + -------- + import asyncio + + from zep_cloud import AsyncZep + + client = AsyncZep( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.user_group.remove_members( + group_uuid="groupUUID", + project_id="projectId", + user_uuids=["user_uuids"], + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.remove_members( + group_uuid, project_id=project_id, user_uuids=user_uuids, request_options=request_options + ) + return _response.data + + async def list_member_candidates( + self, + group_uuid: str, + *, + project_id: str, + page_number: int, + page_size: int, + search: typing.Optional[str] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> UserGroupMembersResponse: + """ + Parameters + ---------- + group_uuid : str + UserGroup UUID + + project_id : str + Project UUID + + page_number : int + Page number + + page_size : int + Page size + + search : typing.Optional[str] + User search + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + UserGroupMembersResponse + OK + + Examples + -------- + import asyncio + + from zep_cloud import AsyncZep + + client = AsyncZep( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.user_group.list_member_candidates( + group_uuid="groupUUID", + project_id="projectId", + page_number=1, + page_size=1, + search="search", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.list_member_candidates( + group_uuid, + project_id=project_id, + page_number=page_number, + page_size=page_size, + search=search, + request_options=request_options, + ) + return _response.data + + async def remove_member( + self, + group_uuid: str, + user_uuid: str, + *, + project_id: str, + request_options: typing.Optional[RequestOptions] = None, + ) -> UserGroupMembershipResponse: + """ + Parameters + ---------- + group_uuid : str + UserGroup UUID + + user_uuid : str + User UUID + + project_id : str + Project UUID + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + UserGroupMembershipResponse + OK + + Examples + -------- + import asyncio + + from zep_cloud import AsyncZep + + client = AsyncZep( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.user_group.remove_member( + group_uuid="groupUUID", + user_uuid="userUUID", + project_id="projectId", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.remove_member( + group_uuid, user_uuid, project_id=project_id, request_options=request_options + ) + return _response.data diff --git a/src/zep_cloud/user_group/raw_client.py b/src/zep_cloud/user_group/raw_client.py new file mode 100644 index 0000000..3253fc4 --- /dev/null +++ b/src/zep_cloud/user_group/raw_client.py @@ -0,0 +1,2487 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing +from json.decoder import JSONDecodeError + +from ..core.api_error import ApiError as core_api_error_ApiError +from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ..core.http_response import AsyncHttpResponse, HttpResponse +from ..core.jsonable_encoder import jsonable_encoder +from ..core.pydantic_utilities import parse_obj_as +from ..core.request_options import RequestOptions +from ..errors.bad_request_error import BadRequestError +from ..errors.conflict_error import ConflictError +from ..errors.forbidden_error import ForbiddenError +from ..errors.not_found_error import NotFoundError +from ..types.api_error import ApiError as types_api_error_ApiError +from ..types.attached_policy_sets_response import AttachedPolicySetsResponse +from ..types.user_group_list_response import UserGroupListResponse +from ..types.user_group_members_response import UserGroupMembersResponse +from ..types.user_group_membership_response import UserGroupMembershipResponse +from ..types.user_group_response import UserGroupResponse +from ..types.user_membership_groups_response import UserMembershipGroupsResponse + +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class RawUserGroupClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._client_wrapper = client_wrapper + + def list_policy_sets( + self, group_uuid: str, *, project_id: str, request_options: typing.Optional[RequestOptions] = None + ) -> HttpResponse[AttachedPolicySetsResponse]: + """ + Parameters + ---------- + group_uuid : str + UserGroup UUID + + project_id : str + Project UUID + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[AttachedPolicySetsResponse] + OK + """ + _response = self._client_wrapper.httpx_client.request( + f"abac/user-groups/{jsonable_encoder(group_uuid)}/policy-sets", + method="GET", + params={ + "projectId": project_id, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + AttachedPolicySetsResponse, + parse_obj_as( + type_=AttachedPolicySetsResponse, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 403: + raise ForbiddenError( + headers=dict(_response.headers), + body=typing.cast( + types_api_error_ApiError, + parse_obj_as( + type_=types_api_error_ApiError, # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 404: + raise NotFoundError( + headers=dict(_response.headers), + body=typing.cast( + types_api_error_ApiError, + parse_obj_as( + type_=types_api_error_ApiError, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise core_api_error_ApiError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.text + ) + raise core_api_error_ApiError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response_json + ) + + def attach_policy_set( + self, + group_uuid: str, + *, + project_id: str, + policy_set_uuid: str, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[AttachedPolicySetsResponse]: + """ + Parameters + ---------- + group_uuid : str + UserGroup UUID + + project_id : str + Project UUID + + policy_set_uuid : str + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[AttachedPolicySetsResponse] + OK + """ + _response = self._client_wrapper.httpx_client.request( + f"abac/user-groups/{jsonable_encoder(group_uuid)}/policy-sets", + method="POST", + params={ + "projectId": project_id, + }, + json={ + "policy_set_uuid": policy_set_uuid, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + AttachedPolicySetsResponse, + parse_obj_as( + type_=AttachedPolicySetsResponse, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 400: + raise BadRequestError( + headers=dict(_response.headers), + body=typing.cast( + typing.Optional[typing.Any], + parse_obj_as( + type_=typing.Optional[typing.Any], # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 403: + raise ForbiddenError( + headers=dict(_response.headers), + body=typing.cast( + types_api_error_ApiError, + parse_obj_as( + type_=types_api_error_ApiError, # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 404: + raise NotFoundError( + headers=dict(_response.headers), + body=typing.cast( + types_api_error_ApiError, + parse_obj_as( + type_=types_api_error_ApiError, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise core_api_error_ApiError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.text + ) + raise core_api_error_ApiError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response_json + ) + + def detach_policy_set( + self, + group_uuid: str, + policy_set_uuid: str, + *, + project_id: str, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[AttachedPolicySetsResponse]: + """ + Parameters + ---------- + group_uuid : str + UserGroup UUID + + policy_set_uuid : str + Policy set UUID + + project_id : str + Project UUID + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[AttachedPolicySetsResponse] + OK + """ + _response = self._client_wrapper.httpx_client.request( + f"abac/user-groups/{jsonable_encoder(group_uuid)}/policy-sets/{jsonable_encoder(policy_set_uuid)}", + method="DELETE", + params={ + "projectId": project_id, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + AttachedPolicySetsResponse, + parse_obj_as( + type_=AttachedPolicySetsResponse, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 403: + raise ForbiddenError( + headers=dict(_response.headers), + body=typing.cast( + types_api_error_ApiError, + parse_obj_as( + type_=types_api_error_ApiError, # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 404: + raise NotFoundError( + headers=dict(_response.headers), + body=typing.cast( + types_api_error_ApiError, + parse_obj_as( + type_=types_api_error_ApiError, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise core_api_error_ApiError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.text + ) + raise core_api_error_ApiError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response_json + ) + + def list( + self, + *, + project_id: str, + page_number: int, + page_size: int, + search: typing.Optional[str] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[UserGroupListResponse]: + """ + Parameters + ---------- + project_id : str + Project UUID + + page_number : int + Page number + + page_size : int + Page size + + search : typing.Optional[str] + Name search + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[UserGroupListResponse] + OK + """ + _response = self._client_wrapper.httpx_client.request( + "user-groups", + method="GET", + params={ + "projectId": project_id, + "pageNumber": page_number, + "pageSize": page_size, + "search": search, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + UserGroupListResponse, + parse_obj_as( + type_=UserGroupListResponse, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 400: + raise BadRequestError( + headers=dict(_response.headers), + body=typing.cast( + typing.Optional[typing.Any], + parse_obj_as( + type_=typing.Optional[typing.Any], # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 403: + raise ForbiddenError( + headers=dict(_response.headers), + body=typing.cast( + types_api_error_ApiError, + parse_obj_as( + type_=types_api_error_ApiError, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise core_api_error_ApiError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.text + ) + raise core_api_error_ApiError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response_json + ) + + def create( + self, + *, + project_id: str, + name: str, + description: typing.Optional[str] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[UserGroupResponse]: + """ + Parameters + ---------- + project_id : str + Project UUID + + name : str + + description : typing.Optional[str] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[UserGroupResponse] + Created + """ + _response = self._client_wrapper.httpx_client.request( + "user-groups", + method="POST", + params={ + "projectId": project_id, + }, + json={ + "description": description, + "name": name, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + UserGroupResponse, + parse_obj_as( + type_=UserGroupResponse, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 400: + raise BadRequestError( + headers=dict(_response.headers), + body=typing.cast( + typing.Optional[typing.Any], + parse_obj_as( + type_=typing.Optional[typing.Any], # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 403: + raise ForbiddenError( + headers=dict(_response.headers), + body=typing.cast( + types_api_error_ApiError, + parse_obj_as( + type_=types_api_error_ApiError, # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 409: + raise ConflictError( + headers=dict(_response.headers), + body=typing.cast( + types_api_error_ApiError, + parse_obj_as( + type_=types_api_error_ApiError, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise core_api_error_ApiError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.text + ) + raise core_api_error_ApiError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response_json + ) + + def list_for_user( + self, user_uuid: str, *, project_id: str, request_options: typing.Optional[RequestOptions] = None + ) -> HttpResponse[UserMembershipGroupsResponse]: + """ + Parameters + ---------- + user_uuid : str + User UUID + + project_id : str + Project UUID + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[UserMembershipGroupsResponse] + OK + """ + _response = self._client_wrapper.httpx_client.request( + f"user-groups/users/{jsonable_encoder(user_uuid)}", + method="GET", + params={ + "projectId": project_id, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + UserMembershipGroupsResponse, + parse_obj_as( + type_=UserMembershipGroupsResponse, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 403: + raise ForbiddenError( + headers=dict(_response.headers), + body=typing.cast( + types_api_error_ApiError, + parse_obj_as( + type_=types_api_error_ApiError, # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 404: + raise NotFoundError( + headers=dict(_response.headers), + body=typing.cast( + types_api_error_ApiError, + parse_obj_as( + type_=types_api_error_ApiError, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise core_api_error_ApiError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.text + ) + raise core_api_error_ApiError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response_json + ) + + def get( + self, group_uuid: str, *, project_id: str, request_options: typing.Optional[RequestOptions] = None + ) -> HttpResponse[UserGroupResponse]: + """ + Parameters + ---------- + group_uuid : str + UserGroup UUID + + project_id : str + Project UUID + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[UserGroupResponse] + OK + """ + _response = self._client_wrapper.httpx_client.request( + f"user-groups/{jsonable_encoder(group_uuid)}", + method="GET", + params={ + "projectId": project_id, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + UserGroupResponse, + parse_obj_as( + type_=UserGroupResponse, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 403: + raise ForbiddenError( + headers=dict(_response.headers), + body=typing.cast( + types_api_error_ApiError, + parse_obj_as( + type_=types_api_error_ApiError, # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 404: + raise NotFoundError( + headers=dict(_response.headers), + body=typing.cast( + types_api_error_ApiError, + parse_obj_as( + type_=types_api_error_ApiError, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise core_api_error_ApiError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.text + ) + raise core_api_error_ApiError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response_json + ) + + def delete( + self, group_uuid: str, *, project_id: str, request_options: typing.Optional[RequestOptions] = None + ) -> HttpResponse[None]: + """ + Parameters + ---------- + group_uuid : str + UserGroup UUID + + project_id : str + Project UUID + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[None] + """ + _response = self._client_wrapper.httpx_client.request( + f"user-groups/{jsonable_encoder(group_uuid)}", + method="DELETE", + params={ + "projectId": project_id, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + return HttpResponse(response=_response, data=None) + if _response.status_code == 403: + raise ForbiddenError( + headers=dict(_response.headers), + body=typing.cast( + types_api_error_ApiError, + parse_obj_as( + type_=types_api_error_ApiError, # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 404: + raise NotFoundError( + headers=dict(_response.headers), + body=typing.cast( + types_api_error_ApiError, + parse_obj_as( + type_=types_api_error_ApiError, # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 409: + raise ConflictError( + headers=dict(_response.headers), + body=typing.cast( + types_api_error_ApiError, + parse_obj_as( + type_=types_api_error_ApiError, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise core_api_error_ApiError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.text + ) + raise core_api_error_ApiError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response_json + ) + + def update( + self, + group_uuid: str, + *, + project_id: str, + expected_version: int, + description: typing.Optional[str] = OMIT, + name: typing.Optional[str] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[UserGroupResponse]: + """ + Parameters + ---------- + group_uuid : str + UserGroup UUID + + project_id : str + Project UUID + + expected_version : int + + description : typing.Optional[str] + + name : typing.Optional[str] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[UserGroupResponse] + OK + """ + _response = self._client_wrapper.httpx_client.request( + f"user-groups/{jsonable_encoder(group_uuid)}", + method="PATCH", + params={ + "projectId": project_id, + }, + json={ + "description": description, + "expected_version": expected_version, + "name": name, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + UserGroupResponse, + parse_obj_as( + type_=UserGroupResponse, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 400: + raise BadRequestError( + headers=dict(_response.headers), + body=typing.cast( + typing.Optional[typing.Any], + parse_obj_as( + type_=typing.Optional[typing.Any], # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 403: + raise ForbiddenError( + headers=dict(_response.headers), + body=typing.cast( + types_api_error_ApiError, + parse_obj_as( + type_=types_api_error_ApiError, # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 404: + raise NotFoundError( + headers=dict(_response.headers), + body=typing.cast( + types_api_error_ApiError, + parse_obj_as( + type_=types_api_error_ApiError, # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 409: + raise ConflictError( + headers=dict(_response.headers), + body=typing.cast( + types_api_error_ApiError, + parse_obj_as( + type_=types_api_error_ApiError, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise core_api_error_ApiError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.text + ) + raise core_api_error_ApiError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response_json + ) + + def list_members( + self, + group_uuid: str, + *, + project_id: str, + page_number: int, + page_size: int, + search: typing.Optional[str] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[UserGroupMembersResponse]: + """ + Parameters + ---------- + group_uuid : str + UserGroup UUID + + project_id : str + Project UUID + + page_number : int + Page number + + page_size : int + Page size + + search : typing.Optional[str] + User search + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[UserGroupMembersResponse] + OK + """ + _response = self._client_wrapper.httpx_client.request( + f"user-groups/{jsonable_encoder(group_uuid)}/members", + method="GET", + params={ + "projectId": project_id, + "pageNumber": page_number, + "pageSize": page_size, + "search": search, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + UserGroupMembersResponse, + parse_obj_as( + type_=UserGroupMembersResponse, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 403: + raise ForbiddenError( + headers=dict(_response.headers), + body=typing.cast( + types_api_error_ApiError, + parse_obj_as( + type_=types_api_error_ApiError, # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 404: + raise NotFoundError( + headers=dict(_response.headers), + body=typing.cast( + types_api_error_ApiError, + parse_obj_as( + type_=types_api_error_ApiError, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise core_api_error_ApiError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.text + ) + raise core_api_error_ApiError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response_json + ) + + def add_members( + self, + group_uuid: str, + *, + project_id: str, + user_uuids: typing.Sequence[str], + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[UserGroupMembershipResponse]: + """ + Parameters + ---------- + group_uuid : str + UserGroup UUID + + project_id : str + Project UUID + + user_uuids : typing.Sequence[str] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[UserGroupMembershipResponse] + OK + """ + _response = self._client_wrapper.httpx_client.request( + f"user-groups/{jsonable_encoder(group_uuid)}/members", + method="POST", + params={ + "projectId": project_id, + }, + json={ + "user_uuids": user_uuids, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + UserGroupMembershipResponse, + parse_obj_as( + type_=UserGroupMembershipResponse, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 400: + raise BadRequestError( + headers=dict(_response.headers), + body=typing.cast( + typing.Optional[typing.Any], + parse_obj_as( + type_=typing.Optional[typing.Any], # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 403: + raise ForbiddenError( + headers=dict(_response.headers), + body=typing.cast( + types_api_error_ApiError, + parse_obj_as( + type_=types_api_error_ApiError, # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 404: + raise NotFoundError( + headers=dict(_response.headers), + body=typing.cast( + types_api_error_ApiError, + parse_obj_as( + type_=types_api_error_ApiError, # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 409: + raise ConflictError( + headers=dict(_response.headers), + body=typing.cast( + types_api_error_ApiError, + parse_obj_as( + type_=types_api_error_ApiError, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise core_api_error_ApiError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.text + ) + raise core_api_error_ApiError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response_json + ) + + def remove_members( + self, + group_uuid: str, + *, + project_id: str, + user_uuids: typing.Sequence[str], + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[UserGroupMembershipResponse]: + """ + Parameters + ---------- + group_uuid : str + UserGroup UUID + + project_id : str + Project UUID + + user_uuids : typing.Sequence[str] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[UserGroupMembershipResponse] + OK + """ + _response = self._client_wrapper.httpx_client.request( + f"user-groups/{jsonable_encoder(group_uuid)}/members/bulk-remove", + method="POST", + params={ + "projectId": project_id, + }, + json={ + "user_uuids": user_uuids, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + UserGroupMembershipResponse, + parse_obj_as( + type_=UserGroupMembershipResponse, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 400: + raise BadRequestError( + headers=dict(_response.headers), + body=typing.cast( + typing.Optional[typing.Any], + parse_obj_as( + type_=typing.Optional[typing.Any], # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 403: + raise ForbiddenError( + headers=dict(_response.headers), + body=typing.cast( + types_api_error_ApiError, + parse_obj_as( + type_=types_api_error_ApiError, # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 404: + raise NotFoundError( + headers=dict(_response.headers), + body=typing.cast( + types_api_error_ApiError, + parse_obj_as( + type_=types_api_error_ApiError, # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 409: + raise ConflictError( + headers=dict(_response.headers), + body=typing.cast( + types_api_error_ApiError, + parse_obj_as( + type_=types_api_error_ApiError, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise core_api_error_ApiError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.text + ) + raise core_api_error_ApiError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response_json + ) + + def list_member_candidates( + self, + group_uuid: str, + *, + project_id: str, + page_number: int, + page_size: int, + search: typing.Optional[str] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[UserGroupMembersResponse]: + """ + Parameters + ---------- + group_uuid : str + UserGroup UUID + + project_id : str + Project UUID + + page_number : int + Page number + + page_size : int + Page size + + search : typing.Optional[str] + User search + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[UserGroupMembersResponse] + OK + """ + _response = self._client_wrapper.httpx_client.request( + f"user-groups/{jsonable_encoder(group_uuid)}/members/candidates", + method="GET", + params={ + "projectId": project_id, + "pageNumber": page_number, + "pageSize": page_size, + "search": search, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + UserGroupMembersResponse, + parse_obj_as( + type_=UserGroupMembersResponse, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 403: + raise ForbiddenError( + headers=dict(_response.headers), + body=typing.cast( + types_api_error_ApiError, + parse_obj_as( + type_=types_api_error_ApiError, # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 404: + raise NotFoundError( + headers=dict(_response.headers), + body=typing.cast( + types_api_error_ApiError, + parse_obj_as( + type_=types_api_error_ApiError, # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 409: + raise ConflictError( + headers=dict(_response.headers), + body=typing.cast( + types_api_error_ApiError, + parse_obj_as( + type_=types_api_error_ApiError, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise core_api_error_ApiError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.text + ) + raise core_api_error_ApiError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response_json + ) + + def remove_member( + self, + group_uuid: str, + user_uuid: str, + *, + project_id: str, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[UserGroupMembershipResponse]: + """ + Parameters + ---------- + group_uuid : str + UserGroup UUID + + user_uuid : str + User UUID + + project_id : str + Project UUID + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[UserGroupMembershipResponse] + OK + """ + _response = self._client_wrapper.httpx_client.request( + f"user-groups/{jsonable_encoder(group_uuid)}/members/{jsonable_encoder(user_uuid)}", + method="DELETE", + params={ + "projectId": project_id, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + UserGroupMembershipResponse, + parse_obj_as( + type_=UserGroupMembershipResponse, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 403: + raise ForbiddenError( + headers=dict(_response.headers), + body=typing.cast( + types_api_error_ApiError, + parse_obj_as( + type_=types_api_error_ApiError, # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 404: + raise NotFoundError( + headers=dict(_response.headers), + body=typing.cast( + types_api_error_ApiError, + parse_obj_as( + type_=types_api_error_ApiError, # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 409: + raise ConflictError( + headers=dict(_response.headers), + body=typing.cast( + types_api_error_ApiError, + parse_obj_as( + type_=types_api_error_ApiError, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise core_api_error_ApiError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.text + ) + raise core_api_error_ApiError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response_json + ) + + +class AsyncRawUserGroupClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._client_wrapper = client_wrapper + + async def list_policy_sets( + self, group_uuid: str, *, project_id: str, request_options: typing.Optional[RequestOptions] = None + ) -> AsyncHttpResponse[AttachedPolicySetsResponse]: + """ + Parameters + ---------- + group_uuid : str + UserGroup UUID + + project_id : str + Project UUID + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[AttachedPolicySetsResponse] + OK + """ + _response = await self._client_wrapper.httpx_client.request( + f"abac/user-groups/{jsonable_encoder(group_uuid)}/policy-sets", + method="GET", + params={ + "projectId": project_id, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + AttachedPolicySetsResponse, + parse_obj_as( + type_=AttachedPolicySetsResponse, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 403: + raise ForbiddenError( + headers=dict(_response.headers), + body=typing.cast( + types_api_error_ApiError, + parse_obj_as( + type_=types_api_error_ApiError, # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 404: + raise NotFoundError( + headers=dict(_response.headers), + body=typing.cast( + types_api_error_ApiError, + parse_obj_as( + type_=types_api_error_ApiError, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise core_api_error_ApiError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.text + ) + raise core_api_error_ApiError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response_json + ) + + async def attach_policy_set( + self, + group_uuid: str, + *, + project_id: str, + policy_set_uuid: str, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[AttachedPolicySetsResponse]: + """ + Parameters + ---------- + group_uuid : str + UserGroup UUID + + project_id : str + Project UUID + + policy_set_uuid : str + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[AttachedPolicySetsResponse] + OK + """ + _response = await self._client_wrapper.httpx_client.request( + f"abac/user-groups/{jsonable_encoder(group_uuid)}/policy-sets", + method="POST", + params={ + "projectId": project_id, + }, + json={ + "policy_set_uuid": policy_set_uuid, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + AttachedPolicySetsResponse, + parse_obj_as( + type_=AttachedPolicySetsResponse, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 400: + raise BadRequestError( + headers=dict(_response.headers), + body=typing.cast( + typing.Optional[typing.Any], + parse_obj_as( + type_=typing.Optional[typing.Any], # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 403: + raise ForbiddenError( + headers=dict(_response.headers), + body=typing.cast( + types_api_error_ApiError, + parse_obj_as( + type_=types_api_error_ApiError, # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 404: + raise NotFoundError( + headers=dict(_response.headers), + body=typing.cast( + types_api_error_ApiError, + parse_obj_as( + type_=types_api_error_ApiError, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise core_api_error_ApiError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.text + ) + raise core_api_error_ApiError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response_json + ) + + async def detach_policy_set( + self, + group_uuid: str, + policy_set_uuid: str, + *, + project_id: str, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[AttachedPolicySetsResponse]: + """ + Parameters + ---------- + group_uuid : str + UserGroup UUID + + policy_set_uuid : str + Policy set UUID + + project_id : str + Project UUID + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[AttachedPolicySetsResponse] + OK + """ + _response = await self._client_wrapper.httpx_client.request( + f"abac/user-groups/{jsonable_encoder(group_uuid)}/policy-sets/{jsonable_encoder(policy_set_uuid)}", + method="DELETE", + params={ + "projectId": project_id, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + AttachedPolicySetsResponse, + parse_obj_as( + type_=AttachedPolicySetsResponse, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 403: + raise ForbiddenError( + headers=dict(_response.headers), + body=typing.cast( + types_api_error_ApiError, + parse_obj_as( + type_=types_api_error_ApiError, # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 404: + raise NotFoundError( + headers=dict(_response.headers), + body=typing.cast( + types_api_error_ApiError, + parse_obj_as( + type_=types_api_error_ApiError, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise core_api_error_ApiError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.text + ) + raise core_api_error_ApiError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response_json + ) + + async def list( + self, + *, + project_id: str, + page_number: int, + page_size: int, + search: typing.Optional[str] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[UserGroupListResponse]: + """ + Parameters + ---------- + project_id : str + Project UUID + + page_number : int + Page number + + page_size : int + Page size + + search : typing.Optional[str] + Name search + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[UserGroupListResponse] + OK + """ + _response = await self._client_wrapper.httpx_client.request( + "user-groups", + method="GET", + params={ + "projectId": project_id, + "pageNumber": page_number, + "pageSize": page_size, + "search": search, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + UserGroupListResponse, + parse_obj_as( + type_=UserGroupListResponse, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 400: + raise BadRequestError( + headers=dict(_response.headers), + body=typing.cast( + typing.Optional[typing.Any], + parse_obj_as( + type_=typing.Optional[typing.Any], # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 403: + raise ForbiddenError( + headers=dict(_response.headers), + body=typing.cast( + types_api_error_ApiError, + parse_obj_as( + type_=types_api_error_ApiError, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise core_api_error_ApiError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.text + ) + raise core_api_error_ApiError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response_json + ) + + async def create( + self, + *, + project_id: str, + name: str, + description: typing.Optional[str] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[UserGroupResponse]: + """ + Parameters + ---------- + project_id : str + Project UUID + + name : str + + description : typing.Optional[str] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[UserGroupResponse] + Created + """ + _response = await self._client_wrapper.httpx_client.request( + "user-groups", + method="POST", + params={ + "projectId": project_id, + }, + json={ + "description": description, + "name": name, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + UserGroupResponse, + parse_obj_as( + type_=UserGroupResponse, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 400: + raise BadRequestError( + headers=dict(_response.headers), + body=typing.cast( + typing.Optional[typing.Any], + parse_obj_as( + type_=typing.Optional[typing.Any], # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 403: + raise ForbiddenError( + headers=dict(_response.headers), + body=typing.cast( + types_api_error_ApiError, + parse_obj_as( + type_=types_api_error_ApiError, # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 409: + raise ConflictError( + headers=dict(_response.headers), + body=typing.cast( + types_api_error_ApiError, + parse_obj_as( + type_=types_api_error_ApiError, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise core_api_error_ApiError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.text + ) + raise core_api_error_ApiError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response_json + ) + + async def list_for_user( + self, user_uuid: str, *, project_id: str, request_options: typing.Optional[RequestOptions] = None + ) -> AsyncHttpResponse[UserMembershipGroupsResponse]: + """ + Parameters + ---------- + user_uuid : str + User UUID + + project_id : str + Project UUID + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[UserMembershipGroupsResponse] + OK + """ + _response = await self._client_wrapper.httpx_client.request( + f"user-groups/users/{jsonable_encoder(user_uuid)}", + method="GET", + params={ + "projectId": project_id, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + UserMembershipGroupsResponse, + parse_obj_as( + type_=UserMembershipGroupsResponse, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 403: + raise ForbiddenError( + headers=dict(_response.headers), + body=typing.cast( + types_api_error_ApiError, + parse_obj_as( + type_=types_api_error_ApiError, # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 404: + raise NotFoundError( + headers=dict(_response.headers), + body=typing.cast( + types_api_error_ApiError, + parse_obj_as( + type_=types_api_error_ApiError, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise core_api_error_ApiError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.text + ) + raise core_api_error_ApiError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response_json + ) + + async def get( + self, group_uuid: str, *, project_id: str, request_options: typing.Optional[RequestOptions] = None + ) -> AsyncHttpResponse[UserGroupResponse]: + """ + Parameters + ---------- + group_uuid : str + UserGroup UUID + + project_id : str + Project UUID + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[UserGroupResponse] + OK + """ + _response = await self._client_wrapper.httpx_client.request( + f"user-groups/{jsonable_encoder(group_uuid)}", + method="GET", + params={ + "projectId": project_id, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + UserGroupResponse, + parse_obj_as( + type_=UserGroupResponse, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 403: + raise ForbiddenError( + headers=dict(_response.headers), + body=typing.cast( + types_api_error_ApiError, + parse_obj_as( + type_=types_api_error_ApiError, # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 404: + raise NotFoundError( + headers=dict(_response.headers), + body=typing.cast( + types_api_error_ApiError, + parse_obj_as( + type_=types_api_error_ApiError, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise core_api_error_ApiError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.text + ) + raise core_api_error_ApiError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response_json + ) + + async def delete( + self, group_uuid: str, *, project_id: str, request_options: typing.Optional[RequestOptions] = None + ) -> AsyncHttpResponse[None]: + """ + Parameters + ---------- + group_uuid : str + UserGroup UUID + + project_id : str + Project UUID + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[None] + """ + _response = await self._client_wrapper.httpx_client.request( + f"user-groups/{jsonable_encoder(group_uuid)}", + method="DELETE", + params={ + "projectId": project_id, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + return AsyncHttpResponse(response=_response, data=None) + if _response.status_code == 403: + raise ForbiddenError( + headers=dict(_response.headers), + body=typing.cast( + types_api_error_ApiError, + parse_obj_as( + type_=types_api_error_ApiError, # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 404: + raise NotFoundError( + headers=dict(_response.headers), + body=typing.cast( + types_api_error_ApiError, + parse_obj_as( + type_=types_api_error_ApiError, # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 409: + raise ConflictError( + headers=dict(_response.headers), + body=typing.cast( + types_api_error_ApiError, + parse_obj_as( + type_=types_api_error_ApiError, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise core_api_error_ApiError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.text + ) + raise core_api_error_ApiError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response_json + ) + + async def update( + self, + group_uuid: str, + *, + project_id: str, + expected_version: int, + description: typing.Optional[str] = OMIT, + name: typing.Optional[str] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[UserGroupResponse]: + """ + Parameters + ---------- + group_uuid : str + UserGroup UUID + + project_id : str + Project UUID + + expected_version : int + + description : typing.Optional[str] + + name : typing.Optional[str] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[UserGroupResponse] + OK + """ + _response = await self._client_wrapper.httpx_client.request( + f"user-groups/{jsonable_encoder(group_uuid)}", + method="PATCH", + params={ + "projectId": project_id, + }, + json={ + "description": description, + "expected_version": expected_version, + "name": name, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + UserGroupResponse, + parse_obj_as( + type_=UserGroupResponse, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 400: + raise BadRequestError( + headers=dict(_response.headers), + body=typing.cast( + typing.Optional[typing.Any], + parse_obj_as( + type_=typing.Optional[typing.Any], # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 403: + raise ForbiddenError( + headers=dict(_response.headers), + body=typing.cast( + types_api_error_ApiError, + parse_obj_as( + type_=types_api_error_ApiError, # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 404: + raise NotFoundError( + headers=dict(_response.headers), + body=typing.cast( + types_api_error_ApiError, + parse_obj_as( + type_=types_api_error_ApiError, # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 409: + raise ConflictError( + headers=dict(_response.headers), + body=typing.cast( + types_api_error_ApiError, + parse_obj_as( + type_=types_api_error_ApiError, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise core_api_error_ApiError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.text + ) + raise core_api_error_ApiError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response_json + ) + + async def list_members( + self, + group_uuid: str, + *, + project_id: str, + page_number: int, + page_size: int, + search: typing.Optional[str] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[UserGroupMembersResponse]: + """ + Parameters + ---------- + group_uuid : str + UserGroup UUID + + project_id : str + Project UUID + + page_number : int + Page number + + page_size : int + Page size + + search : typing.Optional[str] + User search + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[UserGroupMembersResponse] + OK + """ + _response = await self._client_wrapper.httpx_client.request( + f"user-groups/{jsonable_encoder(group_uuid)}/members", + method="GET", + params={ + "projectId": project_id, + "pageNumber": page_number, + "pageSize": page_size, + "search": search, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + UserGroupMembersResponse, + parse_obj_as( + type_=UserGroupMembersResponse, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 403: + raise ForbiddenError( + headers=dict(_response.headers), + body=typing.cast( + types_api_error_ApiError, + parse_obj_as( + type_=types_api_error_ApiError, # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 404: + raise NotFoundError( + headers=dict(_response.headers), + body=typing.cast( + types_api_error_ApiError, + parse_obj_as( + type_=types_api_error_ApiError, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise core_api_error_ApiError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.text + ) + raise core_api_error_ApiError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response_json + ) + + async def add_members( + self, + group_uuid: str, + *, + project_id: str, + user_uuids: typing.Sequence[str], + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[UserGroupMembershipResponse]: + """ + Parameters + ---------- + group_uuid : str + UserGroup UUID + + project_id : str + Project UUID + + user_uuids : typing.Sequence[str] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[UserGroupMembershipResponse] + OK + """ + _response = await self._client_wrapper.httpx_client.request( + f"user-groups/{jsonable_encoder(group_uuid)}/members", + method="POST", + params={ + "projectId": project_id, + }, + json={ + "user_uuids": user_uuids, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + UserGroupMembershipResponse, + parse_obj_as( + type_=UserGroupMembershipResponse, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 400: + raise BadRequestError( + headers=dict(_response.headers), + body=typing.cast( + typing.Optional[typing.Any], + parse_obj_as( + type_=typing.Optional[typing.Any], # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 403: + raise ForbiddenError( + headers=dict(_response.headers), + body=typing.cast( + types_api_error_ApiError, + parse_obj_as( + type_=types_api_error_ApiError, # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 404: + raise NotFoundError( + headers=dict(_response.headers), + body=typing.cast( + types_api_error_ApiError, + parse_obj_as( + type_=types_api_error_ApiError, # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 409: + raise ConflictError( + headers=dict(_response.headers), + body=typing.cast( + types_api_error_ApiError, + parse_obj_as( + type_=types_api_error_ApiError, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise core_api_error_ApiError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.text + ) + raise core_api_error_ApiError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response_json + ) + + async def remove_members( + self, + group_uuid: str, + *, + project_id: str, + user_uuids: typing.Sequence[str], + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[UserGroupMembershipResponse]: + """ + Parameters + ---------- + group_uuid : str + UserGroup UUID + + project_id : str + Project UUID + + user_uuids : typing.Sequence[str] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[UserGroupMembershipResponse] + OK + """ + _response = await self._client_wrapper.httpx_client.request( + f"user-groups/{jsonable_encoder(group_uuid)}/members/bulk-remove", + method="POST", + params={ + "projectId": project_id, + }, + json={ + "user_uuids": user_uuids, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + UserGroupMembershipResponse, + parse_obj_as( + type_=UserGroupMembershipResponse, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 400: + raise BadRequestError( + headers=dict(_response.headers), + body=typing.cast( + typing.Optional[typing.Any], + parse_obj_as( + type_=typing.Optional[typing.Any], # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 403: + raise ForbiddenError( + headers=dict(_response.headers), + body=typing.cast( + types_api_error_ApiError, + parse_obj_as( + type_=types_api_error_ApiError, # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 404: + raise NotFoundError( + headers=dict(_response.headers), + body=typing.cast( + types_api_error_ApiError, + parse_obj_as( + type_=types_api_error_ApiError, # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 409: + raise ConflictError( + headers=dict(_response.headers), + body=typing.cast( + types_api_error_ApiError, + parse_obj_as( + type_=types_api_error_ApiError, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise core_api_error_ApiError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.text + ) + raise core_api_error_ApiError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response_json + ) + + async def list_member_candidates( + self, + group_uuid: str, + *, + project_id: str, + page_number: int, + page_size: int, + search: typing.Optional[str] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[UserGroupMembersResponse]: + """ + Parameters + ---------- + group_uuid : str + UserGroup UUID + + project_id : str + Project UUID + + page_number : int + Page number + + page_size : int + Page size + + search : typing.Optional[str] + User search + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[UserGroupMembersResponse] + OK + """ + _response = await self._client_wrapper.httpx_client.request( + f"user-groups/{jsonable_encoder(group_uuid)}/members/candidates", + method="GET", + params={ + "projectId": project_id, + "pageNumber": page_number, + "pageSize": page_size, + "search": search, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + UserGroupMembersResponse, + parse_obj_as( + type_=UserGroupMembersResponse, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 403: + raise ForbiddenError( + headers=dict(_response.headers), + body=typing.cast( + types_api_error_ApiError, + parse_obj_as( + type_=types_api_error_ApiError, # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 404: + raise NotFoundError( + headers=dict(_response.headers), + body=typing.cast( + types_api_error_ApiError, + parse_obj_as( + type_=types_api_error_ApiError, # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 409: + raise ConflictError( + headers=dict(_response.headers), + body=typing.cast( + types_api_error_ApiError, + parse_obj_as( + type_=types_api_error_ApiError, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise core_api_error_ApiError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.text + ) + raise core_api_error_ApiError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response_json + ) + + async def remove_member( + self, + group_uuid: str, + user_uuid: str, + *, + project_id: str, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[UserGroupMembershipResponse]: + """ + Parameters + ---------- + group_uuid : str + UserGroup UUID + + user_uuid : str + User UUID + + project_id : str + Project UUID + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[UserGroupMembershipResponse] + OK + """ + _response = await self._client_wrapper.httpx_client.request( + f"user-groups/{jsonable_encoder(group_uuid)}/members/{jsonable_encoder(user_uuid)}", + method="DELETE", + params={ + "projectId": project_id, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + UserGroupMembershipResponse, + parse_obj_as( + type_=UserGroupMembershipResponse, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 403: + raise ForbiddenError( + headers=dict(_response.headers), + body=typing.cast( + types_api_error_ApiError, + parse_obj_as( + type_=types_api_error_ApiError, # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 404: + raise NotFoundError( + headers=dict(_response.headers), + body=typing.cast( + types_api_error_ApiError, + parse_obj_as( + type_=types_api_error_ApiError, # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 409: + raise ConflictError( + headers=dict(_response.headers), + body=typing.cast( + types_api_error_ApiError, + parse_obj_as( + type_=types_api_error_ApiError, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise core_api_error_ApiError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.text + ) + raise core_api_error_ApiError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response_json + )