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,197 @@
1
+ from http import HTTPStatus
2
+ from typing import Any, cast
3
+ from urllib.parse import quote
4
+
5
+ import httpx
6
+
7
+ from ... import errors
8
+ from ...client import AuthenticatedClient, Client
9
+ from ...models.error_response import ErrorResponse
10
+ from ...models.http_validation_error import HTTPValidationError
11
+ from ...types import Response
12
+
13
+
14
+ def _get_kwargs(
15
+ discord_id: int,
16
+ group_key: str,
17
+ ) -> dict[str, Any]:
18
+
19
+ _kwargs: dict[str, Any] = {
20
+ "method": "delete",
21
+ "url": "/api/v1/bot/users/{discord_id}/groups/{group_key}".format(
22
+ discord_id=quote(str(discord_id), safe=""),
23
+ group_key=quote(str(group_key), safe=""),
24
+ ),
25
+ }
26
+
27
+ return _kwargs
28
+
29
+
30
+ def _parse_response(
31
+ *, client: AuthenticatedClient | Client, response: httpx.Response
32
+ ) -> Any | ErrorResponse | HTTPValidationError | None:
33
+ if response.status_code == 204:
34
+ response_204 = cast(Any, None)
35
+ return response_204
36
+
37
+ if response.status_code == 401:
38
+ response_401 = ErrorResponse.from_dict(response.json())
39
+
40
+ return response_401
41
+
42
+ if response.status_code == 403:
43
+ response_403 = ErrorResponse.from_dict(response.json())
44
+
45
+ return response_403
46
+
47
+ if response.status_code == 404:
48
+ response_404 = ErrorResponse.from_dict(response.json())
49
+
50
+ return response_404
51
+
52
+ if response.status_code == 422:
53
+ response_422 = HTTPValidationError.from_dict(response.json())
54
+
55
+ return response_422
56
+
57
+ if client.raise_on_unexpected_status:
58
+ raise errors.UnexpectedStatus(response.status_code, response.content)
59
+ else:
60
+ return None
61
+
62
+
63
+ def _build_response(
64
+ *, client: AuthenticatedClient | Client, response: httpx.Response
65
+ ) -> Response[Any | ErrorResponse | HTTPValidationError]:
66
+ return Response(
67
+ status_code=HTTPStatus(response.status_code),
68
+ content=response.content,
69
+ headers=response.headers,
70
+ parsed=_parse_response(client=client, response=response),
71
+ )
72
+
73
+
74
+ def sync_detailed(
75
+ discord_id: int,
76
+ group_key: str,
77
+ *,
78
+ client: AuthenticatedClient,
79
+ ) -> Response[Any | ErrorResponse | HTTPValidationError]:
80
+ """Remove User From Group Endpoint
81
+
82
+ Remove a Discord user from a permission group.
83
+
84
+ Args:
85
+ discord_id (int):
86
+ group_key (str):
87
+
88
+ Raises:
89
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
90
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
91
+
92
+ Returns:
93
+ Response[Any | ErrorResponse | HTTPValidationError]
94
+ """
95
+
96
+ kwargs = _get_kwargs(
97
+ discord_id=discord_id,
98
+ group_key=group_key,
99
+ )
100
+
101
+ response = client.get_httpx_client().request(
102
+ **kwargs,
103
+ )
104
+
105
+ return _build_response(client=client, response=response)
106
+
107
+
108
+ def sync(
109
+ discord_id: int,
110
+ group_key: str,
111
+ *,
112
+ client: AuthenticatedClient,
113
+ ) -> Any | ErrorResponse | HTTPValidationError | None:
114
+ """Remove User From Group Endpoint
115
+
116
+ Remove a Discord user from a permission group.
117
+
118
+ Args:
119
+ discord_id (int):
120
+ group_key (str):
121
+
122
+ Raises:
123
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
124
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
125
+
126
+ Returns:
127
+ Any | ErrorResponse | HTTPValidationError
128
+ """
129
+
130
+ return sync_detailed(
131
+ discord_id=discord_id,
132
+ group_key=group_key,
133
+ client=client,
134
+ ).parsed
135
+
136
+
137
+ async def asyncio_detailed(
138
+ discord_id: int,
139
+ group_key: str,
140
+ *,
141
+ client: AuthenticatedClient,
142
+ ) -> Response[Any | ErrorResponse | HTTPValidationError]:
143
+ """Remove User From Group Endpoint
144
+
145
+ Remove a Discord user from a permission group.
146
+
147
+ Args:
148
+ discord_id (int):
149
+ group_key (str):
150
+
151
+ Raises:
152
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
153
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
154
+
155
+ Returns:
156
+ Response[Any | ErrorResponse | HTTPValidationError]
157
+ """
158
+
159
+ kwargs = _get_kwargs(
160
+ discord_id=discord_id,
161
+ group_key=group_key,
162
+ )
163
+
164
+ response = await client.get_async_httpx_client().request(**kwargs)
165
+
166
+ return _build_response(client=client, response=response)
167
+
168
+
169
+ async def asyncio(
170
+ discord_id: int,
171
+ group_key: str,
172
+ *,
173
+ client: AuthenticatedClient,
174
+ ) -> Any | ErrorResponse | HTTPValidationError | None:
175
+ """Remove User From Group Endpoint
176
+
177
+ Remove a Discord user from a permission group.
178
+
179
+ Args:
180
+ discord_id (int):
181
+ group_key (str):
182
+
183
+ Raises:
184
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
185
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
186
+
187
+ Returns:
188
+ Any | ErrorResponse | HTTPValidationError
189
+ """
190
+
191
+ return (
192
+ await asyncio_detailed(
193
+ discord_id=discord_id,
194
+ group_key=group_key,
195
+ client=client,
196
+ )
197
+ ).parsed
@@ -0,0 +1,234 @@
1
+ from http import HTTPStatus
2
+ from typing import Any
3
+
4
+ import httpx
5
+
6
+ from ... import errors
7
+ from ...client import AuthenticatedClient, Client
8
+ from ...models.command_env_channel_response import CommandEnvChannelResponse
9
+ from ...models.command_env_kind import CommandEnvKind
10
+ from ...models.error_response import ErrorResponse
11
+ from ...models.http_validation_error import HTTPValidationError
12
+ from ...types import UNSET, Response, Unset
13
+
14
+
15
+ def _get_kwargs(
16
+ *,
17
+ guild_id: int,
18
+ channel_id: int,
19
+ kind: CommandEnvKind,
20
+ owner_discord_id: int | None | Unset = UNSET,
21
+ ) -> dict[str, Any]:
22
+
23
+ params: dict[str, Any] = {}
24
+
25
+ params["guild_id"] = guild_id
26
+
27
+ params["channel_id"] = channel_id
28
+
29
+ json_kind = kind.value
30
+ params["kind"] = json_kind
31
+
32
+ json_owner_discord_id: int | None | Unset
33
+ if isinstance(owner_discord_id, Unset):
34
+ json_owner_discord_id = UNSET
35
+ else:
36
+ json_owner_discord_id = owner_discord_id
37
+ params["owner_discord_id"] = json_owner_discord_id
38
+
39
+ params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
40
+
41
+ _kwargs: dict[str, Any] = {
42
+ "method": "get",
43
+ "url": "/api/v1/bot/runtime/command-envs/resolve",
44
+ "params": params,
45
+ }
46
+
47
+ return _kwargs
48
+
49
+
50
+ def _parse_response(
51
+ *, client: AuthenticatedClient | Client, response: httpx.Response
52
+ ) -> CommandEnvChannelResponse | ErrorResponse | HTTPValidationError | None:
53
+ if response.status_code == 200:
54
+ response_200 = CommandEnvChannelResponse.from_dict(response.json())
55
+
56
+ return response_200
57
+
58
+ if response.status_code == 401:
59
+ response_401 = ErrorResponse.from_dict(response.json())
60
+
61
+ return response_401
62
+
63
+ if response.status_code == 403:
64
+ response_403 = ErrorResponse.from_dict(response.json())
65
+
66
+ return response_403
67
+
68
+ if response.status_code == 404:
69
+ response_404 = ErrorResponse.from_dict(response.json())
70
+
71
+ return response_404
72
+
73
+ if response.status_code == 422:
74
+ response_422 = HTTPValidationError.from_dict(response.json())
75
+
76
+ return response_422
77
+
78
+ if client.raise_on_unexpected_status:
79
+ raise errors.UnexpectedStatus(response.status_code, response.content)
80
+ else:
81
+ return None
82
+
83
+
84
+ def _build_response(
85
+ *, client: AuthenticatedClient | Client, response: httpx.Response
86
+ ) -> Response[CommandEnvChannelResponse | ErrorResponse | HTTPValidationError]:
87
+ return Response(
88
+ status_code=HTTPStatus(response.status_code),
89
+ content=response.content,
90
+ headers=response.headers,
91
+ parsed=_parse_response(client=client, response=response),
92
+ )
93
+
94
+
95
+ def sync_detailed(
96
+ *,
97
+ client: AuthenticatedClient,
98
+ guild_id: int,
99
+ channel_id: int,
100
+ kind: CommandEnvKind,
101
+ owner_discord_id: int | None | Unset = UNSET,
102
+ ) -> Response[CommandEnvChannelResponse | ErrorResponse | HTTPValidationError]:
103
+ """Resolve Command Env Endpoint
104
+
105
+ Args:
106
+ guild_id (int):
107
+ channel_id (int):
108
+ kind (CommandEnvKind):
109
+ owner_discord_id (int | None | Unset):
110
+
111
+ Raises:
112
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
113
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
114
+
115
+ Returns:
116
+ Response[CommandEnvChannelResponse | ErrorResponse | HTTPValidationError]
117
+ """
118
+
119
+ kwargs = _get_kwargs(
120
+ guild_id=guild_id,
121
+ channel_id=channel_id,
122
+ kind=kind,
123
+ owner_discord_id=owner_discord_id,
124
+ )
125
+
126
+ response = client.get_httpx_client().request(
127
+ **kwargs,
128
+ )
129
+
130
+ return _build_response(client=client, response=response)
131
+
132
+
133
+ def sync(
134
+ *,
135
+ client: AuthenticatedClient,
136
+ guild_id: int,
137
+ channel_id: int,
138
+ kind: CommandEnvKind,
139
+ owner_discord_id: int | None | Unset = UNSET,
140
+ ) -> CommandEnvChannelResponse | ErrorResponse | HTTPValidationError | None:
141
+ """Resolve Command Env Endpoint
142
+
143
+ Args:
144
+ guild_id (int):
145
+ channel_id (int):
146
+ kind (CommandEnvKind):
147
+ owner_discord_id (int | None | Unset):
148
+
149
+ Raises:
150
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
151
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
152
+
153
+ Returns:
154
+ CommandEnvChannelResponse | ErrorResponse | HTTPValidationError
155
+ """
156
+
157
+ return sync_detailed(
158
+ client=client,
159
+ guild_id=guild_id,
160
+ channel_id=channel_id,
161
+ kind=kind,
162
+ owner_discord_id=owner_discord_id,
163
+ ).parsed
164
+
165
+
166
+ async def asyncio_detailed(
167
+ *,
168
+ client: AuthenticatedClient,
169
+ guild_id: int,
170
+ channel_id: int,
171
+ kind: CommandEnvKind,
172
+ owner_discord_id: int | None | Unset = UNSET,
173
+ ) -> Response[CommandEnvChannelResponse | ErrorResponse | HTTPValidationError]:
174
+ """Resolve Command Env Endpoint
175
+
176
+ Args:
177
+ guild_id (int):
178
+ channel_id (int):
179
+ kind (CommandEnvKind):
180
+ owner_discord_id (int | None | Unset):
181
+
182
+ Raises:
183
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
184
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
185
+
186
+ Returns:
187
+ Response[CommandEnvChannelResponse | ErrorResponse | HTTPValidationError]
188
+ """
189
+
190
+ kwargs = _get_kwargs(
191
+ guild_id=guild_id,
192
+ channel_id=channel_id,
193
+ kind=kind,
194
+ owner_discord_id=owner_discord_id,
195
+ )
196
+
197
+ response = await client.get_async_httpx_client().request(**kwargs)
198
+
199
+ return _build_response(client=client, response=response)
200
+
201
+
202
+ async def asyncio(
203
+ *,
204
+ client: AuthenticatedClient,
205
+ guild_id: int,
206
+ channel_id: int,
207
+ kind: CommandEnvKind,
208
+ owner_discord_id: int | None | Unset = UNSET,
209
+ ) -> CommandEnvChannelResponse | ErrorResponse | HTTPValidationError | None:
210
+ """Resolve Command Env Endpoint
211
+
212
+ Args:
213
+ guild_id (int):
214
+ channel_id (int):
215
+ kind (CommandEnvKind):
216
+ owner_discord_id (int | None | Unset):
217
+
218
+ Raises:
219
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
220
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
221
+
222
+ Returns:
223
+ CommandEnvChannelResponse | ErrorResponse | HTTPValidationError
224
+ """
225
+
226
+ return (
227
+ await asyncio_detailed(
228
+ client=client,
229
+ guild_id=guild_id,
230
+ channel_id=channel_id,
231
+ kind=kind,
232
+ owner_discord_id=owner_discord_id,
233
+ )
234
+ ).parsed
@@ -0,0 +1,181 @@
1
+ from http import HTTPStatus
2
+ from typing import Any
3
+
4
+ import httpx
5
+
6
+ from ... import errors
7
+ from ...client import AuthenticatedClient, Client
8
+ from ...models.command_env_channel_response import CommandEnvChannelResponse
9
+ from ...models.command_env_upsert_request import CommandEnvUpsertRequest
10
+ from ...models.error_response import ErrorResponse
11
+ from ...types import Response
12
+
13
+
14
+ def _get_kwargs(
15
+ *,
16
+ body: CommandEnvUpsertRequest,
17
+ ) -> dict[str, Any]:
18
+ headers: dict[str, Any] = {}
19
+
20
+ _kwargs: dict[str, Any] = {
21
+ "method": "put",
22
+ "url": "/api/v1/bot/command-envs",
23
+ }
24
+
25
+ _kwargs["json"] = body.to_dict()
26
+
27
+ headers["Content-Type"] = "application/json"
28
+
29
+ _kwargs["headers"] = headers
30
+ return _kwargs
31
+
32
+
33
+ def _parse_response(
34
+ *, client: AuthenticatedClient | Client, response: httpx.Response
35
+ ) -> CommandEnvChannelResponse | ErrorResponse | None:
36
+ if response.status_code == 200:
37
+ response_200 = CommandEnvChannelResponse.from_dict(response.json())
38
+
39
+ return response_200
40
+
41
+ if response.status_code == 401:
42
+ response_401 = ErrorResponse.from_dict(response.json())
43
+
44
+ return response_401
45
+
46
+ if response.status_code == 403:
47
+ response_403 = ErrorResponse.from_dict(response.json())
48
+
49
+ return response_403
50
+
51
+ if response.status_code == 409:
52
+ response_409 = ErrorResponse.from_dict(response.json())
53
+
54
+ return response_409
55
+
56
+ if response.status_code == 422:
57
+ response_422 = ErrorResponse.from_dict(response.json())
58
+
59
+ return response_422
60
+
61
+ if client.raise_on_unexpected_status:
62
+ raise errors.UnexpectedStatus(response.status_code, response.content)
63
+ else:
64
+ return None
65
+
66
+
67
+ def _build_response(
68
+ *, client: AuthenticatedClient | Client, response: httpx.Response
69
+ ) -> Response[CommandEnvChannelResponse | ErrorResponse]:
70
+ return Response(
71
+ status_code=HTTPStatus(response.status_code),
72
+ content=response.content,
73
+ headers=response.headers,
74
+ parsed=_parse_response(client=client, response=response),
75
+ )
76
+
77
+
78
+ def sync_detailed(
79
+ *,
80
+ client: AuthenticatedClient,
81
+ body: CommandEnvUpsertRequest,
82
+ ) -> Response[CommandEnvChannelResponse | ErrorResponse]:
83
+ """Upsert Command Env Endpoint
84
+
85
+ Args:
86
+ body (CommandEnvUpsertRequest):
87
+
88
+ Raises:
89
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
90
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
91
+
92
+ Returns:
93
+ Response[CommandEnvChannelResponse | ErrorResponse]
94
+ """
95
+
96
+ kwargs = _get_kwargs(
97
+ body=body,
98
+ )
99
+
100
+ response = client.get_httpx_client().request(
101
+ **kwargs,
102
+ )
103
+
104
+ return _build_response(client=client, response=response)
105
+
106
+
107
+ def sync(
108
+ *,
109
+ client: AuthenticatedClient,
110
+ body: CommandEnvUpsertRequest,
111
+ ) -> CommandEnvChannelResponse | ErrorResponse | None:
112
+ """Upsert Command Env Endpoint
113
+
114
+ Args:
115
+ body (CommandEnvUpsertRequest):
116
+
117
+ Raises:
118
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
119
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
120
+
121
+ Returns:
122
+ CommandEnvChannelResponse | ErrorResponse
123
+ """
124
+
125
+ return sync_detailed(
126
+ client=client,
127
+ body=body,
128
+ ).parsed
129
+
130
+
131
+ async def asyncio_detailed(
132
+ *,
133
+ client: AuthenticatedClient,
134
+ body: CommandEnvUpsertRequest,
135
+ ) -> Response[CommandEnvChannelResponse | ErrorResponse]:
136
+ """Upsert Command Env Endpoint
137
+
138
+ Args:
139
+ body (CommandEnvUpsertRequest):
140
+
141
+ Raises:
142
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
143
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
144
+
145
+ Returns:
146
+ Response[CommandEnvChannelResponse | ErrorResponse]
147
+ """
148
+
149
+ kwargs = _get_kwargs(
150
+ body=body,
151
+ )
152
+
153
+ response = await client.get_async_httpx_client().request(**kwargs)
154
+
155
+ return _build_response(client=client, response=response)
156
+
157
+
158
+ async def asyncio(
159
+ *,
160
+ client: AuthenticatedClient,
161
+ body: CommandEnvUpsertRequest,
162
+ ) -> CommandEnvChannelResponse | ErrorResponse | None:
163
+ """Upsert Command Env Endpoint
164
+
165
+ Args:
166
+ body (CommandEnvUpsertRequest):
167
+
168
+ Raises:
169
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
170
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
171
+
172
+ Returns:
173
+ CommandEnvChannelResponse | ErrorResponse
174
+ """
175
+
176
+ return (
177
+ await asyncio_detailed(
178
+ client=client,
179
+ body=body,
180
+ )
181
+ ).parsed