Alloy Python SDK Generated by Speakeasy
Project description
Alloy Python SDK (AI generated)
This is a library to interact with Alloy's APIs. This library supports Alloy Embedded.
Documentation
Visit the Alloy Docs site for more information on how to get started with Alloy APIs.
SDK Installation
You can install the SDK by cloning this repo or running
pip3 install git+https://github.com/onedebos/alloy-python-sdk-ai.git [--break-system-packages]
SDK Example Usage
Example
import alloypythonsdk
from alloypythonsdk.models import operations
s = alloypythonsdk.AlloyPythonSDK(
api_key="bearer <YOUR_API_KEY_HERE>",
)
res = s.update_a_user(user_id='<value>', request_body=operations.UpdateAUserRequestBody())
if res.object is not None:
# handle response
pass
Available Resources and Operations
AlloyPythonSDK
- update_a_user - Update a user
- get_a_user - Retrieve a single user
- delete_a_user - Delete a user
- create_a_user - Create a user
- list_all_users - Retrieve a list of all users
- create_a_credential - Create Credential
- get_credential_metadata - Retrieve all credential structures
- generate_jwt_token - Generate a new JWT for a user
- list_user_credentials - Retrieve all credentials for a user
- list_workflows - Retrieve a list of workflows
- deactivate_a_workflow - Deactivate a workflow
- activate_a_workflow - Activate a workflow
- get_workflow_analytics - Retrieve usage metrics for a workflow
- disable_all_workflows_for_a_user - Deactivate workflows for a user
- get_workflow_logs - Retrieve all execution logs for a workflow
- get_workflow_errors - Retrieve all error logs for a workflow
- delete_logs_for_a_user - Delete all logs for a user
- delete_a_credential - Delete a Credential for a user
- run_event - Trigger an event for a user
- rerun_workfow - Rerun a single workflow execution
- run_workflow - Run Workflow
- list_apps - Retrieve all supported apps
- list_integrations - Retrieve a list of all integrations
- batch_create_users - Create a batch of users
- list_events - Retrieve a list of custom events
- generate_alloy_link - Create an Embedded link for an integration
- generate_oauth_link - Create OAuth Link
- delete_workflow - Delete a workflow
- find_a_workflow - Retrieve a single workflow
- get_an_integration - Retrieve a single integration
- list_users_by_workflowid - List Users by workflowId
- upgrade_workflow - Upgrade a workflow
- list_versions - Retrieve a list of workflow versions
- credential_medata_by_app - Retrieve credential structure for an app
- start_installation - Start Installation
- complete_installation - Complete Installation
Error Handling
Handling errors in this SDK should largely match your expectations. All operations return a response object or raise an error. If Error objects are specified in your OpenAPI Spec, the SDK will raise the appropriate Error type.
| Error Object | Status Code | Content Type |
|---|---|---|
| errors.UpdateAUserResponseBody | 401 | application/json |
| errors.SDKError | 4xx-5xx | / |
Example
import alloypythonsdk
from alloypythonsdk.models import errors, operations
s = alloypythonsdk.AlloyPythonSDK(
api_key="bearer <YOUR_API_KEY_HERE>",
)
res = None
try:
res = s.update_a_user(user_id='<value>', request_body=operations.UpdateAUserRequestBody())
except errors.UpdateAUserResponseBody as e:
# handle exception
raise(e)
except errors.SDKError as e:
# handle exception
raise(e)
if res.object is not None:
# handle response
pass
Server Selection
Select Server by Index
You can override the default server globally by passing a server index to the server_idx: int optional parameter when initializing the SDK client instance. The selected server will then be used as the default on the operations that use it. This table lists the indexes associated with the available servers:
| # | Server | Variables |
|---|---|---|
| 0 | https://embedded.runalloy.com/2024-03/ |
None |
Example
import alloypythonsdk
from alloypythonsdk.models import operations
s = alloypythonsdk.AlloyPythonSDK(
server_idx=0,
api_key="bearer <YOUR_API_KEY_HERE>",
)
res = s.update_a_user(user_id='<value>', request_body=operations.UpdateAUserRequestBody())
if res.object is not None:
# handle response
pass
Override Server URL Per-Client
The default server can also be overridden globally by passing a URL to the server_url: str optional parameter when initializing the SDK client instance. For example:
import alloypythonsdk
from alloypythonsdk.models import operations
s = alloypythonsdk.AlloyPythonSDK(
server_url="https://embedded.runalloy.com/2024-03/",
api_key="bearer <YOUR_API_KEY_HERE>",
)
res = s.update_a_user(user_id='<value>', request_body=operations.UpdateAUserRequestBody())
if res.object is not None:
# handle response
pass
Custom HTTP Client
The Python SDK makes API calls using the requests HTTP library. In order to provide a convenient way to configure timeouts, cookies, proxies, custom headers, and other low-level configuration, you can initialize the SDK client with a custom requests.Session object.
For example, you could specify a header for every request that this sdk makes as follows:
import alloypythonsdk
import requests
http_client = requests.Session()
http_client.headers.update({'x-custom-header': 'someValue'})
s = alloypythonsdk.AlloyPythonSDK(client=http_client)
Authentication
Per-Client Security Schemes
This SDK supports the following security scheme globally:
| Name | Type | Scheme |
|---|---|---|
api_key |
apiKey | API key |
To authenticate with the API the api_key parameter must be set when initializing the SDK client instance. For example:
import alloypythonsdk
from alloypythonsdk.models import operations
s = alloypythonsdk.AlloyPythonSDK(
api_key="bearer <YOUR_API_KEY_HERE>",
)
res = s.update_a_user(user_id='<value>', request_body=operations.UpdateAUserRequestBody())
if res.object is not None:
# handle response
pass
Development
This repository includes components generated by Speakeasy based on this OpenAPI spec, as well as human authored code that simplifies usage.
Maturity
This SDK is in beta, and there may be breaking changes between versions without a major version update. Therefore, we recommend pinning usage to a specific package version. This way, you can install the same version each time without breaking changes unless you are intentionally looking for the latest version.
Contributions
While we value open-source contributions to this SDK, this library is generated programmatically. Feel free to open a PR or a Github issue as a proof of concept and we'll do our best to include it in a future release!
SDK Created by Speakeasy
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file alloy_python_sdk_ai-0.0.1.tar.gz.
File metadata
- Download URL: alloy_python_sdk_ai-0.0.1.tar.gz
- Upload date:
- Size: 30.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e5a4b75173cde22b8f7f149afe3ecdb1cfdf0eacc2ac75270f6b3d35c75dd613
|
|
| MD5 |
9e8eb378afa550debdfb6c5585e5790d
|
|
| BLAKE2b-256 |
52bd0d4e5ea9a3564cf38e5cbe08899b116a62f8328a5002c374e256eca1a8b5
|
File details
Details for the file alloy_python_sdk_ai-0.0.1-py3-none-any.whl.
File metadata
- Download URL: alloy_python_sdk_ai-0.0.1-py3-none-any.whl
- Upload date:
- Size: 66.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f5ce6b788f80cf5b698922f4bfd3bebca733175b57303f7b5964b9dd065179c0
|
|
| MD5 |
e8e3dbaf6c3b5a6f115c2c4eecee11c9
|
|
| BLAKE2b-256 |
566d44774912a798bc5ff3f05e62e71641b3c7d06da56d45b3d7c652b4a76ec2
|