| 1 |
|
| 2 |
|
| 3 |
import typing |
| 4 |
|
| 5 |
from ... import core |
| 6 |
from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper |
| 7 |
from ...core.request_options import RequestOptions |
| 8 |
from ...types.create_import_users_response_content import CreateImportUsersResponseContent |
| 9 |
from .raw_client import AsyncRawUsersImportsClient, RawUsersImportsClient |
| 10 |
|
| 11 |
|
| 12 |
OMIT = typing.cast(typing.Any, ...) |
| 13 |
|
| 14 |
|
| 15 |
class UsersImportsClient: |
| 16 |
def __init__(self, *, client_wrapper: SyncClientWrapper): |
| 17 |
self._raw_client = RawUsersImportsClient(client_wrapper=client_wrapper) |
| 18 |
|
| 19 |
@property |
| 20 |
def with_raw_response(self) -> RawUsersImportsClient: |
| 21 |
""" |
| 22 |
Retrieves a raw implementation of this client that returns raw responses. |
| 23 |
|
| 24 |
Returns |
| 25 |
------- |
| 26 |
RawUsersImportsClient |
| 27 |
""" |
| 28 |
return self._raw_client |
| 29 |
|
| 30 |
def create( |
| 31 |
self, |
| 32 |
*, |
| 33 |
users: core.File, |
| 34 |
connection_id: str, |
| 35 |
upsert: typing.Optional[bool] = OMIT, |
| 36 |
external_id: typing.Optional[str] = OMIT, |
| 37 |
send_completion_email: typing.Optional[bool] = OMIT, |
| 38 |
request_options: typing.Optional[RequestOptions] = None, |
| 39 |
) -> CreateImportUsersResponseContent: |
| 40 |
""" |
| 41 |
Import users from a <a href="https://auth0.com/docs/users/references/bulk-import-database-schema-examples">formatted file</a> into a connection via a long-running job. When importing users, with or without upsert, the `email_verified` is set to `false` when the email address is added or updated. Users must verify their email address. To avoid this behavior, set `email_verified` to `true` in the imported data. |
| 42 |
|
| 43 |
Parameters |
| 44 |
---------- |
| 45 |
users : core.File |
| 46 |
See core.File for more documentation |
| 47 |
|
| 48 |
connection_id : str |
| 49 |
connection_id of the connection to which users will be imported. |
| 50 |
|
| 51 |
upsert : typing.Optional[bool] |
| 52 |
Whether to update users if they already exist (true) or to ignore them (false). |
| 53 |
|
| 54 |
external_id : typing.Optional[str] |
| 55 |
Customer-defined ID. |
| 56 |
|
| 57 |
send_completion_email : typing.Optional[bool] |
| 58 |
Whether to send a completion email to all tenant owners when the job is finished (true) or not (false). |
| 59 |
|
| 60 |
request_options : typing.Optional[RequestOptions] |
| 61 |
Request-specific configuration. |
| 62 |
|
| 63 |
Returns |
| 64 |
------- |
| 65 |
CreateImportUsersResponseContent |
| 66 |
Job successfully created. |
| 67 |
|
| 68 |
Examples |
| 69 |
-------- |
| 70 |
from auth0 import Auth0 |
| 71 |
|
| 72 |
client = Auth0( |
| 73 |
token="YOUR_TOKEN", |
| 74 |
) |
| 75 |
client.jobs.users_imports.create( |
| 76 |
connection_id="connection_id", |
| 77 |
) |
| 78 |
""" |
| 79 |
_response = self._raw_client.create( |
| 80 |
users=users, |
| 81 |
connection_id=connection_id, |
| 82 |
upsert=upsert, |
| 83 |
external_id=external_id, |
| 84 |
send_completion_email=send_completion_email, |
| 85 |
request_options=request_options, |
| 86 |
) |
| 87 |
return _response.data |
| 88 |
|
| 89 |
|
| 90 |
class AsyncUsersImportsClient: |
| 91 |
def __init__(self, *, client_wrapper: AsyncClientWrapper): |
| 92 |
self._raw_client = AsyncRawUsersImportsClient(client_wrapper=client_wrapper) |
| 93 |
|
| 94 |
@property |
| 95 |
def with_raw_response(self) -> AsyncRawUsersImportsClient: |
| 96 |
""" |
| 97 |
Retrieves a raw implementation of this client that returns raw responses. |
| 98 |
|
| 99 |
Returns |
| 100 |
------- |
| 101 |
AsyncRawUsersImportsClient |
| 102 |
""" |
| 103 |
return self._raw_client |
| 104 |
|
| 105 |
async def create( |
| 106 |
self, |
| 107 |
*, |
| 108 |
users: core.File, |
| 109 |
connection_id: str, |
| 110 |
upsert: typing.Optional[bool] = OMIT, |
| 111 |
external_id: typing.Optional[str] = OMIT, |
| 112 |
send_completion_email: typing.Optional[bool] = OMIT, |
| 113 |
request_options: typing.Optional[RequestOptions] = None, |
| 114 |
) -> CreateImportUsersResponseContent: |
| 115 |
""" |
| 116 |
Import users from a <a href="https://auth0.com/docs/users/references/bulk-import-database-schema-examples">formatted file</a> into a connection via a long-running job. When importing users, with or without upsert, the `email_verified` is set to `false` when the email address is added or updated. Users must verify their email address. To avoid this behavior, set `email_verified` to `true` in the imported data. |
| 117 |
|
| 118 |
Parameters |
| 119 |
---------- |
| 120 |
users : core.File |
| 121 |
See core.File for more documentation |
| 122 |
|
| 123 |
connection_id : str |
| 124 |
connection_id of the connection to which users will be imported. |
| 125 |
|
| 126 |
upsert : typing.Optional[bool] |
| 127 |
Whether to update users if they already exist (true) or to ignore them (false). |
| 128 |
|
| 129 |
external_id : typing.Optional[str] |
| 130 |
Customer-defined ID. |
| 131 |
|
| 132 |
send_completion_email : typing.Optional[bool] |
| 133 |
Whether to send a completion email to all tenant owners when the job is finished (true) or not (false). |
| 134 |
|
| 135 |
request_options : typing.Optional[RequestOptions] |
| 136 |
Request-specific configuration. |
| 137 |
|
| 138 |
Returns |
| 139 |
------- |
| 140 |
CreateImportUsersResponseContent |
| 141 |
Job successfully created. |
| 142 |
|
| 143 |
Examples |
| 144 |
-------- |
| 145 |
import asyncio |
| 146 |
|
| 147 |
from auth0 import AsyncAuth0 |
| 148 |
|
| 149 |
client = AsyncAuth0( |
| 150 |
token="YOUR_TOKEN", |
| 151 |
) |
| 152 |
|
| 153 |
|
| 154 |
async def main() -> None: |
| 155 |
await client.jobs.users_imports.create( |
| 156 |
connection_id="connection_id", |
| 157 |
) |
| 158 |
|
| 159 |
|
| 160 |
asyncio.run(main()) |
| 161 |
""" |
| 162 |
_response = await self._raw_client.create( |
| 163 |
users=users, |
| 164 |
connection_id=connection_id, |
| 165 |
upsert=upsert, |
| 166 |
external_id=external_id, |
| 167 |
send_completion_email=send_completion_email, |
| 168 |
request_options=request_options, |
| 169 |
) |
| 170 |
return _response.data |