skillforge-client 0.3.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (147) hide show
  1. skillforge_client/__init__.py +8 -0
  2. skillforge_client/api/__init__.py +1 -0
  3. skillforge_client/api/auth/__init__.py +1 -0
  4. skillforge_client/api/auth/create_application_client_endpoint_api_v1_auth_clients_post.py +166 -0
  5. skillforge_client/api/auth/create_application_client_secret_endpoint_api_v1_auth_clients_client_id_secrets_post.py +182 -0
  6. skillforge_client/api/auth/create_token_api_v1_auth_token_post.py +165 -0
  7. skillforge_client/api/auth/grant_application_client_scopes_endpoint_api_v1_auth_clients_client_id_scopes_post.py +182 -0
  8. skillforge_client/api/auth/read_application_client_api_v1_auth_clients_client_id_get.py +161 -0
  9. skillforge_client/api/auth/read_application_clients_api_v1_auth_clients_get.py +133 -0
  10. skillforge_client/api/auth/revoke_application_client_scope_endpoint_api_v1_auth_clients_client_id_scopes_scope_key_delete.py +173 -0
  11. skillforge_client/api/auth/revoke_application_client_secret_endpoint_api_v1_auth_clients_client_id_secrets_secret_id_delete.py +174 -0
  12. skillforge_client/api/auth/update_application_client_endpoint_api_v1_auth_clients_client_id_patch.py +182 -0
  13. skillforge_client/api/bot/__init__.py +1 -0
  14. skillforge_client/api/bot/add_user_to_group_endpoint_api_v1_bot_users_discord_id_groups_group_key_put.py +199 -0
  15. skillforge_client/api/bot/cancel_operation_endpoint_api_v1_bot_operations_operation_id_cancel_post.py +203 -0
  16. skillforge_client/api/bot/check_authorization_endpoint_api_v1_bot_authz_check_post.py +206 -0
  17. skillforge_client/api/bot/claim_jobs_endpoint_api_v1_bot_jobs_claim_post.py +210 -0
  18. skillforge_client/api/bot/commit_student_activation_endpoint_api_v1_bot_students_activations_operation_id_commit_post.py +204 -0
  19. skillforge_client/api/bot/commit_student_deactivation_endpoint_api_v1_bot_students_guild_id_student_discord_id_deactivate_operation_id_commit_post.py +211 -0
  20. skillforge_client/api/bot/commit_student_pop_endpoint_api_v1_bot_students_guild_id_student_discord_id_pop_operation_id_commit_post.py +211 -0
  21. skillforge_client/api/bot/commit_student_stash_endpoint_api_v1_bot_students_guild_id_student_discord_id_stash_operation_id_commit_post.py +211 -0
  22. skillforge_client/api/bot/commit_tutor_activation_endpoint_api_v1_bot_tutors_activations_operation_id_commit_post.py +204 -0
  23. skillforge_client/api/bot/commit_tutor_deactivation_endpoint_api_v1_bot_tutors_guild_id_tutor_discord_id_deactivate_operation_id_commit_post.py +211 -0
  24. skillforge_client/api/bot/complete_job_endpoint_api_v1_bot_jobs_job_id_complete_post.py +183 -0
  25. skillforge_client/api/bot/deactivate_discord_account_endpoint_api_v1_bot_users_discord_id_account_delete.py +197 -0
  26. skillforge_client/api/bot/delete_command_env_endpoint_api_v1_bot_command_envs_guild_id_channel_id_kind_delete.py +204 -0
  27. skillforge_client/api/bot/fail_job_endpoint_api_v1_bot_jobs_job_id_fail_post.py +228 -0
  28. skillforge_client/api/bot/job_queue_summary_endpoint_api_v1_bot_jobs_summary_get.py +202 -0
  29. skillforge_client/api/bot/link_discord_account_endpoint_api_v1_bot_users_discord_id_account_put.py +227 -0
  30. skillforge_client/api/bot/list_jobs_endpoint_api_v1_bot_jobs_get.py +243 -0
  31. skillforge_client/api/bot/list_operations_endpoint_api_v1_bot_operations_get.py +302 -0
  32. skillforge_client/api/bot/prepare_student_activation_endpoint_api_v1_bot_students_activations_prepare_post.py +181 -0
  33. skillforge_client/api/bot/prepare_student_deactivation_endpoint_api_v1_bot_students_guild_id_student_discord_id_deactivate_prepare_post.py +190 -0
  34. skillforge_client/api/bot/prepare_student_pop_endpoint_api_v1_bot_students_guild_id_student_discord_id_pop_prepare_post.py +190 -0
  35. skillforge_client/api/bot/prepare_student_stash_endpoint_api_v1_bot_students_guild_id_student_discord_id_stash_prepare_post.py +190 -0
  36. skillforge_client/api/bot/prepare_tutor_activation_endpoint_api_v1_bot_tutors_activations_prepare_post.py +181 -0
  37. skillforge_client/api/bot/prepare_tutor_deactivation_endpoint_api_v1_bot_tutors_guild_id_tutor_discord_id_deactivate_prepare_post.py +190 -0
  38. skillforge_client/api/bot/read_job_api_v1_bot_jobs_job_id_get.py +186 -0
  39. skillforge_client/api/bot/read_operation_api_v1_bot_operations_operation_id_get.py +186 -0
  40. skillforge_client/api/bot/read_principal_api_v1_bot_runtime_principals_discord_id_get.py +177 -0
  41. skillforge_client/api/bot/read_principals_batch_api_v1_bot_runtime_principals_batch_post.py +189 -0
  42. skillforge_client/api/bot/read_student_context_api_v1_bot_runtime_students_guild_id_discord_id_get.py +191 -0
  43. skillforge_client/api/bot/read_student_contexts_batch_api_v1_bot_runtime_students_guild_id_batch_post.py +205 -0
  44. skillforge_client/api/bot/read_tutor_context_api_v1_bot_runtime_tutors_guild_id_discord_id_get.py +191 -0
  45. skillforge_client/api/bot/read_tutor_contexts_batch_api_v1_bot_runtime_tutors_guild_id_batch_post.py +205 -0
  46. skillforge_client/api/bot/remove_user_from_group_endpoint_api_v1_bot_users_discord_id_groups_group_key_delete.py +197 -0
  47. skillforge_client/api/bot/resolve_command_env_endpoint_api_v1_bot_runtime_command_envs_resolve_get.py +234 -0
  48. skillforge_client/api/bot/upsert_command_env_endpoint_api_v1_bot_command_envs_put.py +181 -0
  49. skillforge_client/api/bot/upsert_discord_user_endpoint_api_v1_bot_users_discord_id_put.py +213 -0
  50. skillforge_client/api/default/__init__.py +1 -0
  51. skillforge_client/api/default/root_get.py +81 -0
  52. skillforge_client/api/system/__init__.py +1 -0
  53. skillforge_client/api/system/dependencies_health_check_health_dependencies_get.py +136 -0
  54. skillforge_client/api/system/dependency_health_check_health_dependencies_dependency_name_get.py +170 -0
  55. skillforge_client/api/system/liveness_check_health_live_get.py +132 -0
  56. skillforge_client/api/system/system_health_check_health_get.py +136 -0
  57. skillforge_client/api/system/worker_health_check_health_workers_worker_name_get.py +170 -0
  58. skillforge_client/api/system/workers_health_check_health_workers_get.py +136 -0
  59. skillforge_client/client.py +268 -0
  60. skillforge_client/errors.py +16 -0
  61. skillforge_client/models/__init__.py +167 -0
  62. skillforge_client/models/access_token_response.py +85 -0
  63. skillforge_client/models/application_client_create_request.py +91 -0
  64. skillforge_client/models/application_client_response.py +149 -0
  65. skillforge_client/models/application_client_scope_grant_request.py +61 -0
  66. skillforge_client/models/application_client_secret_create_request.py +104 -0
  67. skillforge_client/models/application_client_secret_response.py +160 -0
  68. skillforge_client/models/application_client_status.py +9 -0
  69. skillforge_client/models/application_client_update_request.py +124 -0
  70. skillforge_client/models/authorization_check_request.py +78 -0
  71. skillforge_client/models/authorization_check_response.py +61 -0
  72. skillforge_client/models/body_create_token_api_v1_auth_token_post.py +123 -0
  73. skillforge_client/models/bot_job.py +119 -0
  74. skillforge_client/models/bot_job_payload.py +47 -0
  75. skillforge_client/models/bot_principal.py +148 -0
  76. skillforge_client/models/command_env_channel_response.py +100 -0
  77. skillforge_client/models/command_env_kind.py +9 -0
  78. skillforge_client/models/command_env_upsert_request.py +100 -0
  79. skillforge_client/models/contact_info_profile.py +92 -0
  80. skillforge_client/models/contact_info_type.py +9 -0
  81. skillforge_client/models/created_client_secret_response.py +75 -0
  82. skillforge_client/models/dependencies_health_check_response.py +77 -0
  83. skillforge_client/models/dependencies_health_check_response_checks.py +56 -0
  84. skillforge_client/models/dependency_health_check_response.py +72 -0
  85. skillforge_client/models/dependency_name.py +8 -0
  86. skillforge_client/models/discord_account_link_request.py +82 -0
  87. skillforge_client/models/discord_account_link_response.py +86 -0
  88. skillforge_client/models/discord_account_profile.py +77 -0
  89. skillforge_client/models/discord_id_batch_request.py +62 -0
  90. skillforge_client/models/discord_user_response.py +87 -0
  91. skillforge_client/models/discord_user_upsert_request.py +81 -0
  92. skillforge_client/models/error_response.py +61 -0
  93. skillforge_client/models/external_accounts_profile.py +124 -0
  94. skillforge_client/models/group_membership_response.py +69 -0
  95. skillforge_client/models/health_check_response.py +63 -0
  96. skillforge_client/models/health_status.py +10 -0
  97. skillforge_client/models/http_validation_error.py +79 -0
  98. skillforge_client/models/job_claim_request.py +113 -0
  99. skillforge_client/models/job_detail.py +239 -0
  100. skillforge_client/models/job_detail_payload.py +47 -0
  101. skillforge_client/models/job_fail_request.py +82 -0
  102. skillforge_client/models/job_kind_counts.py +92 -0
  103. skillforge_client/models/job_list_item.py +225 -0
  104. skillforge_client/models/job_page.py +100 -0
  105. skillforge_client/models/job_queue_summary.py +106 -0
  106. skillforge_client/models/job_response.py +187 -0
  107. skillforge_client/models/job_status.py +11 -0
  108. skillforge_client/models/job_status_counts.py +86 -0
  109. skillforge_client/models/member_role.py +10 -0
  110. skillforge_client/models/microsoft_account_profile.py +61 -0
  111. skillforge_client/models/operation_cancel_response.py +108 -0
  112. skillforge_client/models/operation_kind.py +13 -0
  113. skillforge_client/models/operation_page.py +100 -0
  114. skillforge_client/models/operation_response.py +257 -0
  115. skillforge_client/models/operation_response_plan.py +47 -0
  116. skillforge_client/models/operation_status.py +12 -0
  117. skillforge_client/models/operation_summary.py +243 -0
  118. skillforge_client/models/operational_profile.py +178 -0
  119. skillforge_client/models/party_relation_type.py +10 -0
  120. skillforge_client/models/person_profile.py +69 -0
  121. skillforge_client/models/principal_batch.py +84 -0
  122. skillforge_client/models/relation_profile.py +81 -0
  123. skillforge_client/models/relation_profile_direction.py +9 -0
  124. skillforge_client/models/student_activation_commit_request.py +61 -0
  125. skillforge_client/models/student_activation_prepare_request.py +77 -0
  126. skillforge_client/models/student_channel_state.py +9 -0
  127. skillforge_client/models/student_context.py +140 -0
  128. skillforge_client/models/student_context_batch.py +83 -0
  129. skillforge_client/models/system_health_check_response.py +87 -0
  130. skillforge_client/models/transition_commit_response.py +108 -0
  131. skillforge_client/models/transition_prepare_response.py +95 -0
  132. skillforge_client/models/transition_prepare_response_plan.py +47 -0
  133. skillforge_client/models/tutor_activation_commit_request.py +69 -0
  134. skillforge_client/models/tutor_activation_prepare_request.py +69 -0
  135. skillforge_client/models/tutor_context.py +99 -0
  136. skillforge_client/models/tutor_context_batch.py +83 -0
  137. skillforge_client/models/validation_error.py +123 -0
  138. skillforge_client/models/validation_error_context.py +47 -0
  139. skillforge_client/models/worker_health_check_response.py +72 -0
  140. skillforge_client/models/worker_name.py +8 -0
  141. skillforge_client/models/workers_health_check_response.py +77 -0
  142. skillforge_client/models/workers_health_check_response_checks.py +56 -0
  143. skillforge_client/py.typed +1 -0
  144. skillforge_client/types.py +54 -0
  145. skillforge_client-0.3.0.dist-info/METADATA +83 -0
  146. skillforge_client-0.3.0.dist-info/RECORD +147 -0
  147. skillforge_client-0.3.0.dist-info/WHEEL +4 -0
@@ -0,0 +1,61 @@
1
+ from __future__ import annotations
2
+
3
+ from collections.abc import Mapping
4
+ from typing import Any, TypeVar
5
+
6
+ from attrs import define as _attrs_define
7
+ from attrs import field as _attrs_field
8
+
9
+ T = TypeVar("T", bound="AuthorizationCheckResponse")
10
+
11
+
12
+ @_attrs_define
13
+ class AuthorizationCheckResponse:
14
+ """
15
+ Attributes:
16
+ allowed (bool):
17
+ """
18
+
19
+ allowed: bool
20
+ additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
21
+
22
+ def to_dict(self) -> dict[str, Any]:
23
+ allowed = self.allowed
24
+
25
+ field_dict: dict[str, Any] = {}
26
+ field_dict.update(self.additional_properties)
27
+ field_dict.update(
28
+ {
29
+ "allowed": allowed,
30
+ }
31
+ )
32
+
33
+ return field_dict
34
+
35
+ @classmethod
36
+ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
37
+ d = dict(src_dict)
38
+ allowed = d.pop("allowed")
39
+
40
+ authorization_check_response = cls(
41
+ allowed=allowed,
42
+ )
43
+
44
+ authorization_check_response.additional_properties = d
45
+ return authorization_check_response
46
+
47
+ @property
48
+ def additional_keys(self) -> list[str]:
49
+ return list(self.additional_properties.keys())
50
+
51
+ def __getitem__(self, key: str) -> Any:
52
+ return self.additional_properties[key]
53
+
54
+ def __setitem__(self, key: str, value: Any) -> None:
55
+ self.additional_properties[key] = value
56
+
57
+ def __delitem__(self, key: str) -> None:
58
+ del self.additional_properties[key]
59
+
60
+ def __contains__(self, key: str) -> bool:
61
+ return key in self.additional_properties
@@ -0,0 +1,123 @@
1
+ from __future__ import annotations
2
+
3
+ from collections.abc import Mapping
4
+ from typing import Any, TypeVar, cast
5
+
6
+ from attrs import define as _attrs_define
7
+ from attrs import field as _attrs_field
8
+
9
+ from ..types import UNSET, Unset
10
+
11
+ T = TypeVar("T", bound="BodyCreateTokenApiV1AuthTokenPost")
12
+
13
+
14
+ @_attrs_define
15
+ class BodyCreateTokenApiV1AuthTokenPost:
16
+ """
17
+ Attributes:
18
+ grant_type (str):
19
+ client_id (None | str | Unset):
20
+ client_secret (None | str | Unset):
21
+ scope (None | str | Unset):
22
+ """
23
+
24
+ grant_type: str
25
+ client_id: None | str | Unset = UNSET
26
+ client_secret: None | str | Unset = UNSET
27
+ scope: None | str | Unset = UNSET
28
+ additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
29
+
30
+ def to_dict(self) -> dict[str, Any]:
31
+ grant_type = self.grant_type
32
+
33
+ client_id: None | str | Unset
34
+ if isinstance(self.client_id, Unset):
35
+ client_id = UNSET
36
+ else:
37
+ client_id = self.client_id
38
+
39
+ client_secret: None | str | Unset
40
+ if isinstance(self.client_secret, Unset):
41
+ client_secret = UNSET
42
+ else:
43
+ client_secret = self.client_secret
44
+
45
+ scope: None | str | Unset
46
+ if isinstance(self.scope, Unset):
47
+ scope = UNSET
48
+ else:
49
+ scope = self.scope
50
+
51
+ field_dict: dict[str, Any] = {}
52
+ field_dict.update(self.additional_properties)
53
+ field_dict.update(
54
+ {
55
+ "grant_type": grant_type,
56
+ }
57
+ )
58
+ if client_id is not UNSET:
59
+ field_dict["client_id"] = client_id
60
+ if client_secret is not UNSET:
61
+ field_dict["client_secret"] = client_secret
62
+ if scope is not UNSET:
63
+ field_dict["scope"] = scope
64
+
65
+ return field_dict
66
+
67
+ @classmethod
68
+ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
69
+ d = dict(src_dict)
70
+ grant_type = d.pop("grant_type")
71
+
72
+ def _parse_client_id(data: object) -> None | str | Unset:
73
+ if data is None:
74
+ return data
75
+ if isinstance(data, Unset):
76
+ return data
77
+ return cast(None | str | Unset, data)
78
+
79
+ client_id = _parse_client_id(d.pop("client_id", UNSET))
80
+
81
+ def _parse_client_secret(data: object) -> None | str | Unset:
82
+ if data is None:
83
+ return data
84
+ if isinstance(data, Unset):
85
+ return data
86
+ return cast(None | str | Unset, data)
87
+
88
+ client_secret = _parse_client_secret(d.pop("client_secret", UNSET))
89
+
90
+ def _parse_scope(data: object) -> None | str | Unset:
91
+ if data is None:
92
+ return data
93
+ if isinstance(data, Unset):
94
+ return data
95
+ return cast(None | str | Unset, data)
96
+
97
+ scope = _parse_scope(d.pop("scope", UNSET))
98
+
99
+ body_create_token_api_v1_auth_token_post = cls(
100
+ grant_type=grant_type,
101
+ client_id=client_id,
102
+ client_secret=client_secret,
103
+ scope=scope,
104
+ )
105
+
106
+ body_create_token_api_v1_auth_token_post.additional_properties = d
107
+ return body_create_token_api_v1_auth_token_post
108
+
109
+ @property
110
+ def additional_keys(self) -> list[str]:
111
+ return list(self.additional_properties.keys())
112
+
113
+ def __getitem__(self, key: str) -> Any:
114
+ return self.additional_properties[key]
115
+
116
+ def __setitem__(self, key: str, value: Any) -> None:
117
+ self.additional_properties[key] = value
118
+
119
+ def __delitem__(self, key: str) -> None:
120
+ del self.additional_properties[key]
121
+
122
+ def __contains__(self, key: str) -> bool:
123
+ return key in self.additional_properties
@@ -0,0 +1,119 @@
1
+ from __future__ import annotations
2
+
3
+ import datetime
4
+ from collections.abc import Mapping
5
+ from typing import TYPE_CHECKING, Any, TypeVar, cast
6
+ from uuid import UUID
7
+
8
+ from attrs import define as _attrs_define
9
+ from attrs import field as _attrs_field
10
+
11
+ if TYPE_CHECKING:
12
+ from ..models.bot_job_payload import BotJobPayload
13
+
14
+
15
+ T = TypeVar("T", bound="BotJob")
16
+
17
+
18
+ @_attrs_define
19
+ class BotJob:
20
+ """Processing view returned when a job is claimed.
21
+
22
+ Attributes:
23
+ attempt (int):
24
+ claimed_at (datetime.datetime | None):
25
+ job_id (UUID):
26
+ kind (str):
27
+ payload (BotJobPayload):
28
+ """
29
+
30
+ attempt: int
31
+ claimed_at: datetime.datetime | None
32
+ job_id: UUID
33
+ kind: str
34
+ payload: BotJobPayload
35
+ additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
36
+
37
+ def to_dict(self) -> dict[str, Any]:
38
+ attempt = self.attempt
39
+
40
+ claimed_at: None | str
41
+ if isinstance(self.claimed_at, datetime.datetime):
42
+ claimed_at = self.claimed_at.isoformat()
43
+ else:
44
+ claimed_at = self.claimed_at
45
+
46
+ job_id = str(self.job_id)
47
+
48
+ kind = self.kind
49
+
50
+ payload = self.payload.to_dict()
51
+
52
+ field_dict: dict[str, Any] = {}
53
+ field_dict.update(self.additional_properties)
54
+ field_dict.update(
55
+ {
56
+ "attempt": attempt,
57
+ "claimed_at": claimed_at,
58
+ "job_id": job_id,
59
+ "kind": kind,
60
+ "payload": payload,
61
+ }
62
+ )
63
+
64
+ return field_dict
65
+
66
+ @classmethod
67
+ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
68
+ from ..models.bot_job_payload import BotJobPayload
69
+
70
+ d = dict(src_dict)
71
+ attempt = d.pop("attempt")
72
+
73
+ def _parse_claimed_at(data: object) -> datetime.datetime | None:
74
+ if data is None:
75
+ return data
76
+ try:
77
+ if not isinstance(data, str):
78
+ raise TypeError()
79
+ claimed_at_type_0 = datetime.datetime.fromisoformat(data)
80
+
81
+ return claimed_at_type_0
82
+ except (TypeError, ValueError, AttributeError, KeyError):
83
+ pass
84
+ return cast(datetime.datetime | None, data)
85
+
86
+ claimed_at = _parse_claimed_at(d.pop("claimed_at"))
87
+
88
+ job_id = UUID(d.pop("job_id"))
89
+
90
+ kind = d.pop("kind")
91
+
92
+ payload = BotJobPayload.from_dict(d.pop("payload"))
93
+
94
+ bot_job = cls(
95
+ attempt=attempt,
96
+ claimed_at=claimed_at,
97
+ job_id=job_id,
98
+ kind=kind,
99
+ payload=payload,
100
+ )
101
+
102
+ bot_job.additional_properties = d
103
+ return bot_job
104
+
105
+ @property
106
+ def additional_keys(self) -> list[str]:
107
+ return list(self.additional_properties.keys())
108
+
109
+ def __getitem__(self, key: str) -> Any:
110
+ return self.additional_properties[key]
111
+
112
+ def __setitem__(self, key: str, value: Any) -> None:
113
+ self.additional_properties[key] = value
114
+
115
+ def __delitem__(self, key: str) -> None:
116
+ del self.additional_properties[key]
117
+
118
+ def __contains__(self, key: str) -> bool:
119
+ return key in self.additional_properties
@@ -0,0 +1,47 @@
1
+ from __future__ import annotations
2
+
3
+ from collections.abc import Mapping
4
+ from typing import Any, TypeVar
5
+
6
+ from attrs import define as _attrs_define
7
+ from attrs import field as _attrs_field
8
+
9
+ T = TypeVar("T", bound="BotJobPayload")
10
+
11
+
12
+ @_attrs_define
13
+ class BotJobPayload:
14
+ """ """
15
+
16
+ additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
17
+
18
+ def to_dict(self) -> dict[str, Any]:
19
+
20
+ field_dict: dict[str, Any] = {}
21
+ field_dict.update(self.additional_properties)
22
+
23
+ return field_dict
24
+
25
+ @classmethod
26
+ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
27
+ d = dict(src_dict)
28
+ bot_job_payload = cls()
29
+
30
+ bot_job_payload.additional_properties = d
31
+ return bot_job_payload
32
+
33
+ @property
34
+ def additional_keys(self) -> list[str]:
35
+ return list(self.additional_properties.keys())
36
+
37
+ def __getitem__(self, key: str) -> Any:
38
+ return self.additional_properties[key]
39
+
40
+ def __setitem__(self, key: str, value: Any) -> None:
41
+ self.additional_properties[key] = value
42
+
43
+ def __delitem__(self, key: str) -> None:
44
+ del self.additional_properties[key]
45
+
46
+ def __contains__(self, key: str) -> bool:
47
+ return key in self.additional_properties
@@ -0,0 +1,148 @@
1
+ from __future__ import annotations
2
+
3
+ from collections.abc import Mapping
4
+ from typing import TYPE_CHECKING, Any, TypeVar, cast
5
+
6
+ from attrs import define as _attrs_define
7
+ from attrs import field as _attrs_field
8
+
9
+ from ..models.member_role import MemberRole
10
+ from ..types import UNSET, Unset
11
+
12
+ if TYPE_CHECKING:
13
+ from ..models.operational_profile import OperationalProfile
14
+
15
+
16
+ T = TypeVar("T", bound="BotPrincipal")
17
+
18
+
19
+ @_attrs_define
20
+ class BotPrincipal:
21
+ """
22
+ Attributes:
23
+ active (bool):
24
+ discord_id (int):
25
+ display_name (str):
26
+ role (MemberRole):
27
+ groups (list[str] | Unset):
28
+ permissions (list[str] | Unset):
29
+ profile (None | OperationalProfile | Unset):
30
+ """
31
+
32
+ active: bool
33
+ discord_id: int
34
+ display_name: str
35
+ role: MemberRole
36
+ groups: list[str] | Unset = UNSET
37
+ permissions: list[str] | Unset = UNSET
38
+ profile: None | OperationalProfile | Unset = UNSET
39
+ additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
40
+
41
+ def to_dict(self) -> dict[str, Any]:
42
+ from ..models.operational_profile import OperationalProfile
43
+
44
+ active = self.active
45
+
46
+ discord_id = self.discord_id
47
+
48
+ display_name = self.display_name
49
+
50
+ role = self.role.value
51
+
52
+ groups: list[str] | Unset = UNSET
53
+ if not isinstance(self.groups, Unset):
54
+ groups = self.groups
55
+
56
+ permissions: list[str] | Unset = UNSET
57
+ if not isinstance(self.permissions, Unset):
58
+ permissions = self.permissions
59
+
60
+ profile: dict[str, Any] | None | Unset
61
+ if isinstance(self.profile, Unset):
62
+ profile = UNSET
63
+ elif isinstance(self.profile, OperationalProfile):
64
+ profile = self.profile.to_dict()
65
+ else:
66
+ profile = self.profile
67
+
68
+ field_dict: dict[str, Any] = {}
69
+ field_dict.update(self.additional_properties)
70
+ field_dict.update(
71
+ {
72
+ "active": active,
73
+ "discord_id": discord_id,
74
+ "display_name": display_name,
75
+ "role": role,
76
+ }
77
+ )
78
+ if groups is not UNSET:
79
+ field_dict["groups"] = groups
80
+ if permissions is not UNSET:
81
+ field_dict["permissions"] = permissions
82
+ if profile is not UNSET:
83
+ field_dict["profile"] = profile
84
+
85
+ return field_dict
86
+
87
+ @classmethod
88
+ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
89
+ from ..models.operational_profile import OperationalProfile
90
+
91
+ d = dict(src_dict)
92
+ active = d.pop("active")
93
+
94
+ discord_id = d.pop("discord_id")
95
+
96
+ display_name = d.pop("display_name")
97
+
98
+ role = MemberRole(d.pop("role"))
99
+
100
+ groups = cast(list[str], d.pop("groups", UNSET))
101
+
102
+ permissions = cast(list[str], d.pop("permissions", UNSET))
103
+
104
+ def _parse_profile(data: object) -> None | OperationalProfile | Unset:
105
+ if data is None:
106
+ return data
107
+ if isinstance(data, Unset):
108
+ return data
109
+ try:
110
+ if not isinstance(data, dict):
111
+ raise TypeError()
112
+ profile_type_0 = OperationalProfile.from_dict(data)
113
+
114
+ return profile_type_0
115
+ except (TypeError, ValueError, AttributeError, KeyError):
116
+ pass
117
+ return cast(None | OperationalProfile | Unset, data)
118
+
119
+ profile = _parse_profile(d.pop("profile", UNSET))
120
+
121
+ bot_principal = cls(
122
+ active=active,
123
+ discord_id=discord_id,
124
+ display_name=display_name,
125
+ role=role,
126
+ groups=groups,
127
+ permissions=permissions,
128
+ profile=profile,
129
+ )
130
+
131
+ bot_principal.additional_properties = d
132
+ return bot_principal
133
+
134
+ @property
135
+ def additional_keys(self) -> list[str]:
136
+ return list(self.additional_properties.keys())
137
+
138
+ def __getitem__(self, key: str) -> Any:
139
+ return self.additional_properties[key]
140
+
141
+ def __setitem__(self, key: str, value: Any) -> None:
142
+ self.additional_properties[key] = value
143
+
144
+ def __delitem__(self, key: str) -> None:
145
+ del self.additional_properties[key]
146
+
147
+ def __contains__(self, key: str) -> bool:
148
+ return key in self.additional_properties
@@ -0,0 +1,100 @@
1
+ from __future__ import annotations
2
+
3
+ from collections.abc import Mapping
4
+ from typing import Any, TypeVar, cast
5
+
6
+ from attrs import define as _attrs_define
7
+ from attrs import field as _attrs_field
8
+
9
+ from ..models.command_env_kind import CommandEnvKind
10
+ from ..types import UNSET, Unset
11
+
12
+ T = TypeVar("T", bound="CommandEnvChannelResponse")
13
+
14
+
15
+ @_attrs_define
16
+ class CommandEnvChannelResponse:
17
+ """
18
+ Attributes:
19
+ channel_id (int):
20
+ guild_id (int):
21
+ kind (CommandEnvKind):
22
+ owner_discord_id (int | None | Unset):
23
+ """
24
+
25
+ channel_id: int
26
+ guild_id: int
27
+ kind: CommandEnvKind
28
+ owner_discord_id: int | None | Unset = UNSET
29
+ additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
30
+
31
+ def to_dict(self) -> dict[str, Any]:
32
+ channel_id = self.channel_id
33
+
34
+ guild_id = self.guild_id
35
+
36
+ kind = self.kind.value
37
+
38
+ owner_discord_id: int | None | Unset
39
+ if isinstance(self.owner_discord_id, Unset):
40
+ owner_discord_id = UNSET
41
+ else:
42
+ owner_discord_id = self.owner_discord_id
43
+
44
+ field_dict: dict[str, Any] = {}
45
+ field_dict.update(self.additional_properties)
46
+ field_dict.update(
47
+ {
48
+ "channel_id": channel_id,
49
+ "guild_id": guild_id,
50
+ "kind": kind,
51
+ }
52
+ )
53
+ if owner_discord_id is not UNSET:
54
+ field_dict["owner_discord_id"] = owner_discord_id
55
+
56
+ return field_dict
57
+
58
+ @classmethod
59
+ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
60
+ d = dict(src_dict)
61
+ channel_id = d.pop("channel_id")
62
+
63
+ guild_id = d.pop("guild_id")
64
+
65
+ kind = CommandEnvKind(d.pop("kind"))
66
+
67
+ def _parse_owner_discord_id(data: object) -> int | None | Unset:
68
+ if data is None:
69
+ return data
70
+ if isinstance(data, Unset):
71
+ return data
72
+ return cast(int | None | Unset, data)
73
+
74
+ owner_discord_id = _parse_owner_discord_id(d.pop("owner_discord_id", UNSET))
75
+
76
+ command_env_channel_response = cls(
77
+ channel_id=channel_id,
78
+ guild_id=guild_id,
79
+ kind=kind,
80
+ owner_discord_id=owner_discord_id,
81
+ )
82
+
83
+ command_env_channel_response.additional_properties = d
84
+ return command_env_channel_response
85
+
86
+ @property
87
+ def additional_keys(self) -> list[str]:
88
+ return list(self.additional_properties.keys())
89
+
90
+ def __getitem__(self, key: str) -> Any:
91
+ return self.additional_properties[key]
92
+
93
+ def __setitem__(self, key: str, value: Any) -> None:
94
+ self.additional_properties[key] = value
95
+
96
+ def __delitem__(self, key: str) -> None:
97
+ del self.additional_properties[key]
98
+
99
+ def __contains__(self, key: str) -> bool:
100
+ return key in self.additional_properties
@@ -0,0 +1,9 @@
1
+ from enum import Enum
2
+
3
+
4
+ class CommandEnvKind(str, Enum):
5
+ ADMIN_CMD = "admin_cmd"
6
+ TUTOR_CMD = "tutor_cmd"
7
+
8
+ def __str__(self) -> str:
9
+ return str(self.value)
@@ -0,0 +1,100 @@
1
+ from __future__ import annotations
2
+
3
+ from collections.abc import Mapping
4
+ from typing import Any, TypeVar, cast
5
+
6
+ from attrs import define as _attrs_define
7
+ from attrs import field as _attrs_field
8
+
9
+ from ..models.command_env_kind import CommandEnvKind
10
+ from ..types import UNSET, Unset
11
+
12
+ T = TypeVar("T", bound="CommandEnvUpsertRequest")
13
+
14
+
15
+ @_attrs_define
16
+ class CommandEnvUpsertRequest:
17
+ """
18
+ Attributes:
19
+ channel_id (int):
20
+ guild_id (int):
21
+ kind (CommandEnvKind):
22
+ owner_discord_id (int | None | Unset):
23
+ """
24
+
25
+ channel_id: int
26
+ guild_id: int
27
+ kind: CommandEnvKind
28
+ owner_discord_id: int | None | Unset = UNSET
29
+ additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
30
+
31
+ def to_dict(self) -> dict[str, Any]:
32
+ channel_id = self.channel_id
33
+
34
+ guild_id = self.guild_id
35
+
36
+ kind = self.kind.value
37
+
38
+ owner_discord_id: int | None | Unset
39
+ if isinstance(self.owner_discord_id, Unset):
40
+ owner_discord_id = UNSET
41
+ else:
42
+ owner_discord_id = self.owner_discord_id
43
+
44
+ field_dict: dict[str, Any] = {}
45
+ field_dict.update(self.additional_properties)
46
+ field_dict.update(
47
+ {
48
+ "channel_id": channel_id,
49
+ "guild_id": guild_id,
50
+ "kind": kind,
51
+ }
52
+ )
53
+ if owner_discord_id is not UNSET:
54
+ field_dict["owner_discord_id"] = owner_discord_id
55
+
56
+ return field_dict
57
+
58
+ @classmethod
59
+ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
60
+ d = dict(src_dict)
61
+ channel_id = d.pop("channel_id")
62
+
63
+ guild_id = d.pop("guild_id")
64
+
65
+ kind = CommandEnvKind(d.pop("kind"))
66
+
67
+ def _parse_owner_discord_id(data: object) -> int | None | Unset:
68
+ if data is None:
69
+ return data
70
+ if isinstance(data, Unset):
71
+ return data
72
+ return cast(int | None | Unset, data)
73
+
74
+ owner_discord_id = _parse_owner_discord_id(d.pop("owner_discord_id", UNSET))
75
+
76
+ command_env_upsert_request = cls(
77
+ channel_id=channel_id,
78
+ guild_id=guild_id,
79
+ kind=kind,
80
+ owner_discord_id=owner_discord_id,
81
+ )
82
+
83
+ command_env_upsert_request.additional_properties = d
84
+ return command_env_upsert_request
85
+
86
+ @property
87
+ def additional_keys(self) -> list[str]:
88
+ return list(self.additional_properties.keys())
89
+
90
+ def __getitem__(self, key: str) -> Any:
91
+ return self.additional_properties[key]
92
+
93
+ def __setitem__(self, key: str, value: Any) -> None:
94
+ self.additional_properties[key] = value
95
+
96
+ def __delitem__(self, key: str) -> None:
97
+ del self.additional_properties[key]
98
+
99
+ def __contains__(self, key: str) -> bool:
100
+ return key in self.additional_properties