anchorbrowser 0.5.4__py3-none-any.whl → 0.6.1__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 (38) hide show
  1. anchorbrowser/_base_client.py +1 -1
  2. anchorbrowser/_client.py +9 -2
  3. anchorbrowser/_version.py +1 -1
  4. anchorbrowser/resources/__init__.py +14 -0
  5. anchorbrowser/resources/applications/__init__.py +33 -0
  6. anchorbrowser/resources/applications/applications.py +715 -0
  7. anchorbrowser/resources/applications/auth_flows.py +547 -0
  8. anchorbrowser/resources/identities.py +453 -1
  9. anchorbrowser/resources/sessions/sessions.py +14 -0
  10. anchorbrowser/types/__init__.py +20 -0
  11. anchorbrowser/types/application_create_identity_token_params.py +17 -0
  12. anchorbrowser/types/application_create_identity_token_response.py +23 -0
  13. anchorbrowser/types/application_create_params.py +18 -0
  14. anchorbrowser/types/application_create_response.py +25 -0
  15. anchorbrowser/types/application_delete_response.py +12 -0
  16. anchorbrowser/types/application_list_identities_params.py +12 -0
  17. anchorbrowser/types/application_list_identities_response.py +33 -0
  18. anchorbrowser/types/application_list_params.py +12 -0
  19. anchorbrowser/types/application_list_response.py +41 -0
  20. anchorbrowser/types/application_retrieve_response.py +37 -0
  21. anchorbrowser/types/applications/__init__.py +10 -0
  22. anchorbrowser/types/applications/auth_flow_create_params.py +30 -0
  23. anchorbrowser/types/applications/auth_flow_create_response.py +39 -0
  24. anchorbrowser/types/applications/auth_flow_delete_response.py +12 -0
  25. anchorbrowser/types/applications/auth_flow_list_response.py +43 -0
  26. anchorbrowser/types/applications/auth_flow_update_params.py +32 -0
  27. anchorbrowser/types/applications/auth_flow_update_response.py +39 -0
  28. anchorbrowser/types/identity_create_params.py +84 -0
  29. anchorbrowser/types/identity_create_response.py +26 -0
  30. anchorbrowser/types/identity_delete_response.py +12 -0
  31. anchorbrowser/types/identity_retrieve_response.py +32 -0
  32. anchorbrowser/types/identity_update_params.py +70 -0
  33. anchorbrowser/types/identity_update_response.py +22 -0
  34. anchorbrowser/types/session_create_params.py +15 -0
  35. {anchorbrowser-0.5.4.dist-info → anchorbrowser-0.6.1.dist-info}/METADATA +1 -1
  36. {anchorbrowser-0.5.4.dist-info → anchorbrowser-0.6.1.dist-info}/RECORD +38 -12
  37. {anchorbrowser-0.5.4.dist-info → anchorbrowser-0.6.1.dist-info}/licenses/LICENSE +1 -1
  38. {anchorbrowser-0.5.4.dist-info → anchorbrowser-0.6.1.dist-info}/WHEEL +0 -0
@@ -0,0 +1,547 @@
1
+ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ from __future__ import annotations
4
+
5
+ from typing import List, Iterable
6
+ from typing_extensions import Literal
7
+
8
+ import httpx
9
+
10
+ from ..._types import Body, Omit, Query, Headers, NotGiven, omit, not_given
11
+ from ..._utils import maybe_transform, async_maybe_transform
12
+ from ..._compat import cached_property
13
+ from ..._resource import SyncAPIResource, AsyncAPIResource
14
+ from ..._response import (
15
+ to_raw_response_wrapper,
16
+ to_streamed_response_wrapper,
17
+ async_to_raw_response_wrapper,
18
+ async_to_streamed_response_wrapper,
19
+ )
20
+ from ..._base_client import make_request_options
21
+ from ...types.applications import auth_flow_create_params, auth_flow_update_params
22
+ from ...types.applications.auth_flow_list_response import AuthFlowListResponse
23
+ from ...types.applications.auth_flow_create_response import AuthFlowCreateResponse
24
+ from ...types.applications.auth_flow_delete_response import AuthFlowDeleteResponse
25
+ from ...types.applications.auth_flow_update_response import AuthFlowUpdateResponse
26
+
27
+ __all__ = ["AuthFlowsResource", "AsyncAuthFlowsResource"]
28
+
29
+
30
+ class AuthFlowsResource(SyncAPIResource):
31
+ @cached_property
32
+ def with_raw_response(self) -> AuthFlowsResourceWithRawResponse:
33
+ """
34
+ This property can be used as a prefix for any HTTP method call to return
35
+ the raw response object instead of the parsed content.
36
+
37
+ For more information, see https://www.github.com/anchorbrowser/AnchorBrowser-SDK-Python#accessing-raw-response-data-eg-headers
38
+ """
39
+ return AuthFlowsResourceWithRawResponse(self)
40
+
41
+ @cached_property
42
+ def with_streaming_response(self) -> AuthFlowsResourceWithStreamingResponse:
43
+ """
44
+ An alternative to `.with_raw_response` that doesn't eagerly read the response body.
45
+
46
+ For more information, see https://www.github.com/anchorbrowser/AnchorBrowser-SDK-Python#with_streaming_response
47
+ """
48
+ return AuthFlowsResourceWithStreamingResponse(self)
49
+
50
+ def create(
51
+ self,
52
+ application_id: str,
53
+ *,
54
+ methods: List[Literal["username_password", "authenticator", "custom"]],
55
+ name: str,
56
+ custom_fields: Iterable[auth_flow_create_params.CustomField] | Omit = omit,
57
+ description: str | Omit = omit,
58
+ is_recommended: bool | Omit = omit,
59
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
60
+ # The extra values given here take precedence over values defined on the client or passed to this method.
61
+ extra_headers: Headers | None = None,
62
+ extra_query: Query | None = None,
63
+ extra_body: Body | None = None,
64
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
65
+ ) -> AuthFlowCreateResponse:
66
+ """Creates a new authentication flow for an application.
67
+
68
+ **Beta** Capability.
69
+
70
+ [Contact support](mailto:support@anchorbrowser.io) to
71
+ enable.
72
+
73
+ Args:
74
+ methods: Authentication methods in this flow
75
+
76
+ name: Name of the authentication flow
77
+
78
+ custom_fields: Custom fields for this authentication flow
79
+
80
+ description: Description of the authentication flow
81
+
82
+ is_recommended: Whether this is the recommended authentication flow
83
+
84
+ extra_headers: Send extra headers
85
+
86
+ extra_query: Add additional query parameters to the request
87
+
88
+ extra_body: Add additional JSON properties to the request
89
+
90
+ timeout: Override the client-level default timeout for this request, in seconds
91
+ """
92
+ if not application_id:
93
+ raise ValueError(f"Expected a non-empty value for `application_id` but received {application_id!r}")
94
+ return self._post(
95
+ f"/v1/applications/{application_id}/auth-flows",
96
+ body=maybe_transform(
97
+ {
98
+ "methods": methods,
99
+ "name": name,
100
+ "custom_fields": custom_fields,
101
+ "description": description,
102
+ "is_recommended": is_recommended,
103
+ },
104
+ auth_flow_create_params.AuthFlowCreateParams,
105
+ ),
106
+ options=make_request_options(
107
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
108
+ ),
109
+ cast_to=AuthFlowCreateResponse,
110
+ )
111
+
112
+ def update(
113
+ self,
114
+ auth_flow_id: str,
115
+ *,
116
+ application_id: str,
117
+ custom_fields: Iterable[auth_flow_update_params.CustomField] | Omit = omit,
118
+ description: str | Omit = omit,
119
+ is_recommended: bool | Omit = omit,
120
+ methods: List[Literal["username_password", "authenticator", "custom"]] | Omit = omit,
121
+ name: str | Omit = omit,
122
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
123
+ # The extra values given here take precedence over values defined on the client or passed to this method.
124
+ extra_headers: Headers | None = None,
125
+ extra_query: Query | None = None,
126
+ extra_body: Body | None = None,
127
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
128
+ ) -> AuthFlowUpdateResponse:
129
+ """Updates an existing authentication flow.
130
+
131
+ **Beta** Capability.
132
+
133
+ [Contact support](mailto:support@anchorbrowser.io) to
134
+ enable.
135
+
136
+ Args:
137
+ custom_fields: Custom fields for this authentication flow
138
+
139
+ description: Description of the authentication flow
140
+
141
+ is_recommended: Whether this is the recommended authentication flow
142
+
143
+ methods: Authentication methods in this flow
144
+
145
+ name: Name of the authentication flow
146
+
147
+ extra_headers: Send extra headers
148
+
149
+ extra_query: Add additional query parameters to the request
150
+
151
+ extra_body: Add additional JSON properties to the request
152
+
153
+ timeout: Override the client-level default timeout for this request, in seconds
154
+ """
155
+ if not application_id:
156
+ raise ValueError(f"Expected a non-empty value for `application_id` but received {application_id!r}")
157
+ if not auth_flow_id:
158
+ raise ValueError(f"Expected a non-empty value for `auth_flow_id` but received {auth_flow_id!r}")
159
+ return self._patch(
160
+ f"/v1/applications/{application_id}/auth-flows/{auth_flow_id}",
161
+ body=maybe_transform(
162
+ {
163
+ "custom_fields": custom_fields,
164
+ "description": description,
165
+ "is_recommended": is_recommended,
166
+ "methods": methods,
167
+ "name": name,
168
+ },
169
+ auth_flow_update_params.AuthFlowUpdateParams,
170
+ ),
171
+ options=make_request_options(
172
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
173
+ ),
174
+ cast_to=AuthFlowUpdateResponse,
175
+ )
176
+
177
+ def list(
178
+ self,
179
+ application_id: str,
180
+ *,
181
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
182
+ # The extra values given here take precedence over values defined on the client or passed to this method.
183
+ extra_headers: Headers | None = None,
184
+ extra_query: Query | None = None,
185
+ extra_body: Body | None = None,
186
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
187
+ ) -> AuthFlowListResponse:
188
+ """
189
+ Retrieves all authentication flows for a specific application.
190
+
191
+ **Beta** Capability. [Contact support](mailto:support@anchorbrowser.io) to
192
+ enable.
193
+
194
+ Args:
195
+ extra_headers: Send extra headers
196
+
197
+ extra_query: Add additional query parameters to the request
198
+
199
+ extra_body: Add additional JSON properties to the request
200
+
201
+ timeout: Override the client-level default timeout for this request, in seconds
202
+ """
203
+ if not application_id:
204
+ raise ValueError(f"Expected a non-empty value for `application_id` but received {application_id!r}")
205
+ return self._get(
206
+ f"/v1/applications/{application_id}/auth-flows",
207
+ options=make_request_options(
208
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
209
+ ),
210
+ cast_to=AuthFlowListResponse,
211
+ )
212
+
213
+ def delete(
214
+ self,
215
+ auth_flow_id: str,
216
+ *,
217
+ application_id: str,
218
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
219
+ # The extra values given here take precedence over values defined on the client or passed to this method.
220
+ extra_headers: Headers | None = None,
221
+ extra_query: Query | None = None,
222
+ extra_body: Body | None = None,
223
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
224
+ ) -> AuthFlowDeleteResponse:
225
+ """Deletes an existing authentication flow.
226
+
227
+ **Beta** Capability.
228
+
229
+ [Contact support](mailto:support@anchorbrowser.io) to
230
+ enable.
231
+
232
+ Args:
233
+ extra_headers: Send extra headers
234
+
235
+ extra_query: Add additional query parameters to the request
236
+
237
+ extra_body: Add additional JSON properties to the request
238
+
239
+ timeout: Override the client-level default timeout for this request, in seconds
240
+ """
241
+ if not application_id:
242
+ raise ValueError(f"Expected a non-empty value for `application_id` but received {application_id!r}")
243
+ if not auth_flow_id:
244
+ raise ValueError(f"Expected a non-empty value for `auth_flow_id` but received {auth_flow_id!r}")
245
+ return self._delete(
246
+ f"/v1/applications/{application_id}/auth-flows/{auth_flow_id}",
247
+ options=make_request_options(
248
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
249
+ ),
250
+ cast_to=AuthFlowDeleteResponse,
251
+ )
252
+
253
+
254
+ class AsyncAuthFlowsResource(AsyncAPIResource):
255
+ @cached_property
256
+ def with_raw_response(self) -> AsyncAuthFlowsResourceWithRawResponse:
257
+ """
258
+ This property can be used as a prefix for any HTTP method call to return
259
+ the raw response object instead of the parsed content.
260
+
261
+ For more information, see https://www.github.com/anchorbrowser/AnchorBrowser-SDK-Python#accessing-raw-response-data-eg-headers
262
+ """
263
+ return AsyncAuthFlowsResourceWithRawResponse(self)
264
+
265
+ @cached_property
266
+ def with_streaming_response(self) -> AsyncAuthFlowsResourceWithStreamingResponse:
267
+ """
268
+ An alternative to `.with_raw_response` that doesn't eagerly read the response body.
269
+
270
+ For more information, see https://www.github.com/anchorbrowser/AnchorBrowser-SDK-Python#with_streaming_response
271
+ """
272
+ return AsyncAuthFlowsResourceWithStreamingResponse(self)
273
+
274
+ async def create(
275
+ self,
276
+ application_id: str,
277
+ *,
278
+ methods: List[Literal["username_password", "authenticator", "custom"]],
279
+ name: str,
280
+ custom_fields: Iterable[auth_flow_create_params.CustomField] | Omit = omit,
281
+ description: str | Omit = omit,
282
+ is_recommended: bool | Omit = omit,
283
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
284
+ # The extra values given here take precedence over values defined on the client or passed to this method.
285
+ extra_headers: Headers | None = None,
286
+ extra_query: Query | None = None,
287
+ extra_body: Body | None = None,
288
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
289
+ ) -> AuthFlowCreateResponse:
290
+ """Creates a new authentication flow for an application.
291
+
292
+ **Beta** Capability.
293
+
294
+ [Contact support](mailto:support@anchorbrowser.io) to
295
+ enable.
296
+
297
+ Args:
298
+ methods: Authentication methods in this flow
299
+
300
+ name: Name of the authentication flow
301
+
302
+ custom_fields: Custom fields for this authentication flow
303
+
304
+ description: Description of the authentication flow
305
+
306
+ is_recommended: Whether this is the recommended authentication flow
307
+
308
+ extra_headers: Send extra headers
309
+
310
+ extra_query: Add additional query parameters to the request
311
+
312
+ extra_body: Add additional JSON properties to the request
313
+
314
+ timeout: Override the client-level default timeout for this request, in seconds
315
+ """
316
+ if not application_id:
317
+ raise ValueError(f"Expected a non-empty value for `application_id` but received {application_id!r}")
318
+ return await self._post(
319
+ f"/v1/applications/{application_id}/auth-flows",
320
+ body=await async_maybe_transform(
321
+ {
322
+ "methods": methods,
323
+ "name": name,
324
+ "custom_fields": custom_fields,
325
+ "description": description,
326
+ "is_recommended": is_recommended,
327
+ },
328
+ auth_flow_create_params.AuthFlowCreateParams,
329
+ ),
330
+ options=make_request_options(
331
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
332
+ ),
333
+ cast_to=AuthFlowCreateResponse,
334
+ )
335
+
336
+ async def update(
337
+ self,
338
+ auth_flow_id: str,
339
+ *,
340
+ application_id: str,
341
+ custom_fields: Iterable[auth_flow_update_params.CustomField] | Omit = omit,
342
+ description: str | Omit = omit,
343
+ is_recommended: bool | Omit = omit,
344
+ methods: List[Literal["username_password", "authenticator", "custom"]] | Omit = omit,
345
+ name: str | Omit = omit,
346
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
347
+ # The extra values given here take precedence over values defined on the client or passed to this method.
348
+ extra_headers: Headers | None = None,
349
+ extra_query: Query | None = None,
350
+ extra_body: Body | None = None,
351
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
352
+ ) -> AuthFlowUpdateResponse:
353
+ """Updates an existing authentication flow.
354
+
355
+ **Beta** Capability.
356
+
357
+ [Contact support](mailto:support@anchorbrowser.io) to
358
+ enable.
359
+
360
+ Args:
361
+ custom_fields: Custom fields for this authentication flow
362
+
363
+ description: Description of the authentication flow
364
+
365
+ is_recommended: Whether this is the recommended authentication flow
366
+
367
+ methods: Authentication methods in this flow
368
+
369
+ name: Name of the authentication flow
370
+
371
+ extra_headers: Send extra headers
372
+
373
+ extra_query: Add additional query parameters to the request
374
+
375
+ extra_body: Add additional JSON properties to the request
376
+
377
+ timeout: Override the client-level default timeout for this request, in seconds
378
+ """
379
+ if not application_id:
380
+ raise ValueError(f"Expected a non-empty value for `application_id` but received {application_id!r}")
381
+ if not auth_flow_id:
382
+ raise ValueError(f"Expected a non-empty value for `auth_flow_id` but received {auth_flow_id!r}")
383
+ return await self._patch(
384
+ f"/v1/applications/{application_id}/auth-flows/{auth_flow_id}",
385
+ body=await async_maybe_transform(
386
+ {
387
+ "custom_fields": custom_fields,
388
+ "description": description,
389
+ "is_recommended": is_recommended,
390
+ "methods": methods,
391
+ "name": name,
392
+ },
393
+ auth_flow_update_params.AuthFlowUpdateParams,
394
+ ),
395
+ options=make_request_options(
396
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
397
+ ),
398
+ cast_to=AuthFlowUpdateResponse,
399
+ )
400
+
401
+ async def list(
402
+ self,
403
+ application_id: str,
404
+ *,
405
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
406
+ # The extra values given here take precedence over values defined on the client or passed to this method.
407
+ extra_headers: Headers | None = None,
408
+ extra_query: Query | None = None,
409
+ extra_body: Body | None = None,
410
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
411
+ ) -> AuthFlowListResponse:
412
+ """
413
+ Retrieves all authentication flows for a specific application.
414
+
415
+ **Beta** Capability. [Contact support](mailto:support@anchorbrowser.io) to
416
+ enable.
417
+
418
+ Args:
419
+ extra_headers: Send extra headers
420
+
421
+ extra_query: Add additional query parameters to the request
422
+
423
+ extra_body: Add additional JSON properties to the request
424
+
425
+ timeout: Override the client-level default timeout for this request, in seconds
426
+ """
427
+ if not application_id:
428
+ raise ValueError(f"Expected a non-empty value for `application_id` but received {application_id!r}")
429
+ return await self._get(
430
+ f"/v1/applications/{application_id}/auth-flows",
431
+ options=make_request_options(
432
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
433
+ ),
434
+ cast_to=AuthFlowListResponse,
435
+ )
436
+
437
+ async def delete(
438
+ self,
439
+ auth_flow_id: str,
440
+ *,
441
+ application_id: str,
442
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
443
+ # The extra values given here take precedence over values defined on the client or passed to this method.
444
+ extra_headers: Headers | None = None,
445
+ extra_query: Query | None = None,
446
+ extra_body: Body | None = None,
447
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
448
+ ) -> AuthFlowDeleteResponse:
449
+ """Deletes an existing authentication flow.
450
+
451
+ **Beta** Capability.
452
+
453
+ [Contact support](mailto:support@anchorbrowser.io) to
454
+ enable.
455
+
456
+ Args:
457
+ extra_headers: Send extra headers
458
+
459
+ extra_query: Add additional query parameters to the request
460
+
461
+ extra_body: Add additional JSON properties to the request
462
+
463
+ timeout: Override the client-level default timeout for this request, in seconds
464
+ """
465
+ if not application_id:
466
+ raise ValueError(f"Expected a non-empty value for `application_id` but received {application_id!r}")
467
+ if not auth_flow_id:
468
+ raise ValueError(f"Expected a non-empty value for `auth_flow_id` but received {auth_flow_id!r}")
469
+ return await self._delete(
470
+ f"/v1/applications/{application_id}/auth-flows/{auth_flow_id}",
471
+ options=make_request_options(
472
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
473
+ ),
474
+ cast_to=AuthFlowDeleteResponse,
475
+ )
476
+
477
+
478
+ class AuthFlowsResourceWithRawResponse:
479
+ def __init__(self, auth_flows: AuthFlowsResource) -> None:
480
+ self._auth_flows = auth_flows
481
+
482
+ self.create = to_raw_response_wrapper(
483
+ auth_flows.create,
484
+ )
485
+ self.update = to_raw_response_wrapper(
486
+ auth_flows.update,
487
+ )
488
+ self.list = to_raw_response_wrapper(
489
+ auth_flows.list,
490
+ )
491
+ self.delete = to_raw_response_wrapper(
492
+ auth_flows.delete,
493
+ )
494
+
495
+
496
+ class AsyncAuthFlowsResourceWithRawResponse:
497
+ def __init__(self, auth_flows: AsyncAuthFlowsResource) -> None:
498
+ self._auth_flows = auth_flows
499
+
500
+ self.create = async_to_raw_response_wrapper(
501
+ auth_flows.create,
502
+ )
503
+ self.update = async_to_raw_response_wrapper(
504
+ auth_flows.update,
505
+ )
506
+ self.list = async_to_raw_response_wrapper(
507
+ auth_flows.list,
508
+ )
509
+ self.delete = async_to_raw_response_wrapper(
510
+ auth_flows.delete,
511
+ )
512
+
513
+
514
+ class AuthFlowsResourceWithStreamingResponse:
515
+ def __init__(self, auth_flows: AuthFlowsResource) -> None:
516
+ self._auth_flows = auth_flows
517
+
518
+ self.create = to_streamed_response_wrapper(
519
+ auth_flows.create,
520
+ )
521
+ self.update = to_streamed_response_wrapper(
522
+ auth_flows.update,
523
+ )
524
+ self.list = to_streamed_response_wrapper(
525
+ auth_flows.list,
526
+ )
527
+ self.delete = to_streamed_response_wrapper(
528
+ auth_flows.delete,
529
+ )
530
+
531
+
532
+ class AsyncAuthFlowsResourceWithStreamingResponse:
533
+ def __init__(self, auth_flows: AsyncAuthFlowsResource) -> None:
534
+ self._auth_flows = auth_flows
535
+
536
+ self.create = async_to_streamed_response_wrapper(
537
+ auth_flows.create,
538
+ )
539
+ self.update = async_to_streamed_response_wrapper(
540
+ auth_flows.update,
541
+ )
542
+ self.list = async_to_streamed_response_wrapper(
543
+ auth_flows.list,
544
+ )
545
+ self.delete = async_to_streamed_response_wrapper(
546
+ auth_flows.delete,
547
+ )