-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(flows): retrieve default flow if flow_id is not passed (#76)
* feat(flows): retrieve default flow if flow_id is not passed * fix(tests): retrieve default flow after creation
- Loading branch information
1 parent
8ca0ae4
commit 337decb
Showing
5 changed files
with
46 additions
and
9 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import os | ||
from typing import Optional | ||
|
||
from alice import Config, Onboarding | ||
|
||
RESOURCES_PATH = f"{os.path.dirname(os.path.abspath(__file__))}/../resources" | ||
|
||
|
||
def onboarding_configure_flows(api_key: str, verbose: Optional[bool] = False) -> None: | ||
config = Config(api_key=api_key, verbose=verbose) | ||
onboarding = Onboarding.from_config(config) | ||
|
||
flows = onboarding.retrieve_flows().unwrap_or_raise() | ||
print(f"{flows=}") | ||
|
||
flow_id = flows[0].get("id") | ||
|
||
flow = onboarding.retrieve_flow(flow_id).unwrap_or_raise() | ||
print(f"{flow=}") | ||
|
||
default_flow = onboarding.retrieve_flow().unwrap_or_raise() | ||
print(f"{default_flow=}") | ||
|
||
|
||
if __name__ == "__main__": | ||
api_key = os.environ.get("ONBOARDING_API_KEY") | ||
if api_key is None: | ||
raise AssertionError( | ||
"Please configure your ONBOARDING_API_KEY to run the example" | ||
) | ||
print("Running configure flows example...") | ||
onboarding_configure_flows(api_key=api_key, verbose=True) |
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