-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add in cross-org password sdk support
- Loading branch information
1 parent
3e7155d
commit fccb84e
Showing
14 changed files
with
350 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
# !!! | ||
# WARNING: This file is autogenerated | ||
# Only modify code within MANUAL() sections | ||
# or your changes may be overwritten later! | ||
# !!! | ||
|
||
from __future__ import annotations | ||
|
||
from typing import Any, Dict | ||
|
||
from stytch.b2b.api.passwords_discovery_email import Email | ||
from stytch.b2b.models.passwords_discovery import AuthenticateResponse | ||
from stytch.core.api_base import ApiBase | ||
from stytch.core.http.client import AsyncClient, SyncClient | ||
|
||
|
||
class Discovery: | ||
def __init__( | ||
self, api_base: ApiBase, sync_client: SyncClient, async_client: AsyncClient | ||
) -> None: | ||
self.api_base = api_base | ||
self.sync_client = sync_client | ||
self.async_client = async_client | ||
self.email = Email( | ||
api_base=self.api_base, | ||
sync_client=self.sync_client, | ||
async_client=self.async_client, | ||
) | ||
|
||
def authenticate( | ||
self, | ||
email_address: str, | ||
password: str, | ||
) -> AuthenticateResponse: | ||
headers: Dict[str, str] = {} | ||
data: Dict[str, Any] = { | ||
"email_address": email_address, | ||
"password": password, | ||
} | ||
|
||
url = self.api_base.url_for("/v1/b2b/passwords/discovery/authenticate", data) | ||
res = self.sync_client.post(url, data, headers) | ||
return AuthenticateResponse.from_json(res.response.status_code, res.json) | ||
|
||
async def authenticate_async( | ||
self, | ||
email_address: str, | ||
password: str, | ||
) -> AuthenticateResponse: | ||
headers: Dict[str, str] = {} | ||
data: Dict[str, Any] = { | ||
"email_address": email_address, | ||
"password": password, | ||
} | ||
|
||
url = self.api_base.url_for("/v1/b2b/passwords/discovery/authenticate", data) | ||
res = await self.async_client.post(url, data, headers) | ||
return AuthenticateResponse.from_json(res.response.status, res.json) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,137 @@ | ||
# !!! | ||
# WARNING: This file is autogenerated | ||
# Only modify code within MANUAL() sections | ||
# or your changes may be overwritten later! | ||
# !!! | ||
|
||
from __future__ import annotations | ||
|
||
from typing import Any, Dict, Optional | ||
|
||
from stytch.b2b.models.passwords_discovery_email import ( | ||
ResetResponse, | ||
ResetStartResponse, | ||
) | ||
from stytch.core.api_base import ApiBase | ||
from stytch.core.http.client import AsyncClient, SyncClient | ||
|
||
|
||
class Email: | ||
def __init__( | ||
self, api_base: ApiBase, sync_client: SyncClient, async_client: AsyncClient | ||
) -> None: | ||
self.api_base = api_base | ||
self.sync_client = sync_client | ||
self.async_client = async_client | ||
|
||
def reset_start( | ||
self, | ||
email_address: str, | ||
reset_password_redirect_url: Optional[str] = None, | ||
discovery_redirect_url: Optional[str] = None, | ||
reset_password_template_id: Optional[str] = None, | ||
reset_password_expiration_minutes: Optional[int] = None, | ||
pkce_code_challenge: Optional[str] = None, | ||
locale: Optional[str] = None, | ||
) -> ResetStartResponse: | ||
headers: Dict[str, str] = {} | ||
data: Dict[str, Any] = { | ||
"email_address": email_address, | ||
} | ||
if reset_password_redirect_url is not None: | ||
data["reset_password_redirect_url"] = reset_password_redirect_url | ||
if discovery_redirect_url is not None: | ||
data["discovery_redirect_url"] = discovery_redirect_url | ||
if reset_password_template_id is not None: | ||
data["reset_password_template_id"] = reset_password_template_id | ||
if reset_password_expiration_minutes is not None: | ||
data["reset_password_expiration_minutes"] = ( | ||
reset_password_expiration_minutes | ||
) | ||
if pkce_code_challenge is not None: | ||
data["pkce_code_challenge"] = pkce_code_challenge | ||
if locale is not None: | ||
data["locale"] = locale | ||
|
||
url = self.api_base.url_for( | ||
"/v1/b2b/passwords/discovery/email/reset/start", data | ||
) | ||
res = self.sync_client.post(url, data, headers) | ||
return ResetStartResponse.from_json(res.response.status_code, res.json) | ||
|
||
async def reset_start_async( | ||
self, | ||
email_address: str, | ||
reset_password_redirect_url: Optional[str] = None, | ||
discovery_redirect_url: Optional[str] = None, | ||
reset_password_template_id: Optional[str] = None, | ||
reset_password_expiration_minutes: Optional[int] = None, | ||
pkce_code_challenge: Optional[str] = None, | ||
locale: Optional[str] = None, | ||
) -> ResetStartResponse: | ||
headers: Dict[str, str] = {} | ||
data: Dict[str, Any] = { | ||
"email_address": email_address, | ||
} | ||
if reset_password_redirect_url is not None: | ||
data["reset_password_redirect_url"] = reset_password_redirect_url | ||
if discovery_redirect_url is not None: | ||
data["discovery_redirect_url"] = discovery_redirect_url | ||
if reset_password_template_id is not None: | ||
data["reset_password_template_id"] = reset_password_template_id | ||
if reset_password_expiration_minutes is not None: | ||
data["reset_password_expiration_minutes"] = ( | ||
reset_password_expiration_minutes | ||
) | ||
if pkce_code_challenge is not None: | ||
data["pkce_code_challenge"] = pkce_code_challenge | ||
if locale is not None: | ||
data["locale"] = locale | ||
|
||
url = self.api_base.url_for( | ||
"/v1/b2b/passwords/discovery/email/reset/start", data | ||
) | ||
res = await self.async_client.post(url, data, headers) | ||
return ResetStartResponse.from_json(res.response.status, res.json) | ||
|
||
def reset( | ||
self, | ||
password_reset_token: str, | ||
password: str, | ||
pkce_code_verifier: Optional[str] = None, | ||
locale: Optional[str] = None, | ||
) -> ResetResponse: | ||
headers: Dict[str, str] = {} | ||
data: Dict[str, Any] = { | ||
"password_reset_token": password_reset_token, | ||
"password": password, | ||
} | ||
if pkce_code_verifier is not None: | ||
data["pkce_code_verifier"] = pkce_code_verifier | ||
if locale is not None: | ||
data["locale"] = locale | ||
|
||
url = self.api_base.url_for("/v1/b2b/passwords/discovery/email/reset", data) | ||
res = self.sync_client.post(url, data, headers) | ||
return ResetResponse.from_json(res.response.status_code, res.json) | ||
|
||
async def reset_async( | ||
self, | ||
password_reset_token: str, | ||
password: str, | ||
pkce_code_verifier: Optional[str] = None, | ||
locale: Optional[str] = None, | ||
) -> ResetResponse: | ||
headers: Dict[str, str] = {} | ||
data: Dict[str, Any] = { | ||
"password_reset_token": password_reset_token, | ||
"password": password, | ||
} | ||
if pkce_code_verifier is not None: | ||
data["pkce_code_verifier"] = pkce_code_verifier | ||
if locale is not None: | ||
data["locale"] = locale | ||
|
||
url = self.api_base.url_for("/v1/b2b/passwords/discovery/email/reset", data) | ||
res = await self.async_client.post(url, data, headers) | ||
return ResetResponse.from_json(res.response.status, res.json) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.