dfns-sdk 0.0.0.dev0__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 (69) hide show
  1. dfns_sdk/__init__.py +24 -0
  2. dfns_sdk/_internal/__init__.py +5 -0
  3. dfns_sdk/_internal/http_client.py +395 -0
  4. dfns_sdk/auth.py +137 -0
  5. dfns_sdk/base_auth_api.py +129 -0
  6. dfns_sdk/client.py +81 -0
  7. dfns_sdk/delegated_client.py +97 -0
  8. dfns_sdk/generated/__init__.py +47 -0
  9. dfns_sdk/generated/agreements/__init__.py +7 -0
  10. dfns_sdk/generated/agreements/client.py +55 -0
  11. dfns_sdk/generated/agreements/delegated_client.py +95 -0
  12. dfns_sdk/generated/agreements/types.py +20 -0
  13. dfns_sdk/generated/allocations/__init__.py +7 -0
  14. dfns_sdk/generated/allocations/client.py +118 -0
  15. dfns_sdk/generated/allocations/delegated_client.py +187 -0
  16. dfns_sdk/generated/allocations/types.py +69 -0
  17. dfns_sdk/generated/auth/__init__.py +7 -0
  18. dfns_sdk/generated/auth/client.py +1215 -0
  19. dfns_sdk/generated/auth/delegated_client.py +1825 -0
  20. dfns_sdk/generated/auth/types.py +702 -0
  21. dfns_sdk/generated/exchanges/__init__.py +7 -0
  22. dfns_sdk/generated/exchanges/client.py +209 -0
  23. dfns_sdk/generated/exchanges/delegated_client.py +341 -0
  24. dfns_sdk/generated/exchanges/types.py +96 -0
  25. dfns_sdk/generated/fee_sponsors/__init__.py +7 -0
  26. dfns_sdk/generated/fee_sponsors/client.py +161 -0
  27. dfns_sdk/generated/fee_sponsors/delegated_client.py +287 -0
  28. dfns_sdk/generated/fee_sponsors/types.py +89 -0
  29. dfns_sdk/generated/keys/__init__.py +7 -0
  30. dfns_sdk/generated/keys/client.py +310 -0
  31. dfns_sdk/generated/keys/delegated_client.py +518 -0
  32. dfns_sdk/generated/keys/types.py +229 -0
  33. dfns_sdk/generated/networks/__init__.py +7 -0
  34. dfns_sdk/generated/networks/client.py +176 -0
  35. dfns_sdk/generated/networks/delegated_client.py +274 -0
  36. dfns_sdk/generated/networks/types.py +77 -0
  37. dfns_sdk/generated/permissions/__init__.py +7 -0
  38. dfns_sdk/generated/permissions/client.py +185 -0
  39. dfns_sdk/generated/permissions/delegated_client.py +344 -0
  40. dfns_sdk/generated/permissions/types.py +107 -0
  41. dfns_sdk/generated/policies/__init__.py +7 -0
  42. dfns_sdk/generated/policies/client.py +187 -0
  43. dfns_sdk/generated/policies/delegated_client.py +311 -0
  44. dfns_sdk/generated/policies/types.py +70 -0
  45. dfns_sdk/generated/signers/__init__.py +7 -0
  46. dfns_sdk/generated/signers/client.py +45 -0
  47. dfns_sdk/generated/signers/delegated_client.py +56 -0
  48. dfns_sdk/generated/signers/types.py +13 -0
  49. dfns_sdk/generated/staking/__init__.py +7 -0
  50. dfns_sdk/generated/staking/client.py +142 -0
  51. dfns_sdk/generated/staking/delegated_client.py +211 -0
  52. dfns_sdk/generated/staking/types.py +64 -0
  53. dfns_sdk/generated/swaps/__init__.py +7 -0
  54. dfns_sdk/generated/swaps/client.py +118 -0
  55. dfns_sdk/generated/swaps/delegated_client.py +157 -0
  56. dfns_sdk/generated/swaps/types.py +99 -0
  57. dfns_sdk/generated/wallets/__init__.py +7 -0
  58. dfns_sdk/generated/wallets/client.py +805 -0
  59. dfns_sdk/generated/wallets/delegated_client.py +1231 -0
  60. dfns_sdk/generated/wallets/types.py +534 -0
  61. dfns_sdk/generated/webhooks/__init__.py +7 -0
  62. dfns_sdk/generated/webhooks/client.py +193 -0
  63. dfns_sdk/generated/webhooks/delegated_client.py +320 -0
  64. dfns_sdk/generated/webhooks/types.py +101 -0
  65. dfns_sdk/types.py +72 -0
  66. dfns_sdk-0.0.0.dev0.dist-info/METADATA +191 -0
  67. dfns_sdk-0.0.0.dev0.dist-info/RECORD +69 -0
  68. dfns_sdk-0.0.0.dev0.dist-info/WHEEL +4 -0
  69. dfns_sdk-0.0.0.dev0.dist-info/licenses/LICENSE +21 -0
@@ -0,0 +1,77 @@
1
+ """Types for the networks domain."""
2
+
3
+ from typing import Any, Literal, NotRequired, Optional, TypedDict, Union
4
+
5
+ class EstimateFeesQuery(TypedDict, total=False):
6
+ """estimateFees query parameters."""
7
+
8
+ network: Literal["Bitcoin", "BitcoinSignet", "BitcoinTestnet3", "Adi", "AdiTestnet", "AdiTestnetAb", "ArbitrumOne", "ArbitrumGoerli", "ArbitrumSepolia", "ArcTestnet", "AvalancheC", "AvalancheCFuji", "Base", "BaseGoerli", "BaseSepolia", "Bob", "BobSepolia", "Bsc", "BscTestnet", "Berachain", "BerachainBArtio", "BerachainBepolia", "Celo", "CeloAlfajores", "Codex", "CodexSepolia", "Ethereum", "EthereumClassic", "EthereumClassicMordor", "EthereumGoerli", "EthereumSepolia", "EthereumHolesky", "EthereumHoodi", "FantomOpera", "FantomTestnet", "FlareC", "FlareCCoston2", "FlowEvm", "FlowEvmTestnet", "Ink", "InkSepolia", "Optimism", "OptimismGoerli", "OptimismSepolia", "Plasma", "PlasmaTestnet", "Plume", "PlumeSepolia", "Polygon", "PolygonAmoy", "PolygonMumbai", "Race", "RaceSepolia", "Sonic", "SonicTestnet", "TempoAndantino", "Tsc", "TscTestnet1"]
9
+
10
+ class ReadContractResponse(TypedDict, total=False):
11
+ """readContract response."""
12
+
13
+ kind: Literal["Evm"]
14
+ data: str
15
+
16
+ class GetCantonValidatorResponse(TypedDict, total=False):
17
+ """getCantonValidator response."""
18
+
19
+ id: str
20
+ org_id: str
21
+ network: Literal["Canton", "CantonDevnet", "CantonTestnet"]
22
+ name: NotRequired[str]
23
+ kind: Literal["Shared", "Custom"]
24
+ date_created: str
25
+ party_hint: str
26
+
27
+ class UpdateCantonValidatorRequest(TypedDict, total=False):
28
+ """updateCantonValidator request body."""
29
+
30
+ name: NotRequired[str]
31
+ validator: NotRequired[TypedDict]
32
+ ledger: NotRequired[TypedDict]
33
+
34
+ class UpdateCantonValidatorResponse(TypedDict, total=False):
35
+ """updateCantonValidator response."""
36
+
37
+ id: str
38
+ org_id: str
39
+ network: Literal["Canton", "CantonDevnet", "CantonTestnet"]
40
+ name: NotRequired[str]
41
+ kind: Literal["Shared", "Custom"]
42
+ date_created: str
43
+ party_hint: str
44
+
45
+ class DeleteCantonValidatorResponse(TypedDict, total=False):
46
+ """deleteCantonValidator response."""
47
+
48
+ id: str
49
+ org_id: str
50
+ network: Literal["Canton", "CantonDevnet", "CantonTestnet"]
51
+ name: NotRequired[str]
52
+ kind: Literal["Shared", "Custom"]
53
+ date_created: str
54
+ party_hint: str
55
+
56
+ class ListCantonValidatorsResponse(TypedDict, total=False):
57
+ """listCantonValidators response."""
58
+
59
+ items: list[TypedDict]
60
+ next_page_token: NotRequired[str]
61
+
62
+ class ListCantonValidatorsQuery(TypedDict, total=False):
63
+ """listCantonValidators query parameters."""
64
+
65
+ limit: NotRequired[int]
66
+ pagination_token: NotRequired[str]
67
+
68
+ class CreateCantonValidatorResponse(TypedDict, total=False):
69
+ """createCantonValidator response."""
70
+
71
+ id: str
72
+ org_id: str
73
+ network: Literal["Canton", "CantonDevnet", "CantonTestnet"]
74
+ name: NotRequired[str]
75
+ kind: Literal["Shared", "Custom"]
76
+ date_created: str
77
+ party_hint: str
@@ -0,0 +1,7 @@
1
+ """Permissions domain module."""
2
+
3
+ from .client import PermissionsClient
4
+ from .delegated_client import DelegatedPermissionsClient
5
+ from . import types
6
+
7
+ __all__ = ["PermissionsClient", "DelegatedPermissionsClient", "types"]
@@ -0,0 +1,185 @@
1
+ """Client for the permissions domain."""
2
+
3
+ from typing import Any, Literal, Optional, TypedDict, Union
4
+
5
+ from ..._internal import HttpClient
6
+ from . import types as T
7
+
8
+
9
+ class PermissionsClient:
10
+ """Client for permissions operations."""
11
+
12
+ def __init__(self, http_client: HttpClient):
13
+ self._http = http_client
14
+
15
+ def list_permission_assignments(self, permission_id: str) -> T.ListPermissionAssignmentsResponse:
16
+ """
17
+ List Permission Assignments.
18
+
19
+ Retrieves a list of permission assignments (success) or gives a reason why it's not possible (failure).
20
+
21
+ Args:
22
+ permission_id: Path parameter.
23
+
24
+ Returns:
25
+ T.ListPermissionAssignmentsResponse: The API response.
26
+ """
27
+ return self._http.request(
28
+ method="GET",
29
+ path="/permissions/{permissionId}/assignments",
30
+ path_params={"permissionId": permission_id},
31
+ query_params=None,
32
+ body=None,
33
+ requires_signature=False,
34
+ )
35
+
36
+ def assign_permission(self, permission_id: str, body: T.AssignPermissionRequest) -> T.AssignPermissionResponse:
37
+ """
38
+ Assign Permission.
39
+
40
+ Creates a permission that allows certain specified operations to be executed.
41
+
42
+ Response is either the permission object itself (success) or a reason why it was not possible to create the permission (failure).
43
+
44
+ Args:
45
+ permission_id: Path parameter.
46
+ body: Request body.
47
+
48
+ Returns:
49
+ T.AssignPermissionResponse: The API response.
50
+ """
51
+ return self._http.request(
52
+ method="POST",
53
+ path="/permissions/{permissionId}/assignments",
54
+ path_params={"permissionId": permission_id},
55
+ query_params=None,
56
+ body=body,
57
+ requires_signature=True,
58
+ )
59
+
60
+ def revoke_permission(self, permission_id: str, assignment_id: str, query: Optional[T.RevokePermissionQuery] = None) -> None:
61
+ """
62
+ Revoke Permission.
63
+
64
+ Revokes a permission assignment (success) or gives reason why it’s not possible (failure).
65
+
66
+ Args:
67
+ permission_id: Path parameter.
68
+ assignment_id: Path parameter.
69
+ query: Query parameters.
70
+ """
71
+ return self._http.request(
72
+ method="DELETE",
73
+ path="/permissions/{permissionId}/assignments/{assignmentId}",
74
+ path_params={"permissionId": permission_id, "assignmentId": assignment_id},
75
+ query_params=query,
76
+ body=None,
77
+ requires_signature=True,
78
+ )
79
+
80
+ def delete_permission(self, permission_id: str, body: T.DeletePermissionRequest) -> T.DeletePermissionResponse:
81
+ """
82
+ Delete Permission.
83
+
84
+ Delete a specific Permission.
85
+
86
+ Args:
87
+ permission_id: Path parameter.
88
+ body: Request body.
89
+
90
+ Returns:
91
+ T.DeletePermissionResponse: The API response.
92
+ """
93
+ return self._http.request(
94
+ method="PUT",
95
+ path="/permissions/{permissionId}/archive",
96
+ path_params={"permissionId": permission_id},
97
+ query_params=None,
98
+ body=body,
99
+ requires_signature=True,
100
+ )
101
+
102
+ def list_permissions(self, query: Optional[T.ListPermissionsQuery] = None) -> T.ListPermissionsResponse:
103
+ """
104
+ List Permissions.
105
+
106
+ Retrieves a list of permissions (success) or gives a reason why it's not possible (failure).
107
+
108
+ Args:
109
+ query: Query parameters.
110
+
111
+ Returns:
112
+ T.ListPermissionsResponse: The API response.
113
+ """
114
+ return self._http.request(
115
+ method="GET",
116
+ path="/permissions",
117
+ path_params={},
118
+ query_params=query,
119
+ body=None,
120
+ requires_signature=False,
121
+ )
122
+
123
+ def create_permission(self, body: T.CreatePermissionRequest) -> T.CreatePermissionResponse:
124
+ """
125
+ Create Permission.
126
+
127
+ Creates a permission that allows certain specified operations to be executed.
128
+
129
+ Args:
130
+ body: Request body.
131
+
132
+ Returns:
133
+ T.CreatePermissionResponse: The API response.
134
+ """
135
+ return self._http.request(
136
+ method="POST",
137
+ path="/permissions",
138
+ path_params={},
139
+ query_params=None,
140
+ body=body,
141
+ requires_signature=True,
142
+ )
143
+
144
+ def get_permission(self, permission_id: str) -> T.GetPermissionResponse:
145
+ """
146
+ Get Permission.
147
+
148
+ Retrieves a specific permission (success) or gives a reason why it's not possible (failure).
149
+
150
+ Args:
151
+ permission_id: Path parameter.
152
+
153
+ Returns:
154
+ T.GetPermissionResponse: The API response.
155
+ """
156
+ return self._http.request(
157
+ method="GET",
158
+ path="/permissions/{permissionId}",
159
+ path_params={"permissionId": permission_id},
160
+ query_params=None,
161
+ body=None,
162
+ requires_signature=False,
163
+ )
164
+
165
+ def update_permission(self, permission_id: str, body: T.UpdatePermissionRequest) -> T.UpdatePermissionResponse:
166
+ """
167
+ Update Permission.
168
+
169
+ Updates an existing permission. Response either returns the updated permission (success) or the reason why it was not possible to update (failure).
170
+
171
+ Args:
172
+ permission_id: Path parameter.
173
+ body: Request body.
174
+
175
+ Returns:
176
+ T.UpdatePermissionResponse: The API response.
177
+ """
178
+ return self._http.request(
179
+ method="PUT",
180
+ path="/permissions/{permissionId}",
181
+ path_params={"permissionId": permission_id},
182
+ query_params=None,
183
+ body=body,
184
+ requires_signature=True,
185
+ )
@@ -0,0 +1,344 @@
1
+ """Delegated client for the permissions domain."""
2
+
3
+ import json
4
+ from typing import Any, Literal, Optional, TypedDict, Union
5
+
6
+ from ..._internal import HttpClient
7
+ from ...base_auth_api import (
8
+ BaseAuthApi,
9
+ SignUserActionChallengeRequest,
10
+ UserActionChallengeResponse,
11
+ )
12
+ from . import types as T
13
+
14
+
15
+ class DelegatedPermissionsClient:
16
+ """
17
+ Delegated client for permissions operations.
18
+
19
+ This client separates user action signing into _init() and _complete() method pairs,
20
+ allowing external systems to handle the signing process.
21
+ """
22
+
23
+ def __init__(self, http_client: HttpClient):
24
+ self._http = http_client
25
+
26
+ def list_permission_assignments(self, permission_id: str) -> T.ListPermissionAssignmentsResponse:
27
+ """
28
+ List Permission Assignments.
29
+
30
+ Retrieves a list of permission assignments (success) or gives a reason why it's not possible (failure).
31
+
32
+ Args:
33
+ permission_id: Path parameter.
34
+
35
+ Returns:
36
+ T.ListPermissionAssignmentsResponse: The API response.
37
+ """
38
+ return self._http.request(
39
+ method="GET",
40
+ path="/permissions/{permissionId}/assignments",
41
+ path_params={"permissionId": permission_id},
42
+ query_params=None,
43
+ body=None,
44
+ requires_signature=False,
45
+ )
46
+
47
+ def assign_permission_init(self, permission_id: str, body: T.AssignPermissionRequest) -> UserActionChallengeResponse:
48
+ """
49
+ Initialize Assign Permission.
50
+
51
+ Creates a user action challenge for external signing.
52
+
53
+ Args:
54
+ permission_id: Path parameter.
55
+ body: Request body.
56
+
57
+ Returns:
58
+ UserActionChallengeResponse: The challenge to sign externally.
59
+ """
60
+ path = "/permissions/{permissionId}/assignments"
61
+ path = path.replace("{permissionId}", str(permission_id))
62
+ payload = json.dumps(body, separators=(",", ":")) if body else ""
63
+
64
+ return BaseAuthApi.create_user_action_challenge(
65
+ self._http,
66
+ user_action_http_method="POST",
67
+ user_action_http_path=path,
68
+ user_action_payload=payload,
69
+ )
70
+
71
+ def assign_permission_complete(self, permission_id: str, body: T.AssignPermissionRequest, signed_challenge: SignUserActionChallengeRequest) -> T.AssignPermissionResponse:
72
+ """
73
+ Complete Assign Permission.
74
+
75
+ Submits the signed challenge and makes the API request.
76
+
77
+ Args:
78
+ permission_id: Path parameter.
79
+ body: Request body.
80
+ signed_challenge: The signed challenge from external signing.
81
+
82
+ Returns:
83
+ T.AssignPermissionResponse: The API response.
84
+ """
85
+ user_action_result = BaseAuthApi.sign_user_action_challenge(
86
+ self._http, signed_challenge
87
+ )
88
+ user_action_token = user_action_result["userAction"]
89
+
90
+ return self._http.request_with_user_action(
91
+ method="POST",
92
+ path="/permissions/{permissionId}/assignments",
93
+ path_params={"permissionId": permission_id},
94
+ query_params=None,
95
+ body=body,
96
+ user_action=user_action_token,
97
+ )
98
+
99
+ def revoke_permission_init(self, permission_id: str, assignment_id: str, query: Optional[T.RevokePermissionQuery] = None) -> UserActionChallengeResponse:
100
+ """
101
+ Initialize Revoke Permission.
102
+
103
+ Creates a user action challenge for external signing.
104
+
105
+ Args:
106
+ permission_id: Path parameter.
107
+ assignment_id: Path parameter.
108
+ query: Query parameters.
109
+
110
+ Returns:
111
+ UserActionChallengeResponse: The challenge to sign externally.
112
+ """
113
+ path = "/permissions/{permissionId}/assignments/{assignmentId}"
114
+ path = path.replace("{permissionId}", str(permission_id))
115
+ path = path.replace("{assignmentId}", str(assignment_id))
116
+ payload = ""
117
+
118
+ return BaseAuthApi.create_user_action_challenge(
119
+ self._http,
120
+ user_action_http_method="DELETE",
121
+ user_action_http_path=path,
122
+ user_action_payload=payload,
123
+ )
124
+
125
+ def revoke_permission_complete(self, permission_id: str, assignment_id: str, signed_challenge: SignUserActionChallengeRequest, query: Optional[T.RevokePermissionQuery] = None) -> None:
126
+ """
127
+ Complete Revoke Permission.
128
+
129
+ Submits the signed challenge and makes the API request.
130
+
131
+ Args:
132
+ permission_id: Path parameter.
133
+ assignment_id: Path parameter.
134
+ signed_challenge: The signed challenge from external signing.
135
+ query: Query parameters.
136
+ """
137
+ user_action_result = BaseAuthApi.sign_user_action_challenge(
138
+ self._http, signed_challenge
139
+ )
140
+ user_action_token = user_action_result["userAction"]
141
+
142
+ return self._http.request_with_user_action(
143
+ method="DELETE",
144
+ path="/permissions/{permissionId}/assignments/{assignmentId}",
145
+ path_params={"permissionId": permission_id, "assignmentId": assignment_id},
146
+ query_params=query,
147
+ body=None,
148
+ user_action=user_action_token,
149
+ )
150
+
151
+ def delete_permission_init(self, permission_id: str, body: T.DeletePermissionRequest) -> UserActionChallengeResponse:
152
+ """
153
+ Initialize Delete Permission.
154
+
155
+ Creates a user action challenge for external signing.
156
+
157
+ Args:
158
+ permission_id: Path parameter.
159
+ body: Request body.
160
+
161
+ Returns:
162
+ UserActionChallengeResponse: The challenge to sign externally.
163
+ """
164
+ path = "/permissions/{permissionId}/archive"
165
+ path = path.replace("{permissionId}", str(permission_id))
166
+ payload = json.dumps(body, separators=(",", ":")) if body else ""
167
+
168
+ return BaseAuthApi.create_user_action_challenge(
169
+ self._http,
170
+ user_action_http_method="PUT",
171
+ user_action_http_path=path,
172
+ user_action_payload=payload,
173
+ )
174
+
175
+ def delete_permission_complete(self, permission_id: str, body: T.DeletePermissionRequest, signed_challenge: SignUserActionChallengeRequest) -> T.DeletePermissionResponse:
176
+ """
177
+ Complete Delete Permission.
178
+
179
+ Submits the signed challenge and makes the API request.
180
+
181
+ Args:
182
+ permission_id: Path parameter.
183
+ body: Request body.
184
+ signed_challenge: The signed challenge from external signing.
185
+
186
+ Returns:
187
+ T.DeletePermissionResponse: The API response.
188
+ """
189
+ user_action_result = BaseAuthApi.sign_user_action_challenge(
190
+ self._http, signed_challenge
191
+ )
192
+ user_action_token = user_action_result["userAction"]
193
+
194
+ return self._http.request_with_user_action(
195
+ method="PUT",
196
+ path="/permissions/{permissionId}/archive",
197
+ path_params={"permissionId": permission_id},
198
+ query_params=None,
199
+ body=body,
200
+ user_action=user_action_token,
201
+ )
202
+
203
+ def list_permissions(self, query: Optional[T.ListPermissionsQuery] = None) -> T.ListPermissionsResponse:
204
+ """
205
+ List Permissions.
206
+
207
+ Retrieves a list of permissions (success) or gives a reason why it's not possible (failure).
208
+
209
+ Args:
210
+ query: Query parameters.
211
+
212
+ Returns:
213
+ T.ListPermissionsResponse: The API response.
214
+ """
215
+ return self._http.request(
216
+ method="GET",
217
+ path="/permissions",
218
+ path_params={},
219
+ query_params=query,
220
+ body=None,
221
+ requires_signature=False,
222
+ )
223
+
224
+ def create_permission_init(self, body: T.CreatePermissionRequest) -> UserActionChallengeResponse:
225
+ """
226
+ Initialize Create Permission.
227
+
228
+ Creates a user action challenge for external signing.
229
+
230
+ Args:
231
+ body: Request body.
232
+
233
+ Returns:
234
+ UserActionChallengeResponse: The challenge to sign externally.
235
+ """
236
+ path = "/permissions"
237
+ payload = json.dumps(body, separators=(",", ":")) if body else ""
238
+
239
+ return BaseAuthApi.create_user_action_challenge(
240
+ self._http,
241
+ user_action_http_method="POST",
242
+ user_action_http_path=path,
243
+ user_action_payload=payload,
244
+ )
245
+
246
+ def create_permission_complete(self, body: T.CreatePermissionRequest, signed_challenge: SignUserActionChallengeRequest) -> T.CreatePermissionResponse:
247
+ """
248
+ Complete Create Permission.
249
+
250
+ Submits the signed challenge and makes the API request.
251
+
252
+ Args:
253
+ body: Request body.
254
+ signed_challenge: The signed challenge from external signing.
255
+
256
+ Returns:
257
+ T.CreatePermissionResponse: The API response.
258
+ """
259
+ user_action_result = BaseAuthApi.sign_user_action_challenge(
260
+ self._http, signed_challenge
261
+ )
262
+ user_action_token = user_action_result["userAction"]
263
+
264
+ return self._http.request_with_user_action(
265
+ method="POST",
266
+ path="/permissions",
267
+ path_params={},
268
+ query_params=None,
269
+ body=body,
270
+ user_action=user_action_token,
271
+ )
272
+
273
+ def get_permission(self, permission_id: str) -> T.GetPermissionResponse:
274
+ """
275
+ Get Permission.
276
+
277
+ Retrieves a specific permission (success) or gives a reason why it's not possible (failure).
278
+
279
+ Args:
280
+ permission_id: Path parameter.
281
+
282
+ Returns:
283
+ T.GetPermissionResponse: The API response.
284
+ """
285
+ return self._http.request(
286
+ method="GET",
287
+ path="/permissions/{permissionId}",
288
+ path_params={"permissionId": permission_id},
289
+ query_params=None,
290
+ body=None,
291
+ requires_signature=False,
292
+ )
293
+
294
+ def update_permission_init(self, permission_id: str, body: T.UpdatePermissionRequest) -> UserActionChallengeResponse:
295
+ """
296
+ Initialize Update Permission.
297
+
298
+ Creates a user action challenge for external signing.
299
+
300
+ Args:
301
+ permission_id: Path parameter.
302
+ body: Request body.
303
+
304
+ Returns:
305
+ UserActionChallengeResponse: The challenge to sign externally.
306
+ """
307
+ path = "/permissions/{permissionId}"
308
+ path = path.replace("{permissionId}", str(permission_id))
309
+ payload = json.dumps(body, separators=(",", ":")) if body else ""
310
+
311
+ return BaseAuthApi.create_user_action_challenge(
312
+ self._http,
313
+ user_action_http_method="PUT",
314
+ user_action_http_path=path,
315
+ user_action_payload=payload,
316
+ )
317
+
318
+ def update_permission_complete(self, permission_id: str, body: T.UpdatePermissionRequest, signed_challenge: SignUserActionChallengeRequest) -> T.UpdatePermissionResponse:
319
+ """
320
+ Complete Update Permission.
321
+
322
+ Submits the signed challenge and makes the API request.
323
+
324
+ Args:
325
+ permission_id: Path parameter.
326
+ body: Request body.
327
+ signed_challenge: The signed challenge from external signing.
328
+
329
+ Returns:
330
+ T.UpdatePermissionResponse: The API response.
331
+ """
332
+ user_action_result = BaseAuthApi.sign_user_action_challenge(
333
+ self._http, signed_challenge
334
+ )
335
+ user_action_token = user_action_result["userAction"]
336
+
337
+ return self._http.request_with_user_action(
338
+ method="PUT",
339
+ path="/permissions/{permissionId}",
340
+ path_params={"permissionId": permission_id},
341
+ query_params=None,
342
+ body=body,
343
+ user_action=user_action_token,
344
+ )