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,182 @@
1
+ from http import HTTPStatus
2
+ from typing import Any
3
+ from urllib.parse import quote
4
+
5
+ import httpx
6
+
7
+ from ... import errors
8
+ from ...client import AuthenticatedClient, Client
9
+ from ...models.application_client_response import ApplicationClientResponse
10
+ from ...models.application_client_update_request import ApplicationClientUpdateRequest
11
+ from ...models.http_validation_error import HTTPValidationError
12
+ from ...types import Response
13
+
14
+
15
+ def _get_kwargs(
16
+ client_id: str,
17
+ *,
18
+ body: ApplicationClientUpdateRequest,
19
+ ) -> dict[str, Any]:
20
+ headers: dict[str, Any] = {}
21
+
22
+ _kwargs: dict[str, Any] = {
23
+ "method": "patch",
24
+ "url": "/api/v1/auth/clients/{client_id}".format(
25
+ client_id=quote(str(client_id), safe=""),
26
+ ),
27
+ }
28
+
29
+ _kwargs["json"] = body.to_dict()
30
+
31
+ headers["Content-Type"] = "application/json"
32
+
33
+ _kwargs["headers"] = headers
34
+ return _kwargs
35
+
36
+
37
+ def _parse_response(
38
+ *, client: AuthenticatedClient | Client, response: httpx.Response
39
+ ) -> ApplicationClientResponse | HTTPValidationError | None:
40
+ if response.status_code == 200:
41
+ response_200 = ApplicationClientResponse.from_dict(response.json())
42
+
43
+ return response_200
44
+
45
+ if response.status_code == 422:
46
+ response_422 = HTTPValidationError.from_dict(response.json())
47
+
48
+ return response_422
49
+
50
+ if client.raise_on_unexpected_status:
51
+ raise errors.UnexpectedStatus(response.status_code, response.content)
52
+ else:
53
+ return None
54
+
55
+
56
+ def _build_response(
57
+ *, client: AuthenticatedClient | Client, response: httpx.Response
58
+ ) -> Response[ApplicationClientResponse | HTTPValidationError]:
59
+ return Response(
60
+ status_code=HTTPStatus(response.status_code),
61
+ content=response.content,
62
+ headers=response.headers,
63
+ parsed=_parse_response(client=client, response=response),
64
+ )
65
+
66
+
67
+ def sync_detailed(
68
+ client_id: str,
69
+ *,
70
+ client: AuthenticatedClient,
71
+ body: ApplicationClientUpdateRequest,
72
+ ) -> Response[ApplicationClientResponse | HTTPValidationError]:
73
+ """Update Application Client Endpoint
74
+
75
+ Args:
76
+ client_id (str):
77
+ body (ApplicationClientUpdateRequest):
78
+
79
+ Raises:
80
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
81
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
82
+
83
+ Returns:
84
+ Response[ApplicationClientResponse | HTTPValidationError]
85
+ """
86
+
87
+ kwargs = _get_kwargs(
88
+ client_id=client_id,
89
+ body=body,
90
+ )
91
+
92
+ response = client.get_httpx_client().request(
93
+ **kwargs,
94
+ )
95
+
96
+ return _build_response(client=client, response=response)
97
+
98
+
99
+ def sync(
100
+ client_id: str,
101
+ *,
102
+ client: AuthenticatedClient,
103
+ body: ApplicationClientUpdateRequest,
104
+ ) -> ApplicationClientResponse | HTTPValidationError | None:
105
+ """Update Application Client Endpoint
106
+
107
+ Args:
108
+ client_id (str):
109
+ body (ApplicationClientUpdateRequest):
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
+ ApplicationClientResponse | HTTPValidationError
117
+ """
118
+
119
+ return sync_detailed(
120
+ client_id=client_id,
121
+ client=client,
122
+ body=body,
123
+ ).parsed
124
+
125
+
126
+ async def asyncio_detailed(
127
+ client_id: str,
128
+ *,
129
+ client: AuthenticatedClient,
130
+ body: ApplicationClientUpdateRequest,
131
+ ) -> Response[ApplicationClientResponse | HTTPValidationError]:
132
+ """Update Application Client Endpoint
133
+
134
+ Args:
135
+ client_id (str):
136
+ body (ApplicationClientUpdateRequest):
137
+
138
+ Raises:
139
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
140
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
141
+
142
+ Returns:
143
+ Response[ApplicationClientResponse | HTTPValidationError]
144
+ """
145
+
146
+ kwargs = _get_kwargs(
147
+ client_id=client_id,
148
+ body=body,
149
+ )
150
+
151
+ response = await client.get_async_httpx_client().request(**kwargs)
152
+
153
+ return _build_response(client=client, response=response)
154
+
155
+
156
+ async def asyncio(
157
+ client_id: str,
158
+ *,
159
+ client: AuthenticatedClient,
160
+ body: ApplicationClientUpdateRequest,
161
+ ) -> ApplicationClientResponse | HTTPValidationError | None:
162
+ """Update Application Client Endpoint
163
+
164
+ Args:
165
+ client_id (str):
166
+ body (ApplicationClientUpdateRequest):
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
+ ApplicationClientResponse | HTTPValidationError
174
+ """
175
+
176
+ return (
177
+ await asyncio_detailed(
178
+ client_id=client_id,
179
+ client=client,
180
+ body=body,
181
+ )
182
+ ).parsed
@@ -0,0 +1 @@
1
+ """Contains endpoint functions for accessing the API"""
@@ -0,0 +1,199 @@
1
+ from http import HTTPStatus
2
+ from typing import Any
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.group_membership_response import GroupMembershipResponse
11
+ from ...models.http_validation_error import HTTPValidationError
12
+ from ...types import Response
13
+
14
+
15
+ def _get_kwargs(
16
+ discord_id: int,
17
+ group_key: str,
18
+ ) -> dict[str, Any]:
19
+
20
+ _kwargs: dict[str, Any] = {
21
+ "method": "put",
22
+ "url": "/api/v1/bot/users/{discord_id}/groups/{group_key}".format(
23
+ discord_id=quote(str(discord_id), safe=""),
24
+ group_key=quote(str(group_key), safe=""),
25
+ ),
26
+ }
27
+
28
+ return _kwargs
29
+
30
+
31
+ def _parse_response(
32
+ *, client: AuthenticatedClient | Client, response: httpx.Response
33
+ ) -> ErrorResponse | GroupMembershipResponse | HTTPValidationError | None:
34
+ if response.status_code == 200:
35
+ response_200 = GroupMembershipResponse.from_dict(response.json())
36
+
37
+ return response_200
38
+
39
+ if response.status_code == 401:
40
+ response_401 = ErrorResponse.from_dict(response.json())
41
+
42
+ return response_401
43
+
44
+ if response.status_code == 403:
45
+ response_403 = ErrorResponse.from_dict(response.json())
46
+
47
+ return response_403
48
+
49
+ if response.status_code == 404:
50
+ response_404 = ErrorResponse.from_dict(response.json())
51
+
52
+ return response_404
53
+
54
+ if response.status_code == 422:
55
+ response_422 = HTTPValidationError.from_dict(response.json())
56
+
57
+ return response_422
58
+
59
+ if client.raise_on_unexpected_status:
60
+ raise errors.UnexpectedStatus(response.status_code, response.content)
61
+ else:
62
+ return None
63
+
64
+
65
+ def _build_response(
66
+ *, client: AuthenticatedClient | Client, response: httpx.Response
67
+ ) -> Response[ErrorResponse | GroupMembershipResponse | HTTPValidationError]:
68
+ return Response(
69
+ status_code=HTTPStatus(response.status_code),
70
+ content=response.content,
71
+ headers=response.headers,
72
+ parsed=_parse_response(client=client, response=response),
73
+ )
74
+
75
+
76
+ def sync_detailed(
77
+ discord_id: int,
78
+ group_key: str,
79
+ *,
80
+ client: AuthenticatedClient,
81
+ ) -> Response[ErrorResponse | GroupMembershipResponse | HTTPValidationError]:
82
+ """Add User To Group Endpoint
83
+
84
+ Add a Discord user to a permission group. Idempotent on (user, group).
85
+
86
+ Args:
87
+ discord_id (int):
88
+ group_key (str):
89
+
90
+ Raises:
91
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
92
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
93
+
94
+ Returns:
95
+ Response[ErrorResponse | GroupMembershipResponse | HTTPValidationError]
96
+ """
97
+
98
+ kwargs = _get_kwargs(
99
+ discord_id=discord_id,
100
+ group_key=group_key,
101
+ )
102
+
103
+ response = client.get_httpx_client().request(
104
+ **kwargs,
105
+ )
106
+
107
+ return _build_response(client=client, response=response)
108
+
109
+
110
+ def sync(
111
+ discord_id: int,
112
+ group_key: str,
113
+ *,
114
+ client: AuthenticatedClient,
115
+ ) -> ErrorResponse | GroupMembershipResponse | HTTPValidationError | None:
116
+ """Add User To Group Endpoint
117
+
118
+ Add a Discord user to a permission group. Idempotent on (user, group).
119
+
120
+ Args:
121
+ discord_id (int):
122
+ group_key (str):
123
+
124
+ Raises:
125
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
126
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
127
+
128
+ Returns:
129
+ ErrorResponse | GroupMembershipResponse | HTTPValidationError
130
+ """
131
+
132
+ return sync_detailed(
133
+ discord_id=discord_id,
134
+ group_key=group_key,
135
+ client=client,
136
+ ).parsed
137
+
138
+
139
+ async def asyncio_detailed(
140
+ discord_id: int,
141
+ group_key: str,
142
+ *,
143
+ client: AuthenticatedClient,
144
+ ) -> Response[ErrorResponse | GroupMembershipResponse | HTTPValidationError]:
145
+ """Add User To Group Endpoint
146
+
147
+ Add a Discord user to a permission group. Idempotent on (user, group).
148
+
149
+ Args:
150
+ discord_id (int):
151
+ group_key (str):
152
+
153
+ Raises:
154
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
155
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
156
+
157
+ Returns:
158
+ Response[ErrorResponse | GroupMembershipResponse | HTTPValidationError]
159
+ """
160
+
161
+ kwargs = _get_kwargs(
162
+ discord_id=discord_id,
163
+ group_key=group_key,
164
+ )
165
+
166
+ response = await client.get_async_httpx_client().request(**kwargs)
167
+
168
+ return _build_response(client=client, response=response)
169
+
170
+
171
+ async def asyncio(
172
+ discord_id: int,
173
+ group_key: str,
174
+ *,
175
+ client: AuthenticatedClient,
176
+ ) -> ErrorResponse | GroupMembershipResponse | HTTPValidationError | None:
177
+ """Add User To Group Endpoint
178
+
179
+ Add a Discord user to a permission group. Idempotent on (user, group).
180
+
181
+ Args:
182
+ discord_id (int):
183
+ group_key (str):
184
+
185
+ Raises:
186
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
187
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
188
+
189
+ Returns:
190
+ ErrorResponse | GroupMembershipResponse | HTTPValidationError
191
+ """
192
+
193
+ return (
194
+ await asyncio_detailed(
195
+ discord_id=discord_id,
196
+ group_key=group_key,
197
+ client=client,
198
+ )
199
+ ).parsed
@@ -0,0 +1,203 @@
1
+ from http import HTTPStatus
2
+ from typing import Any
3
+ from urllib.parse import quote
4
+ from uuid import UUID
5
+
6
+ import httpx
7
+
8
+ from ... import errors
9
+ from ...client import AuthenticatedClient, Client
10
+ from ...models.error_response import ErrorResponse
11
+ from ...models.http_validation_error import HTTPValidationError
12
+ from ...models.operation_cancel_response import OperationCancelResponse
13
+ from ...types import Response
14
+
15
+
16
+ def _get_kwargs(
17
+ operation_id: UUID,
18
+ ) -> dict[str, Any]:
19
+
20
+ _kwargs: dict[str, Any] = {
21
+ "method": "post",
22
+ "url": "/api/v1/bot/operations/{operation_id}/cancel".format(
23
+ operation_id=quote(str(operation_id), safe=""),
24
+ ),
25
+ }
26
+
27
+ return _kwargs
28
+
29
+
30
+ def _parse_response(
31
+ *, client: AuthenticatedClient | Client, response: httpx.Response
32
+ ) -> ErrorResponse | HTTPValidationError | OperationCancelResponse | None:
33
+ if response.status_code == 200:
34
+ response_200 = OperationCancelResponse.from_dict(response.json())
35
+
36
+ return response_200
37
+
38
+ if response.status_code == 401:
39
+ response_401 = ErrorResponse.from_dict(response.json())
40
+
41
+ return response_401
42
+
43
+ if response.status_code == 403:
44
+ response_403 = ErrorResponse.from_dict(response.json())
45
+
46
+ return response_403
47
+
48
+ if response.status_code == 404:
49
+ response_404 = ErrorResponse.from_dict(response.json())
50
+
51
+ return response_404
52
+
53
+ if response.status_code == 409:
54
+ response_409 = ErrorResponse.from_dict(response.json())
55
+
56
+ return response_409
57
+
58
+ if response.status_code == 422:
59
+ response_422 = HTTPValidationError.from_dict(response.json())
60
+
61
+ return response_422
62
+
63
+ if client.raise_on_unexpected_status:
64
+ raise errors.UnexpectedStatus(response.status_code, response.content)
65
+ else:
66
+ return None
67
+
68
+
69
+ def _build_response(
70
+ *, client: AuthenticatedClient | Client, response: httpx.Response
71
+ ) -> Response[ErrorResponse | HTTPValidationError | OperationCancelResponse]:
72
+ return Response(
73
+ status_code=HTTPStatus(response.status_code),
74
+ content=response.content,
75
+ headers=response.headers,
76
+ parsed=_parse_response(client=client, response=response),
77
+ )
78
+
79
+
80
+ def sync_detailed(
81
+ operation_id: UUID,
82
+ *,
83
+ client: AuthenticatedClient,
84
+ ) -> Response[ErrorResponse | HTTPValidationError | OperationCancelResponse]:
85
+ """Cancel Operation Endpoint
86
+
87
+ Explicitly cancel a PREPARED operation, releasing its reservation immediately.
88
+
89
+ Idempotent on an already-cancelled operation; a non-cancellable state (committed, expired,
90
+ failed) returns 409 and an unknown id returns 404.
91
+
92
+ Args:
93
+ operation_id (UUID):
94
+
95
+ Raises:
96
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
97
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
98
+
99
+ Returns:
100
+ Response[ErrorResponse | HTTPValidationError | OperationCancelResponse]
101
+ """
102
+
103
+ kwargs = _get_kwargs(
104
+ operation_id=operation_id,
105
+ )
106
+
107
+ response = client.get_httpx_client().request(
108
+ **kwargs,
109
+ )
110
+
111
+ return _build_response(client=client, response=response)
112
+
113
+
114
+ def sync(
115
+ operation_id: UUID,
116
+ *,
117
+ client: AuthenticatedClient,
118
+ ) -> ErrorResponse | HTTPValidationError | OperationCancelResponse | None:
119
+ """Cancel Operation Endpoint
120
+
121
+ Explicitly cancel a PREPARED operation, releasing its reservation immediately.
122
+
123
+ Idempotent on an already-cancelled operation; a non-cancellable state (committed, expired,
124
+ failed) returns 409 and an unknown id returns 404.
125
+
126
+ Args:
127
+ operation_id (UUID):
128
+
129
+ Raises:
130
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
131
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
132
+
133
+ Returns:
134
+ ErrorResponse | HTTPValidationError | OperationCancelResponse
135
+ """
136
+
137
+ return sync_detailed(
138
+ operation_id=operation_id,
139
+ client=client,
140
+ ).parsed
141
+
142
+
143
+ async def asyncio_detailed(
144
+ operation_id: UUID,
145
+ *,
146
+ client: AuthenticatedClient,
147
+ ) -> Response[ErrorResponse | HTTPValidationError | OperationCancelResponse]:
148
+ """Cancel Operation Endpoint
149
+
150
+ Explicitly cancel a PREPARED operation, releasing its reservation immediately.
151
+
152
+ Idempotent on an already-cancelled operation; a non-cancellable state (committed, expired,
153
+ failed) returns 409 and an unknown id returns 404.
154
+
155
+ Args:
156
+ operation_id (UUID):
157
+
158
+ Raises:
159
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
160
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
161
+
162
+ Returns:
163
+ Response[ErrorResponse | HTTPValidationError | OperationCancelResponse]
164
+ """
165
+
166
+ kwargs = _get_kwargs(
167
+ operation_id=operation_id,
168
+ )
169
+
170
+ response = await client.get_async_httpx_client().request(**kwargs)
171
+
172
+ return _build_response(client=client, response=response)
173
+
174
+
175
+ async def asyncio(
176
+ operation_id: UUID,
177
+ *,
178
+ client: AuthenticatedClient,
179
+ ) -> ErrorResponse | HTTPValidationError | OperationCancelResponse | None:
180
+ """Cancel Operation Endpoint
181
+
182
+ Explicitly cancel a PREPARED operation, releasing its reservation immediately.
183
+
184
+ Idempotent on an already-cancelled operation; a non-cancellable state (committed, expired,
185
+ failed) returns 409 and an unknown id returns 404.
186
+
187
+ Args:
188
+ operation_id (UUID):
189
+
190
+ Raises:
191
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
192
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
193
+
194
+ Returns:
195
+ ErrorResponse | HTTPValidationError | OperationCancelResponse
196
+ """
197
+
198
+ return (
199
+ await asyncio_detailed(
200
+ operation_id=operation_id,
201
+ client=client,
202
+ )
203
+ ).parsed