authpi-admin 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 (40) hide show
  1. authpi_admin/__init__.py +55 -0
  2. authpi_admin/_version.py +5 -0
  3. authpi_admin/client.py +155 -0
  4. authpi_admin/errors.py +218 -0
  5. authpi_admin/generated/__init__.py +28 -0
  6. authpi_admin/generated/models.py +380 -0
  7. authpi_admin/generated/resources/__init__.py +0 -0
  8. authpi_admin/generated/resources/accounts.py +157 -0
  9. authpi_admin/generated/resources/agents.py +177 -0
  10. authpi_admin/generated/resources/api_keys.py +213 -0
  11. authpi_admin/generated/resources/approvals.py +109 -0
  12. authpi_admin/generated/resources/auth_methods.py +148 -0
  13. authpi_admin/generated/resources/clients.py +197 -0
  14. authpi_admin/generated/resources/deliveries.py +83 -0
  15. authpi_admin/generated/resources/domains.py +194 -0
  16. authpi_admin/generated/resources/events.py +111 -0
  17. authpi_admin/generated/resources/groups.py +160 -0
  18. authpi_admin/generated/resources/invitations.py +202 -0
  19. authpi_admin/generated/resources/issuers.py +157 -0
  20. authpi_admin/generated/resources/members.py +154 -0
  21. authpi_admin/generated/resources/notes.py +192 -0
  22. authpi_admin/generated/resources/organizations.py +244 -0
  23. authpi_admin/generated/resources/sessions.py +125 -0
  24. authpi_admin/generated/resources/tokens.py +94 -0
  25. authpi_admin/generated/resources/trusted_devices.py +102 -0
  26. authpi_admin/generated/resources/users.py +224 -0
  27. authpi_admin/generated/resources/verifiers.py +102 -0
  28. authpi_admin/generated/resources/webhooks.py +167 -0
  29. authpi_admin/generated/scopes/__init__.py +0 -0
  30. authpi_admin/generated/scopes/agent_scope.py +84 -0
  31. authpi_admin/generated/scopes/issuer_scope.py +160 -0
  32. authpi_admin/generated/scopes/user_scope.py +102 -0
  33. authpi_admin/generated/scopes/webhook_scope.py +84 -0
  34. authpi_admin/http_client.py +305 -0
  35. authpi_admin/pagination.py +41 -0
  36. authpi_admin/py.typed +0 -0
  37. authpi_admin/user_agent.py +21 -0
  38. authpi_admin-0.3.0.dist-info/METADATA +285 -0
  39. authpi_admin-0.3.0.dist-info/RECORD +40 -0
  40. authpi_admin-0.3.0.dist-info/WHEEL +4 -0
@@ -0,0 +1,83 @@
1
+ """Generated resource class for deliveries — DO NOT EDIT."""
2
+
3
+ from __future__ import annotations
4
+
5
+ from typing import Any, AsyncIterator
6
+
7
+ from authpi_admin.http_client import HttpClient, validate_path_segment as _validate_path_segment
8
+ from authpi_admin.pagination import Page, auto_paginate
9
+
10
+
11
+ class DeliveriesResource:
12
+ """Operations on deliveries."""
13
+
14
+ def __init__(self, client: HttpClient, base_path: str) -> None:
15
+ self._client = client
16
+ self._base_path = base_path
17
+
18
+ async def list(
19
+ self,
20
+ limit: int | None = None,
21
+ cursor: str | None = None,
22
+ event_type: str | None = None,
23
+ status: str | None = None,
24
+ after: float | None = None,
25
+ before: float | None = None,
26
+ *,
27
+ timeout: float | None = None,
28
+ headers: dict[str, str] | None = None,
29
+ ) -> Page[dict[str, Any]]:
30
+ """List Webhook Deliveries"""
31
+ query: dict[str, Any] = {}
32
+ if limit is not None:
33
+ query["limit"] = limit
34
+ if cursor is not None:
35
+ query["cursor"] = cursor
36
+ if event_type is not None:
37
+ query["event_type"] = event_type
38
+ if status is not None:
39
+ query["status"] = status
40
+ if after is not None:
41
+ query["after"] = after
42
+ if before is not None:
43
+ query["before"] = before
44
+ resp = await self._client.request(
45
+ "GET",
46
+ self._base_path,
47
+ query=query or None,
48
+ timeout=timeout,
49
+ headers=headers,
50
+ )
51
+ data = resp.data
52
+ items = data.get("data", []) if data else []
53
+ return Page(
54
+ data=items,
55
+ has_more=data.get("has_more", False) if data else False,
56
+ next_cursor=data.get("next_cursor") if data else None,
57
+ )
58
+
59
+ async def list_all(
60
+ self,
61
+ limit: int | None = None,
62
+ event_type: str | None = None,
63
+ status: str | None = None,
64
+ after: float | None = None,
65
+ before: float | None = None,
66
+ *,
67
+ timeout: float | None = None,
68
+ headers: dict[str, str] | None = None,
69
+ ) -> AsyncIterator[dict[str, Any]]:
70
+ """Auto-paginating iterator over all deliveries."""
71
+ async def _fetch(cursor: str | None = None) -> Page[dict[str, Any]]:
72
+ return await self.list(
73
+ limit=limit,
74
+ event_type=event_type,
75
+ status=status,
76
+ after=after,
77
+ before=before,
78
+ cursor=cursor,
79
+ timeout=timeout,
80
+ headers=headers,
81
+ )
82
+ async for item in auto_paginate(_fetch):
83
+ yield item
@@ -0,0 +1,194 @@
1
+ """Generated resource class for domains — DO NOT EDIT."""
2
+
3
+ from __future__ import annotations
4
+
5
+ from typing import Any, AsyncIterator
6
+
7
+ from authpi_admin.http_client import HttpClient, validate_path_segment as _validate_path_segment
8
+ from authpi_admin.pagination import Page, auto_paginate
9
+
10
+
11
+ class DomainsResource:
12
+ """Operations on domains."""
13
+
14
+ def __init__(self, client: HttpClient, base_path: str) -> None:
15
+ self._client = client
16
+ self._base_path = base_path
17
+
18
+ async def list(
19
+ self,
20
+ *,
21
+ timeout: float | None = None,
22
+ headers: dict[str, str] | None = None,
23
+ ) -> Page[dict[str, Any]]:
24
+ """List Account Domains"""
25
+ query: dict[str, Any] = {}
26
+ resp = await self._client.request(
27
+ "GET",
28
+ self._base_path,
29
+ query=query or None,
30
+ timeout=timeout,
31
+ headers=headers,
32
+ )
33
+ data = resp.data
34
+ items = data.get("data", []) if data else []
35
+ return Page(
36
+ data=items,
37
+ has_more=data.get("has_more", False) if data else False,
38
+ next_cursor=data.get("next_cursor") if data else None,
39
+ )
40
+
41
+ async def list_all(
42
+ self,
43
+ *,
44
+ timeout: float | None = None,
45
+ headers: dict[str, str] | None = None,
46
+ ) -> AsyncIterator[dict[str, Any]]:
47
+ """Auto-paginating iterator over all domains."""
48
+ async def _fetch(cursor: str | None = None) -> Page[dict[str, Any]]:
49
+ return await self.list(
50
+ timeout=timeout,
51
+ headers=headers,
52
+ )
53
+ async for item in auto_paginate(_fetch):
54
+ yield item
55
+
56
+ async def create(
57
+ self,
58
+ body: dict[str, Any],
59
+ *,
60
+ idempotency_key: str | None = None,
61
+ timeout: float | None = None,
62
+ headers: dict[str, str] | None = None,
63
+ ) -> dict[str, Any]:
64
+ """Add Account Domain"""
65
+ req_headers: dict[str, str] = {}
66
+ if headers:
67
+ req_headers.update(headers)
68
+ if idempotency_key:
69
+ req_headers["idempotency-key"] = idempotency_key
70
+ resp = await self._client.request(
71
+ "POST",
72
+ self._base_path,
73
+ body=body,
74
+ timeout=timeout,
75
+ headers=req_headers or None,
76
+ )
77
+ data = resp.data
78
+ if resp.etag and isinstance(data, dict):
79
+ data["_etag"] = resp.etag
80
+ return data
81
+
82
+ async def delete(
83
+ self,
84
+ domain: str,
85
+ *,
86
+ if_match: str | None = None,
87
+ timeout: float | None = None,
88
+ headers: dict[str, str] | None = None,
89
+ ) -> None:
90
+ """Remove Account Domain"""
91
+ path = f"{self._base_path}/{domain}"
92
+ req_headers: dict[str, str] = {}
93
+ if headers:
94
+ req_headers.update(headers)
95
+ if if_match:
96
+ req_headers["if-match"] = if_match
97
+ await self._client.request(
98
+ "DELETE",
99
+ path,
100
+ timeout=timeout,
101
+ headers=req_headers or None,
102
+ )
103
+
104
+ async def assign(
105
+ self,
106
+ domain: str,
107
+ body: dict[str, Any] | None = None,
108
+ *,
109
+ if_match: str | None = None,
110
+ idempotency_key: str | None = None,
111
+ timeout: float | None = None,
112
+ headers: dict[str, str] | None = None,
113
+ ) -> dict[str, Any]:
114
+ """Assign Domain to Issuer"""
115
+ _validate_path_segment(domain, "domain")
116
+ path = f"{self._base_path}/{domain}/assign"
117
+ req_headers: dict[str, str] = {}
118
+ if headers:
119
+ req_headers.update(headers)
120
+ if if_match:
121
+ req_headers["if-match"] = if_match
122
+ if idempotency_key:
123
+ req_headers["idempotency-key"] = idempotency_key
124
+ resp = await self._client.request(
125
+ "POST",
126
+ path,
127
+ body=body,
128
+ timeout=timeout,
129
+ headers=req_headers or None,
130
+ )
131
+ data = resp.data
132
+ if resp.etag and isinstance(data, dict):
133
+ data["_etag"] = resp.etag
134
+ return data
135
+
136
+ async def unassign(
137
+ self,
138
+ domain: str,
139
+ *,
140
+ if_match: str | None = None,
141
+ idempotency_key: str | None = None,
142
+ timeout: float | None = None,
143
+ headers: dict[str, str] | None = None,
144
+ ) -> dict[str, Any]:
145
+ """Unassign Domain from Issuer"""
146
+ _validate_path_segment(domain, "domain")
147
+ path = f"{self._base_path}/{domain}/unassign"
148
+ req_headers: dict[str, str] = {}
149
+ if headers:
150
+ req_headers.update(headers)
151
+ if if_match:
152
+ req_headers["if-match"] = if_match
153
+ if idempotency_key:
154
+ req_headers["idempotency-key"] = idempotency_key
155
+ resp = await self._client.request(
156
+ "POST",
157
+ path,
158
+ timeout=timeout,
159
+ headers=req_headers or None,
160
+ )
161
+ data = resp.data
162
+ if resp.etag and isinstance(data, dict):
163
+ data["_etag"] = resp.etag
164
+ return data
165
+
166
+ async def verify(
167
+ self,
168
+ domain: str,
169
+ *,
170
+ if_match: str | None = None,
171
+ idempotency_key: str | None = None,
172
+ timeout: float | None = None,
173
+ headers: dict[str, str] | None = None,
174
+ ) -> dict[str, Any]:
175
+ """Verify Account Domain"""
176
+ _validate_path_segment(domain, "domain")
177
+ path = f"{self._base_path}/{domain}/verify"
178
+ req_headers: dict[str, str] = {}
179
+ if headers:
180
+ req_headers.update(headers)
181
+ if if_match:
182
+ req_headers["if-match"] = if_match
183
+ if idempotency_key:
184
+ req_headers["idempotency-key"] = idempotency_key
185
+ resp = await self._client.request(
186
+ "POST",
187
+ path,
188
+ timeout=timeout,
189
+ headers=req_headers or None,
190
+ )
191
+ data = resp.data
192
+ if resp.etag and isinstance(data, dict):
193
+ data["_etag"] = resp.etag
194
+ return data
@@ -0,0 +1,111 @@
1
+ """Generated resource class for events — DO NOT EDIT."""
2
+
3
+ from __future__ import annotations
4
+
5
+ from typing import Any, AsyncIterator
6
+
7
+ from authpi_admin.http_client import HttpClient, validate_path_segment as _validate_path_segment
8
+ from authpi_admin.pagination import Page, auto_paginate
9
+ from authpi_admin.generated.models import (
10
+ Event,
11
+ )
12
+
13
+
14
+ class EventsResource:
15
+ """Operations on events."""
16
+
17
+ def __init__(self, client: HttpClient, base_path: str) -> None:
18
+ self._client = client
19
+ self._base_path = base_path
20
+
21
+ async def list(
22
+ self,
23
+ limit: int | None = None,
24
+ cursor: str | None = None,
25
+ issuer_id: str | None = None,
26
+ user_id: str | None = None,
27
+ client_id: str | None = None,
28
+ event_types: str | None = None,
29
+ after: float | None = None,
30
+ before: float | None = None,
31
+ *,
32
+ timeout: float | None = None,
33
+ headers: dict[str, str] | None = None,
34
+ ) -> Page[Event]:
35
+ """List Events"""
36
+ query: dict[str, Any] = {}
37
+ if limit is not None:
38
+ query["limit"] = limit
39
+ if cursor is not None:
40
+ query["cursor"] = cursor
41
+ if issuer_id is not None:
42
+ query["issuer_id"] = issuer_id
43
+ if user_id is not None:
44
+ query["user_id"] = user_id
45
+ if client_id is not None:
46
+ query["client_id"] = client_id
47
+ if event_types is not None:
48
+ query["event_types"] = event_types
49
+ if after is not None:
50
+ query["after"] = after
51
+ if before is not None:
52
+ query["before"] = before
53
+ resp = await self._client.request(
54
+ "GET",
55
+ self._base_path,
56
+ query=query or None,
57
+ timeout=timeout,
58
+ headers=headers,
59
+ )
60
+ data = resp.data
61
+ items = [Event(**item) for item in data.get("data", [])] if data else []
62
+ return Page(
63
+ data=items,
64
+ has_more=data.get("has_more", False) if data else False,
65
+ next_cursor=data.get("next_cursor") if data else None,
66
+ )
67
+
68
+ async def list_all(
69
+ self,
70
+ limit: int | None = None,
71
+ issuer_id: str | None = None,
72
+ user_id: str | None = None,
73
+ client_id: str | None = None,
74
+ event_types: str | None = None,
75
+ after: float | None = None,
76
+ before: float | None = None,
77
+ *,
78
+ timeout: float | None = None,
79
+ headers: dict[str, str] | None = None,
80
+ ) -> AsyncIterator[Event]:
81
+ """Auto-paginating iterator over all events."""
82
+ async def _fetch(cursor: str | None = None) -> Page[Event]:
83
+ return await self.list(
84
+ limit=limit,
85
+ issuer_id=issuer_id,
86
+ user_id=user_id,
87
+ client_id=client_id,
88
+ event_types=event_types,
89
+ after=after,
90
+ before=before,
91
+ cursor=cursor,
92
+ timeout=timeout,
93
+ headers=headers,
94
+ )
95
+ async for item in auto_paginate(_fetch):
96
+ yield item
97
+
98
+ async def get(
99
+ self,
100
+ event_id: str,
101
+ *,
102
+ timeout: float | None = None,
103
+ headers: dict[str, str] | None = None,
104
+ ) -> dict[str, Any]:
105
+ """Get Event"""
106
+ path = f"{self._base_path}/{event_id}"
107
+ resp = await self._client.request("GET", path, timeout=timeout, headers=headers)
108
+ data = resp.data
109
+ if resp.etag and isinstance(data, dict):
110
+ data["_etag"] = resp.etag
111
+ return data
@@ -0,0 +1,160 @@
1
+ """Generated resource class for groups — DO NOT EDIT."""
2
+
3
+ from __future__ import annotations
4
+
5
+ from typing import Any, AsyncIterator
6
+
7
+ from authpi_admin.http_client import HttpClient, validate_path_segment as _validate_path_segment
8
+ from authpi_admin.pagination import Page, auto_paginate
9
+
10
+
11
+ class GroupsResource:
12
+ """Operations on groups."""
13
+
14
+ def __init__(self, client: HttpClient, base_path: str) -> None:
15
+ self._client = client
16
+ self._base_path = base_path
17
+
18
+ async def list(
19
+ self,
20
+ limit: int | None = None,
21
+ cursor: str | None = None,
22
+ *,
23
+ timeout: float | None = None,
24
+ headers: dict[str, str] | None = None,
25
+ ) -> Page[dict[str, Any]]:
26
+ """List Organization Groups"""
27
+ query: dict[str, Any] = {}
28
+ if limit is not None:
29
+ query["limit"] = limit
30
+ if cursor is not None:
31
+ query["cursor"] = cursor
32
+ resp = await self._client.request(
33
+ "GET",
34
+ self._base_path,
35
+ query=query or None,
36
+ timeout=timeout,
37
+ headers=headers,
38
+ )
39
+ data = resp.data
40
+ items = data.get("data", []) if data else []
41
+ return Page(
42
+ data=items,
43
+ has_more=data.get("has_more", False) if data else False,
44
+ next_cursor=data.get("next_cursor") if data else None,
45
+ )
46
+
47
+ async def list_all(
48
+ self,
49
+ limit: int | None = None,
50
+ *,
51
+ timeout: float | None = None,
52
+ headers: dict[str, str] | None = None,
53
+ ) -> AsyncIterator[dict[str, Any]]:
54
+ """Auto-paginating iterator over all groups."""
55
+ async def _fetch(cursor: str | None = None) -> Page[dict[str, Any]]:
56
+ return await self.list(
57
+ limit=limit,
58
+ cursor=cursor,
59
+ timeout=timeout,
60
+ headers=headers,
61
+ )
62
+ async for item in auto_paginate(_fetch):
63
+ yield item
64
+
65
+ async def create(
66
+ self,
67
+ body: dict[str, Any],
68
+ *,
69
+ idempotency_key: str | None = None,
70
+ timeout: float | None = None,
71
+ headers: dict[str, str] | None = None,
72
+ ) -> dict[str, Any]:
73
+ """Create Organization Group"""
74
+ req_headers: dict[str, str] = {}
75
+ if headers:
76
+ req_headers.update(headers)
77
+ if idempotency_key:
78
+ req_headers["idempotency-key"] = idempotency_key
79
+ resp = await self._client.request(
80
+ "POST",
81
+ self._base_path,
82
+ body=body,
83
+ timeout=timeout,
84
+ headers=req_headers or None,
85
+ )
86
+ data = resp.data
87
+ if resp.etag and isinstance(data, dict):
88
+ data["_etag"] = resp.etag
89
+ return data
90
+
91
+ async def get(
92
+ self,
93
+ org_id: str,
94
+ group_id: str,
95
+ *,
96
+ timeout: float | None = None,
97
+ headers: dict[str, str] | None = None,
98
+ ) -> dict[str, Any]:
99
+ """Get Organization Group"""
100
+ path = f"{self._base_path}/{org_id}/{group_id}"
101
+ resp = await self._client.request("GET", path, timeout=timeout, headers=headers)
102
+ data = resp.data
103
+ if resp.etag and isinstance(data, dict):
104
+ data["_etag"] = resp.etag
105
+ return data
106
+
107
+ async def update(
108
+ self,
109
+ org_id: str,
110
+ group_id: str,
111
+ body: dict[str, Any],
112
+ *,
113
+ if_match: str | None = None,
114
+ idempotency_key: str | None = None,
115
+ timeout: float | None = None,
116
+ headers: dict[str, str] | None = None,
117
+ ) -> dict[str, Any]:
118
+ """Update Organization Group"""
119
+ path = f"{self._base_path}/{org_id}/{group_id}"
120
+ req_headers: dict[str, str] = {}
121
+ if headers:
122
+ req_headers.update(headers)
123
+ if if_match:
124
+ req_headers["if-match"] = if_match
125
+ if idempotency_key:
126
+ req_headers["idempotency-key"] = idempotency_key
127
+ resp = await self._client.request(
128
+ "PATCH",
129
+ path,
130
+ body=body,
131
+ timeout=timeout,
132
+ headers=req_headers or None,
133
+ )
134
+ data = resp.data
135
+ if resp.etag and isinstance(data, dict):
136
+ data["_etag"] = resp.etag
137
+ return data
138
+
139
+ async def delete(
140
+ self,
141
+ org_id: str,
142
+ group_id: str,
143
+ *,
144
+ if_match: str | None = None,
145
+ timeout: float | None = None,
146
+ headers: dict[str, str] | None = None,
147
+ ) -> None:
148
+ """Delete Organization Group"""
149
+ path = f"{self._base_path}/{org_id}/{group_id}"
150
+ req_headers: dict[str, str] = {}
151
+ if headers:
152
+ req_headers.update(headers)
153
+ if if_match:
154
+ req_headers["if-match"] = if_match
155
+ await self._client.request(
156
+ "DELETE",
157
+ path,
158
+ timeout=timeout,
159
+ headers=req_headers or None,
160
+ )