wallaroo.wallaroo_ml_ops_api_client.models.workspaces_add_user_json_body

 1from typing import Any, Dict, List, Type, TypeVar, Union
 2
 3import attr
 4
 5from ..types import UNSET, Unset
 6
 7T = TypeVar("T", bound="WorkspacesAddUserJsonBody")
 8
 9@attr.s(auto_attribs=True)
10class WorkspacesAddUserJsonBody:
11    """ Request for adding a user to workspace.
12
13    Attributes:
14        workspace_id (int):  Workspace identifier.
15        email (Union[Unset, None, str]):  User's email address.
16        user_id (Union[Unset, None, str]):  User identifier.
17        url (Union[Unset, None, str]):  Workspace URL.
18        user_type (Union[Unset, None, str]):  User's role in the workspace. Defaults to Collaborator.
19    """
20
21    workspace_id: int
22    email: Union[Unset, None, str] = UNSET
23    user_id: Union[Unset, None, str] = UNSET
24    url: Union[Unset, None, str] = UNSET
25    user_type: Union[Unset, None, str] = UNSET
26    additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict)
27
28
29    def to_dict(self) -> Dict[str, Any]:
30        workspace_id = self.workspace_id
31        email = self.email
32        user_id = self.user_id
33        url = self.url
34        user_type = self.user_type
35
36        field_dict: Dict[str, Any] = {}
37        field_dict.update(self.additional_properties)
38        field_dict.update({
39            "workspace_id": workspace_id,
40        })
41        if email is not UNSET:
42            field_dict["email"] = email
43        if user_id is not UNSET:
44            field_dict["user_id"] = user_id
45        if url is not UNSET:
46            field_dict["url"] = url
47        if user_type is not UNSET:
48            field_dict["user_type"] = user_type
49
50        return field_dict
51
52
53
54    @classmethod
55    def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T:
56        d = src_dict.copy()
57        workspace_id = d.pop("workspace_id")
58
59        email = d.pop("email", UNSET)
60
61        user_id = d.pop("user_id", UNSET)
62
63        url = d.pop("url", UNSET)
64
65        user_type = d.pop("user_type", UNSET)
66
67        workspaces_add_user_json_body = cls(
68            workspace_id=workspace_id,
69            email=email,
70            user_id=user_id,
71            url=url,
72            user_type=user_type,
73        )
74
75        workspaces_add_user_json_body.additional_properties = d
76        return workspaces_add_user_json_body
77
78    @property
79    def additional_keys(self) -> List[str]:
80        return list(self.additional_properties.keys())
81
82    def __getitem__(self, key: str) -> Any:
83        return self.additional_properties[key]
84
85    def __setitem__(self, key: str, value: Any) -> None:
86        self.additional_properties[key] = value
87
88    def __delitem__(self, key: str) -> None:
89        del self.additional_properties[key]
90
91    def __contains__(self, key: str) -> bool:
92        return key in self.additional_properties
@attr.s(auto_attribs=True)
class WorkspacesAddUserJsonBody:
10@attr.s(auto_attribs=True)
11class WorkspacesAddUserJsonBody:
12    """ Request for adding a user to workspace.
13
14    Attributes:
15        workspace_id (int):  Workspace identifier.
16        email (Union[Unset, None, str]):  User's email address.
17        user_id (Union[Unset, None, str]):  User identifier.
18        url (Union[Unset, None, str]):  Workspace URL.
19        user_type (Union[Unset, None, str]):  User's role in the workspace. Defaults to Collaborator.
20    """
21
22    workspace_id: int
23    email: Union[Unset, None, str] = UNSET
24    user_id: Union[Unset, None, str] = UNSET
25    url: Union[Unset, None, str] = UNSET
26    user_type: Union[Unset, None, str] = UNSET
27    additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict)
28
29
30    def to_dict(self) -> Dict[str, Any]:
31        workspace_id = self.workspace_id
32        email = self.email
33        user_id = self.user_id
34        url = self.url
35        user_type = self.user_type
36
37        field_dict: Dict[str, Any] = {}
38        field_dict.update(self.additional_properties)
39        field_dict.update({
40            "workspace_id": workspace_id,
41        })
42        if email is not UNSET:
43            field_dict["email"] = email
44        if user_id is not UNSET:
45            field_dict["user_id"] = user_id
46        if url is not UNSET:
47            field_dict["url"] = url
48        if user_type is not UNSET:
49            field_dict["user_type"] = user_type
50
51        return field_dict
52
53
54
55    @classmethod
56    def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T:
57        d = src_dict.copy()
58        workspace_id = d.pop("workspace_id")
59
60        email = d.pop("email", UNSET)
61
62        user_id = d.pop("user_id", UNSET)
63
64        url = d.pop("url", UNSET)
65
66        user_type = d.pop("user_type", UNSET)
67
68        workspaces_add_user_json_body = cls(
69            workspace_id=workspace_id,
70            email=email,
71            user_id=user_id,
72            url=url,
73            user_type=user_type,
74        )
75
76        workspaces_add_user_json_body.additional_properties = d
77        return workspaces_add_user_json_body
78
79    @property
80    def additional_keys(self) -> List[str]:
81        return list(self.additional_properties.keys())
82
83    def __getitem__(self, key: str) -> Any:
84        return self.additional_properties[key]
85
86    def __setitem__(self, key: str, value: Any) -> None:
87        self.additional_properties[key] = value
88
89    def __delitem__(self, key: str) -> None:
90        del self.additional_properties[key]
91
92    def __contains__(self, key: str) -> bool:
93        return key in self.additional_properties

Request for adding a user to workspace.

Attributes: workspace_id (int): Workspace identifier. email (Union[Unset, None, str]): User's email address. user_id (Union[Unset, None, str]): User identifier. url (Union[Unset, None, str]): Workspace URL. user_type (Union[Unset, None, str]): User's role in the workspace. Defaults to Collaborator.

WorkspacesAddUserJsonBody( workspace_id: int, email: Union[wallaroo.wallaroo_ml_ops_api_client.types.Unset, NoneType, str] = <wallaroo.wallaroo_ml_ops_api_client.types.Unset object>, user_id: Union[wallaroo.wallaroo_ml_ops_api_client.types.Unset, NoneType, str] = <wallaroo.wallaroo_ml_ops_api_client.types.Unset object>, url: Union[wallaroo.wallaroo_ml_ops_api_client.types.Unset, NoneType, str] = <wallaroo.wallaroo_ml_ops_api_client.types.Unset object>, user_type: Union[wallaroo.wallaroo_ml_ops_api_client.types.Unset, NoneType, str] = <wallaroo.wallaroo_ml_ops_api_client.types.Unset object>)
2def __init__(self, workspace_id, email=attr_dict['email'].default, user_id=attr_dict['user_id'].default, url=attr_dict['url'].default, user_type=attr_dict['user_type'].default):
3    self.workspace_id = workspace_id
4    self.email = email
5    self.user_id = user_id
6    self.url = url
7    self.user_type = user_type
8    self.additional_properties = __attr_factory_additional_properties()

Method generated by attrs for class WorkspacesAddUserJsonBody.

def to_dict(self) -> Dict[str, Any]:
30    def to_dict(self) -> Dict[str, Any]:
31        workspace_id = self.workspace_id
32        email = self.email
33        user_id = self.user_id
34        url = self.url
35        user_type = self.user_type
36
37        field_dict: Dict[str, Any] = {}
38        field_dict.update(self.additional_properties)
39        field_dict.update({
40            "workspace_id": workspace_id,
41        })
42        if email is not UNSET:
43            field_dict["email"] = email
44        if user_id is not UNSET:
45            field_dict["user_id"] = user_id
46        if url is not UNSET:
47            field_dict["url"] = url
48        if user_type is not UNSET:
49            field_dict["user_type"] = user_type
50
51        return field_dict
@classmethod
def from_dict(cls: Type[~T], src_dict: Dict[str, Any]) -> ~T:
55    @classmethod
56    def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T:
57        d = src_dict.copy()
58        workspace_id = d.pop("workspace_id")
59
60        email = d.pop("email", UNSET)
61
62        user_id = d.pop("user_id", UNSET)
63
64        url = d.pop("url", UNSET)
65
66        user_type = d.pop("user_type", UNSET)
67
68        workspaces_add_user_json_body = cls(
69            workspace_id=workspace_id,
70            email=email,
71            user_id=user_id,
72            url=url,
73            user_type=user_type,
74        )
75
76        workspaces_add_user_json_body.additional_properties = d
77        return workspaces_add_user_json_body
additional_keys: List[str]