diff --git a/.github/workflows/create-releases.yml b/.github/workflows/create-releases.yml
new file mode 100644
index 0000000..b6aa80a
--- /dev/null
+++ b/.github/workflows/create-releases.yml
@@ -0,0 +1,38 @@
+name: Create releases
+on:
+ schedule:
+ - cron: '0 5 * * *' # every day at 5am UTC
+ push:
+ branches:
+ - main
+
+jobs:
+ release:
+ name: release
+ if: github.ref == 'refs/heads/main' && github.repository == 'prelude-so/python-sdk'
+ runs-on: ubuntu-latest
+
+ steps:
+ - uses: actions/checkout@v4
+
+ - uses: stainless-api/trigger-release-please@v1
+ id: release
+ with:
+ repo: ${{ github.event.repository.full_name }}
+ stainless-api-key: ${{ secrets.STAINLESS_API_KEY }}
+
+ - name: Install Rye
+ if: ${{ steps.release.outputs.releases_created }}
+ run: |
+ curl -sSf https://rye.astral.sh/get | bash
+ echo "$HOME/.rye/shims" >> $GITHUB_PATH
+ env:
+ RYE_VERSION: '0.35.0'
+ RYE_INSTALL_OPTION: '--yes'
+
+ - name: Publish to PyPI
+ if: ${{ steps.release.outputs.releases_created }}
+ run: |
+ bash ./bin/publish-pypi
+ env:
+ PYPI_TOKEN: ${{ secrets.PRELUDE_PYPI_TOKEN || secrets.PYPI_TOKEN }}
diff --git a/.github/workflows/handle-release-pr-title-edit.yml b/.github/workflows/handle-release-pr-title-edit.yml
new file mode 100644
index 0000000..e8abca1
--- /dev/null
+++ b/.github/workflows/handle-release-pr-title-edit.yml
@@ -0,0 +1,25 @@
+name: Handle release PR title edits
+on:
+ pull_request:
+ types:
+ - edited
+ - unlabeled
+
+jobs:
+ update_pr_content:
+ name: Update pull request content
+ if: |
+ ((github.event.action == 'edited' && github.event.changes.title.from != github.event.pull_request.title) ||
+ (github.event.action == 'unlabeled' && github.event.label.name == 'autorelease: custom version')) &&
+ startsWith(github.event.pull_request.head.ref, 'release-please--') &&
+ github.event.pull_request.state == 'open' &&
+ github.event.sender.login != 'stainless-bot' &&
+ github.event.sender.login != 'stainless-app' &&
+ github.repository == 'prelude-so/python-sdk'
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v4
+ - uses: stainless-api/trigger-release-please@v1
+ with:
+ repo: ${{ github.event.repository.full_name }}
+ stainless-api-key: ${{ secrets.STAINLESS_API_KEY }}
diff --git a/.github/workflows/publish-pypi.yml b/.github/workflows/publish-pypi.yml
new file mode 100644
index 0000000..c6f8b52
--- /dev/null
+++ b/.github/workflows/publish-pypi.yml
@@ -0,0 +1,27 @@
+# workflow for re-running publishing to PyPI in case it fails for some reason
+# you can run this workflow by navigating to https://www.github.com/prelude-so/python-sdk/actions/workflows/publish-pypi.yml
+name: Publish PyPI
+on:
+ workflow_dispatch:
+
+jobs:
+ publish:
+ name: publish
+ runs-on: ubuntu-latest
+
+ steps:
+ - uses: actions/checkout@v4
+
+ - name: Install Rye
+ run: |
+ curl -sSf https://rye.astral.sh/get | bash
+ echo "$HOME/.rye/shims" >> $GITHUB_PATH
+ env:
+ RYE_VERSION: '0.35.0'
+ RYE_INSTALL_OPTION: '--yes'
+
+ - name: Publish to PyPI
+ run: |
+ bash ./bin/publish-pypi
+ env:
+ PYPI_TOKEN: ${{ secrets.PRELUDE_PYPI_TOKEN || secrets.PYPI_TOKEN }}
diff --git a/.github/workflows/release-doctor.yml b/.github/workflows/release-doctor.yml
new file mode 100644
index 0000000..6661e73
--- /dev/null
+++ b/.github/workflows/release-doctor.yml
@@ -0,0 +1,22 @@
+name: Release Doctor
+on:
+ pull_request:
+ branches:
+ - main
+ workflow_dispatch:
+
+jobs:
+ release_doctor:
+ name: release doctor
+ runs-on: ubuntu-latest
+ if: github.repository == 'prelude-so/python-sdk' && (github.event_name == 'push' || github.event_name == 'workflow_dispatch' || startsWith(github.head_ref, 'release-please') || github.head_ref == 'next')
+
+ steps:
+ - uses: actions/checkout@v4
+
+ - name: Check release environment
+ run: |
+ bash ./bin/check-release-environment
+ env:
+ STAINLESS_API_KEY: ${{ secrets.STAINLESS_API_KEY }}
+ PYPI_TOKEN: ${{ secrets.PRELUDE_PYPI_TOKEN || secrets.PYPI_TOKEN }}
diff --git a/.release-please-manifest.json b/.release-please-manifest.json
new file mode 100644
index 0000000..c476280
--- /dev/null
+++ b/.release-please-manifest.json
@@ -0,0 +1,3 @@
+{
+ ".": "0.0.1-alpha.0"
+}
\ No newline at end of file
diff --git a/.stats.yml b/.stats.yml
index 336d932..f668c85 100644
--- a/.stats.yml
+++ b/.stats.yml
@@ -1,2 +1,2 @@
-configured_endpoints: 6
-openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/prelude%2Fprelude-989c0ce686fda9836cf0ea2580994f0de0a36cf69bc14d451dd8b96290dfebc6.yml
+configured_endpoints: 3
+openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/prelude%2Fprelude-0aa7fe37b742552639f50f71aaf8e55c20a6a9ee7388f03245558748e4edd493.yml
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index c952110..29f3e29 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -37,7 +37,7 @@ $ pip install -r requirements-dev.lock
Most of the SDK is generated code. Modifications to code will be persisted between generations, but may
result in merge conflicts between manual patches and changes from the generator. The generator will never
-modify the contents of the `src/prelude/lib/` and `examples/` directories.
+modify the contents of the `src/prelude_sdk/lib/` and `examples/` directories.
## Adding and running examples
@@ -63,7 +63,7 @@ If you’d like to use the repository from source, you can either install from g
To install via git:
```sh
-$ pip install git+ssh://git@github.com/stainless-sdks/prelude-python.git
+$ pip install git+ssh://git@github.com/prelude-so/python-sdk.git
```
Alternatively, you can build from source and install the wheel file:
@@ -121,7 +121,7 @@ the changes aren't made through the automated pipeline, you may want to make rel
### Publish with a GitHub workflow
-You can release to package managers by using [the `Publish PyPI` GitHub action](https://www.github.com/stainless-sdks/prelude-python/actions/workflows/publish-pypi.yml). This requires a setup organization or repository secret to be set up.
+You can release to package managers by using [the `Publish PyPI` GitHub action](https://www.github.com/prelude-so/python-sdk/actions/workflows/publish-pypi.yml). This requires a setup organization or repository secret to be set up.
### Publish manually
diff --git a/README.md b/README.md
index c40ab0d..27f810b 100644
--- a/README.md
+++ b/README.md
@@ -1,6 +1,6 @@
# Prelude Python API library
-[![PyPI version](https://img.shields.io/pypi/v/prelude.svg)](https://pypi.org/project/prelude/)
+[![PyPI version](https://img.shields.io/pypi/v/prelude-sdk.svg)](https://pypi.org/project/prelude-sdk/)
The Prelude Python library provides convenient access to the Prelude REST API from any Python 3.8+
application. The library includes type definitions for all request params and response fields,
@@ -15,12 +15,12 @@ The REST API documentation can be found on [docs.prelude.so](https://docs.prelud
## Installation
```sh
-# install from this staging repo
-pip install git+ssh://git@github.com/stainless-sdks/prelude-python.git
+# install from the production repo
+pip install git+ssh://git@github.com/prelude-so/python-sdk.git
```
> [!NOTE]
-> Once this package is [published to PyPI](https://app.stainlessapi.com/docs/guides/publish), this will become: `pip install --pre prelude`
+> Once this package is [published to PyPI](https://app.stainlessapi.com/docs/guides/publish), this will become: `pip install --pre prelude-sdk`
## Usage
@@ -28,25 +28,26 @@ The full API of this library can be found in [api.md](api.md).
```python
import os
-from prelude import Prelude
+from prelude_sdk import Prelude
client = Prelude(
# This is the default and can be omitted
- api_key=os.environ.get("PRELUDE_API_KEY"),
- customer_uuid="My Customer Uuid",
+ api_token=os.environ.get("API_TOKEN"),
)
-authentication = client.authentication.create(
- customer_uuid="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
- phone_number="+1234567890",
+verification = client.verification.create(
+ target={
+ "type": "phone_number",
+ "value": "+30123456789",
+ },
)
-print(authentication.authentication_uuid)
+print(verification.id)
```
-While you can provide an `api_key` keyword argument,
+While you can provide a `api_token` keyword argument,
we recommend using [python-dotenv](https://pypi.org/project/python-dotenv/)
-to add `PRELUDE_API_KEY="My API Key"` to your `.env` file
-so that your API Key is not stored in source control.
+to add `API_TOKEN="My API Token"` to your `.env` file
+so that your API Token is not stored in source control.
## Async usage
@@ -55,21 +56,22 @@ Simply import `AsyncPrelude` instead of `Prelude` and use `await` with each API
```python
import os
import asyncio
-from prelude import AsyncPrelude
+from prelude_sdk import AsyncPrelude
client = AsyncPrelude(
# This is the default and can be omitted
- api_key=os.environ.get("PRELUDE_API_KEY"),
- customer_uuid="My Customer Uuid",
+ api_token=os.environ.get("API_TOKEN"),
)
async def main() -> None:
- authentication = await client.authentication.create(
- customer_uuid="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
- phone_number="+1234567890",
+ verification = await client.verification.create(
+ target={
+ "type": "phone_number",
+ "value": "+30123456789",
+ },
)
- print(authentication.authentication_uuid)
+ print(verification.id)
asyncio.run(main())
@@ -88,32 +90,32 @@ Typed requests and responses provide autocomplete and documentation within your
## Handling errors
-When the library is unable to connect to the API (for example, due to network connection problems or a timeout), a subclass of `prelude.APIConnectionError` is raised.
+When the library is unable to connect to the API (for example, due to network connection problems or a timeout), a subclass of `prelude_sdk.APIConnectionError` is raised.
When the API returns a non-success status code (that is, 4xx or 5xx
-response), a subclass of `prelude.APIStatusError` is raised, containing `status_code` and `response` properties.
+response), a subclass of `prelude_sdk.APIStatusError` is raised, containing `status_code` and `response` properties.
-All errors inherit from `prelude.APIError`.
+All errors inherit from `prelude_sdk.APIError`.
```python
-import prelude
-from prelude import Prelude
+import prelude_sdk
+from prelude_sdk import Prelude
-client = Prelude(
- customer_uuid="My Customer Uuid",
-)
+client = Prelude()
try:
- client.authentication.create(
- customer_uuid="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
- phone_number="+1234567890",
+ client.verification.create(
+ target={
+ "type": "phone_number",
+ "value": "+30123456789",
+ },
)
-except prelude.APIConnectionError as e:
+except prelude_sdk.APIConnectionError as e:
print("The server could not be reached")
print(e.__cause__) # an underlying Exception, likely raised within httpx.
-except prelude.RateLimitError as e:
+except prelude_sdk.RateLimitError as e:
print("A 429 status code was received; we should back off a bit.")
-except prelude.APIStatusError as e:
+except prelude_sdk.APIStatusError as e:
print("Another non-200-range status code was received")
print(e.status_code)
print(e.response)
@@ -141,19 +143,20 @@ Connection errors (for example, due to a network connectivity problem), 408 Requ
You can use the `max_retries` option to configure or disable retry settings:
```python
-from prelude import Prelude
+from prelude_sdk import Prelude
# Configure the default for all requests:
client = Prelude(
# default is 2
max_retries=0,
- customer_uuid="My Customer Uuid",
)
# Or, configure per-request:
-client.with_options(max_retries=5).authentication.create(
- customer_uuid="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
- phone_number="+1234567890",
+client.with_options(max_retries=5).verification.create(
+ target={
+ "type": "phone_number",
+ "value": "+30123456789",
+ },
)
```
@@ -163,25 +166,25 @@ By default requests time out after 1 minute. You can configure this with a `time
which accepts a float or an [`httpx.Timeout`](https://www.python-httpx.org/advanced/#fine-tuning-the-configuration) object:
```python
-from prelude import Prelude
+from prelude_sdk import Prelude
# Configure the default for all requests:
client = Prelude(
# 20 seconds (default is 1 minute)
timeout=20.0,
- customer_uuid="My Customer Uuid",
)
# More granular control:
client = Prelude(
timeout=httpx.Timeout(60.0, read=5.0, write=10.0, connect=2.0),
- customer_uuid="My Customer Uuid",
)
# Override per-request:
-client.with_options(timeout=5.0).authentication.create(
- customer_uuid="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
- phone_number="+1234567890",
+client.with_options(timeout=5.0).verification.create(
+ target={
+ "type": "phone_number",
+ "value": "+30123456789",
+ },
)
```
@@ -218,24 +221,24 @@ if response.my_field is None:
The "raw" Response object can be accessed by prefixing `.with_raw_response.` to any HTTP method call, e.g.,
```py
-from prelude import Prelude
-
-client = Prelude(
- customer_uuid="My Customer Uuid",
-)
-response = client.authentication.with_raw_response.create(
- customer_uuid="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
- phone_number="+1234567890",
+from prelude_sdk import Prelude
+
+client = Prelude()
+response = client.verification.with_raw_response.create(
+ target={
+ "type": "phone_number",
+ "value": "+30123456789",
+ },
)
print(response.headers.get('X-My-Header'))
-authentication = response.parse() # get the object that `authentication.create()` would have returned
-print(authentication.authentication_uuid)
+verification = response.parse() # get the object that `verification.create()` would have returned
+print(verification.id)
```
-These methods return an [`APIResponse`](https://github.com/stainless-sdks/prelude-python/tree/main/src/prelude/_response.py) object.
+These methods return an [`APIResponse`](https://github.com/prelude-so/python-sdk/tree/main/src/prelude_sdk/_response.py) object.
-The async client returns an [`AsyncAPIResponse`](https://github.com/stainless-sdks/prelude-python/tree/main/src/prelude/_response.py) with the same structure, the only difference being `await`able methods for reading the response content.
+The async client returns an [`AsyncAPIResponse`](https://github.com/prelude-so/python-sdk/tree/main/src/prelude_sdk/_response.py) with the same structure, the only difference being `await`able methods for reading the response content.
#### `.with_streaming_response`
@@ -244,9 +247,11 @@ The above interface eagerly reads the full response body when you make the reque
To stream the response body, use `.with_streaming_response` instead, which requires a context manager and only reads the response body once you call `.read()`, `.text()`, `.json()`, `.iter_bytes()`, `.iter_text()`, `.iter_lines()` or `.parse()`. In the async client, these are async methods.
```python
-with client.authentication.with_streaming_response.create(
- customer_uuid="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
- phone_number="+1234567890",
+with client.verification.with_streaming_response.create(
+ target={
+ "type": "phone_number",
+ "value": "+30123456789",
+ },
) as response:
print(response.headers.get("X-My-Header"))
@@ -300,7 +305,7 @@ You can directly override the [httpx client](https://www.python-httpx.org/api/#c
- Additional [advanced](https://www.python-httpx.org/advanced/clients/) functionality
```python
-from prelude import Prelude, DefaultHttpxClient
+from prelude_sdk import Prelude, DefaultHttpxClient
client = Prelude(
# Or use the `PRELUDE_BASE_URL` env var
@@ -309,7 +314,6 @@ client = Prelude(
proxies="http://my.test.proxy.example.com",
transport=httpx.HTTPTransport(local_address="0.0.0.0"),
),
- customer_uuid="My Customer Uuid",
)
```
@@ -333,7 +337,7 @@ This package generally follows [SemVer](https://semver.org/spec/v2.0.0.html) con
We take backwards-compatibility seriously and work hard to ensure you can rely on a smooth upgrade experience.
-We are keen for your feedback; please open an [issue](https://www.github.com/stainless-sdks/prelude-python/issues) with questions, bugs, or suggestions.
+We are keen for your feedback; please open an [issue](https://www.github.com/prelude-so/python-sdk/issues) with questions, bugs, or suggestions.
### Determining the installed version
@@ -342,8 +346,8 @@ If you've upgraded to the latest version but aren't seeing any new features you
You can determine the version that is being used at runtime with:
```py
-import prelude
-print(prelude.__version__)
+import prelude_sdk
+print(prelude_sdk.__version__)
```
## Requirements
diff --git a/SECURITY.md b/SECURITY.md
index d078342..b80688e 100644
--- a/SECURITY.md
+++ b/SECURITY.md
@@ -20,7 +20,7 @@ or products provided by Prelude please follow the respective company's security
### Prelude Terms and Policies
-Please contact dev-feedback@prelude.so for any questions or concerns regarding security of our services.
+Please contact hello@prelude.so for any questions or concerns regarding security of our services.
---
diff --git a/api.md b/api.md
index c876226..8ecccf0 100644
--- a/api.md
+++ b/api.md
@@ -1,60 +1,24 @@
-# Authentication
+# Verification
Types:
```python
-from prelude.types import AuthenticationCreateResponse, AuthenticationRetrieveResponse
+from prelude_sdk.types import VerificationCreateResponse, VerificationCheckResponse
```
Methods:
-- client.authentication.create(\*\*params) -> AuthenticationCreateResponse
-- client.authentication.retrieve(auth_uuid) -> AuthenticationRetrieveResponse
+- client.verification.create(\*\*params) -> VerificationCreateResponse
+- client.verification.check(\*\*params) -> VerificationCheckResponse
-## Feedback
+# Transactional
Types:
```python
-from prelude.types.authentication import FeedbackCreateResponse
+from prelude_sdk.types import TransactionalSendResponse
```
Methods:
-- client.authentication.feedback.create(\*\*params) -> FeedbackCreateResponse
-
-# Check
-
-Types:
-
-```python
-from prelude.types import CheckCreateResponse
-```
-
-Methods:
-
-- client.check.create(\*\*params) -> CheckCreateResponse
-
-# Retry
-
-Types:
-
-```python
-from prelude.types import RetryCreateResponse
-```
-
-Methods:
-
-- client.retry.create(\*\*params) -> RetryCreateResponse
-
-# Lookup
-
-Types:
-
-```python
-from prelude.types import LookupRetrieveResponse
-```
-
-Methods:
-
-- client.lookup.retrieve(phone_number) -> LookupRetrieveResponse
+- client.transactional.send(\*\*params) -> TransactionalSendResponse
diff --git a/bin/check-release-environment b/bin/check-release-environment
new file mode 100644
index 0000000..34a43ce
--- /dev/null
+++ b/bin/check-release-environment
@@ -0,0 +1,25 @@
+#!/usr/bin/env bash
+
+errors=()
+
+if [ -z "${STAINLESS_API_KEY}" ]; then
+ errors+=("The STAINLESS_API_KEY secret has not been set. Please contact Stainless for an API key & set it in your organization secrets on GitHub.")
+fi
+
+if [ -z "${PYPI_TOKEN}" ]; then
+ errors+=("The PRELUDE_PYPI_TOKEN secret has not been set. Please set it in either this repository's secrets or your organization secrets.")
+fi
+
+lenErrors=${#errors[@]}
+
+if [[ lenErrors -gt 0 ]]; then
+ echo -e "Found the following errors in the release environment:\n"
+
+ for error in "${errors[@]}"; do
+ echo -e "- $error\n"
+ done
+
+ exit 1
+fi
+
+echo "The environment is ready to push releases!"
diff --git a/mypy.ini b/mypy.ini
index 1d3c853..77f4648 100644
--- a/mypy.ini
+++ b/mypy.ini
@@ -5,7 +5,7 @@ show_error_codes = True
# Exclude _files.py because mypy isn't smart enough to apply
# the correct type narrowing and as this is an internal module
# it's fine to just use Pyright.
-exclude = ^(src/prelude/_files\.py|_dev/.*\.py)$
+exclude = ^(src/prelude_sdk/_files\.py|_dev/.*\.py)$
strict_equality = True
implicit_reexport = True
diff --git a/pyproject.toml b/pyproject.toml
index 07d89d1..9600d8e 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -1,11 +1,11 @@
[project]
-name = "prelude"
+name = "prelude-sdk"
version = "0.0.1-alpha.0"
-description = "The official Python library for the prelude API"
+description = "The official Python library for the Prelude API"
dynamic = ["readme"]
license = "Apache-2.0"
authors = [
-{ name = "Prelude", email = "dev-feedback@prelude.so" },
+{ name = "Prelude", email = "hello@prelude.so" },
]
dependencies = [
"httpx>=0.23.0, <1",
@@ -35,8 +35,8 @@ classifiers = [
]
[project.urls]
-Homepage = "https://github.com/stainless-sdks/prelude-python"
-Repository = "https://github.com/stainless-sdks/prelude-python"
+Homepage = "https://github.com/prelude-so/python-sdk"
+Repository = "https://github.com/prelude-so/python-sdk"
@@ -76,14 +76,14 @@ format = { chain = [
"check:ruff" = "ruff check ."
"fix:ruff" = "ruff check --fix ."
-"check:importable" = "python -c 'import prelude'"
+"check:importable" = "python -c 'import prelude_sdk'"
typecheck = { chain = [
"typecheck:pyright",
"typecheck:mypy"
]}
"typecheck:pyright" = "pyright"
-"typecheck:verify-types" = "pyright --verifytypes prelude --ignoreexternal"
+"typecheck:verify-types" = "pyright --verifytypes prelude_sdk --ignoreexternal"
"typecheck:mypy" = "mypy ."
[build-system]
@@ -96,7 +96,7 @@ include = [
]
[tool.hatch.build.targets.wheel]
-packages = ["src/prelude"]
+packages = ["src/prelude_sdk"]
[tool.hatch.build.targets.sdist]
# Basically everything except hidden files/directories (such as .github, .devcontainers, .python-version, etc)
@@ -122,7 +122,7 @@ path = "README.md"
[[tool.hatch.metadata.hooks.fancy-pypi-readme.substitutions]]
# replace relative links with absolute links
pattern = '\[(.+?)\]\(((?!https?://)\S+?)\)'
-replacement = '[\1](https://github.com/stainless-sdks/prelude-python/tree/main/\g<2>)'
+replacement = '[\1](https://github.com/prelude-so/python-sdk/tree/main/\g<2>)'
[tool.pytest.ini_options]
testpaths = ["tests"]
@@ -198,7 +198,7 @@ length-sort = true
length-sort-straight = true
combine-as-imports = true
extra-standard-library = ["typing_extensions"]
-known-first-party = ["prelude", "tests"]
+known-first-party = ["prelude_sdk", "tests"]
[tool.ruff.lint.per-file-ignores]
"bin/**.py" = ["T201", "T203"]
diff --git a/release-please-config.json b/release-please-config.json
new file mode 100644
index 0000000..e6fc076
--- /dev/null
+++ b/release-please-config.json
@@ -0,0 +1,66 @@
+{
+ "packages": {
+ ".": {}
+ },
+ "$schema": "https://raw.githubusercontent.com/stainless-api/release-please/main/schemas/config.json",
+ "include-v-in-tag": true,
+ "include-component-in-tag": false,
+ "versioning": "prerelease",
+ "prerelease": true,
+ "bump-minor-pre-major": true,
+ "bump-patch-for-minor-pre-major": false,
+ "pull-request-header": "Automated Release PR",
+ "pull-request-title-pattern": "release: ${version}",
+ "changelog-sections": [
+ {
+ "type": "feat",
+ "section": "Features"
+ },
+ {
+ "type": "fix",
+ "section": "Bug Fixes"
+ },
+ {
+ "type": "perf",
+ "section": "Performance Improvements"
+ },
+ {
+ "type": "revert",
+ "section": "Reverts"
+ },
+ {
+ "type": "chore",
+ "section": "Chores"
+ },
+ {
+ "type": "docs",
+ "section": "Documentation"
+ },
+ {
+ "type": "style",
+ "section": "Styles"
+ },
+ {
+ "type": "refactor",
+ "section": "Refactors"
+ },
+ {
+ "type": "test",
+ "section": "Tests",
+ "hidden": true
+ },
+ {
+ "type": "build",
+ "section": "Build System"
+ },
+ {
+ "type": "ci",
+ "section": "Continuous Integration",
+ "hidden": true
+ }
+ ],
+ "release-type": "python",
+ "extra-files": [
+ "src/prelude_sdk/_version.py"
+ ]
+}
\ No newline at end of file
diff --git a/requirements-dev.lock b/requirements-dev.lock
index e43b5a7..2334263 100644
--- a/requirements-dev.lock
+++ b/requirements-dev.lock
@@ -13,7 +13,7 @@ annotated-types==0.6.0
# via pydantic
anyio==4.4.0
# via httpx
- # via prelude
+ # via prelude-sdk
argcomplete==3.1.2
# via nox
certifi==2023.7.22
@@ -25,7 +25,7 @@ dirty-equals==0.6.0
distlib==0.3.7
# via virtualenv
distro==1.8.0
- # via prelude
+ # via prelude-sdk
exceptiongroup==1.2.2
# via anyio
# via pytest
@@ -36,7 +36,7 @@ h11==0.14.0
httpcore==1.0.2
# via httpx
httpx==0.25.2
- # via prelude
+ # via prelude-sdk
# via respx
idna==3.4
# via anyio
@@ -62,7 +62,7 @@ platformdirs==3.11.0
pluggy==1.5.0
# via pytest
pydantic==2.9.2
- # via prelude
+ # via prelude-sdk
pydantic-core==2.23.4
# via pydantic
pygments==2.18.0
@@ -85,7 +85,7 @@ six==1.16.0
sniffio==1.3.0
# via anyio
# via httpx
- # via prelude
+ # via prelude-sdk
time-machine==2.9.0
tomli==2.0.2
# via mypy
@@ -93,7 +93,7 @@ tomli==2.0.2
typing-extensions==4.12.2
# via anyio
# via mypy
- # via prelude
+ # via prelude-sdk
# via pydantic
# via pydantic-core
virtualenv==20.24.5
diff --git a/requirements.lock b/requirements.lock
index c04bec8..f7853e8 100644
--- a/requirements.lock
+++ b/requirements.lock
@@ -13,12 +13,12 @@ annotated-types==0.6.0
# via pydantic
anyio==4.4.0
# via httpx
- # via prelude
+ # via prelude-sdk
certifi==2023.7.22
# via httpcore
# via httpx
distro==1.8.0
- # via prelude
+ # via prelude-sdk
exceptiongroup==1.2.2
# via anyio
h11==0.14.0
@@ -26,20 +26,20 @@ h11==0.14.0
httpcore==1.0.2
# via httpx
httpx==0.25.2
- # via prelude
+ # via prelude-sdk
idna==3.4
# via anyio
# via httpx
pydantic==2.9.2
- # via prelude
+ # via prelude-sdk
pydantic-core==2.23.4
# via pydantic
sniffio==1.3.0
# via anyio
# via httpx
- # via prelude
+ # via prelude-sdk
typing-extensions==4.12.2
# via anyio
- # via prelude
+ # via prelude-sdk
# via pydantic
# via pydantic-core
diff --git a/scripts/lint b/scripts/lint
index 148626c..57a581a 100755
--- a/scripts/lint
+++ b/scripts/lint
@@ -8,5 +8,5 @@ echo "==> Running lints"
rye run lint
echo "==> Making sure it imports"
-rye run python -c 'import prelude'
+rye run python -c 'import prelude_sdk'
diff --git a/src/prelude/resources/__init__.py b/src/prelude/resources/__init__.py
deleted file mode 100644
index 4836645..0000000
--- a/src/prelude/resources/__init__.py
+++ /dev/null
@@ -1,61 +0,0 @@
-# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
-
-from .check import (
- CheckResource,
- AsyncCheckResource,
- CheckResourceWithRawResponse,
- AsyncCheckResourceWithRawResponse,
- CheckResourceWithStreamingResponse,
- AsyncCheckResourceWithStreamingResponse,
-)
-from .retry import (
- RetryResource,
- AsyncRetryResource,
- RetryResourceWithRawResponse,
- AsyncRetryResourceWithRawResponse,
- RetryResourceWithStreamingResponse,
- AsyncRetryResourceWithStreamingResponse,
-)
-from .lookup import (
- LookupResource,
- AsyncLookupResource,
- LookupResourceWithRawResponse,
- AsyncLookupResourceWithRawResponse,
- LookupResourceWithStreamingResponse,
- AsyncLookupResourceWithStreamingResponse,
-)
-from .authentication import (
- AuthenticationResource,
- AsyncAuthenticationResource,
- AuthenticationResourceWithRawResponse,
- AsyncAuthenticationResourceWithRawResponse,
- AuthenticationResourceWithStreamingResponse,
- AsyncAuthenticationResourceWithStreamingResponse,
-)
-
-__all__ = [
- "AuthenticationResource",
- "AsyncAuthenticationResource",
- "AuthenticationResourceWithRawResponse",
- "AsyncAuthenticationResourceWithRawResponse",
- "AuthenticationResourceWithStreamingResponse",
- "AsyncAuthenticationResourceWithStreamingResponse",
- "CheckResource",
- "AsyncCheckResource",
- "CheckResourceWithRawResponse",
- "AsyncCheckResourceWithRawResponse",
- "CheckResourceWithStreamingResponse",
- "AsyncCheckResourceWithStreamingResponse",
- "RetryResource",
- "AsyncRetryResource",
- "RetryResourceWithRawResponse",
- "AsyncRetryResourceWithRawResponse",
- "RetryResourceWithStreamingResponse",
- "AsyncRetryResourceWithStreamingResponse",
- "LookupResource",
- "AsyncLookupResource",
- "LookupResourceWithRawResponse",
- "AsyncLookupResourceWithRawResponse",
- "LookupResourceWithStreamingResponse",
- "AsyncLookupResourceWithStreamingResponse",
-]
diff --git a/src/prelude/resources/authentication/__init__.py b/src/prelude/resources/authentication/__init__.py
deleted file mode 100644
index 238b35e..0000000
--- a/src/prelude/resources/authentication/__init__.py
+++ /dev/null
@@ -1,33 +0,0 @@
-# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
-
-from .feedback import (
- FeedbackResource,
- AsyncFeedbackResource,
- FeedbackResourceWithRawResponse,
- AsyncFeedbackResourceWithRawResponse,
- FeedbackResourceWithStreamingResponse,
- AsyncFeedbackResourceWithStreamingResponse,
-)
-from .authentication import (
- AuthenticationResource,
- AsyncAuthenticationResource,
- AuthenticationResourceWithRawResponse,
- AsyncAuthenticationResourceWithRawResponse,
- AuthenticationResourceWithStreamingResponse,
- AsyncAuthenticationResourceWithStreamingResponse,
-)
-
-__all__ = [
- "FeedbackResource",
- "AsyncFeedbackResource",
- "FeedbackResourceWithRawResponse",
- "AsyncFeedbackResourceWithRawResponse",
- "FeedbackResourceWithStreamingResponse",
- "AsyncFeedbackResourceWithStreamingResponse",
- "AuthenticationResource",
- "AsyncAuthenticationResource",
- "AuthenticationResourceWithRawResponse",
- "AsyncAuthenticationResourceWithRawResponse",
- "AuthenticationResourceWithStreamingResponse",
- "AsyncAuthenticationResourceWithStreamingResponse",
-]
diff --git a/src/prelude/resources/authentication/authentication.py b/src/prelude/resources/authentication/authentication.py
deleted file mode 100644
index edc0258..0000000
--- a/src/prelude/resources/authentication/authentication.py
+++ /dev/null
@@ -1,423 +0,0 @@
-# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
-
-from __future__ import annotations
-
-from typing_extensions import Literal
-
-import httpx
-
-from ...types import authentication_create_params
-from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven
-from ..._utils import (
- maybe_transform,
- async_maybe_transform,
-)
-from .feedback import (
- FeedbackResource,
- AsyncFeedbackResource,
- FeedbackResourceWithRawResponse,
- AsyncFeedbackResourceWithRawResponse,
- FeedbackResourceWithStreamingResponse,
- AsyncFeedbackResourceWithStreamingResponse,
-)
-from ..._compat import cached_property
-from ..._resource import SyncAPIResource, AsyncAPIResource
-from ..._response import (
- to_raw_response_wrapper,
- to_streamed_response_wrapper,
- async_to_raw_response_wrapper,
- async_to_streamed_response_wrapper,
-)
-from ..._base_client import make_request_options
-from ...types.authentication_create_response import AuthenticationCreateResponse
-from ...types.authentication_retrieve_response import AuthenticationRetrieveResponse
-
-__all__ = ["AuthenticationResource", "AsyncAuthenticationResource"]
-
-
-class AuthenticationResource(SyncAPIResource):
- @cached_property
- def feedback(self) -> FeedbackResource:
- return FeedbackResource(self._client)
-
- @cached_property
- def with_raw_response(self) -> AuthenticationResourceWithRawResponse:
- """
- This property can be used as a prefix for any HTTP method call to return the
- the raw response object instead of the parsed content.
-
- For more information, see https://www.github.com/stainless-sdks/prelude-python#accessing-raw-response-data-eg-headers
- """
- return AuthenticationResourceWithRawResponse(self)
-
- @cached_property
- def with_streaming_response(self) -> AuthenticationResourceWithStreamingResponse:
- """
- An alternative to `.with_raw_response` that doesn't eagerly read the response body.
-
- For more information, see https://www.github.com/stainless-sdks/prelude-python#with_streaming_response
- """
- return AuthenticationResourceWithStreamingResponse(self)
-
- def create(
- self,
- *,
- customer_uuid: str,
- phone_number: str,
- app_realm: str | NotGiven = NOT_GIVEN,
- app_version: str | NotGiven = NOT_GIVEN,
- callback_url: str | NotGiven = NOT_GIVEN,
- correlation_id: str | NotGiven = NOT_GIVEN,
- device_id: str | NotGiven = NOT_GIVEN,
- device_model: str | NotGiven = NOT_GIVEN,
- device_type: Literal["IOS", "ANDROID", "WEB"] | NotGiven = NOT_GIVEN,
- ip: str | NotGiven = NOT_GIVEN,
- is_returning_user: bool | NotGiven = NOT_GIVEN,
- locale: str | NotGiven = NOT_GIVEN,
- os_version: str | NotGiven = NOT_GIVEN,
- sender_id: str | NotGiven = NOT_GIVEN,
- template_id: str | NotGiven = NOT_GIVEN,
- # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
- # The extra values given here take precedence over values defined on the client or passed to this method.
- extra_headers: Headers | None = None,
- extra_query: Query | None = None,
- extra_body: Body | None = None,
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
- ) -> AuthenticationCreateResponse:
- """
- Send a code
-
- Args:
- customer_uuid: Your customer UUID, which can be found in the API settings in the dashboard.
-
- phone_number: An E.164 formatted phone number to send the OTP to.
-
- app_realm: The Android SMS Retriever API hash code that identifies your app. This allows
- you to automatically retrieve and fill the OTP code on Android devices.
-
- app_version: The version of your application.
-
- callback_url: A webhook URL to which delivery statuses will be sent.
-
- correlation_id: A unique, user-defined identifier that will be included in webhook events
-
- device_id: Unique identifier for the user's device. For Android, this corresponds to the
- `ANDROID_ID` and for iOS, this corresponds to the `identifierForVendor`.
-
- device_model: The model of the user's device.
-
- device_type: The type of device the user is using.
-
- ip: The IP address of the user's device.
-
- is_returning_user: This signal should do more than just confirm if a user is returning to your app;
- it should provide a higher level of trust, indicating that the user is genuine.
- For more details, refer to [Signals](/guides/prevent-fraud#signals).
-
- locale: A BCP-47 locale indicating the language the SMS should be sent to; if this is
- not set, the SMS will be sent to the language specified by the country code of
- the message. If we don't support the language set, the message will be sent in
- US English (en-US).
-
- os_version: The version of the user's device operating system.
-
- sender_id: The Sender ID to use when sending the message.
-
- template_id: The template id associated with the message content variant to be sent.
-
- extra_headers: Send extra headers
-
- extra_query: Add additional query parameters to the request
-
- extra_body: Add additional JSON properties to the request
-
- timeout: Override the client-level default timeout for this request, in seconds
- """
- return self._post(
- "/authentication",
- body=maybe_transform(
- {
- "customer_uuid": customer_uuid,
- "phone_number": phone_number,
- "app_realm": app_realm,
- "app_version": app_version,
- "callback_url": callback_url,
- "correlation_id": correlation_id,
- "device_id": device_id,
- "device_model": device_model,
- "device_type": device_type,
- "ip": ip,
- "is_returning_user": is_returning_user,
- "locale": locale,
- "os_version": os_version,
- "sender_id": sender_id,
- "template_id": template_id,
- },
- authentication_create_params.AuthenticationCreateParams,
- ),
- options=make_request_options(
- extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
- ),
- cast_to=AuthenticationCreateResponse,
- )
-
- def retrieve(
- self,
- auth_uuid: str,
- *,
- # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
- # The extra values given here take precedence over values defined on the client or passed to this method.
- extra_headers: Headers | None = None,
- extra_query: Query | None = None,
- extra_body: Body | None = None,
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
- ) -> AuthenticationRetrieveResponse:
- """
- Get authentication status
-
- Args:
- auth_uuid: The UUID of the authentication.
-
- extra_headers: Send extra headers
-
- extra_query: Add additional query parameters to the request
-
- extra_body: Add additional JSON properties to the request
-
- timeout: Override the client-level default timeout for this request, in seconds
- """
- if not auth_uuid:
- raise ValueError(f"Expected a non-empty value for `auth_uuid` but received {auth_uuid!r}")
- return self._get(
- f"/authentication/{auth_uuid}",
- options=make_request_options(
- extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
- ),
- cast_to=AuthenticationRetrieveResponse,
- )
-
-
-class AsyncAuthenticationResource(AsyncAPIResource):
- @cached_property
- def feedback(self) -> AsyncFeedbackResource:
- return AsyncFeedbackResource(self._client)
-
- @cached_property
- def with_raw_response(self) -> AsyncAuthenticationResourceWithRawResponse:
- """
- This property can be used as a prefix for any HTTP method call to return the
- the raw response object instead of the parsed content.
-
- For more information, see https://www.github.com/stainless-sdks/prelude-python#accessing-raw-response-data-eg-headers
- """
- return AsyncAuthenticationResourceWithRawResponse(self)
-
- @cached_property
- def with_streaming_response(self) -> AsyncAuthenticationResourceWithStreamingResponse:
- """
- An alternative to `.with_raw_response` that doesn't eagerly read the response body.
-
- For more information, see https://www.github.com/stainless-sdks/prelude-python#with_streaming_response
- """
- return AsyncAuthenticationResourceWithStreamingResponse(self)
-
- async def create(
- self,
- *,
- customer_uuid: str,
- phone_number: str,
- app_realm: str | NotGiven = NOT_GIVEN,
- app_version: str | NotGiven = NOT_GIVEN,
- callback_url: str | NotGiven = NOT_GIVEN,
- correlation_id: str | NotGiven = NOT_GIVEN,
- device_id: str | NotGiven = NOT_GIVEN,
- device_model: str | NotGiven = NOT_GIVEN,
- device_type: Literal["IOS", "ANDROID", "WEB"] | NotGiven = NOT_GIVEN,
- ip: str | NotGiven = NOT_GIVEN,
- is_returning_user: bool | NotGiven = NOT_GIVEN,
- locale: str | NotGiven = NOT_GIVEN,
- os_version: str | NotGiven = NOT_GIVEN,
- sender_id: str | NotGiven = NOT_GIVEN,
- template_id: str | NotGiven = NOT_GIVEN,
- # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
- # The extra values given here take precedence over values defined on the client or passed to this method.
- extra_headers: Headers | None = None,
- extra_query: Query | None = None,
- extra_body: Body | None = None,
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
- ) -> AuthenticationCreateResponse:
- """
- Send a code
-
- Args:
- customer_uuid: Your customer UUID, which can be found in the API settings in the dashboard.
-
- phone_number: An E.164 formatted phone number to send the OTP to.
-
- app_realm: The Android SMS Retriever API hash code that identifies your app. This allows
- you to automatically retrieve and fill the OTP code on Android devices.
-
- app_version: The version of your application.
-
- callback_url: A webhook URL to which delivery statuses will be sent.
-
- correlation_id: A unique, user-defined identifier that will be included in webhook events
-
- device_id: Unique identifier for the user's device. For Android, this corresponds to the
- `ANDROID_ID` and for iOS, this corresponds to the `identifierForVendor`.
-
- device_model: The model of the user's device.
-
- device_type: The type of device the user is using.
-
- ip: The IP address of the user's device.
-
- is_returning_user: This signal should do more than just confirm if a user is returning to your app;
- it should provide a higher level of trust, indicating that the user is genuine.
- For more details, refer to [Signals](/guides/prevent-fraud#signals).
-
- locale: A BCP-47 locale indicating the language the SMS should be sent to; if this is
- not set, the SMS will be sent to the language specified by the country code of
- the message. If we don't support the language set, the message will be sent in
- US English (en-US).
-
- os_version: The version of the user's device operating system.
-
- sender_id: The Sender ID to use when sending the message.
-
- template_id: The template id associated with the message content variant to be sent.
-
- extra_headers: Send extra headers
-
- extra_query: Add additional query parameters to the request
-
- extra_body: Add additional JSON properties to the request
-
- timeout: Override the client-level default timeout for this request, in seconds
- """
- return await self._post(
- "/authentication",
- body=await async_maybe_transform(
- {
- "customer_uuid": customer_uuid,
- "phone_number": phone_number,
- "app_realm": app_realm,
- "app_version": app_version,
- "callback_url": callback_url,
- "correlation_id": correlation_id,
- "device_id": device_id,
- "device_model": device_model,
- "device_type": device_type,
- "ip": ip,
- "is_returning_user": is_returning_user,
- "locale": locale,
- "os_version": os_version,
- "sender_id": sender_id,
- "template_id": template_id,
- },
- authentication_create_params.AuthenticationCreateParams,
- ),
- options=make_request_options(
- extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
- ),
- cast_to=AuthenticationCreateResponse,
- )
-
- async def retrieve(
- self,
- auth_uuid: str,
- *,
- # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
- # The extra values given here take precedence over values defined on the client or passed to this method.
- extra_headers: Headers | None = None,
- extra_query: Query | None = None,
- extra_body: Body | None = None,
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
- ) -> AuthenticationRetrieveResponse:
- """
- Get authentication status
-
- Args:
- auth_uuid: The UUID of the authentication.
-
- extra_headers: Send extra headers
-
- extra_query: Add additional query parameters to the request
-
- extra_body: Add additional JSON properties to the request
-
- timeout: Override the client-level default timeout for this request, in seconds
- """
- if not auth_uuid:
- raise ValueError(f"Expected a non-empty value for `auth_uuid` but received {auth_uuid!r}")
- return await self._get(
- f"/authentication/{auth_uuid}",
- options=make_request_options(
- extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
- ),
- cast_to=AuthenticationRetrieveResponse,
- )
-
-
-class AuthenticationResourceWithRawResponse:
- def __init__(self, authentication: AuthenticationResource) -> None:
- self._authentication = authentication
-
- self.create = to_raw_response_wrapper(
- authentication.create,
- )
- self.retrieve = to_raw_response_wrapper(
- authentication.retrieve,
- )
-
- @cached_property
- def feedback(self) -> FeedbackResourceWithRawResponse:
- return FeedbackResourceWithRawResponse(self._authentication.feedback)
-
-
-class AsyncAuthenticationResourceWithRawResponse:
- def __init__(self, authentication: AsyncAuthenticationResource) -> None:
- self._authentication = authentication
-
- self.create = async_to_raw_response_wrapper(
- authentication.create,
- )
- self.retrieve = async_to_raw_response_wrapper(
- authentication.retrieve,
- )
-
- @cached_property
- def feedback(self) -> AsyncFeedbackResourceWithRawResponse:
- return AsyncFeedbackResourceWithRawResponse(self._authentication.feedback)
-
-
-class AuthenticationResourceWithStreamingResponse:
- def __init__(self, authentication: AuthenticationResource) -> None:
- self._authentication = authentication
-
- self.create = to_streamed_response_wrapper(
- authentication.create,
- )
- self.retrieve = to_streamed_response_wrapper(
- authentication.retrieve,
- )
-
- @cached_property
- def feedback(self) -> FeedbackResourceWithStreamingResponse:
- return FeedbackResourceWithStreamingResponse(self._authentication.feedback)
-
-
-class AsyncAuthenticationResourceWithStreamingResponse:
- def __init__(self, authentication: AsyncAuthenticationResource) -> None:
- self._authentication = authentication
-
- self.create = async_to_streamed_response_wrapper(
- authentication.create,
- )
- self.retrieve = async_to_streamed_response_wrapper(
- authentication.retrieve,
- )
-
- @cached_property
- def feedback(self) -> AsyncFeedbackResourceWithStreamingResponse:
- return AsyncFeedbackResourceWithStreamingResponse(self._authentication.feedback)
diff --git a/src/prelude/resources/authentication/feedback.py b/src/prelude/resources/authentication/feedback.py
deleted file mode 100644
index bc5fe48..0000000
--- a/src/prelude/resources/authentication/feedback.py
+++ /dev/null
@@ -1,198 +0,0 @@
-# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
-
-from __future__ import annotations
-
-from typing_extensions import Literal
-
-import httpx
-
-from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven
-from ..._utils import (
- maybe_transform,
- async_maybe_transform,
-)
-from ..._compat import cached_property
-from ..._resource import SyncAPIResource, AsyncAPIResource
-from ..._response import (
- to_raw_response_wrapper,
- to_streamed_response_wrapper,
- async_to_raw_response_wrapper,
- async_to_streamed_response_wrapper,
-)
-from ..._base_client import make_request_options
-from ...types.authentication import feedback_create_params
-from ...types.authentication.feedback_create_response import FeedbackCreateResponse
-
-__all__ = ["FeedbackResource", "AsyncFeedbackResource"]
-
-
-class FeedbackResource(SyncAPIResource):
- @cached_property
- def with_raw_response(self) -> FeedbackResourceWithRawResponse:
- """
- This property can be used as a prefix for any HTTP method call to return the
- the raw response object instead of the parsed content.
-
- For more information, see https://www.github.com/stainless-sdks/prelude-python#accessing-raw-response-data-eg-headers
- """
- return FeedbackResourceWithRawResponse(self)
-
- @cached_property
- def with_streaming_response(self) -> FeedbackResourceWithStreamingResponse:
- """
- An alternative to `.with_raw_response` that doesn't eagerly read the response body.
-
- For more information, see https://www.github.com/stainless-sdks/prelude-python#with_streaming_response
- """
- return FeedbackResourceWithStreamingResponse(self)
-
- def create(
- self,
- *,
- customer_uuid: str,
- phone_number: str,
- status: Literal["onboarded", "not_onboarded"],
- # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
- # The extra values given here take precedence over values defined on the client or passed to this method.
- extra_headers: Headers | None = None,
- extra_query: Query | None = None,
- extra_body: Body | None = None,
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
- ) -> FeedbackCreateResponse:
- """
- Send feedback
-
- Args:
- customer_uuid: Your customer UUID, which can be found in the API settings in the dashboard.
-
- phone_number: An E.164 formatted phone number.
-
- status: The type of the feedback.
-
- extra_headers: Send extra headers
-
- extra_query: Add additional query parameters to the request
-
- extra_body: Add additional JSON properties to the request
-
- timeout: Override the client-level default timeout for this request, in seconds
- """
- return self._post(
- "/authentication/feedback",
- body=maybe_transform(
- {
- "customer_uuid": customer_uuid,
- "phone_number": phone_number,
- "status": status,
- },
- feedback_create_params.FeedbackCreateParams,
- ),
- options=make_request_options(
- extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
- ),
- cast_to=FeedbackCreateResponse,
- )
-
-
-class AsyncFeedbackResource(AsyncAPIResource):
- @cached_property
- def with_raw_response(self) -> AsyncFeedbackResourceWithRawResponse:
- """
- This property can be used as a prefix for any HTTP method call to return the
- the raw response object instead of the parsed content.
-
- For more information, see https://www.github.com/stainless-sdks/prelude-python#accessing-raw-response-data-eg-headers
- """
- return AsyncFeedbackResourceWithRawResponse(self)
-
- @cached_property
- def with_streaming_response(self) -> AsyncFeedbackResourceWithStreamingResponse:
- """
- An alternative to `.with_raw_response` that doesn't eagerly read the response body.
-
- For more information, see https://www.github.com/stainless-sdks/prelude-python#with_streaming_response
- """
- return AsyncFeedbackResourceWithStreamingResponse(self)
-
- async def create(
- self,
- *,
- customer_uuid: str,
- phone_number: str,
- status: Literal["onboarded", "not_onboarded"],
- # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
- # The extra values given here take precedence over values defined on the client or passed to this method.
- extra_headers: Headers | None = None,
- extra_query: Query | None = None,
- extra_body: Body | None = None,
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
- ) -> FeedbackCreateResponse:
- """
- Send feedback
-
- Args:
- customer_uuid: Your customer UUID, which can be found in the API settings in the dashboard.
-
- phone_number: An E.164 formatted phone number.
-
- status: The type of the feedback.
-
- extra_headers: Send extra headers
-
- extra_query: Add additional query parameters to the request
-
- extra_body: Add additional JSON properties to the request
-
- timeout: Override the client-level default timeout for this request, in seconds
- """
- return await self._post(
- "/authentication/feedback",
- body=await async_maybe_transform(
- {
- "customer_uuid": customer_uuid,
- "phone_number": phone_number,
- "status": status,
- },
- feedback_create_params.FeedbackCreateParams,
- ),
- options=make_request_options(
- extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
- ),
- cast_to=FeedbackCreateResponse,
- )
-
-
-class FeedbackResourceWithRawResponse:
- def __init__(self, feedback: FeedbackResource) -> None:
- self._feedback = feedback
-
- self.create = to_raw_response_wrapper(
- feedback.create,
- )
-
-
-class AsyncFeedbackResourceWithRawResponse:
- def __init__(self, feedback: AsyncFeedbackResource) -> None:
- self._feedback = feedback
-
- self.create = async_to_raw_response_wrapper(
- feedback.create,
- )
-
-
-class FeedbackResourceWithStreamingResponse:
- def __init__(self, feedback: FeedbackResource) -> None:
- self._feedback = feedback
-
- self.create = to_streamed_response_wrapper(
- feedback.create,
- )
-
-
-class AsyncFeedbackResourceWithStreamingResponse:
- def __init__(self, feedback: AsyncFeedbackResource) -> None:
- self._feedback = feedback
-
- self.create = async_to_streamed_response_wrapper(
- feedback.create,
- )
diff --git a/src/prelude/resources/check.py b/src/prelude/resources/check.py
deleted file mode 100644
index f3ead5e..0000000
--- a/src/prelude/resources/check.py
+++ /dev/null
@@ -1,196 +0,0 @@
-# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
-
-from __future__ import annotations
-
-import httpx
-
-from ..types import check_create_params
-from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven
-from .._utils import (
- maybe_transform,
- async_maybe_transform,
-)
-from .._compat import cached_property
-from .._resource import SyncAPIResource, AsyncAPIResource
-from .._response import (
- to_raw_response_wrapper,
- to_streamed_response_wrapper,
- async_to_raw_response_wrapper,
- async_to_streamed_response_wrapper,
-)
-from .._base_client import make_request_options
-from ..types.check_create_response import CheckCreateResponse
-
-__all__ = ["CheckResource", "AsyncCheckResource"]
-
-
-class CheckResource(SyncAPIResource):
- @cached_property
- def with_raw_response(self) -> CheckResourceWithRawResponse:
- """
- This property can be used as a prefix for any HTTP method call to return the
- the raw response object instead of the parsed content.
-
- For more information, see https://www.github.com/stainless-sdks/prelude-python#accessing-raw-response-data-eg-headers
- """
- return CheckResourceWithRawResponse(self)
-
- @cached_property
- def with_streaming_response(self) -> CheckResourceWithStreamingResponse:
- """
- An alternative to `.with_raw_response` that doesn't eagerly read the response body.
-
- For more information, see https://www.github.com/stainless-sdks/prelude-python#with_streaming_response
- """
- return CheckResourceWithStreamingResponse(self)
-
- def create(
- self,
- *,
- authentication_uuid: str,
- check_code: str,
- customer_uuid: str,
- # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
- # The extra values given here take precedence over values defined on the client or passed to this method.
- extra_headers: Headers | None = None,
- extra_query: Query | None = None,
- extra_body: Body | None = None,
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
- ) -> CheckCreateResponse:
- """
- Check a code
-
- Args:
- authentication_uuid: The authentication UUID that was returned when you created the authentication.
-
- check_code: The code that the user entered.
-
- customer_uuid: Your customer UUID, which can be found in the API settings in the Dashboard.
-
- extra_headers: Send extra headers
-
- extra_query: Add additional query parameters to the request
-
- extra_body: Add additional JSON properties to the request
-
- timeout: Override the client-level default timeout for this request, in seconds
- """
- return self._post(
- "/check",
- body=maybe_transform(
- {
- "authentication_uuid": authentication_uuid,
- "check_code": check_code,
- "customer_uuid": customer_uuid,
- },
- check_create_params.CheckCreateParams,
- ),
- options=make_request_options(
- extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
- ),
- cast_to=CheckCreateResponse,
- )
-
-
-class AsyncCheckResource(AsyncAPIResource):
- @cached_property
- def with_raw_response(self) -> AsyncCheckResourceWithRawResponse:
- """
- This property can be used as a prefix for any HTTP method call to return the
- the raw response object instead of the parsed content.
-
- For more information, see https://www.github.com/stainless-sdks/prelude-python#accessing-raw-response-data-eg-headers
- """
- return AsyncCheckResourceWithRawResponse(self)
-
- @cached_property
- def with_streaming_response(self) -> AsyncCheckResourceWithStreamingResponse:
- """
- An alternative to `.with_raw_response` that doesn't eagerly read the response body.
-
- For more information, see https://www.github.com/stainless-sdks/prelude-python#with_streaming_response
- """
- return AsyncCheckResourceWithStreamingResponse(self)
-
- async def create(
- self,
- *,
- authentication_uuid: str,
- check_code: str,
- customer_uuid: str,
- # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
- # The extra values given here take precedence over values defined on the client or passed to this method.
- extra_headers: Headers | None = None,
- extra_query: Query | None = None,
- extra_body: Body | None = None,
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
- ) -> CheckCreateResponse:
- """
- Check a code
-
- Args:
- authentication_uuid: The authentication UUID that was returned when you created the authentication.
-
- check_code: The code that the user entered.
-
- customer_uuid: Your customer UUID, which can be found in the API settings in the Dashboard.
-
- extra_headers: Send extra headers
-
- extra_query: Add additional query parameters to the request
-
- extra_body: Add additional JSON properties to the request
-
- timeout: Override the client-level default timeout for this request, in seconds
- """
- return await self._post(
- "/check",
- body=await async_maybe_transform(
- {
- "authentication_uuid": authentication_uuid,
- "check_code": check_code,
- "customer_uuid": customer_uuid,
- },
- check_create_params.CheckCreateParams,
- ),
- options=make_request_options(
- extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
- ),
- cast_to=CheckCreateResponse,
- )
-
-
-class CheckResourceWithRawResponse:
- def __init__(self, check: CheckResource) -> None:
- self._check = check
-
- self.create = to_raw_response_wrapper(
- check.create,
- )
-
-
-class AsyncCheckResourceWithRawResponse:
- def __init__(self, check: AsyncCheckResource) -> None:
- self._check = check
-
- self.create = async_to_raw_response_wrapper(
- check.create,
- )
-
-
-class CheckResourceWithStreamingResponse:
- def __init__(self, check: CheckResource) -> None:
- self._check = check
-
- self.create = to_streamed_response_wrapper(
- check.create,
- )
-
-
-class AsyncCheckResourceWithStreamingResponse:
- def __init__(self, check: AsyncCheckResource) -> None:
- self._check = check
-
- self.create = async_to_streamed_response_wrapper(
- check.create,
- )
diff --git a/src/prelude/resources/lookup.py b/src/prelude/resources/lookup.py
deleted file mode 100644
index a2fd1b2..0000000
--- a/src/prelude/resources/lookup.py
+++ /dev/null
@@ -1,175 +0,0 @@
-# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
-
-from __future__ import annotations
-
-import httpx
-
-from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven
-from .._compat import cached_property
-from .._resource import SyncAPIResource, AsyncAPIResource
-from .._response import (
- to_raw_response_wrapper,
- to_streamed_response_wrapper,
- async_to_raw_response_wrapper,
- async_to_streamed_response_wrapper,
-)
-from .._base_client import make_request_options
-from ..types.lookup_retrieve_response import LookupRetrieveResponse
-
-__all__ = ["LookupResource", "AsyncLookupResource"]
-
-
-class LookupResource(SyncAPIResource):
- @cached_property
- def with_raw_response(self) -> LookupResourceWithRawResponse:
- """
- This property can be used as a prefix for any HTTP method call to return the
- the raw response object instead of the parsed content.
-
- For more information, see https://www.github.com/stainless-sdks/prelude-python#accessing-raw-response-data-eg-headers
- """
- return LookupResourceWithRawResponse(self)
-
- @cached_property
- def with_streaming_response(self) -> LookupResourceWithStreamingResponse:
- """
- An alternative to `.with_raw_response` that doesn't eagerly read the response body.
-
- For more information, see https://www.github.com/stainless-sdks/prelude-python#with_streaming_response
- """
- return LookupResourceWithStreamingResponse(self)
-
- def retrieve(
- self,
- phone_number: str,
- *,
- customer_uuid: str,
- # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
- # The extra values given here take precedence over values defined on the client or passed to this method.
- extra_headers: Headers | None = None,
- extra_query: Query | None = None,
- extra_body: Body | None = None,
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
- ) -> LookupRetrieveResponse:
- """
- Look up for phone number
-
- Args:
- phone_number: An E.164 formatted phone number to look up.
-
- customer_uuid: Your customer UUID, which can be found in the API settings in the dashboard.
-
- extra_headers: Send extra headers
-
- extra_query: Add additional query parameters to the request
-
- extra_body: Add additional JSON properties to the request
-
- timeout: Override the client-level default timeout for this request, in seconds
- """
- if not phone_number:
- raise ValueError(f"Expected a non-empty value for `phone_number` but received {phone_number!r}")
- extra_headers = {"customer-uuid": customer_uuid, **(extra_headers or {})}
- return self._get(
- f"/lookup/{phone_number}",
- options=make_request_options(
- extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
- ),
- cast_to=LookupRetrieveResponse,
- )
-
-
-class AsyncLookupResource(AsyncAPIResource):
- @cached_property
- def with_raw_response(self) -> AsyncLookupResourceWithRawResponse:
- """
- This property can be used as a prefix for any HTTP method call to return the
- the raw response object instead of the parsed content.
-
- For more information, see https://www.github.com/stainless-sdks/prelude-python#accessing-raw-response-data-eg-headers
- """
- return AsyncLookupResourceWithRawResponse(self)
-
- @cached_property
- def with_streaming_response(self) -> AsyncLookupResourceWithStreamingResponse:
- """
- An alternative to `.with_raw_response` that doesn't eagerly read the response body.
-
- For more information, see https://www.github.com/stainless-sdks/prelude-python#with_streaming_response
- """
- return AsyncLookupResourceWithStreamingResponse(self)
-
- async def retrieve(
- self,
- phone_number: str,
- *,
- customer_uuid: str,
- # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
- # The extra values given here take precedence over values defined on the client or passed to this method.
- extra_headers: Headers | None = None,
- extra_query: Query | None = None,
- extra_body: Body | None = None,
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
- ) -> LookupRetrieveResponse:
- """
- Look up for phone number
-
- Args:
- phone_number: An E.164 formatted phone number to look up.
-
- customer_uuid: Your customer UUID, which can be found in the API settings in the dashboard.
-
- extra_headers: Send extra headers
-
- extra_query: Add additional query parameters to the request
-
- extra_body: Add additional JSON properties to the request
-
- timeout: Override the client-level default timeout for this request, in seconds
- """
- if not phone_number:
- raise ValueError(f"Expected a non-empty value for `phone_number` but received {phone_number!r}")
- extra_headers = {"customer-uuid": customer_uuid, **(extra_headers or {})}
- return await self._get(
- f"/lookup/{phone_number}",
- options=make_request_options(
- extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
- ),
- cast_to=LookupRetrieveResponse,
- )
-
-
-class LookupResourceWithRawResponse:
- def __init__(self, lookup: LookupResource) -> None:
- self._lookup = lookup
-
- self.retrieve = to_raw_response_wrapper(
- lookup.retrieve,
- )
-
-
-class AsyncLookupResourceWithRawResponse:
- def __init__(self, lookup: AsyncLookupResource) -> None:
- self._lookup = lookup
-
- self.retrieve = async_to_raw_response_wrapper(
- lookup.retrieve,
- )
-
-
-class LookupResourceWithStreamingResponse:
- def __init__(self, lookup: LookupResource) -> None:
- self._lookup = lookup
-
- self.retrieve = to_streamed_response_wrapper(
- lookup.retrieve,
- )
-
-
-class AsyncLookupResourceWithStreamingResponse:
- def __init__(self, lookup: AsyncLookupResource) -> None:
- self._lookup = lookup
-
- self.retrieve = async_to_streamed_response_wrapper(
- lookup.retrieve,
- )
diff --git a/src/prelude/resources/retry.py b/src/prelude/resources/retry.py
deleted file mode 100644
index 1cb11ed..0000000
--- a/src/prelude/resources/retry.py
+++ /dev/null
@@ -1,188 +0,0 @@
-# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
-
-from __future__ import annotations
-
-import httpx
-
-from ..types import retry_create_params
-from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven
-from .._utils import (
- maybe_transform,
- async_maybe_transform,
-)
-from .._compat import cached_property
-from .._resource import SyncAPIResource, AsyncAPIResource
-from .._response import (
- to_raw_response_wrapper,
- to_streamed_response_wrapper,
- async_to_raw_response_wrapper,
- async_to_streamed_response_wrapper,
-)
-from .._base_client import make_request_options
-from ..types.retry_create_response import RetryCreateResponse
-
-__all__ = ["RetryResource", "AsyncRetryResource"]
-
-
-class RetryResource(SyncAPIResource):
- @cached_property
- def with_raw_response(self) -> RetryResourceWithRawResponse:
- """
- This property can be used as a prefix for any HTTP method call to return the
- the raw response object instead of the parsed content.
-
- For more information, see https://www.github.com/stainless-sdks/prelude-python#accessing-raw-response-data-eg-headers
- """
- return RetryResourceWithRawResponse(self)
-
- @cached_property
- def with_streaming_response(self) -> RetryResourceWithStreamingResponse:
- """
- An alternative to `.with_raw_response` that doesn't eagerly read the response body.
-
- For more information, see https://www.github.com/stainless-sdks/prelude-python#with_streaming_response
- """
- return RetryResourceWithStreamingResponse(self)
-
- def create(
- self,
- *,
- authentication_uuid: str,
- customer_uuid: str,
- # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
- # The extra values given here take precedence over values defined on the client or passed to this method.
- extra_headers: Headers | None = None,
- extra_query: Query | None = None,
- extra_body: Body | None = None,
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
- ) -> RetryCreateResponse:
- """
- Perform a retry
-
- Args:
- authentication_uuid: The authentication UUID that was returned when you created the authentication.
-
- customer_uuid: Your customer UUID, which can be found in the API settings in the dashboard.
-
- extra_headers: Send extra headers
-
- extra_query: Add additional query parameters to the request
-
- extra_body: Add additional JSON properties to the request
-
- timeout: Override the client-level default timeout for this request, in seconds
- """
- return self._post(
- "/retry",
- body=maybe_transform(
- {
- "authentication_uuid": authentication_uuid,
- "customer_uuid": customer_uuid,
- },
- retry_create_params.RetryCreateParams,
- ),
- options=make_request_options(
- extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
- ),
- cast_to=RetryCreateResponse,
- )
-
-
-class AsyncRetryResource(AsyncAPIResource):
- @cached_property
- def with_raw_response(self) -> AsyncRetryResourceWithRawResponse:
- """
- This property can be used as a prefix for any HTTP method call to return the
- the raw response object instead of the parsed content.
-
- For more information, see https://www.github.com/stainless-sdks/prelude-python#accessing-raw-response-data-eg-headers
- """
- return AsyncRetryResourceWithRawResponse(self)
-
- @cached_property
- def with_streaming_response(self) -> AsyncRetryResourceWithStreamingResponse:
- """
- An alternative to `.with_raw_response` that doesn't eagerly read the response body.
-
- For more information, see https://www.github.com/stainless-sdks/prelude-python#with_streaming_response
- """
- return AsyncRetryResourceWithStreamingResponse(self)
-
- async def create(
- self,
- *,
- authentication_uuid: str,
- customer_uuid: str,
- # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
- # The extra values given here take precedence over values defined on the client or passed to this method.
- extra_headers: Headers | None = None,
- extra_query: Query | None = None,
- extra_body: Body | None = None,
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
- ) -> RetryCreateResponse:
- """
- Perform a retry
-
- Args:
- authentication_uuid: The authentication UUID that was returned when you created the authentication.
-
- customer_uuid: Your customer UUID, which can be found in the API settings in the dashboard.
-
- extra_headers: Send extra headers
-
- extra_query: Add additional query parameters to the request
-
- extra_body: Add additional JSON properties to the request
-
- timeout: Override the client-level default timeout for this request, in seconds
- """
- return await self._post(
- "/retry",
- body=await async_maybe_transform(
- {
- "authentication_uuid": authentication_uuid,
- "customer_uuid": customer_uuid,
- },
- retry_create_params.RetryCreateParams,
- ),
- options=make_request_options(
- extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
- ),
- cast_to=RetryCreateResponse,
- )
-
-
-class RetryResourceWithRawResponse:
- def __init__(self, retry: RetryResource) -> None:
- self._retry = retry
-
- self.create = to_raw_response_wrapper(
- retry.create,
- )
-
-
-class AsyncRetryResourceWithRawResponse:
- def __init__(self, retry: AsyncRetryResource) -> None:
- self._retry = retry
-
- self.create = async_to_raw_response_wrapper(
- retry.create,
- )
-
-
-class RetryResourceWithStreamingResponse:
- def __init__(self, retry: RetryResource) -> None:
- self._retry = retry
-
- self.create = to_streamed_response_wrapper(
- retry.create,
- )
-
-
-class AsyncRetryResourceWithStreamingResponse:
- def __init__(self, retry: AsyncRetryResource) -> None:
- self._retry = retry
-
- self.create = async_to_streamed_response_wrapper(
- retry.create,
- )
diff --git a/src/prelude/types/__init__.py b/src/prelude/types/__init__.py
deleted file mode 100644
index 9c7723e..0000000
--- a/src/prelude/types/__init__.py
+++ /dev/null
@@ -1,12 +0,0 @@
-# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
-
-from __future__ import annotations
-
-from .check_create_params import CheckCreateParams as CheckCreateParams
-from .retry_create_params import RetryCreateParams as RetryCreateParams
-from .check_create_response import CheckCreateResponse as CheckCreateResponse
-from .retry_create_response import RetryCreateResponse as RetryCreateResponse
-from .lookup_retrieve_response import LookupRetrieveResponse as LookupRetrieveResponse
-from .authentication_create_params import AuthenticationCreateParams as AuthenticationCreateParams
-from .authentication_create_response import AuthenticationCreateResponse as AuthenticationCreateResponse
-from .authentication_retrieve_response import AuthenticationRetrieveResponse as AuthenticationRetrieveResponse
diff --git a/src/prelude/types/authentication/__init__.py b/src/prelude/types/authentication/__init__.py
deleted file mode 100644
index 5dd8c73..0000000
--- a/src/prelude/types/authentication/__init__.py
+++ /dev/null
@@ -1,6 +0,0 @@
-# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
-
-from __future__ import annotations
-
-from .feedback_create_params import FeedbackCreateParams as FeedbackCreateParams
-from .feedback_create_response import FeedbackCreateResponse as FeedbackCreateResponse
diff --git a/src/prelude/types/authentication/feedback_create_params.py b/src/prelude/types/authentication/feedback_create_params.py
deleted file mode 100644
index 5b7b0c1..0000000
--- a/src/prelude/types/authentication/feedback_create_params.py
+++ /dev/null
@@ -1,18 +0,0 @@
-# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
-
-from __future__ import annotations
-
-from typing_extensions import Literal, Required, TypedDict
-
-__all__ = ["FeedbackCreateParams"]
-
-
-class FeedbackCreateParams(TypedDict, total=False):
- customer_uuid: Required[str]
- """Your customer UUID, which can be found in the API settings in the dashboard."""
-
- phone_number: Required[str]
- """An E.164 formatted phone number."""
-
- status: Required[Literal["onboarded", "not_onboarded"]]
- """The type of the feedback."""
diff --git a/src/prelude/types/authentication/feedback_create_response.py b/src/prelude/types/authentication/feedback_create_response.py
deleted file mode 100644
index 7adfff8..0000000
--- a/src/prelude/types/authentication/feedback_create_response.py
+++ /dev/null
@@ -1,12 +0,0 @@
-# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
-
-from typing import Optional
-
-from ..._models import BaseModel
-
-__all__ = ["FeedbackCreateResponse"]
-
-
-class FeedbackCreateResponse(BaseModel):
- uuid: Optional[str] = None
- """The UUID of the feedback."""
diff --git a/src/prelude/types/authentication_create_params.py b/src/prelude/types/authentication_create_params.py
deleted file mode 100644
index f2415fa..0000000
--- a/src/prelude/types/authentication_create_params.py
+++ /dev/null
@@ -1,71 +0,0 @@
-# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
-
-from __future__ import annotations
-
-from typing_extensions import Literal, Required, TypedDict
-
-__all__ = ["AuthenticationCreateParams"]
-
-
-class AuthenticationCreateParams(TypedDict, total=False):
- customer_uuid: Required[str]
- """Your customer UUID, which can be found in the API settings in the dashboard."""
-
- phone_number: Required[str]
- """An E.164 formatted phone number to send the OTP to."""
-
- app_realm: str
- """The Android SMS Retriever API hash code that identifies your app.
-
- This allows you to automatically retrieve and fill the OTP code on Android
- devices.
- """
-
- app_version: str
- """The version of your application."""
-
- callback_url: str
- """A webhook URL to which delivery statuses will be sent."""
-
- correlation_id: str
- """A unique, user-defined identifier that will be included in webhook events"""
-
- device_id: str
- """Unique identifier for the user's device.
-
- For Android, this corresponds to the `ANDROID_ID` and for iOS, this corresponds
- to the `identifierForVendor`.
- """
-
- device_model: str
- """The model of the user's device."""
-
- device_type: Literal["IOS", "ANDROID", "WEB"]
- """The type of device the user is using."""
-
- ip: str
- """The IP address of the user's device."""
-
- is_returning_user: bool
- """
- This signal should do more than just confirm if a user is returning to your app;
- it should provide a higher level of trust, indicating that the user is genuine.
- For more details, refer to [Signals](/guides/prevent-fraud#signals).
- """
-
- locale: str
- """
- A BCP-47 locale indicating the language the SMS should be sent to; if this is
- not set, the SMS will be sent to the language specified by the country code of
- the message. If we don't support the language set, the message will be sent in
- US English (en-US).
- """
-
- os_version: str
- """The version of the user's device operating system."""
-
- sender_id: str
- """The Sender ID to use when sending the message."""
-
- template_id: str
- """The template id associated with the message content variant to be sent."""
diff --git a/src/prelude/types/authentication_create_response.py b/src/prelude/types/authentication_create_response.py
deleted file mode 100644
index 60698ca..0000000
--- a/src/prelude/types/authentication_create_response.py
+++ /dev/null
@@ -1,34 +0,0 @@
-# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
-
-from typing import Optional
-from datetime import datetime
-from typing_extensions import Literal
-
-from .._models import BaseModel
-
-__all__ = ["AuthenticationCreateResponse"]
-
-
-class AuthenticationCreateResponse(BaseModel):
- authentication_uuid: Optional[str] = None
- """
- A unique identifier for the authentication that you can use on the /check and
- /retry endpoints.
- """
-
- created_at: Optional[datetime] = None
-
- expires_at: Optional[datetime] = None
- """
- The time at which the authentication expires and can no longer be checked or
- retried.
- """
-
- status: Optional[Literal["pending", "rate_limited", "spam_detected"]] = None
- """The status of the authentication. Possible values are:
-
- - `pending` - The OTP code is being sent.
- - `rate_limited` - This user is rate-limited and cannot receive another code.
- - `spam_detected` - This attempt is flagged as spam. Go to the dashboard for
- more details.
- """
diff --git a/src/prelude/types/authentication_retrieve_response.py b/src/prelude/types/authentication_retrieve_response.py
deleted file mode 100644
index 4744530..0000000
--- a/src/prelude/types/authentication_retrieve_response.py
+++ /dev/null
@@ -1,195 +0,0 @@
-# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
-
-from typing import List, Union, Optional
-from datetime import datetime
-from typing_extensions import Literal, TypeAlias
-
-from .._models import BaseModel
-
-__all__ = [
- "AuthenticationRetrieveResponse",
- "Event",
- "EventAttempt",
- "EventCheck",
- "EventDeliveryStatus",
- "EventBalanceUpdate",
- "Signals",
-]
-
-
-class EventAttempt(BaseModel):
- id: Optional[str] = None
- """The ID of the attempt."""
-
- attempt_number: Optional[int] = None
- """The attempt number."""
-
- capability: Optional[Literal["rcs", "text", "whatsapp", "viber"]] = None
- """The capability of the attempt."""
-
- content: Optional[str] = None
- """The content of the attempt."""
-
- created_at: Optional[datetime] = None
-
- sender_id: Optional[str] = None
- """The sender ID of the attempt."""
-
- status: Optional[Literal["pending", "delivered", "failed", "rate_limited", "expired"]] = None
- """The status of the attempt. Possible values are:
-
- - `pending` - The attempt is pending.
- - `delivered` - The attempt was delivered.
- - `failed` - The attempt failed.
- - `rate_limited` - The authentication was rate limited and cannot be retried.
- - `expired` - The authentication has expired and cannot be retried.
- """
-
- type: Optional[Literal["attempt", "check", "delivery_status", "balance_update"]] = None
- """The type of the event."""
-
-
-class EventCheck(BaseModel):
- id: Optional[str] = None
- """The ID of the check."""
-
- code: Optional[str] = None
- """The code that was checked."""
-
- created_at: Optional[datetime] = None
-
- status: Optional[
- Literal["unknown", "valid", "invalid", "without_attempt", "rate_limited", "already_validated", "expired_auth"]
- ] = None
- """The status of the check. Possible values are:
-
- - `unknown` - The status is unknown.
- - `valid` - The code is valid.
- - `invalid` - The code is invalid.
- - `without_attempt` - No attempt was sent yet, so a check cannot be completed.
- - `rate_limited` - The authentication was rate limited and cannot be checked.
- - `already_validated` - The authentication has already been validated.
- - `expired_auth` - The authentication has expired and cannot be checked.
- """
-
- type: Optional[Literal["attempt", "check", "delivery_status", "balance_update"]] = None
- """The type of the event."""
-
-
-class EventDeliveryStatus(BaseModel):
- attempt_id: Optional[str] = None
- """The ID of the attempt."""
-
- attempt_number: Optional[int] = None
- """The attempt number."""
-
- created_at: Optional[datetime] = None
-
- originated_at: Optional[datetime] = None
- """The date and time from the provider."""
-
- status: Optional[Literal["unknown", "submitted", "in_transit", "delivered", "undeliverable"]] = None
- """The status of the delivery. Possible values are:
-
- - `unknown` - The status of the delivery is unknown.
- - `submitted` - The message has been submitted to the carrier.
- - `in_transit` - The message is in transit to the recipient.
- - `delivered` - The message has been delivered to the recipient.
- - `undeliverable` - The message could not be delivered to the recipient.
- """
-
- type: Optional[Literal["attempt", "check", "delivery_status", "balance_update"]] = None
- """The type of the event."""
-
-
-class EventBalanceUpdate(BaseModel):
- amount: Optional[float] = None
- """The amount of the balance update."""
-
- balance_update_type: Optional[
- Literal[
- "unknown",
- "authentication",
- "attempt",
- "attempt_pending",
- "attempt_success",
- "authentication_pending",
- "authentication_success",
- ]
- ] = None
-
- created_at: Optional[datetime] = None
-
- type: Optional[Literal["attempt", "check", "delivery_status", "balance_update"]] = None
- """The type of the event."""
-
-
-Event: TypeAlias = Union[EventAttempt, EventCheck, EventDeliveryStatus, EventBalanceUpdate]
-
-
-class Signals(BaseModel):
- app_realm: Optional[str] = None
- """The Android SMS Retriever API hash code that identifies your app.
-
- This allows you to automatically retrieve and fill the OTP code on Android
- devices.
- """
-
- app_version: Optional[str] = None
- """The version of your application."""
-
- device_id: Optional[str] = None
- """Unique identifier for the user's device.
-
- For Android, this corresponds to the `ANDROID_ID` and for iOS, this corresponds
- to the `identifierForVendor`.
- """
-
- device_model: Optional[str] = None
- """The model of the user's device."""
-
- device_type: Optional[Literal["IOS", "ANDROID", "WEB"]] = None
- """The type of device the user is using."""
-
- ip: Optional[str] = None
- """The IP address of the user's device."""
-
- is_returning_user: Optional[bool] = None
- """
- This signal should do more than just confirm if a user is returning to your app;
- it should provide a higher level of trust, indicating that the user is genuine.
- For more details, refer to [Signals](/guides/prevent-fraud#signals).
- """
-
- os_version: Optional[str] = None
- """The version of the user's device operating system."""
-
-
-class AuthenticationRetrieveResponse(BaseModel):
- correlation_id: Optional[str] = None
- """A unique, user-defined identifier that will be included in webhook events."""
-
- created_at: Optional[datetime] = None
-
- events: Optional[List[Event]] = None
- """Represents a collection of events that occur during the authentication process.
-
- Each event captures specific actions and outcomes related to the authentication
- attempts, checks, delivery statuses, and balance updates. The array can contain
- different types of events, each with its own structure and properties.
- """
-
- phone_number: Optional[str] = None
- """An E.164 formatted phone number."""
-
- signals: Optional[Signals] = None
- """
- [Signals](/guides/prevent-fraud#signals) are data points used to distinguish
- between fraudulent and legitimate users.
- """
-
- template_id: Optional[str] = None
- """The template id associated with the message content variant to be sent."""
-
- uuid: Optional[str] = None
- """The UUID of the corresponding authentication."""
diff --git a/src/prelude/types/check_create_params.py b/src/prelude/types/check_create_params.py
deleted file mode 100644
index 98acef6..0000000
--- a/src/prelude/types/check_create_params.py
+++ /dev/null
@@ -1,18 +0,0 @@
-# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
-
-from __future__ import annotations
-
-from typing_extensions import Required, TypedDict
-
-__all__ = ["CheckCreateParams"]
-
-
-class CheckCreateParams(TypedDict, total=False):
- authentication_uuid: Required[str]
- """The authentication UUID that was returned when you created the authentication."""
-
- check_code: Required[str]
- """The code that the user entered."""
-
- customer_uuid: Required[str]
- """Your customer UUID, which can be found in the API settings in the Dashboard."""
diff --git a/src/prelude/types/check_create_response.py b/src/prelude/types/check_create_response.py
deleted file mode 100644
index 38eb680..0000000
--- a/src/prelude/types/check_create_response.py
+++ /dev/null
@@ -1,27 +0,0 @@
-# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
-
-from typing import Optional
-from typing_extensions import Literal
-
-from .._models import BaseModel
-
-__all__ = ["CheckCreateResponse"]
-
-
-class CheckCreateResponse(BaseModel):
- authentication_uuid: Optional[str] = None
- """The UUID of the corresponding authentication."""
-
- status: Optional[
- Literal["unknown", "valid", "invalid", "without_attempt", "rate_limited", "already_validated", "expired_auth"]
- ] = None
- """The status of the check. Possible values are:
-
- - `unknown` - The status is unknown.
- - `valid` - The code is valid.
- - `invalid` - The code is invalid.
- - `without_attempt` - No attempt was sent yet, so a check cannot be completed.
- - `rate_limited` - The authentication was rate limited and cannot be checked.
- - `already_validated` - The authentication has already been validated.
- - `expired_auth` - The authentication has expired and cannot be checked.
- """
diff --git a/src/prelude/types/lookup_retrieve_response.py b/src/prelude/types/lookup_retrieve_response.py
deleted file mode 100644
index 3711719..0000000
--- a/src/prelude/types/lookup_retrieve_response.py
+++ /dev/null
@@ -1,83 +0,0 @@
-# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
-
-from typing import Optional
-from typing_extensions import Literal
-
-from .._models import BaseModel
-
-__all__ = ["LookupRetrieveResponse"]
-
-
-class LookupRetrieveResponse(BaseModel):
- carrier: Optional[str] = None
- """The carrier of the phone number."""
-
- country_code: Optional[str] = None
- """The ISO 3166-1 alpha-2 country code of the phone number."""
-
- line_type: Optional[
- Literal[
- "CallingCards",
- "FixedLine",
- "InternetServiceProvider",
- "LocalRate",
- "Mobile",
- "Other",
- "Pager",
- "PayPhone",
- "PremiumRate",
- "Satellite",
- "Service",
- "SharedCost",
- "ShortCodesCommercial",
- "TollFree",
- "UniversalAccess",
- "Unknown",
- "VPN",
- "VoiceMail",
- "Voip",
- ]
- ] = None
- """The type of phone line.
-
- - `CallingCards` - Numbers that are associated with providers of pre-paid
- domestic and international calling cards.
- - `FixedLine` - Landline phone numbers.
- - `InternetServiceProvider` - Numbers reserved for ISPs.
- - `LocalRate` - Numbers that can be assigned non-geographically.
- - `Mobile` - Mobile phone numbers.
- - `Other` - Other types of services.
- - `Pager` - Number ranges specifically allocated to paging devices.
- - `PayPhone` - Allocated numbers for payphone kiosks in some countries.
- - `PremiumRate` - Landline numbers where the calling party pays more than
- standard.
- - `Satellite` - Satellite phone numbers.
- - `Service` - Automated applications.
- - `SharedCost` - Specific landline ranges where the cost of making the call is
- shared between the calling and called party.
- - `ShortCodesCommercial` - Short codes are memorable, easy-to-use numbers, like
- the UK's NHS 111, often sold to businesses. Not available in all countries.
- - `TollFree` - Number where the called party pays for the cost of the call not
- the calling party.
- - `UniversalAccess` - Number ranges reserved for Universal Access initiatives.
- - `Unknown` - Unknown phone number type.
- - `VPN` - Numbers are used exclusively within a private telecommunications
- network, connecting the operator's terminals internally and not accessible via
- the public telephone network.
- - `VoiceMail` - A specific category of Interactive Voice Response (IVR)
- services.
- - `Voip` - Specific ranges for providers of VoIP services to allow incoming
- calls from the regular telephony network.
- """
-
- mcc: Optional[str] = None
- """The mobile country code of the phone number."""
-
- mnc: Optional[str] = None
- """The mobile network code of the phone number."""
-
- number_ported: Optional[bool] = None
- """Whether the phone number has been ported."""
-
- phone_number: Optional[str] = None
- """An E.164 formatted phone number."""
diff --git a/src/prelude/types/retry_create_params.py b/src/prelude/types/retry_create_params.py
deleted file mode 100644
index 23d83d5..0000000
--- a/src/prelude/types/retry_create_params.py
+++ /dev/null
@@ -1,15 +0,0 @@
-# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
-
-from __future__ import annotations
-
-from typing_extensions import Required, TypedDict
-
-__all__ = ["RetryCreateParams"]
-
-
-class RetryCreateParams(TypedDict, total=False):
- authentication_uuid: Required[str]
- """The authentication UUID that was returned when you created the authentication."""
-
- customer_uuid: Required[str]
- """Your customer UUID, which can be found in the API settings in the dashboard."""
diff --git a/src/prelude/types/retry_create_response.py b/src/prelude/types/retry_create_response.py
deleted file mode 100644
index 56134f8..0000000
--- a/src/prelude/types/retry_create_response.py
+++ /dev/null
@@ -1,35 +0,0 @@
-# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
-
-from typing import Optional
-from datetime import datetime
-from typing_extensions import Literal
-
-from .._models import BaseModel
-
-__all__ = ["RetryCreateResponse"]
-
-
-class RetryCreateResponse(BaseModel):
- authentication_uuid: Optional[str] = None
- """The UUID of the corresponding authentication."""
-
- created_at: Optional[datetime] = None
-
- next_retry_at: Optional[datetime] = None
- """The time at which the next retry will be available."""
-
- remaining_retry: Optional[int] = None
- """The number of remaining retries."""
-
- status: Optional[
- Literal["approved", "denied", "no_attempt", "rate_limited", "expired_auth", "already_validated"]
- ] = None
- """The status of the retry. Possible values are:
-
- - `approved` - The retry was approved and a new code was sent.
- - `denied` - The retry was denied.
- - `no_attempt` - No attempt was sent yet, so a retry cannot be completed.
- - `rate_limited` - The authentication was rate limited and cannot be retried.
- - `expired_auth` - The authentication has expired and cannot be retried.
- - `already_validated` - The authentication has already been validated.
- """
diff --git a/src/prelude/__init__.py b/src/prelude_sdk/__init__.py
similarity index 94%
rename from src/prelude/__init__.py
rename to src/prelude_sdk/__init__.py
index 64f4dfe..9266f5d 100644
--- a/src/prelude/__init__.py
+++ b/src/prelude_sdk/__init__.py
@@ -72,12 +72,12 @@
# Update the __module__ attribute for exported symbols so that
# error messages point to this module instead of the module
# it was originally defined in, e.g.
-# prelude._exceptions.NotFoundError -> prelude.NotFoundError
+# prelude_sdk._exceptions.NotFoundError -> prelude_sdk.NotFoundError
__locals = locals()
for __name in __all__:
if not __name.startswith("__"):
try:
- __locals[__name].__module__ = "prelude"
+ __locals[__name].__module__ = "prelude_sdk"
except (TypeError, AttributeError):
# Some of our exported symbols are builtins which we can't set attributes for.
pass
diff --git a/src/prelude/_base_client.py b/src/prelude_sdk/_base_client.py
similarity index 99%
rename from src/prelude/_base_client.py
rename to src/prelude_sdk/_base_client.py
index d80045c..fca20ab 100644
--- a/src/prelude/_base_client.py
+++ b/src/prelude_sdk/_base_client.py
@@ -367,7 +367,7 @@ def __init__(
if max_retries is None: # pyright: ignore[reportUnnecessaryComparison]
raise TypeError(
- "max_retries cannot be None. If you want to disable retries, pass `0`; if you want unlimited retries, pass `math.inf` or a very high number; if you want the default behavior, pass `prelude.DEFAULT_MAX_RETRIES`"
+ "max_retries cannot be None. If you want to disable retries, pass `0`; if you want unlimited retries, pass `math.inf` or a very high number; if you want the default behavior, pass `prelude_sdk.DEFAULT_MAX_RETRIES`"
)
def _enforce_trailing_slash(self, url: URL) -> URL:
diff --git a/src/prelude/_client.py b/src/prelude_sdk/_client.py
similarity index 71%
rename from src/prelude/_client.py
rename to src/prelude_sdk/_client.py
index 7f7f7b9..93f9266 100644
--- a/src/prelude/_client.py
+++ b/src/prelude_sdk/_client.py
@@ -46,22 +46,18 @@
class Prelude(SyncAPIClient):
- authentication: resources.AuthenticationResource
- check: resources.CheckResource
- retry: resources.RetryResource
- lookup: resources.LookupResource
+ verification: resources.VerificationResource
+ transactional: resources.TransactionalResource
with_raw_response: PreludeWithRawResponse
with_streaming_response: PreludeWithStreamedResponse
# client options
- api_key: str
- customer_uuid: str
+ api_token: str
def __init__(
self,
*,
- api_key: str | None = None,
- customer_uuid: str | None = None,
+ api_token: str | None = None,
base_url: str | httpx.URL | None = None,
timeout: Union[float, Timeout, None, NotGiven] = NOT_GIVEN,
max_retries: int = DEFAULT_MAX_RETRIES,
@@ -81,32 +77,22 @@ def __init__(
# part of our public interface in the future.
_strict_response_validation: bool = False,
) -> None:
- """Construct a new synchronous prelude client instance.
+ """Construct a new synchronous Prelude client instance.
- This automatically infers the following arguments from their corresponding environment variables if they are not provided:
- - `api_key` from `PRELUDE_API_KEY`
- - `customer_uuid` from `PRELUDE_CUSTOMER_UUID`
+ This automatically infers the `api_token` argument from the `API_TOKEN` environment variable if it is not provided.
"""
- if api_key is None:
- api_key = os.environ.get("PRELUDE_API_KEY")
- if api_key is None:
+ if api_token is None:
+ api_token = os.environ.get("API_TOKEN")
+ if api_token is None:
raise PreludeError(
- "The api_key client option must be set either by passing api_key to the client or by setting the PRELUDE_API_KEY environment variable"
+ "The api_token client option must be set either by passing api_token to the client or by setting the API_TOKEN environment variable"
)
- self.api_key = api_key
-
- if customer_uuid is None:
- customer_uuid = os.environ.get("PRELUDE_CUSTOMER_UUID")
- if customer_uuid is None:
- raise PreludeError(
- "The customer_uuid client option must be set either by passing customer_uuid to the client or by setting the PRELUDE_CUSTOMER_UUID environment variable"
- )
- self.customer_uuid = customer_uuid
+ self.api_token = api_token
if base_url is None:
base_url = os.environ.get("PRELUDE_BASE_URL")
if base_url is None:
- base_url = f"https://api.ding.live/v1"
+ base_url = f"https://api.prelude.dev"
super().__init__(
version=__version__,
@@ -119,10 +105,8 @@ def __init__(
_strict_response_validation=_strict_response_validation,
)
- self.authentication = resources.AuthenticationResource(self)
- self.check = resources.CheckResource(self)
- self.retry = resources.RetryResource(self)
- self.lookup = resources.LookupResource(self)
+ self.verification = resources.VerificationResource(self)
+ self.transactional = resources.TransactionalResource(self)
self.with_raw_response = PreludeWithRawResponse(self)
self.with_streaming_response = PreludeWithStreamedResponse(self)
@@ -134,8 +118,8 @@ def qs(self) -> Querystring:
@property
@override
def auth_headers(self) -> dict[str, str]:
- api_key = self.api_key
- return {"x-api-key": api_key}
+ api_token = self.api_token
+ return {"Authorization": f"Bearer {api_token}"}
@property
@override
@@ -143,15 +127,13 @@ def default_headers(self) -> dict[str, str | Omit]:
return {
**super().default_headers,
"X-Stainless-Async": "false",
- "CUSTOMER_UUID": self.customer_uuid,
**self._custom_headers,
}
def copy(
self,
*,
- api_key: str | None = None,
- customer_uuid: str | None = None,
+ api_token: str | None = None,
base_url: str | httpx.URL | None = None,
timeout: float | Timeout | None | NotGiven = NOT_GIVEN,
http_client: httpx.Client | None = None,
@@ -185,8 +167,7 @@ def copy(
http_client = http_client or self._client
return self.__class__(
- api_key=api_key or self.api_key,
- customer_uuid=customer_uuid or self.customer_uuid,
+ api_token=api_token or self.api_token,
base_url=base_url or self.base_url,
timeout=self.timeout if isinstance(timeout, NotGiven) else timeout,
http_client=http_client,
@@ -235,22 +216,18 @@ def _make_status_error(
class AsyncPrelude(AsyncAPIClient):
- authentication: resources.AsyncAuthenticationResource
- check: resources.AsyncCheckResource
- retry: resources.AsyncRetryResource
- lookup: resources.AsyncLookupResource
+ verification: resources.AsyncVerificationResource
+ transactional: resources.AsyncTransactionalResource
with_raw_response: AsyncPreludeWithRawResponse
with_streaming_response: AsyncPreludeWithStreamedResponse
# client options
- api_key: str
- customer_uuid: str
+ api_token: str
def __init__(
self,
*,
- api_key: str | None = None,
- customer_uuid: str | None = None,
+ api_token: str | None = None,
base_url: str | httpx.URL | None = None,
timeout: Union[float, Timeout, None, NotGiven] = NOT_GIVEN,
max_retries: int = DEFAULT_MAX_RETRIES,
@@ -270,32 +247,22 @@ def __init__(
# part of our public interface in the future.
_strict_response_validation: bool = False,
) -> None:
- """Construct a new async prelude client instance.
+ """Construct a new async Prelude client instance.
- This automatically infers the following arguments from their corresponding environment variables if they are not provided:
- - `api_key` from `PRELUDE_API_KEY`
- - `customer_uuid` from `PRELUDE_CUSTOMER_UUID`
+ This automatically infers the `api_token` argument from the `API_TOKEN` environment variable if it is not provided.
"""
- if api_key is None:
- api_key = os.environ.get("PRELUDE_API_KEY")
- if api_key is None:
- raise PreludeError(
- "The api_key client option must be set either by passing api_key to the client or by setting the PRELUDE_API_KEY environment variable"
- )
- self.api_key = api_key
-
- if customer_uuid is None:
- customer_uuid = os.environ.get("PRELUDE_CUSTOMER_UUID")
- if customer_uuid is None:
+ if api_token is None:
+ api_token = os.environ.get("API_TOKEN")
+ if api_token is None:
raise PreludeError(
- "The customer_uuid client option must be set either by passing customer_uuid to the client or by setting the PRELUDE_CUSTOMER_UUID environment variable"
+ "The api_token client option must be set either by passing api_token to the client or by setting the API_TOKEN environment variable"
)
- self.customer_uuid = customer_uuid
+ self.api_token = api_token
if base_url is None:
base_url = os.environ.get("PRELUDE_BASE_URL")
if base_url is None:
- base_url = f"https://api.ding.live/v1"
+ base_url = f"https://api.prelude.dev"
super().__init__(
version=__version__,
@@ -308,10 +275,8 @@ def __init__(
_strict_response_validation=_strict_response_validation,
)
- self.authentication = resources.AsyncAuthenticationResource(self)
- self.check = resources.AsyncCheckResource(self)
- self.retry = resources.AsyncRetryResource(self)
- self.lookup = resources.AsyncLookupResource(self)
+ self.verification = resources.AsyncVerificationResource(self)
+ self.transactional = resources.AsyncTransactionalResource(self)
self.with_raw_response = AsyncPreludeWithRawResponse(self)
self.with_streaming_response = AsyncPreludeWithStreamedResponse(self)
@@ -323,8 +288,8 @@ def qs(self) -> Querystring:
@property
@override
def auth_headers(self) -> dict[str, str]:
- api_key = self.api_key
- return {"x-api-key": api_key}
+ api_token = self.api_token
+ return {"Authorization": f"Bearer {api_token}"}
@property
@override
@@ -332,15 +297,13 @@ def default_headers(self) -> dict[str, str | Omit]:
return {
**super().default_headers,
"X-Stainless-Async": f"async:{get_async_library()}",
- "CUSTOMER_UUID": self.customer_uuid,
**self._custom_headers,
}
def copy(
self,
*,
- api_key: str | None = None,
- customer_uuid: str | None = None,
+ api_token: str | None = None,
base_url: str | httpx.URL | None = None,
timeout: float | Timeout | None | NotGiven = NOT_GIVEN,
http_client: httpx.AsyncClient | None = None,
@@ -374,8 +337,7 @@ def copy(
http_client = http_client or self._client
return self.__class__(
- api_key=api_key or self.api_key,
- customer_uuid=customer_uuid or self.customer_uuid,
+ api_token=api_token or self.api_token,
base_url=base_url or self.base_url,
timeout=self.timeout if isinstance(timeout, NotGiven) else timeout,
http_client=http_client,
@@ -425,34 +387,26 @@ def _make_status_error(
class PreludeWithRawResponse:
def __init__(self, client: Prelude) -> None:
- self.authentication = resources.AuthenticationResourceWithRawResponse(client.authentication)
- self.check = resources.CheckResourceWithRawResponse(client.check)
- self.retry = resources.RetryResourceWithRawResponse(client.retry)
- self.lookup = resources.LookupResourceWithRawResponse(client.lookup)
+ self.verification = resources.VerificationResourceWithRawResponse(client.verification)
+ self.transactional = resources.TransactionalResourceWithRawResponse(client.transactional)
class AsyncPreludeWithRawResponse:
def __init__(self, client: AsyncPrelude) -> None:
- self.authentication = resources.AsyncAuthenticationResourceWithRawResponse(client.authentication)
- self.check = resources.AsyncCheckResourceWithRawResponse(client.check)
- self.retry = resources.AsyncRetryResourceWithRawResponse(client.retry)
- self.lookup = resources.AsyncLookupResourceWithRawResponse(client.lookup)
+ self.verification = resources.AsyncVerificationResourceWithRawResponse(client.verification)
+ self.transactional = resources.AsyncTransactionalResourceWithRawResponse(client.transactional)
class PreludeWithStreamedResponse:
def __init__(self, client: Prelude) -> None:
- self.authentication = resources.AuthenticationResourceWithStreamingResponse(client.authentication)
- self.check = resources.CheckResourceWithStreamingResponse(client.check)
- self.retry = resources.RetryResourceWithStreamingResponse(client.retry)
- self.lookup = resources.LookupResourceWithStreamingResponse(client.lookup)
+ self.verification = resources.VerificationResourceWithStreamingResponse(client.verification)
+ self.transactional = resources.TransactionalResourceWithStreamingResponse(client.transactional)
class AsyncPreludeWithStreamedResponse:
def __init__(self, client: AsyncPrelude) -> None:
- self.authentication = resources.AsyncAuthenticationResourceWithStreamingResponse(client.authentication)
- self.check = resources.AsyncCheckResourceWithStreamingResponse(client.check)
- self.retry = resources.AsyncRetryResourceWithStreamingResponse(client.retry)
- self.lookup = resources.AsyncLookupResourceWithStreamingResponse(client.lookup)
+ self.verification = resources.AsyncVerificationResourceWithStreamingResponse(client.verification)
+ self.transactional = resources.AsyncTransactionalResourceWithStreamingResponse(client.transactional)
Client = Prelude
diff --git a/src/prelude/_compat.py b/src/prelude_sdk/_compat.py
similarity index 100%
rename from src/prelude/_compat.py
rename to src/prelude_sdk/_compat.py
diff --git a/src/prelude/_constants.py b/src/prelude_sdk/_constants.py
similarity index 100%
rename from src/prelude/_constants.py
rename to src/prelude_sdk/_constants.py
diff --git a/src/prelude/_exceptions.py b/src/prelude_sdk/_exceptions.py
similarity index 100%
rename from src/prelude/_exceptions.py
rename to src/prelude_sdk/_exceptions.py
diff --git a/src/prelude/_files.py b/src/prelude_sdk/_files.py
similarity index 100%
rename from src/prelude/_files.py
rename to src/prelude_sdk/_files.py
diff --git a/src/prelude/_models.py b/src/prelude_sdk/_models.py
similarity index 100%
rename from src/prelude/_models.py
rename to src/prelude_sdk/_models.py
diff --git a/src/prelude/_qs.py b/src/prelude_sdk/_qs.py
similarity index 100%
rename from src/prelude/_qs.py
rename to src/prelude_sdk/_qs.py
diff --git a/src/prelude/_resource.py b/src/prelude_sdk/_resource.py
similarity index 100%
rename from src/prelude/_resource.py
rename to src/prelude_sdk/_resource.py
diff --git a/src/prelude/_response.py b/src/prelude_sdk/_response.py
similarity index 98%
rename from src/prelude/_response.py
rename to src/prelude_sdk/_response.py
index 1bc2115..3039cae 100644
--- a/src/prelude/_response.py
+++ b/src/prelude_sdk/_response.py
@@ -211,7 +211,9 @@ def _parse(self, *, to: type[_T] | None = None) -> R | _T:
return cast(R, response)
if inspect.isclass(origin) and not issubclass(origin, BaseModel) and issubclass(origin, pydantic.BaseModel):
- raise TypeError("Pydantic models must subclass our base model type, e.g. `from prelude import BaseModel`")
+ raise TypeError(
+ "Pydantic models must subclass our base model type, e.g. `from prelude_sdk import BaseModel`"
+ )
if (
cast_to is not object
@@ -277,7 +279,7 @@ def parse(self, *, to: type[_T] | None = None) -> R | _T:
the `to` argument, e.g.
```py
- from prelude import BaseModel
+ from prelude_sdk import BaseModel
class MyModel(BaseModel):
@@ -379,7 +381,7 @@ async def parse(self, *, to: type[_T] | None = None) -> R | _T:
the `to` argument, e.g.
```py
- from prelude import BaseModel
+ from prelude_sdk import BaseModel
class MyModel(BaseModel):
@@ -550,7 +552,7 @@ async def stream_to_file(
class MissingStreamClassError(TypeError):
def __init__(self) -> None:
super().__init__(
- "The `stream` argument was set to `True` but the `stream_cls` argument was not given. See `prelude._streaming` for reference",
+ "The `stream` argument was set to `True` but the `stream_cls` argument was not given. See `prelude_sdk._streaming` for reference",
)
diff --git a/src/prelude/_streaming.py b/src/prelude_sdk/_streaming.py
similarity index 100%
rename from src/prelude/_streaming.py
rename to src/prelude_sdk/_streaming.py
diff --git a/src/prelude/_types.py b/src/prelude_sdk/_types.py
similarity index 99%
rename from src/prelude/_types.py
rename to src/prelude_sdk/_types.py
index bec3af8..ddd58ab 100644
--- a/src/prelude/_types.py
+++ b/src/prelude_sdk/_types.py
@@ -81,7 +81,7 @@
# This unfortunately means that you will either have
# to import this type and pass it explicitly:
#
-# from prelude import NoneType
+# from prelude_sdk import NoneType
# client.get('/foo', cast_to=NoneType)
#
# or build it yourself:
diff --git a/src/prelude/_utils/__init__.py b/src/prelude_sdk/_utils/__init__.py
similarity index 100%
rename from src/prelude/_utils/__init__.py
rename to src/prelude_sdk/_utils/__init__.py
diff --git a/src/prelude/_utils/_logs.py b/src/prelude_sdk/_utils/_logs.py
similarity index 76%
rename from src/prelude/_utils/_logs.py
rename to src/prelude_sdk/_utils/_logs.py
index 3d786e0..280cd77 100644
--- a/src/prelude/_utils/_logs.py
+++ b/src/prelude_sdk/_utils/_logs.py
@@ -1,12 +1,12 @@
import os
import logging
-logger: logging.Logger = logging.getLogger("prelude")
+logger: logging.Logger = logging.getLogger("prelude_sdk")
httpx_logger: logging.Logger = logging.getLogger("httpx")
def _basic_config() -> None:
- # e.g. [2023-10-05 14:12:26 - prelude._base_client:818 - DEBUG] HTTP Request: POST http://127.0.0.1:4010/foo/bar "200 OK"
+ # e.g. [2023-10-05 14:12:26 - prelude_sdk._base_client:818 - DEBUG] HTTP Request: POST http://127.0.0.1:4010/foo/bar "200 OK"
logging.basicConfig(
format="[%(asctime)s - %(name)s:%(lineno)d - %(levelname)s] %(message)s",
datefmt="%Y-%m-%d %H:%M:%S",
diff --git a/src/prelude/_utils/_proxy.py b/src/prelude_sdk/_utils/_proxy.py
similarity index 100%
rename from src/prelude/_utils/_proxy.py
rename to src/prelude_sdk/_utils/_proxy.py
diff --git a/src/prelude/_utils/_reflection.py b/src/prelude_sdk/_utils/_reflection.py
similarity index 100%
rename from src/prelude/_utils/_reflection.py
rename to src/prelude_sdk/_utils/_reflection.py
diff --git a/src/prelude/_utils/_streams.py b/src/prelude_sdk/_utils/_streams.py
similarity index 100%
rename from src/prelude/_utils/_streams.py
rename to src/prelude_sdk/_utils/_streams.py
diff --git a/src/prelude/_utils/_sync.py b/src/prelude_sdk/_utils/_sync.py
similarity index 100%
rename from src/prelude/_utils/_sync.py
rename to src/prelude_sdk/_utils/_sync.py
diff --git a/src/prelude/_utils/_transform.py b/src/prelude_sdk/_utils/_transform.py
similarity index 100%
rename from src/prelude/_utils/_transform.py
rename to src/prelude_sdk/_utils/_transform.py
diff --git a/src/prelude/_utils/_typing.py b/src/prelude_sdk/_utils/_typing.py
similarity index 100%
rename from src/prelude/_utils/_typing.py
rename to src/prelude_sdk/_utils/_typing.py
diff --git a/src/prelude/_utils/_utils.py b/src/prelude_sdk/_utils/_utils.py
similarity index 100%
rename from src/prelude/_utils/_utils.py
rename to src/prelude_sdk/_utils/_utils.py
diff --git a/src/prelude/_version.py b/src/prelude_sdk/_version.py
similarity index 50%
rename from src/prelude/_version.py
rename to src/prelude_sdk/_version.py
index ccc436a..70f7bb1 100644
--- a/src/prelude/_version.py
+++ b/src/prelude_sdk/_version.py
@@ -1,4 +1,4 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
-__title__ = "prelude"
-__version__ = "0.0.1-alpha.0"
+__title__ = "prelude_sdk"
+__version__ = "0.0.1-alpha.0" # x-release-please-version
diff --git a/src/prelude_sdk/lib/.keep b/src/prelude_sdk/lib/.keep
new file mode 100644
index 0000000..5e2c99f
--- /dev/null
+++ b/src/prelude_sdk/lib/.keep
@@ -0,0 +1,4 @@
+File generated from our OpenAPI spec by Stainless.
+
+This directory can be used to store custom files to expand the SDK.
+It is ignored by Stainless code generation and its content (other than this keep file) won't be touched.
\ No newline at end of file
diff --git a/src/prelude/py.typed b/src/prelude_sdk/py.typed
similarity index 100%
rename from src/prelude/py.typed
rename to src/prelude_sdk/py.typed
diff --git a/src/prelude_sdk/resources/__init__.py b/src/prelude_sdk/resources/__init__.py
new file mode 100644
index 0000000..9e99ab8
--- /dev/null
+++ b/src/prelude_sdk/resources/__init__.py
@@ -0,0 +1,33 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from .verification import (
+ VerificationResource,
+ AsyncVerificationResource,
+ VerificationResourceWithRawResponse,
+ AsyncVerificationResourceWithRawResponse,
+ VerificationResourceWithStreamingResponse,
+ AsyncVerificationResourceWithStreamingResponse,
+)
+from .transactional import (
+ TransactionalResource,
+ AsyncTransactionalResource,
+ TransactionalResourceWithRawResponse,
+ AsyncTransactionalResourceWithRawResponse,
+ TransactionalResourceWithStreamingResponse,
+ AsyncTransactionalResourceWithStreamingResponse,
+)
+
+__all__ = [
+ "VerificationResource",
+ "AsyncVerificationResource",
+ "VerificationResourceWithRawResponse",
+ "AsyncVerificationResourceWithRawResponse",
+ "VerificationResourceWithStreamingResponse",
+ "AsyncVerificationResourceWithStreamingResponse",
+ "TransactionalResource",
+ "AsyncTransactionalResource",
+ "TransactionalResourceWithRawResponse",
+ "AsyncTransactionalResourceWithRawResponse",
+ "TransactionalResourceWithStreamingResponse",
+ "AsyncTransactionalResourceWithStreamingResponse",
+]
diff --git a/src/prelude_sdk/resources/transactional.py b/src/prelude_sdk/resources/transactional.py
new file mode 100644
index 0000000..3835c95
--- /dev/null
+++ b/src/prelude_sdk/resources/transactional.py
@@ -0,0 +1,230 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from __future__ import annotations
+
+from typing import Dict
+
+import httpx
+
+from ..types import transactional_send_params
+from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven
+from .._utils import (
+ maybe_transform,
+ async_maybe_transform,
+)
+from .._compat import cached_property
+from .._resource import SyncAPIResource, AsyncAPIResource
+from .._response import (
+ to_raw_response_wrapper,
+ to_streamed_response_wrapper,
+ async_to_raw_response_wrapper,
+ async_to_streamed_response_wrapper,
+)
+from .._base_client import make_request_options
+from ..types.transactional_send_response import TransactionalSendResponse
+
+__all__ = ["TransactionalResource", "AsyncTransactionalResource"]
+
+
+class TransactionalResource(SyncAPIResource):
+ @cached_property
+ def with_raw_response(self) -> TransactionalResourceWithRawResponse:
+ """
+ This property can be used as a prefix for any HTTP method call to return the
+ the raw response object instead of the parsed content.
+
+ For more information, see https://www.github.com/prelude-so/python-sdk#accessing-raw-response-data-eg-headers
+ """
+ return TransactionalResourceWithRawResponse(self)
+
+ @cached_property
+ def with_streaming_response(self) -> TransactionalResourceWithStreamingResponse:
+ """
+ An alternative to `.with_raw_response` that doesn't eagerly read the response body.
+
+ For more information, see https://www.github.com/prelude-so/python-sdk#with_streaming_response
+ """
+ return TransactionalResourceWithStreamingResponse(self)
+
+ def send(
+ self,
+ *,
+ template_id: str,
+ to: str,
+ callback_url: str | NotGiven = NOT_GIVEN,
+ correlation_id: str | NotGiven = NOT_GIVEN,
+ expires_at: str | NotGiven = NOT_GIVEN,
+ from_: str | NotGiven = NOT_GIVEN,
+ variables: Dict[str, str] | NotGiven = NOT_GIVEN,
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
+ # The extra values given here take precedence over values defined on the client or passed to this method.
+ extra_headers: Headers | None = None,
+ extra_query: Query | None = None,
+ extra_body: Body | None = None,
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
+ ) -> TransactionalSendResponse:
+ """
+ Send a transactional message
+
+ Args:
+ template_id: The template identifier.
+
+ to: The recipient's phone number.
+
+ callback_url: The callback URL.
+
+ correlation_id: A unique, user-defined identifier that will be included in webhook events.
+
+ expires_at: The message expiration date.
+
+ from_: The Sender ID.
+
+ variables: The variables to be replaced in the template.
+
+ extra_headers: Send extra headers
+
+ extra_query: Add additional query parameters to the request
+
+ extra_body: Add additional JSON properties to the request
+
+ timeout: Override the client-level default timeout for this request, in seconds
+ """
+ return self._post(
+ "/v2/transactional",
+ body=maybe_transform(
+ {
+ "template_id": template_id,
+ "to": to,
+ "callback_url": callback_url,
+ "correlation_id": correlation_id,
+ "expires_at": expires_at,
+ "from_": from_,
+ "variables": variables,
+ },
+ transactional_send_params.TransactionalSendParams,
+ ),
+ options=make_request_options(
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
+ ),
+ cast_to=TransactionalSendResponse,
+ )
+
+
+class AsyncTransactionalResource(AsyncAPIResource):
+ @cached_property
+ def with_raw_response(self) -> AsyncTransactionalResourceWithRawResponse:
+ """
+ This property can be used as a prefix for any HTTP method call to return the
+ the raw response object instead of the parsed content.
+
+ For more information, see https://www.github.com/prelude-so/python-sdk#accessing-raw-response-data-eg-headers
+ """
+ return AsyncTransactionalResourceWithRawResponse(self)
+
+ @cached_property
+ def with_streaming_response(self) -> AsyncTransactionalResourceWithStreamingResponse:
+ """
+ An alternative to `.with_raw_response` that doesn't eagerly read the response body.
+
+ For more information, see https://www.github.com/prelude-so/python-sdk#with_streaming_response
+ """
+ return AsyncTransactionalResourceWithStreamingResponse(self)
+
+ async def send(
+ self,
+ *,
+ template_id: str,
+ to: str,
+ callback_url: str | NotGiven = NOT_GIVEN,
+ correlation_id: str | NotGiven = NOT_GIVEN,
+ expires_at: str | NotGiven = NOT_GIVEN,
+ from_: str | NotGiven = NOT_GIVEN,
+ variables: Dict[str, str] | NotGiven = NOT_GIVEN,
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
+ # The extra values given here take precedence over values defined on the client or passed to this method.
+ extra_headers: Headers | None = None,
+ extra_query: Query | None = None,
+ extra_body: Body | None = None,
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
+ ) -> TransactionalSendResponse:
+ """
+ Send a transactional message
+
+ Args:
+ template_id: The template identifier.
+
+ to: The recipient's phone number.
+
+ callback_url: The callback URL.
+
+ correlation_id: A unique, user-defined identifier that will be included in webhook events.
+
+ expires_at: The message expiration date.
+
+ from_: The Sender ID.
+
+ variables: The variables to be replaced in the template.
+
+ extra_headers: Send extra headers
+
+ extra_query: Add additional query parameters to the request
+
+ extra_body: Add additional JSON properties to the request
+
+ timeout: Override the client-level default timeout for this request, in seconds
+ """
+ return await self._post(
+ "/v2/transactional",
+ body=await async_maybe_transform(
+ {
+ "template_id": template_id,
+ "to": to,
+ "callback_url": callback_url,
+ "correlation_id": correlation_id,
+ "expires_at": expires_at,
+ "from_": from_,
+ "variables": variables,
+ },
+ transactional_send_params.TransactionalSendParams,
+ ),
+ options=make_request_options(
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
+ ),
+ cast_to=TransactionalSendResponse,
+ )
+
+
+class TransactionalResourceWithRawResponse:
+ def __init__(self, transactional: TransactionalResource) -> None:
+ self._transactional = transactional
+
+ self.send = to_raw_response_wrapper(
+ transactional.send,
+ )
+
+
+class AsyncTransactionalResourceWithRawResponse:
+ def __init__(self, transactional: AsyncTransactionalResource) -> None:
+ self._transactional = transactional
+
+ self.send = async_to_raw_response_wrapper(
+ transactional.send,
+ )
+
+
+class TransactionalResourceWithStreamingResponse:
+ def __init__(self, transactional: TransactionalResource) -> None:
+ self._transactional = transactional
+
+ self.send = to_streamed_response_wrapper(
+ transactional.send,
+ )
+
+
+class AsyncTransactionalResourceWithStreamingResponse:
+ def __init__(self, transactional: AsyncTransactionalResource) -> None:
+ self._transactional = transactional
+
+ self.send = async_to_streamed_response_wrapper(
+ transactional.send,
+ )
diff --git a/src/prelude_sdk/resources/verification.py b/src/prelude_sdk/resources/verification.py
new file mode 100644
index 0000000..d8a1ba4
--- /dev/null
+++ b/src/prelude_sdk/resources/verification.py
@@ -0,0 +1,317 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from __future__ import annotations
+
+import httpx
+
+from ..types import verification_check_params, verification_create_params
+from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven
+from .._utils import (
+ maybe_transform,
+ async_maybe_transform,
+)
+from .._compat import cached_property
+from .._resource import SyncAPIResource, AsyncAPIResource
+from .._response import (
+ to_raw_response_wrapper,
+ to_streamed_response_wrapper,
+ async_to_raw_response_wrapper,
+ async_to_streamed_response_wrapper,
+)
+from .._base_client import make_request_options
+from ..types.verification_check_response import VerificationCheckResponse
+from ..types.verification_create_response import VerificationCreateResponse
+
+__all__ = ["VerificationResource", "AsyncVerificationResource"]
+
+
+class VerificationResource(SyncAPIResource):
+ @cached_property
+ def with_raw_response(self) -> VerificationResourceWithRawResponse:
+ """
+ This property can be used as a prefix for any HTTP method call to return the
+ the raw response object instead of the parsed content.
+
+ For more information, see https://www.github.com/prelude-so/python-sdk#accessing-raw-response-data-eg-headers
+ """
+ return VerificationResourceWithRawResponse(self)
+
+ @cached_property
+ def with_streaming_response(self) -> VerificationResourceWithStreamingResponse:
+ """
+ An alternative to `.with_raw_response` that doesn't eagerly read the response body.
+
+ For more information, see https://www.github.com/prelude-so/python-sdk#with_streaming_response
+ """
+ return VerificationResourceWithStreamingResponse(self)
+
+ def create(
+ self,
+ *,
+ target: verification_create_params.Target,
+ metadata: verification_create_params.Metadata | NotGiven = NOT_GIVEN,
+ options: verification_create_params.Options | NotGiven = NOT_GIVEN,
+ signals: verification_create_params.Signals | NotGiven = NOT_GIVEN,
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
+ # The extra values given here take precedence over values defined on the client or passed to this method.
+ extra_headers: Headers | None = None,
+ extra_query: Query | None = None,
+ extra_body: Body | None = None,
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
+ ) -> VerificationCreateResponse:
+ """Create a new verification for a specific phone number.
+
+ If another non-expired
+ verification exists (the request is performed within the verification window),
+ this endpoint will perform a retry instead.
+
+ Args:
+ target: The target to verify. Currently this can only be an E.164 formatted phone
+ number.
+
+ metadata: The metadata for this verification. This object will be returned with every
+ response or webhook sent that refers to this verification.
+
+ options: Verification options
+
+ signals: The signals used for anti-fraud.
+
+ extra_headers: Send extra headers
+
+ extra_query: Add additional query parameters to the request
+
+ extra_body: Add additional JSON properties to the request
+
+ timeout: Override the client-level default timeout for this request, in seconds
+ """
+ return self._post(
+ "/v2/verification",
+ body=maybe_transform(
+ {
+ "target": target,
+ "metadata": metadata,
+ "options": options,
+ "signals": signals,
+ },
+ verification_create_params.VerificationCreateParams,
+ ),
+ options=make_request_options(
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
+ ),
+ cast_to=VerificationCreateResponse,
+ )
+
+ def check(
+ self,
+ *,
+ target: verification_check_params.Target,
+ code: str | NotGiven = NOT_GIVEN,
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
+ # The extra values given here take precedence over values defined on the client or passed to this method.
+ extra_headers: Headers | None = None,
+ extra_query: Query | None = None,
+ extra_body: Body | None = None,
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
+ ) -> VerificationCheckResponse:
+ """Check a code
+
+ Args:
+ target: The target to verify.
+
+ Currently this can only be an E.164 formatted phone
+ number.
+
+ code: The OTP code to validate.
+
+ extra_headers: Send extra headers
+
+ extra_query: Add additional query parameters to the request
+
+ extra_body: Add additional JSON properties to the request
+
+ timeout: Override the client-level default timeout for this request, in seconds
+ """
+ return self._post(
+ "/v2/verification/check",
+ body=maybe_transform(
+ {
+ "target": target,
+ "code": code,
+ },
+ verification_check_params.VerificationCheckParams,
+ ),
+ options=make_request_options(
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
+ ),
+ cast_to=VerificationCheckResponse,
+ )
+
+
+class AsyncVerificationResource(AsyncAPIResource):
+ @cached_property
+ def with_raw_response(self) -> AsyncVerificationResourceWithRawResponse:
+ """
+ This property can be used as a prefix for any HTTP method call to return the
+ the raw response object instead of the parsed content.
+
+ For more information, see https://www.github.com/prelude-so/python-sdk#accessing-raw-response-data-eg-headers
+ """
+ return AsyncVerificationResourceWithRawResponse(self)
+
+ @cached_property
+ def with_streaming_response(self) -> AsyncVerificationResourceWithStreamingResponse:
+ """
+ An alternative to `.with_raw_response` that doesn't eagerly read the response body.
+
+ For more information, see https://www.github.com/prelude-so/python-sdk#with_streaming_response
+ """
+ return AsyncVerificationResourceWithStreamingResponse(self)
+
+ async def create(
+ self,
+ *,
+ target: verification_create_params.Target,
+ metadata: verification_create_params.Metadata | NotGiven = NOT_GIVEN,
+ options: verification_create_params.Options | NotGiven = NOT_GIVEN,
+ signals: verification_create_params.Signals | NotGiven = NOT_GIVEN,
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
+ # The extra values given here take precedence over values defined on the client or passed to this method.
+ extra_headers: Headers | None = None,
+ extra_query: Query | None = None,
+ extra_body: Body | None = None,
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
+ ) -> VerificationCreateResponse:
+ """Create a new verification for a specific phone number.
+
+ If another non-expired
+ verification exists (the request is performed within the verification window),
+ this endpoint will perform a retry instead.
+
+ Args:
+ target: The target to verify. Currently this can only be an E.164 formatted phone
+ number.
+
+ metadata: The metadata for this verification. This object will be returned with every
+ response or webhook sent that refers to this verification.
+
+ options: Verification options
+
+ signals: The signals used for anti-fraud.
+
+ extra_headers: Send extra headers
+
+ extra_query: Add additional query parameters to the request
+
+ extra_body: Add additional JSON properties to the request
+
+ timeout: Override the client-level default timeout for this request, in seconds
+ """
+ return await self._post(
+ "/v2/verification",
+ body=await async_maybe_transform(
+ {
+ "target": target,
+ "metadata": metadata,
+ "options": options,
+ "signals": signals,
+ },
+ verification_create_params.VerificationCreateParams,
+ ),
+ options=make_request_options(
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
+ ),
+ cast_to=VerificationCreateResponse,
+ )
+
+ async def check(
+ self,
+ *,
+ target: verification_check_params.Target,
+ code: str | NotGiven = NOT_GIVEN,
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
+ # The extra values given here take precedence over values defined on the client or passed to this method.
+ extra_headers: Headers | None = None,
+ extra_query: Query | None = None,
+ extra_body: Body | None = None,
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
+ ) -> VerificationCheckResponse:
+ """Check a code
+
+ Args:
+ target: The target to verify.
+
+ Currently this can only be an E.164 formatted phone
+ number.
+
+ code: The OTP code to validate.
+
+ extra_headers: Send extra headers
+
+ extra_query: Add additional query parameters to the request
+
+ extra_body: Add additional JSON properties to the request
+
+ timeout: Override the client-level default timeout for this request, in seconds
+ """
+ return await self._post(
+ "/v2/verification/check",
+ body=await async_maybe_transform(
+ {
+ "target": target,
+ "code": code,
+ },
+ verification_check_params.VerificationCheckParams,
+ ),
+ options=make_request_options(
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
+ ),
+ cast_to=VerificationCheckResponse,
+ )
+
+
+class VerificationResourceWithRawResponse:
+ def __init__(self, verification: VerificationResource) -> None:
+ self._verification = verification
+
+ self.create = to_raw_response_wrapper(
+ verification.create,
+ )
+ self.check = to_raw_response_wrapper(
+ verification.check,
+ )
+
+
+class AsyncVerificationResourceWithRawResponse:
+ def __init__(self, verification: AsyncVerificationResource) -> None:
+ self._verification = verification
+
+ self.create = async_to_raw_response_wrapper(
+ verification.create,
+ )
+ self.check = async_to_raw_response_wrapper(
+ verification.check,
+ )
+
+
+class VerificationResourceWithStreamingResponse:
+ def __init__(self, verification: VerificationResource) -> None:
+ self._verification = verification
+
+ self.create = to_streamed_response_wrapper(
+ verification.create,
+ )
+ self.check = to_streamed_response_wrapper(
+ verification.check,
+ )
+
+
+class AsyncVerificationResourceWithStreamingResponse:
+ def __init__(self, verification: AsyncVerificationResource) -> None:
+ self._verification = verification
+
+ self.create = async_to_streamed_response_wrapper(
+ verification.create,
+ )
+ self.check = async_to_streamed_response_wrapper(
+ verification.check,
+ )
diff --git a/src/prelude_sdk/types/__init__.py b/src/prelude_sdk/types/__init__.py
new file mode 100644
index 0000000..5eabd09
--- /dev/null
+++ b/src/prelude_sdk/types/__init__.py
@@ -0,0 +1,10 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from __future__ import annotations
+
+from .transactional_send_params import TransactionalSendParams as TransactionalSendParams
+from .verification_check_params import VerificationCheckParams as VerificationCheckParams
+from .verification_create_params import VerificationCreateParams as VerificationCreateParams
+from .transactional_send_response import TransactionalSendResponse as TransactionalSendResponse
+from .verification_check_response import VerificationCheckResponse as VerificationCheckResponse
+from .verification_create_response import VerificationCreateResponse as VerificationCreateResponse
diff --git a/src/prelude_sdk/types/transactional_send_params.py b/src/prelude_sdk/types/transactional_send_params.py
new file mode 100644
index 0000000..6aba37f
--- /dev/null
+++ b/src/prelude_sdk/types/transactional_send_params.py
@@ -0,0 +1,33 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from __future__ import annotations
+
+from typing import Dict
+from typing_extensions import Required, Annotated, TypedDict
+
+from .._utils import PropertyInfo
+
+__all__ = ["TransactionalSendParams"]
+
+
+class TransactionalSendParams(TypedDict, total=False):
+ template_id: Required[str]
+ """The template identifier."""
+
+ to: Required[str]
+ """The recipient's phone number."""
+
+ callback_url: str
+ """The callback URL."""
+
+ correlation_id: str
+ """A unique, user-defined identifier that will be included in webhook events."""
+
+ expires_at: str
+ """The message expiration date."""
+
+ from_: Annotated[str, PropertyInfo(alias="from")]
+ """The Sender ID."""
+
+ variables: Dict[str, str]
+ """The variables to be replaced in the template."""
diff --git a/src/prelude_sdk/types/transactional_send_response.py b/src/prelude_sdk/types/transactional_send_response.py
new file mode 100644
index 0000000..f33ecea
--- /dev/null
+++ b/src/prelude_sdk/types/transactional_send_response.py
@@ -0,0 +1,39 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from typing import Dict, Optional
+from datetime import datetime
+
+from pydantic import Field as FieldInfo
+
+from .._models import BaseModel
+
+__all__ = ["TransactionalSendResponse"]
+
+
+class TransactionalSendResponse(BaseModel):
+ id: str
+ """The message identifier."""
+
+ created_at: datetime
+ """The message creation date."""
+
+ expires_at: datetime
+ """The message expiration date."""
+
+ template_id: str
+ """The template identifier."""
+
+ to: str
+ """The recipient's phone number."""
+
+ variables: Dict[str, str]
+ """The variables to be replaced in the template."""
+
+ callback_url: Optional[str] = None
+ """The callback URL."""
+
+ correlation_id: Optional[str] = None
+ """A unique, user-defined identifier that will be included in webhook events."""
+
+ from_: Optional[str] = FieldInfo(alias="from", default=None)
+ """The Sender ID."""
diff --git a/src/prelude_sdk/types/verification_check_params.py b/src/prelude_sdk/types/verification_check_params.py
new file mode 100644
index 0000000..6dd61e2
--- /dev/null
+++ b/src/prelude_sdk/types/verification_check_params.py
@@ -0,0 +1,26 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from __future__ import annotations
+
+from typing_extensions import Literal, Required, TypedDict
+
+__all__ = ["VerificationCheckParams", "Target"]
+
+
+class VerificationCheckParams(TypedDict, total=False):
+ target: Required[Target]
+ """The target to verify.
+
+ Currently this can only be an E.164 formatted phone number.
+ """
+
+ code: str
+ """The OTP code to validate."""
+
+
+class Target(TypedDict, total=False):
+ type: Required[Literal["phone_number"]]
+ """The type of the target to verify. Currently this can only be "phone_number"."""
+
+ value: Required[str]
+ """An E.164 formatted phone number to verify."""
diff --git a/src/prelude_sdk/types/verification_check_response.py b/src/prelude_sdk/types/verification_check_response.py
new file mode 100644
index 0000000..e516a9c
--- /dev/null
+++ b/src/prelude_sdk/types/verification_check_response.py
@@ -0,0 +1,23 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from typing import Optional
+from typing_extensions import Literal
+
+from .._models import BaseModel
+
+__all__ = ["VerificationCheckResponse", "Metadata"]
+
+
+class Metadata(BaseModel):
+ correlation_id: Optional[str] = None
+
+
+class VerificationCheckResponse(BaseModel):
+ id: Optional[str] = None
+ """The verification identifier."""
+
+ metadata: Optional[Metadata] = None
+ """The metadata for this verification."""
+
+ status: Optional[Literal["success", "failure", "expired"]] = None
+ """The status of the check."""
diff --git a/src/prelude_sdk/types/verification_create_params.py b/src/prelude_sdk/types/verification_create_params.py
new file mode 100644
index 0000000..ed8abf8
--- /dev/null
+++ b/src/prelude_sdk/types/verification_create_params.py
@@ -0,0 +1,101 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from __future__ import annotations
+
+from typing_extensions import Literal, Required, TypedDict
+
+__all__ = ["VerificationCreateParams", "Target", "Metadata", "Options", "Signals"]
+
+
+class VerificationCreateParams(TypedDict, total=False):
+ target: Required[Target]
+ """The target to verify.
+
+ Currently this can only be an E.164 formatted phone number.
+ """
+
+ metadata: Metadata
+ """The metadata for this verification.
+
+ This object will be returned with every response or webhook sent that refers to
+ this verification.
+ """
+
+ options: Options
+ """Verification options"""
+
+ signals: Signals
+ """The signals used for anti-fraud."""
+
+
+class Target(TypedDict, total=False):
+ type: Required[Literal["phone_number"]]
+ """The type of the target to verify. Currently this can only be "phone_number"."""
+
+ value: Required[str]
+ """An E.164 formatted phone number to verify."""
+
+
+class Metadata(TypedDict, total=False):
+ correlation_id: str
+ """A user-defined identifier to correlate this verification with."""
+
+
+class Options(TypedDict, total=False):
+ locale: str
+ """
+ A BCP-47 formatted locale string with the language the text message will be sent
+ to. If there's no locale set, the language will be determined by the country
+ code of the phone number. If the language specified doesn't exist, it defaults
+ to US English.
+ """
+
+ sender_id: str
+ """The Sender ID to use for this message.
+
+ The Sender ID needs to be enabled by Prelude.
+ """
+
+ template_id: str
+ """The identifier of a verification settings template.
+
+ It is used to be able to switch behavior for specific use cases. Contact us if
+ you need to use this functionality.
+ """
+
+
+class Signals(TypedDict, total=False):
+ app_realm: str
+ """The Android SMS Retriever API hash code that identifies your app.
+
+ This allows you to automatically retrieve and fill the OTP code on Android
+ devices.
+ """
+
+ app_version: str
+ """The version of your application."""
+
+ device_id: str
+ """The unique identifier for the user's device.
+
+ For Android, this corresponds to the `ANDROID_ID` and for iOS, this corresponds
+ to the `identifierForVendor`.
+ """
+
+ device_model: str
+ """The model of the user's device."""
+
+ device_type: Literal["IOS", "ANDROID", "WEB"]
+ """The type of the user's device."""
+
+ ip: str
+ """The IP address of the user's device."""
+
+ is_trusted_user: str
+ """
+ This signal should provide a higher level of trust, indicating that the user is
+ genuine. For more details, refer to [Signals](/guides/prevent-fraud#signals).
+ """
+
+ os_version: str
+ """The version of the user's device operating system."""
diff --git a/src/prelude_sdk/types/verification_create_response.py b/src/prelude_sdk/types/verification_create_response.py
new file mode 100644
index 0000000..f1121cb
--- /dev/null
+++ b/src/prelude_sdk/types/verification_create_response.py
@@ -0,0 +1,28 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from typing import Optional
+from typing_extensions import Literal
+
+from .._models import BaseModel
+
+__all__ = ["VerificationCreateResponse", "Metadata"]
+
+
+class Metadata(BaseModel):
+ correlation_id: Optional[str] = None
+
+
+class VerificationCreateResponse(BaseModel):
+ id: Optional[str] = None
+ """The verification identifier."""
+
+ metadata: Optional[Metadata] = None
+ """The metadata for this verification."""
+
+ method: Optional[Literal["message"]] = None
+ """The method used for verifying this phone number."""
+
+ request_id: Optional[str] = None
+
+ status: Optional[Literal["success", "retry", "blocked"]] = None
+ """The status of the verification."""
diff --git a/tests/api_resources/authentication/__init__.py b/tests/api_resources/authentication/__init__.py
deleted file mode 100644
index fd8019a..0000000
--- a/tests/api_resources/authentication/__init__.py
+++ /dev/null
@@ -1 +0,0 @@
-# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
diff --git a/tests/api_resources/authentication/test_feedback.py b/tests/api_resources/authentication/test_feedback.py
deleted file mode 100644
index a7ff742..0000000
--- a/tests/api_resources/authentication/test_feedback.py
+++ /dev/null
@@ -1,96 +0,0 @@
-# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
-
-from __future__ import annotations
-
-import os
-from typing import Any, cast
-
-import pytest
-
-from prelude import Prelude, AsyncPrelude
-from tests.utils import assert_matches_type
-from prelude.types.authentication import FeedbackCreateResponse
-
-base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010")
-
-
-class TestFeedback:
- parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"])
-
- @parametrize
- def test_method_create(self, client: Prelude) -> None:
- feedback = client.authentication.feedback.create(
- customer_uuid="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
- phone_number="+1234567890",
- status="onboarded",
- )
- assert_matches_type(FeedbackCreateResponse, feedback, path=["response"])
-
- @parametrize
- def test_raw_response_create(self, client: Prelude) -> None:
- response = client.authentication.feedback.with_raw_response.create(
- customer_uuid="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
- phone_number="+1234567890",
- status="onboarded",
- )
-
- assert response.is_closed is True
- assert response.http_request.headers.get("X-Stainless-Lang") == "python"
- feedback = response.parse()
- assert_matches_type(FeedbackCreateResponse, feedback, path=["response"])
-
- @parametrize
- def test_streaming_response_create(self, client: Prelude) -> None:
- with client.authentication.feedback.with_streaming_response.create(
- customer_uuid="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
- phone_number="+1234567890",
- status="onboarded",
- ) as response:
- assert not response.is_closed
- assert response.http_request.headers.get("X-Stainless-Lang") == "python"
-
- feedback = response.parse()
- assert_matches_type(FeedbackCreateResponse, feedback, path=["response"])
-
- assert cast(Any, response.is_closed) is True
-
-
-class TestAsyncFeedback:
- parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"])
-
- @parametrize
- async def test_method_create(self, async_client: AsyncPrelude) -> None:
- feedback = await async_client.authentication.feedback.create(
- customer_uuid="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
- phone_number="+1234567890",
- status="onboarded",
- )
- assert_matches_type(FeedbackCreateResponse, feedback, path=["response"])
-
- @parametrize
- async def test_raw_response_create(self, async_client: AsyncPrelude) -> None:
- response = await async_client.authentication.feedback.with_raw_response.create(
- customer_uuid="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
- phone_number="+1234567890",
- status="onboarded",
- )
-
- assert response.is_closed is True
- assert response.http_request.headers.get("X-Stainless-Lang") == "python"
- feedback = await response.parse()
- assert_matches_type(FeedbackCreateResponse, feedback, path=["response"])
-
- @parametrize
- async def test_streaming_response_create(self, async_client: AsyncPrelude) -> None:
- async with async_client.authentication.feedback.with_streaming_response.create(
- customer_uuid="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
- phone_number="+1234567890",
- status="onboarded",
- ) as response:
- assert not response.is_closed
- assert response.http_request.headers.get("X-Stainless-Lang") == "python"
-
- feedback = await response.parse()
- assert_matches_type(FeedbackCreateResponse, feedback, path=["response"])
-
- assert cast(Any, response.is_closed) is True
diff --git a/tests/api_resources/test_authentication.py b/tests/api_resources/test_authentication.py
deleted file mode 100644
index 2c3d23d..0000000
--- a/tests/api_resources/test_authentication.py
+++ /dev/null
@@ -1,208 +0,0 @@
-# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
-
-from __future__ import annotations
-
-import os
-from typing import Any, cast
-
-import pytest
-
-from prelude import Prelude, AsyncPrelude
-from tests.utils import assert_matches_type
-from prelude.types import AuthenticationCreateResponse, AuthenticationRetrieveResponse
-
-base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010")
-
-
-class TestAuthentication:
- parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"])
-
- @parametrize
- def test_method_create(self, client: Prelude) -> None:
- authentication = client.authentication.create(
- customer_uuid="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
- phone_number="+1234567890",
- )
- assert_matches_type(AuthenticationCreateResponse, authentication, path=["response"])
-
- @parametrize
- def test_method_create_with_all_params(self, client: Prelude) -> None:
- authentication = client.authentication.create(
- customer_uuid="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
- phone_number="+1234567890",
- app_realm="app_realm",
- app_version="app_version",
- callback_url="callback_url",
- correlation_id="correlation_id",
- device_id="device_id",
- device_model="device_model",
- device_type="IOS",
- ip="ip",
- is_returning_user=True,
- locale="en-US",
- os_version="os_version",
- sender_id="sender_id",
- template_id="template_id",
- )
- assert_matches_type(AuthenticationCreateResponse, authentication, path=["response"])
-
- @parametrize
- def test_raw_response_create(self, client: Prelude) -> None:
- response = client.authentication.with_raw_response.create(
- customer_uuid="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
- phone_number="+1234567890",
- )
-
- assert response.is_closed is True
- assert response.http_request.headers.get("X-Stainless-Lang") == "python"
- authentication = response.parse()
- assert_matches_type(AuthenticationCreateResponse, authentication, path=["response"])
-
- @parametrize
- def test_streaming_response_create(self, client: Prelude) -> None:
- with client.authentication.with_streaming_response.create(
- customer_uuid="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
- phone_number="+1234567890",
- ) as response:
- assert not response.is_closed
- assert response.http_request.headers.get("X-Stainless-Lang") == "python"
-
- authentication = response.parse()
- assert_matches_type(AuthenticationCreateResponse, authentication, path=["response"])
-
- assert cast(Any, response.is_closed) is True
-
- @parametrize
- def test_method_retrieve(self, client: Prelude) -> None:
- authentication = client.authentication.retrieve(
- "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
- )
- assert_matches_type(AuthenticationRetrieveResponse, authentication, path=["response"])
-
- @parametrize
- def test_raw_response_retrieve(self, client: Prelude) -> None:
- response = client.authentication.with_raw_response.retrieve(
- "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
- )
-
- assert response.is_closed is True
- assert response.http_request.headers.get("X-Stainless-Lang") == "python"
- authentication = response.parse()
- assert_matches_type(AuthenticationRetrieveResponse, authentication, path=["response"])
-
- @parametrize
- def test_streaming_response_retrieve(self, client: Prelude) -> None:
- with client.authentication.with_streaming_response.retrieve(
- "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
- ) as response:
- assert not response.is_closed
- assert response.http_request.headers.get("X-Stainless-Lang") == "python"
-
- authentication = response.parse()
- assert_matches_type(AuthenticationRetrieveResponse, authentication, path=["response"])
-
- assert cast(Any, response.is_closed) is True
-
- @parametrize
- def test_path_params_retrieve(self, client: Prelude) -> None:
- with pytest.raises(ValueError, match=r"Expected a non-empty value for `auth_uuid` but received ''"):
- client.authentication.with_raw_response.retrieve(
- "",
- )
-
-
-class TestAsyncAuthentication:
- parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"])
-
- @parametrize
- async def test_method_create(self, async_client: AsyncPrelude) -> None:
- authentication = await async_client.authentication.create(
- customer_uuid="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
- phone_number="+1234567890",
- )
- assert_matches_type(AuthenticationCreateResponse, authentication, path=["response"])
-
- @parametrize
- async def test_method_create_with_all_params(self, async_client: AsyncPrelude) -> None:
- authentication = await async_client.authentication.create(
- customer_uuid="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
- phone_number="+1234567890",
- app_realm="app_realm",
- app_version="app_version",
- callback_url="callback_url",
- correlation_id="correlation_id",
- device_id="device_id",
- device_model="device_model",
- device_type="IOS",
- ip="ip",
- is_returning_user=True,
- locale="en-US",
- os_version="os_version",
- sender_id="sender_id",
- template_id="template_id",
- )
- assert_matches_type(AuthenticationCreateResponse, authentication, path=["response"])
-
- @parametrize
- async def test_raw_response_create(self, async_client: AsyncPrelude) -> None:
- response = await async_client.authentication.with_raw_response.create(
- customer_uuid="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
- phone_number="+1234567890",
- )
-
- assert response.is_closed is True
- assert response.http_request.headers.get("X-Stainless-Lang") == "python"
- authentication = await response.parse()
- assert_matches_type(AuthenticationCreateResponse, authentication, path=["response"])
-
- @parametrize
- async def test_streaming_response_create(self, async_client: AsyncPrelude) -> None:
- async with async_client.authentication.with_streaming_response.create(
- customer_uuid="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
- phone_number="+1234567890",
- ) as response:
- assert not response.is_closed
- assert response.http_request.headers.get("X-Stainless-Lang") == "python"
-
- authentication = await response.parse()
- assert_matches_type(AuthenticationCreateResponse, authentication, path=["response"])
-
- assert cast(Any, response.is_closed) is True
-
- @parametrize
- async def test_method_retrieve(self, async_client: AsyncPrelude) -> None:
- authentication = await async_client.authentication.retrieve(
- "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
- )
- assert_matches_type(AuthenticationRetrieveResponse, authentication, path=["response"])
-
- @parametrize
- async def test_raw_response_retrieve(self, async_client: AsyncPrelude) -> None:
- response = await async_client.authentication.with_raw_response.retrieve(
- "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
- )
-
- assert response.is_closed is True
- assert response.http_request.headers.get("X-Stainless-Lang") == "python"
- authentication = await response.parse()
- assert_matches_type(AuthenticationRetrieveResponse, authentication, path=["response"])
-
- @parametrize
- async def test_streaming_response_retrieve(self, async_client: AsyncPrelude) -> None:
- async with async_client.authentication.with_streaming_response.retrieve(
- "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
- ) as response:
- assert not response.is_closed
- assert response.http_request.headers.get("X-Stainless-Lang") == "python"
-
- authentication = await response.parse()
- assert_matches_type(AuthenticationRetrieveResponse, authentication, path=["response"])
-
- assert cast(Any, response.is_closed) is True
-
- @parametrize
- async def test_path_params_retrieve(self, async_client: AsyncPrelude) -> None:
- with pytest.raises(ValueError, match=r"Expected a non-empty value for `auth_uuid` but received ''"):
- await async_client.authentication.with_raw_response.retrieve(
- "",
- )
diff --git a/tests/api_resources/test_check.py b/tests/api_resources/test_check.py
deleted file mode 100644
index 1d0e5ff..0000000
--- a/tests/api_resources/test_check.py
+++ /dev/null
@@ -1,96 +0,0 @@
-# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
-
-from __future__ import annotations
-
-import os
-from typing import Any, cast
-
-import pytest
-
-from prelude import Prelude, AsyncPrelude
-from tests.utils import assert_matches_type
-from prelude.types import CheckCreateResponse
-
-base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010")
-
-
-class TestCheck:
- parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"])
-
- @parametrize
- def test_method_create(self, client: Prelude) -> None:
- check = client.check.create(
- authentication_uuid="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
- check_code="123456",
- customer_uuid="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
- )
- assert_matches_type(CheckCreateResponse, check, path=["response"])
-
- @parametrize
- def test_raw_response_create(self, client: Prelude) -> None:
- response = client.check.with_raw_response.create(
- authentication_uuid="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
- check_code="123456",
- customer_uuid="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
- )
-
- assert response.is_closed is True
- assert response.http_request.headers.get("X-Stainless-Lang") == "python"
- check = response.parse()
- assert_matches_type(CheckCreateResponse, check, path=["response"])
-
- @parametrize
- def test_streaming_response_create(self, client: Prelude) -> None:
- with client.check.with_streaming_response.create(
- authentication_uuid="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
- check_code="123456",
- customer_uuid="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
- ) as response:
- assert not response.is_closed
- assert response.http_request.headers.get("X-Stainless-Lang") == "python"
-
- check = response.parse()
- assert_matches_type(CheckCreateResponse, check, path=["response"])
-
- assert cast(Any, response.is_closed) is True
-
-
-class TestAsyncCheck:
- parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"])
-
- @parametrize
- async def test_method_create(self, async_client: AsyncPrelude) -> None:
- check = await async_client.check.create(
- authentication_uuid="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
- check_code="123456",
- customer_uuid="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
- )
- assert_matches_type(CheckCreateResponse, check, path=["response"])
-
- @parametrize
- async def test_raw_response_create(self, async_client: AsyncPrelude) -> None:
- response = await async_client.check.with_raw_response.create(
- authentication_uuid="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
- check_code="123456",
- customer_uuid="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
- )
-
- assert response.is_closed is True
- assert response.http_request.headers.get("X-Stainless-Lang") == "python"
- check = await response.parse()
- assert_matches_type(CheckCreateResponse, check, path=["response"])
-
- @parametrize
- async def test_streaming_response_create(self, async_client: AsyncPrelude) -> None:
- async with async_client.check.with_streaming_response.create(
- authentication_uuid="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
- check_code="123456",
- customer_uuid="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
- ) as response:
- assert not response.is_closed
- assert response.http_request.headers.get("X-Stainless-Lang") == "python"
-
- check = await response.parse()
- assert_matches_type(CheckCreateResponse, check, path=["response"])
-
- assert cast(Any, response.is_closed) is True
diff --git a/tests/api_resources/test_lookup.py b/tests/api_resources/test_lookup.py
deleted file mode 100644
index 6a4e9ea..0000000
--- a/tests/api_resources/test_lookup.py
+++ /dev/null
@@ -1,106 +0,0 @@
-# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
-
-from __future__ import annotations
-
-import os
-from typing import Any, cast
-
-import pytest
-
-from prelude import Prelude, AsyncPrelude
-from tests.utils import assert_matches_type
-from prelude.types import LookupRetrieveResponse
-
-base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010")
-
-
-class TestLookup:
- parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"])
-
- @parametrize
- def test_method_retrieve(self, client: Prelude) -> None:
- lookup = client.lookup.retrieve(
- phone_number="phone_number",
- customer_uuid="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
- )
- assert_matches_type(LookupRetrieveResponse, lookup, path=["response"])
-
- @parametrize
- def test_raw_response_retrieve(self, client: Prelude) -> None:
- response = client.lookup.with_raw_response.retrieve(
- phone_number="phone_number",
- customer_uuid="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
- )
-
- assert response.is_closed is True
- assert response.http_request.headers.get("X-Stainless-Lang") == "python"
- lookup = response.parse()
- assert_matches_type(LookupRetrieveResponse, lookup, path=["response"])
-
- @parametrize
- def test_streaming_response_retrieve(self, client: Prelude) -> None:
- with client.lookup.with_streaming_response.retrieve(
- phone_number="phone_number",
- customer_uuid="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
- ) as response:
- assert not response.is_closed
- assert response.http_request.headers.get("X-Stainless-Lang") == "python"
-
- lookup = response.parse()
- assert_matches_type(LookupRetrieveResponse, lookup, path=["response"])
-
- assert cast(Any, response.is_closed) is True
-
- @parametrize
- def test_path_params_retrieve(self, client: Prelude) -> None:
- with pytest.raises(ValueError, match=r"Expected a non-empty value for `phone_number` but received ''"):
- client.lookup.with_raw_response.retrieve(
- phone_number="",
- customer_uuid="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
- )
-
-
-class TestAsyncLookup:
- parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"])
-
- @parametrize
- async def test_method_retrieve(self, async_client: AsyncPrelude) -> None:
- lookup = await async_client.lookup.retrieve(
- phone_number="phone_number",
- customer_uuid="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
- )
- assert_matches_type(LookupRetrieveResponse, lookup, path=["response"])
-
- @parametrize
- async def test_raw_response_retrieve(self, async_client: AsyncPrelude) -> None:
- response = await async_client.lookup.with_raw_response.retrieve(
- phone_number="phone_number",
- customer_uuid="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
- )
-
- assert response.is_closed is True
- assert response.http_request.headers.get("X-Stainless-Lang") == "python"
- lookup = await response.parse()
- assert_matches_type(LookupRetrieveResponse, lookup, path=["response"])
-
- @parametrize
- async def test_streaming_response_retrieve(self, async_client: AsyncPrelude) -> None:
- async with async_client.lookup.with_streaming_response.retrieve(
- phone_number="phone_number",
- customer_uuid="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
- ) as response:
- assert not response.is_closed
- assert response.http_request.headers.get("X-Stainless-Lang") == "python"
-
- lookup = await response.parse()
- assert_matches_type(LookupRetrieveResponse, lookup, path=["response"])
-
- assert cast(Any, response.is_closed) is True
-
- @parametrize
- async def test_path_params_retrieve(self, async_client: AsyncPrelude) -> None:
- with pytest.raises(ValueError, match=r"Expected a non-empty value for `phone_number` but received ''"):
- await async_client.lookup.with_raw_response.retrieve(
- phone_number="",
- customer_uuid="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
- )
diff --git a/tests/api_resources/test_retry.py b/tests/api_resources/test_retry.py
deleted file mode 100644
index 73f9403..0000000
--- a/tests/api_resources/test_retry.py
+++ /dev/null
@@ -1,90 +0,0 @@
-# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
-
-from __future__ import annotations
-
-import os
-from typing import Any, cast
-
-import pytest
-
-from prelude import Prelude, AsyncPrelude
-from tests.utils import assert_matches_type
-from prelude.types import RetryCreateResponse
-
-base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010")
-
-
-class TestRetry:
- parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"])
-
- @parametrize
- def test_method_create(self, client: Prelude) -> None:
- retry = client.retry.create(
- authentication_uuid="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
- customer_uuid="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
- )
- assert_matches_type(RetryCreateResponse, retry, path=["response"])
-
- @parametrize
- def test_raw_response_create(self, client: Prelude) -> None:
- response = client.retry.with_raw_response.create(
- authentication_uuid="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
- customer_uuid="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
- )
-
- assert response.is_closed is True
- assert response.http_request.headers.get("X-Stainless-Lang") == "python"
- retry = response.parse()
- assert_matches_type(RetryCreateResponse, retry, path=["response"])
-
- @parametrize
- def test_streaming_response_create(self, client: Prelude) -> None:
- with client.retry.with_streaming_response.create(
- authentication_uuid="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
- customer_uuid="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
- ) as response:
- assert not response.is_closed
- assert response.http_request.headers.get("X-Stainless-Lang") == "python"
-
- retry = response.parse()
- assert_matches_type(RetryCreateResponse, retry, path=["response"])
-
- assert cast(Any, response.is_closed) is True
-
-
-class TestAsyncRetry:
- parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"])
-
- @parametrize
- async def test_method_create(self, async_client: AsyncPrelude) -> None:
- retry = await async_client.retry.create(
- authentication_uuid="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
- customer_uuid="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
- )
- assert_matches_type(RetryCreateResponse, retry, path=["response"])
-
- @parametrize
- async def test_raw_response_create(self, async_client: AsyncPrelude) -> None:
- response = await async_client.retry.with_raw_response.create(
- authentication_uuid="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
- customer_uuid="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
- )
-
- assert response.is_closed is True
- assert response.http_request.headers.get("X-Stainless-Lang") == "python"
- retry = await response.parse()
- assert_matches_type(RetryCreateResponse, retry, path=["response"])
-
- @parametrize
- async def test_streaming_response_create(self, async_client: AsyncPrelude) -> None:
- async with async_client.retry.with_streaming_response.create(
- authentication_uuid="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
- customer_uuid="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
- ) as response:
- assert not response.is_closed
- assert response.http_request.headers.get("X-Stainless-Lang") == "python"
-
- retry = await response.parse()
- assert_matches_type(RetryCreateResponse, retry, path=["response"])
-
- assert cast(Any, response.is_closed) is True
diff --git a/tests/api_resources/test_transactional.py b/tests/api_resources/test_transactional.py
new file mode 100644
index 0000000..d174e06
--- /dev/null
+++ b/tests/api_resources/test_transactional.py
@@ -0,0 +1,140 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from __future__ import annotations
+
+import os
+from typing import Any, cast
+
+import pytest
+
+from prelude_sdk import Prelude, AsyncPrelude
+from tests.utils import assert_matches_type
+from prelude_sdk.types import TransactionalSendResponse
+
+base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010")
+
+
+class TestTransactional:
+ parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"])
+
+ @pytest.mark.skip(
+ reason="currently no good way to test endpoints defining callbacks, Prism mock server will fail trying to reach the provided callback url"
+ )
+ @parametrize
+ def test_method_send(self, client: Prelude) -> None:
+ transactional = client.transactional.send(
+ template_id="template_id",
+ to="to",
+ )
+ assert_matches_type(TransactionalSendResponse, transactional, path=["response"])
+
+ @pytest.mark.skip(
+ reason="currently no good way to test endpoints defining callbacks, Prism mock server will fail trying to reach the provided callback url"
+ )
+ @parametrize
+ def test_method_send_with_all_params(self, client: Prelude) -> None:
+ transactional = client.transactional.send(
+ template_id="template_id",
+ to="to",
+ callback_url="callback_url",
+ correlation_id="correlation_id",
+ expires_at="expires_at",
+ from_="from",
+ variables={"foo": "string"},
+ )
+ assert_matches_type(TransactionalSendResponse, transactional, path=["response"])
+
+ @pytest.mark.skip(
+ reason="currently no good way to test endpoints defining callbacks, Prism mock server will fail trying to reach the provided callback url"
+ )
+ @parametrize
+ def test_raw_response_send(self, client: Prelude) -> None:
+ response = client.transactional.with_raw_response.send(
+ template_id="template_id",
+ to="to",
+ )
+
+ assert response.is_closed is True
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+ transactional = response.parse()
+ assert_matches_type(TransactionalSendResponse, transactional, path=["response"])
+
+ @pytest.mark.skip(
+ reason="currently no good way to test endpoints defining callbacks, Prism mock server will fail trying to reach the provided callback url"
+ )
+ @parametrize
+ def test_streaming_response_send(self, client: Prelude) -> None:
+ with client.transactional.with_streaming_response.send(
+ template_id="template_id",
+ to="to",
+ ) as response:
+ assert not response.is_closed
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+
+ transactional = response.parse()
+ assert_matches_type(TransactionalSendResponse, transactional, path=["response"])
+
+ assert cast(Any, response.is_closed) is True
+
+
+class TestAsyncTransactional:
+ parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"])
+
+ @pytest.mark.skip(
+ reason="currently no good way to test endpoints defining callbacks, Prism mock server will fail trying to reach the provided callback url"
+ )
+ @parametrize
+ async def test_method_send(self, async_client: AsyncPrelude) -> None:
+ transactional = await async_client.transactional.send(
+ template_id="template_id",
+ to="to",
+ )
+ assert_matches_type(TransactionalSendResponse, transactional, path=["response"])
+
+ @pytest.mark.skip(
+ reason="currently no good way to test endpoints defining callbacks, Prism mock server will fail trying to reach the provided callback url"
+ )
+ @parametrize
+ async def test_method_send_with_all_params(self, async_client: AsyncPrelude) -> None:
+ transactional = await async_client.transactional.send(
+ template_id="template_id",
+ to="to",
+ callback_url="callback_url",
+ correlation_id="correlation_id",
+ expires_at="expires_at",
+ from_="from",
+ variables={"foo": "string"},
+ )
+ assert_matches_type(TransactionalSendResponse, transactional, path=["response"])
+
+ @pytest.mark.skip(
+ reason="currently no good way to test endpoints defining callbacks, Prism mock server will fail trying to reach the provided callback url"
+ )
+ @parametrize
+ async def test_raw_response_send(self, async_client: AsyncPrelude) -> None:
+ response = await async_client.transactional.with_raw_response.send(
+ template_id="template_id",
+ to="to",
+ )
+
+ assert response.is_closed is True
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+ transactional = await response.parse()
+ assert_matches_type(TransactionalSendResponse, transactional, path=["response"])
+
+ @pytest.mark.skip(
+ reason="currently no good way to test endpoints defining callbacks, Prism mock server will fail trying to reach the provided callback url"
+ )
+ @parametrize
+ async def test_streaming_response_send(self, async_client: AsyncPrelude) -> None:
+ async with async_client.transactional.with_streaming_response.send(
+ template_id="template_id",
+ to="to",
+ ) as response:
+ assert not response.is_closed
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+
+ transactional = await response.parse()
+ assert_matches_type(TransactionalSendResponse, transactional, path=["response"])
+
+ assert cast(Any, response.is_closed) is True
diff --git a/tests/api_resources/test_verification.py b/tests/api_resources/test_verification.py
new file mode 100644
index 0000000..627897b
--- /dev/null
+++ b/tests/api_resources/test_verification.py
@@ -0,0 +1,259 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from __future__ import annotations
+
+import os
+from typing import Any, cast
+
+import pytest
+
+from prelude_sdk import Prelude, AsyncPrelude
+from tests.utils import assert_matches_type
+from prelude_sdk.types import (
+ VerificationCheckResponse,
+ VerificationCreateResponse,
+)
+
+base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010")
+
+
+class TestVerification:
+ parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"])
+
+ @parametrize
+ def test_method_create(self, client: Prelude) -> None:
+ verification = client.verification.create(
+ target={
+ "type": "phone_number",
+ "value": "+30123456789",
+ },
+ )
+ assert_matches_type(VerificationCreateResponse, verification, path=["response"])
+
+ @parametrize
+ def test_method_create_with_all_params(self, client: Prelude) -> None:
+ verification = client.verification.create(
+ target={
+ "type": "phone_number",
+ "value": "+30123456789",
+ },
+ metadata={"correlation_id": "correlation_id"},
+ options={
+ "locale": "el-GR",
+ "sender_id": "sender_id",
+ "template_id": "template_id",
+ },
+ signals={
+ "app_realm": "app_realm",
+ "app_version": "app_version",
+ "device_id": "device_id",
+ "device_model": "device_model",
+ "device_type": "IOS",
+ "ip": "ip",
+ "is_trusted_user": "is_trusted_user",
+ "os_version": "os_version",
+ },
+ )
+ assert_matches_type(VerificationCreateResponse, verification, path=["response"])
+
+ @parametrize
+ def test_raw_response_create(self, client: Prelude) -> None:
+ response = client.verification.with_raw_response.create(
+ target={
+ "type": "phone_number",
+ "value": "+30123456789",
+ },
+ )
+
+ assert response.is_closed is True
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+ verification = response.parse()
+ assert_matches_type(VerificationCreateResponse, verification, path=["response"])
+
+ @parametrize
+ def test_streaming_response_create(self, client: Prelude) -> None:
+ with client.verification.with_streaming_response.create(
+ target={
+ "type": "phone_number",
+ "value": "+30123456789",
+ },
+ ) as response:
+ assert not response.is_closed
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+
+ verification = response.parse()
+ assert_matches_type(VerificationCreateResponse, verification, path=["response"])
+
+ assert cast(Any, response.is_closed) is True
+
+ @parametrize
+ def test_method_check(self, client: Prelude) -> None:
+ verification = client.verification.check(
+ target={
+ "type": "phone_number",
+ "value": "+30123456789",
+ },
+ )
+ assert_matches_type(VerificationCheckResponse, verification, path=["response"])
+
+ @parametrize
+ def test_method_check_with_all_params(self, client: Prelude) -> None:
+ verification = client.verification.check(
+ target={
+ "type": "phone_number",
+ "value": "+30123456789",
+ },
+ code="12345",
+ )
+ assert_matches_type(VerificationCheckResponse, verification, path=["response"])
+
+ @parametrize
+ def test_raw_response_check(self, client: Prelude) -> None:
+ response = client.verification.with_raw_response.check(
+ target={
+ "type": "phone_number",
+ "value": "+30123456789",
+ },
+ )
+
+ assert response.is_closed is True
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+ verification = response.parse()
+ assert_matches_type(VerificationCheckResponse, verification, path=["response"])
+
+ @parametrize
+ def test_streaming_response_check(self, client: Prelude) -> None:
+ with client.verification.with_streaming_response.check(
+ target={
+ "type": "phone_number",
+ "value": "+30123456789",
+ },
+ ) as response:
+ assert not response.is_closed
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+
+ verification = response.parse()
+ assert_matches_type(VerificationCheckResponse, verification, path=["response"])
+
+ assert cast(Any, response.is_closed) is True
+
+
+class TestAsyncVerification:
+ parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"])
+
+ @parametrize
+ async def test_method_create(self, async_client: AsyncPrelude) -> None:
+ verification = await async_client.verification.create(
+ target={
+ "type": "phone_number",
+ "value": "+30123456789",
+ },
+ )
+ assert_matches_type(VerificationCreateResponse, verification, path=["response"])
+
+ @parametrize
+ async def test_method_create_with_all_params(self, async_client: AsyncPrelude) -> None:
+ verification = await async_client.verification.create(
+ target={
+ "type": "phone_number",
+ "value": "+30123456789",
+ },
+ metadata={"correlation_id": "correlation_id"},
+ options={
+ "locale": "el-GR",
+ "sender_id": "sender_id",
+ "template_id": "template_id",
+ },
+ signals={
+ "app_realm": "app_realm",
+ "app_version": "app_version",
+ "device_id": "device_id",
+ "device_model": "device_model",
+ "device_type": "IOS",
+ "ip": "ip",
+ "is_trusted_user": "is_trusted_user",
+ "os_version": "os_version",
+ },
+ )
+ assert_matches_type(VerificationCreateResponse, verification, path=["response"])
+
+ @parametrize
+ async def test_raw_response_create(self, async_client: AsyncPrelude) -> None:
+ response = await async_client.verification.with_raw_response.create(
+ target={
+ "type": "phone_number",
+ "value": "+30123456789",
+ },
+ )
+
+ assert response.is_closed is True
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+ verification = await response.parse()
+ assert_matches_type(VerificationCreateResponse, verification, path=["response"])
+
+ @parametrize
+ async def test_streaming_response_create(self, async_client: AsyncPrelude) -> None:
+ async with async_client.verification.with_streaming_response.create(
+ target={
+ "type": "phone_number",
+ "value": "+30123456789",
+ },
+ ) as response:
+ assert not response.is_closed
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+
+ verification = await response.parse()
+ assert_matches_type(VerificationCreateResponse, verification, path=["response"])
+
+ assert cast(Any, response.is_closed) is True
+
+ @parametrize
+ async def test_method_check(self, async_client: AsyncPrelude) -> None:
+ verification = await async_client.verification.check(
+ target={
+ "type": "phone_number",
+ "value": "+30123456789",
+ },
+ )
+ assert_matches_type(VerificationCheckResponse, verification, path=["response"])
+
+ @parametrize
+ async def test_method_check_with_all_params(self, async_client: AsyncPrelude) -> None:
+ verification = await async_client.verification.check(
+ target={
+ "type": "phone_number",
+ "value": "+30123456789",
+ },
+ code="12345",
+ )
+ assert_matches_type(VerificationCheckResponse, verification, path=["response"])
+
+ @parametrize
+ async def test_raw_response_check(self, async_client: AsyncPrelude) -> None:
+ response = await async_client.verification.with_raw_response.check(
+ target={
+ "type": "phone_number",
+ "value": "+30123456789",
+ },
+ )
+
+ assert response.is_closed is True
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+ verification = await response.parse()
+ assert_matches_type(VerificationCheckResponse, verification, path=["response"])
+
+ @parametrize
+ async def test_streaming_response_check(self, async_client: AsyncPrelude) -> None:
+ async with async_client.verification.with_streaming_response.check(
+ target={
+ "type": "phone_number",
+ "value": "+30123456789",
+ },
+ ) as response:
+ assert not response.is_closed
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+
+ verification = await response.parse()
+ assert_matches_type(VerificationCheckResponse, verification, path=["response"])
+
+ assert cast(Any, response.is_closed) is True
diff --git a/tests/conftest.py b/tests/conftest.py
index c6c4c62..a688415 100644
--- a/tests/conftest.py
+++ b/tests/conftest.py
@@ -7,14 +7,14 @@
import pytest
from pytest_asyncio import is_async_test
-from prelude import Prelude, AsyncPrelude
+from prelude_sdk import Prelude, AsyncPrelude
if TYPE_CHECKING:
from _pytest.fixtures import FixtureRequest
pytest.register_assert_rewrite("tests.utils")
-logging.getLogger("prelude").setLevel(logging.DEBUG)
+logging.getLogger("prelude_sdk").setLevel(logging.DEBUG)
# automatically add `pytest.mark.asyncio()` to all of our async tests
@@ -28,8 +28,7 @@ def pytest_collection_modifyitems(items: list[pytest.Function]) -> None:
base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010")
-api_key = "My API Key"
-customer_uuid = "My Customer Uuid"
+api_token = "My API Token"
@pytest.fixture(scope="session")
@@ -38,9 +37,7 @@ def client(request: FixtureRequest) -> Iterator[Prelude]:
if not isinstance(strict, bool):
raise TypeError(f"Unexpected fixture parameter type {type(strict)}, expected {bool}")
- with Prelude(
- base_url=base_url, api_key=api_key, customer_uuid=customer_uuid, _strict_response_validation=strict
- ) as client:
+ with Prelude(base_url=base_url, api_token=api_token, _strict_response_validation=strict) as client:
yield client
@@ -50,7 +47,5 @@ async def async_client(request: FixtureRequest) -> AsyncIterator[AsyncPrelude]:
if not isinstance(strict, bool):
raise TypeError(f"Unexpected fixture parameter type {type(strict)}, expected {bool}")
- async with AsyncPrelude(
- base_url=base_url, api_key=api_key, customer_uuid=customer_uuid, _strict_response_validation=strict
- ) as client:
+ async with AsyncPrelude(base_url=base_url, api_token=api_token, _strict_response_validation=strict) as client:
yield client
diff --git a/tests/test_client.py b/tests/test_client.py
index 32859d9..4f97c40 100644
--- a/tests/test_client.py
+++ b/tests/test_client.py
@@ -17,12 +17,12 @@
from respx import MockRouter
from pydantic import ValidationError
-from prelude import Prelude, AsyncPrelude, APIResponseValidationError
-from prelude._types import Omit
-from prelude._models import BaseModel, FinalRequestOptions
-from prelude._constants import RAW_RESPONSE_HEADER
-from prelude._exceptions import PreludeError, APIStatusError, APITimeoutError, APIResponseValidationError
-from prelude._base_client import (
+from prelude_sdk import Prelude, AsyncPrelude, APIResponseValidationError
+from prelude_sdk._types import Omit
+from prelude_sdk._models import BaseModel, FinalRequestOptions
+from prelude_sdk._constants import RAW_RESPONSE_HEADER
+from prelude_sdk._exceptions import PreludeError, APIStatusError, APITimeoutError, APIResponseValidationError
+from prelude_sdk._base_client import (
DEFAULT_TIMEOUT,
HTTPX_DEFAULT_TIMEOUT,
BaseClient,
@@ -32,8 +32,7 @@
from .utils import update_env
base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010")
-api_key = "My API Key"
-customer_uuid = "My Customer Uuid"
+api_token = "My API Token"
def _get_params(client: BaseClient[Any, Any]) -> dict[str, str]:
@@ -55,7 +54,7 @@ def _get_open_connections(client: Prelude | AsyncPrelude) -> int:
class TestPrelude:
- client = Prelude(base_url=base_url, api_key=api_key, customer_uuid=customer_uuid, _strict_response_validation=True)
+ client = Prelude(base_url=base_url, api_token=api_token, _strict_response_validation=True)
@pytest.mark.respx(base_url=base_url)
def test_raw_response(self, respx_mock: MockRouter) -> None:
@@ -81,13 +80,9 @@ def test_copy(self) -> None:
copied = self.client.copy()
assert id(copied) != id(self.client)
- copied = self.client.copy(api_key="another My API Key")
- assert copied.api_key == "another My API Key"
- assert self.client.api_key == "My API Key"
-
- copied = self.client.copy(customer_uuid="another My Customer Uuid")
- assert copied.customer_uuid == "another My Customer Uuid"
- assert self.client.customer_uuid == "My Customer Uuid"
+ copied = self.client.copy(api_token="another My API Token")
+ assert copied.api_token == "another My API Token"
+ assert self.client.api_token == "My API Token"
def test_copy_default_options(self) -> None:
# options that have a default are overridden correctly
@@ -107,11 +102,7 @@ def test_copy_default_options(self) -> None:
def test_copy_default_headers(self) -> None:
client = Prelude(
- base_url=base_url,
- api_key=api_key,
- customer_uuid=customer_uuid,
- _strict_response_validation=True,
- default_headers={"X-Foo": "bar"},
+ base_url=base_url, api_token=api_token, _strict_response_validation=True, default_headers={"X-Foo": "bar"}
)
assert client.default_headers["X-Foo"] == "bar"
@@ -145,11 +136,7 @@ def test_copy_default_headers(self) -> None:
def test_copy_default_query(self) -> None:
client = Prelude(
- base_url=base_url,
- api_key=api_key,
- customer_uuid=customer_uuid,
- _strict_response_validation=True,
- default_query={"foo": "bar"},
+ base_url=base_url, api_token=api_token, _strict_response_validation=True, default_query={"foo": "bar"}
)
assert _get_params(client)["foo"] == "bar"
@@ -239,10 +226,10 @@ def add_leak(leaks: list[tracemalloc.StatisticDiff], diff: tracemalloc.Statistic
# to_raw_response_wrapper leaks through the @functools.wraps() decorator.
#
# removing the decorator fixes the leak for reasons we don't understand.
- "prelude/_legacy_response.py",
- "prelude/_response.py",
+ "prelude_sdk/_legacy_response.py",
+ "prelude_sdk/_response.py",
# pydantic.BaseModel.model_dump || pydantic.BaseModel.dict leak memory for some reason.
- "prelude/_compat.py",
+ "prelude_sdk/_compat.py",
# Standard library leaks we don't care about.
"/logging/__init__.py",
]
@@ -274,11 +261,7 @@ def test_request_timeout(self) -> None:
def test_client_timeout_option(self) -> None:
client = Prelude(
- base_url=base_url,
- api_key=api_key,
- customer_uuid=customer_uuid,
- _strict_response_validation=True,
- timeout=httpx.Timeout(0),
+ base_url=base_url, api_token=api_token, _strict_response_validation=True, timeout=httpx.Timeout(0)
)
request = client._build_request(FinalRequestOptions(method="get", url="/foo"))
@@ -289,11 +272,7 @@ def test_http_client_timeout_option(self) -> None:
# custom timeout given to the httpx client should be used
with httpx.Client(timeout=None) as http_client:
client = Prelude(
- base_url=base_url,
- api_key=api_key,
- customer_uuid=customer_uuid,
- _strict_response_validation=True,
- http_client=http_client,
+ base_url=base_url, api_token=api_token, _strict_response_validation=True, http_client=http_client
)
request = client._build_request(FinalRequestOptions(method="get", url="/foo"))
@@ -303,11 +282,7 @@ def test_http_client_timeout_option(self) -> None:
# no timeout given to the httpx client should not use the httpx default
with httpx.Client() as http_client:
client = Prelude(
- base_url=base_url,
- api_key=api_key,
- customer_uuid=customer_uuid,
- _strict_response_validation=True,
- http_client=http_client,
+ base_url=base_url, api_token=api_token, _strict_response_validation=True, http_client=http_client
)
request = client._build_request(FinalRequestOptions(method="get", url="/foo"))
@@ -317,11 +292,7 @@ def test_http_client_timeout_option(self) -> None:
# explicitly passing the default timeout currently results in it being ignored
with httpx.Client(timeout=HTTPX_DEFAULT_TIMEOUT) as http_client:
client = Prelude(
- base_url=base_url,
- api_key=api_key,
- customer_uuid=customer_uuid,
- _strict_response_validation=True,
- http_client=http_client,
+ base_url=base_url, api_token=api_token, _strict_response_validation=True, http_client=http_client
)
request = client._build_request(FinalRequestOptions(method="get", url="/foo"))
@@ -333,19 +304,14 @@ async def test_invalid_http_client(self) -> None:
async with httpx.AsyncClient() as http_client:
Prelude(
base_url=base_url,
- api_key=api_key,
- customer_uuid=customer_uuid,
+ api_token=api_token,
_strict_response_validation=True,
http_client=cast(Any, http_client),
)
def test_default_headers_option(self) -> None:
client = Prelude(
- base_url=base_url,
- api_key=api_key,
- customer_uuid=customer_uuid,
- _strict_response_validation=True,
- default_headers={"X-Foo": "bar"},
+ base_url=base_url, api_token=api_token, _strict_response_validation=True, default_headers={"X-Foo": "bar"}
)
request = client._build_request(FinalRequestOptions(method="get", url="/foo"))
assert request.headers.get("x-foo") == "bar"
@@ -353,8 +319,7 @@ def test_default_headers_option(self) -> None:
client2 = Prelude(
base_url=base_url,
- api_key=api_key,
- customer_uuid=customer_uuid,
+ api_token=api_token,
_strict_response_validation=True,
default_headers={
"X-Foo": "stainless",
@@ -366,24 +331,19 @@ def test_default_headers_option(self) -> None:
assert request.headers.get("x-stainless-lang") == "my-overriding-header"
def test_validate_headers(self) -> None:
- client = Prelude(
- base_url=base_url, api_key=api_key, customer_uuid=customer_uuid, _strict_response_validation=True
- )
+ client = Prelude(base_url=base_url, api_token=api_token, _strict_response_validation=True)
request = client._build_request(FinalRequestOptions(method="get", url="/foo"))
- assert request.headers.get("x-api-key") == api_key
+ assert request.headers.get("Authorization") == f"Bearer {api_token}"
with pytest.raises(PreludeError):
- with update_env(**{"PRELUDE_API_KEY": Omit()}):
- client2 = Prelude(
- base_url=base_url, api_key=None, customer_uuid=customer_uuid, _strict_response_validation=True
- )
+ with update_env(**{"API_TOKEN": Omit()}):
+ client2 = Prelude(base_url=base_url, api_token=None, _strict_response_validation=True)
_ = client2
def test_default_query_option(self) -> None:
client = Prelude(
base_url=base_url,
- api_key=api_key,
- customer_uuid=customer_uuid,
+ api_token=api_token,
_strict_response_validation=True,
default_query={"query_param": "bar"},
)
@@ -586,10 +546,7 @@ class Model(BaseModel):
def test_base_url_setter(self) -> None:
client = Prelude(
- base_url="https://example.com/from_init",
- api_key=api_key,
- customer_uuid=customer_uuid,
- _strict_response_validation=True,
+ base_url="https://example.com/from_init", api_token=api_token, _strict_response_validation=True
)
assert client.base_url == "https://example.com/from_init/"
@@ -599,22 +556,18 @@ def test_base_url_setter(self) -> None:
def test_base_url_env(self) -> None:
with update_env(PRELUDE_BASE_URL="http://localhost:5000/from/env"):
- client = Prelude(api_key=api_key, customer_uuid=customer_uuid, _strict_response_validation=True)
+ client = Prelude(api_token=api_token, _strict_response_validation=True)
assert client.base_url == "http://localhost:5000/from/env/"
@pytest.mark.parametrize(
"client",
[
Prelude(
- base_url="http://localhost:5000/custom/path/",
- api_key=api_key,
- customer_uuid=customer_uuid,
- _strict_response_validation=True,
+ base_url="http://localhost:5000/custom/path/", api_token=api_token, _strict_response_validation=True
),
Prelude(
base_url="http://localhost:5000/custom/path/",
- api_key=api_key,
- customer_uuid=customer_uuid,
+ api_token=api_token,
_strict_response_validation=True,
http_client=httpx.Client(),
),
@@ -635,15 +588,11 @@ def test_base_url_trailing_slash(self, client: Prelude) -> None:
"client",
[
Prelude(
- base_url="http://localhost:5000/custom/path/",
- api_key=api_key,
- customer_uuid=customer_uuid,
- _strict_response_validation=True,
+ base_url="http://localhost:5000/custom/path/", api_token=api_token, _strict_response_validation=True
),
Prelude(
base_url="http://localhost:5000/custom/path/",
- api_key=api_key,
- customer_uuid=customer_uuid,
+ api_token=api_token,
_strict_response_validation=True,
http_client=httpx.Client(),
),
@@ -664,15 +613,11 @@ def test_base_url_no_trailing_slash(self, client: Prelude) -> None:
"client",
[
Prelude(
- base_url="http://localhost:5000/custom/path/",
- api_key=api_key,
- customer_uuid=customer_uuid,
- _strict_response_validation=True,
+ base_url="http://localhost:5000/custom/path/", api_token=api_token, _strict_response_validation=True
),
Prelude(
base_url="http://localhost:5000/custom/path/",
- api_key=api_key,
- customer_uuid=customer_uuid,
+ api_token=api_token,
_strict_response_validation=True,
http_client=httpx.Client(),
),
@@ -690,9 +635,7 @@ def test_absolute_request_url(self, client: Prelude) -> None:
assert request.url == "https://myapi.com/foo"
def test_copied_client_does_not_close_http(self) -> None:
- client = Prelude(
- base_url=base_url, api_key=api_key, customer_uuid=customer_uuid, _strict_response_validation=True
- )
+ client = Prelude(base_url=base_url, api_token=api_token, _strict_response_validation=True)
assert not client.is_closed()
copied = client.copy()
@@ -703,9 +646,7 @@ def test_copied_client_does_not_close_http(self) -> None:
assert not client.is_closed()
def test_client_context_manager(self) -> None:
- client = Prelude(
- base_url=base_url, api_key=api_key, customer_uuid=customer_uuid, _strict_response_validation=True
- )
+ client = Prelude(base_url=base_url, api_token=api_token, _strict_response_validation=True)
with client as c2:
assert c2 is client
assert not c2.is_closed()
@@ -727,11 +668,7 @@ class Model(BaseModel):
def test_client_max_retries_validation(self) -> None:
with pytest.raises(TypeError, match=r"max_retries cannot be None"):
Prelude(
- base_url=base_url,
- api_key=api_key,
- customer_uuid=customer_uuid,
- _strict_response_validation=True,
- max_retries=cast(Any, None),
+ base_url=base_url, api_token=api_token, _strict_response_validation=True, max_retries=cast(Any, None)
)
@pytest.mark.respx(base_url=base_url)
@@ -741,16 +678,12 @@ class Model(BaseModel):
respx_mock.get("/foo").mock(return_value=httpx.Response(200, text="my-custom-format"))
- strict_client = Prelude(
- base_url=base_url, api_key=api_key, customer_uuid=customer_uuid, _strict_response_validation=True
- )
+ strict_client = Prelude(base_url=base_url, api_token=api_token, _strict_response_validation=True)
with pytest.raises(APIResponseValidationError):
strict_client.get("/foo", cast_to=Model)
- client = Prelude(
- base_url=base_url, api_key=api_key, customer_uuid=customer_uuid, _strict_response_validation=False
- )
+ client = Prelude(base_url=base_url, api_token=api_token, _strict_response_validation=False)
response = client.get("/foo", cast_to=Model)
assert isinstance(response, str) # type: ignore[unreachable]
@@ -778,25 +711,29 @@ class Model(BaseModel):
)
@mock.patch("time.time", mock.MagicMock(return_value=1696004797))
def test_parse_retry_after_header(self, remaining_retries: int, retry_after: str, timeout: float) -> None:
- client = Prelude(
- base_url=base_url, api_key=api_key, customer_uuid=customer_uuid, _strict_response_validation=True
- )
+ client = Prelude(base_url=base_url, api_token=api_token, _strict_response_validation=True)
headers = httpx.Headers({"retry-after": retry_after})
options = FinalRequestOptions(method="get", url="/foo", max_retries=3)
calculated = client._calculate_retry_timeout(remaining_retries, options, headers)
assert calculated == pytest.approx(timeout, 0.5 * 0.875) # pyright: ignore[reportUnknownMemberType]
- @mock.patch("prelude._base_client.BaseClient._calculate_retry_timeout", _low_retry_timeout)
+ @mock.patch("prelude_sdk._base_client.BaseClient._calculate_retry_timeout", _low_retry_timeout)
@pytest.mark.respx(base_url=base_url)
def test_retrying_timeout_errors_doesnt_leak(self, respx_mock: MockRouter) -> None:
- respx_mock.post("/authentication").mock(side_effect=httpx.TimeoutException("Test timeout error"))
+ respx_mock.post("/v2/verification").mock(side_effect=httpx.TimeoutException("Test timeout error"))
with pytest.raises(APITimeoutError):
self.client.post(
- "/authentication",
+ "/v2/verification",
body=cast(
- object, dict(customer_uuid="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", phone_number="+1234567890")
+ object,
+ dict(
+ target={
+ "type": "phone_number",
+ "value": "+30123456789",
+ }
+ ),
),
cast_to=httpx.Response,
options={"headers": {RAW_RESPONSE_HEADER: "stream"}},
@@ -804,16 +741,22 @@ def test_retrying_timeout_errors_doesnt_leak(self, respx_mock: MockRouter) -> No
assert _get_open_connections(self.client) == 0
- @mock.patch("prelude._base_client.BaseClient._calculate_retry_timeout", _low_retry_timeout)
+ @mock.patch("prelude_sdk._base_client.BaseClient._calculate_retry_timeout", _low_retry_timeout)
@pytest.mark.respx(base_url=base_url)
def test_retrying_status_errors_doesnt_leak(self, respx_mock: MockRouter) -> None:
- respx_mock.post("/authentication").mock(return_value=httpx.Response(500))
+ respx_mock.post("/v2/verification").mock(return_value=httpx.Response(500))
with pytest.raises(APIStatusError):
self.client.post(
- "/authentication",
+ "/v2/verification",
body=cast(
- object, dict(customer_uuid="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", phone_number="+1234567890")
+ object,
+ dict(
+ target={
+ "type": "phone_number",
+ "value": "+30123456789",
+ }
+ ),
),
cast_to=httpx.Response,
options={"headers": {RAW_RESPONSE_HEADER: "stream"}},
@@ -822,7 +765,7 @@ def test_retrying_status_errors_doesnt_leak(self, respx_mock: MockRouter) -> Non
assert _get_open_connections(self.client) == 0
@pytest.mark.parametrize("failures_before_success", [0, 2, 4])
- @mock.patch("prelude._base_client.BaseClient._calculate_retry_timeout", _low_retry_timeout)
+ @mock.patch("prelude_sdk._base_client.BaseClient._calculate_retry_timeout", _low_retry_timeout)
@pytest.mark.respx(base_url=base_url)
@pytest.mark.parametrize("failure_mode", ["status", "exception"])
def test_retries_taken(
@@ -845,17 +788,20 @@ def retry_handler(_request: httpx.Request) -> httpx.Response:
return httpx.Response(500)
return httpx.Response(200)
- respx_mock.post("/authentication").mock(side_effect=retry_handler)
+ respx_mock.post("/v2/verification").mock(side_effect=retry_handler)
- response = client.authentication.with_raw_response.create(
- customer_uuid="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", phone_number="+1234567890"
+ response = client.verification.with_raw_response.create(
+ target={
+ "type": "phone_number",
+ "value": "+30123456789",
+ }
)
assert response.retries_taken == failures_before_success
assert int(response.http_request.headers.get("x-stainless-retry-count")) == failures_before_success
@pytest.mark.parametrize("failures_before_success", [0, 2, 4])
- @mock.patch("prelude._base_client.BaseClient._calculate_retry_timeout", _low_retry_timeout)
+ @mock.patch("prelude_sdk._base_client.BaseClient._calculate_retry_timeout", _low_retry_timeout)
@pytest.mark.respx(base_url=base_url)
def test_omit_retry_count_header(
self, client: Prelude, failures_before_success: int, respx_mock: MockRouter
@@ -871,18 +817,20 @@ def retry_handler(_request: httpx.Request) -> httpx.Response:
return httpx.Response(500)
return httpx.Response(200)
- respx_mock.post("/authentication").mock(side_effect=retry_handler)
+ respx_mock.post("/v2/verification").mock(side_effect=retry_handler)
- response = client.authentication.with_raw_response.create(
- customer_uuid="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
- phone_number="+1234567890",
+ response = client.verification.with_raw_response.create(
+ target={
+ "type": "phone_number",
+ "value": "+30123456789",
+ },
extra_headers={"x-stainless-retry-count": Omit()},
)
assert len(response.http_request.headers.get_list("x-stainless-retry-count")) == 0
@pytest.mark.parametrize("failures_before_success", [0, 2, 4])
- @mock.patch("prelude._base_client.BaseClient._calculate_retry_timeout", _low_retry_timeout)
+ @mock.patch("prelude_sdk._base_client.BaseClient._calculate_retry_timeout", _low_retry_timeout)
@pytest.mark.respx(base_url=base_url)
def test_overwrite_retry_count_header(
self, client: Prelude, failures_before_success: int, respx_mock: MockRouter
@@ -898,11 +846,13 @@ def retry_handler(_request: httpx.Request) -> httpx.Response:
return httpx.Response(500)
return httpx.Response(200)
- respx_mock.post("/authentication").mock(side_effect=retry_handler)
+ respx_mock.post("/v2/verification").mock(side_effect=retry_handler)
- response = client.authentication.with_raw_response.create(
- customer_uuid="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
- phone_number="+1234567890",
+ response = client.verification.with_raw_response.create(
+ target={
+ "type": "phone_number",
+ "value": "+30123456789",
+ },
extra_headers={"x-stainless-retry-count": "42"},
)
@@ -910,9 +860,7 @@ def retry_handler(_request: httpx.Request) -> httpx.Response:
class TestAsyncPrelude:
- client = AsyncPrelude(
- base_url=base_url, api_key=api_key, customer_uuid=customer_uuid, _strict_response_validation=True
- )
+ client = AsyncPrelude(base_url=base_url, api_token=api_token, _strict_response_validation=True)
@pytest.mark.respx(base_url=base_url)
@pytest.mark.asyncio
@@ -940,13 +888,9 @@ def test_copy(self) -> None:
copied = self.client.copy()
assert id(copied) != id(self.client)
- copied = self.client.copy(api_key="another My API Key")
- assert copied.api_key == "another My API Key"
- assert self.client.api_key == "My API Key"
-
- copied = self.client.copy(customer_uuid="another My Customer Uuid")
- assert copied.customer_uuid == "another My Customer Uuid"
- assert self.client.customer_uuid == "My Customer Uuid"
+ copied = self.client.copy(api_token="another My API Token")
+ assert copied.api_token == "another My API Token"
+ assert self.client.api_token == "My API Token"
def test_copy_default_options(self) -> None:
# options that have a default are overridden correctly
@@ -966,11 +910,7 @@ def test_copy_default_options(self) -> None:
def test_copy_default_headers(self) -> None:
client = AsyncPrelude(
- base_url=base_url,
- api_key=api_key,
- customer_uuid=customer_uuid,
- _strict_response_validation=True,
- default_headers={"X-Foo": "bar"},
+ base_url=base_url, api_token=api_token, _strict_response_validation=True, default_headers={"X-Foo": "bar"}
)
assert client.default_headers["X-Foo"] == "bar"
@@ -1004,11 +944,7 @@ def test_copy_default_headers(self) -> None:
def test_copy_default_query(self) -> None:
client = AsyncPrelude(
- base_url=base_url,
- api_key=api_key,
- customer_uuid=customer_uuid,
- _strict_response_validation=True,
- default_query={"foo": "bar"},
+ base_url=base_url, api_token=api_token, _strict_response_validation=True, default_query={"foo": "bar"}
)
assert _get_params(client)["foo"] == "bar"
@@ -1098,10 +1034,10 @@ def add_leak(leaks: list[tracemalloc.StatisticDiff], diff: tracemalloc.Statistic
# to_raw_response_wrapper leaks through the @functools.wraps() decorator.
#
# removing the decorator fixes the leak for reasons we don't understand.
- "prelude/_legacy_response.py",
- "prelude/_response.py",
+ "prelude_sdk/_legacy_response.py",
+ "prelude_sdk/_response.py",
# pydantic.BaseModel.model_dump || pydantic.BaseModel.dict leak memory for some reason.
- "prelude/_compat.py",
+ "prelude_sdk/_compat.py",
# Standard library leaks we don't care about.
"/logging/__init__.py",
]
@@ -1133,11 +1069,7 @@ async def test_request_timeout(self) -> None:
async def test_client_timeout_option(self) -> None:
client = AsyncPrelude(
- base_url=base_url,
- api_key=api_key,
- customer_uuid=customer_uuid,
- _strict_response_validation=True,
- timeout=httpx.Timeout(0),
+ base_url=base_url, api_token=api_token, _strict_response_validation=True, timeout=httpx.Timeout(0)
)
request = client._build_request(FinalRequestOptions(method="get", url="/foo"))
@@ -1148,11 +1080,7 @@ async def test_http_client_timeout_option(self) -> None:
# custom timeout given to the httpx client should be used
async with httpx.AsyncClient(timeout=None) as http_client:
client = AsyncPrelude(
- base_url=base_url,
- api_key=api_key,
- customer_uuid=customer_uuid,
- _strict_response_validation=True,
- http_client=http_client,
+ base_url=base_url, api_token=api_token, _strict_response_validation=True, http_client=http_client
)
request = client._build_request(FinalRequestOptions(method="get", url="/foo"))
@@ -1162,11 +1090,7 @@ async def test_http_client_timeout_option(self) -> None:
# no timeout given to the httpx client should not use the httpx default
async with httpx.AsyncClient() as http_client:
client = AsyncPrelude(
- base_url=base_url,
- api_key=api_key,
- customer_uuid=customer_uuid,
- _strict_response_validation=True,
- http_client=http_client,
+ base_url=base_url, api_token=api_token, _strict_response_validation=True, http_client=http_client
)
request = client._build_request(FinalRequestOptions(method="get", url="/foo"))
@@ -1176,11 +1100,7 @@ async def test_http_client_timeout_option(self) -> None:
# explicitly passing the default timeout currently results in it being ignored
async with httpx.AsyncClient(timeout=HTTPX_DEFAULT_TIMEOUT) as http_client:
client = AsyncPrelude(
- base_url=base_url,
- api_key=api_key,
- customer_uuid=customer_uuid,
- _strict_response_validation=True,
- http_client=http_client,
+ base_url=base_url, api_token=api_token, _strict_response_validation=True, http_client=http_client
)
request = client._build_request(FinalRequestOptions(method="get", url="/foo"))
@@ -1192,19 +1112,14 @@ def test_invalid_http_client(self) -> None:
with httpx.Client() as http_client:
AsyncPrelude(
base_url=base_url,
- api_key=api_key,
- customer_uuid=customer_uuid,
+ api_token=api_token,
_strict_response_validation=True,
http_client=cast(Any, http_client),
)
def test_default_headers_option(self) -> None:
client = AsyncPrelude(
- base_url=base_url,
- api_key=api_key,
- customer_uuid=customer_uuid,
- _strict_response_validation=True,
- default_headers={"X-Foo": "bar"},
+ base_url=base_url, api_token=api_token, _strict_response_validation=True, default_headers={"X-Foo": "bar"}
)
request = client._build_request(FinalRequestOptions(method="get", url="/foo"))
assert request.headers.get("x-foo") == "bar"
@@ -1212,8 +1127,7 @@ def test_default_headers_option(self) -> None:
client2 = AsyncPrelude(
base_url=base_url,
- api_key=api_key,
- customer_uuid=customer_uuid,
+ api_token=api_token,
_strict_response_validation=True,
default_headers={
"X-Foo": "stainless",
@@ -1225,24 +1139,19 @@ def test_default_headers_option(self) -> None:
assert request.headers.get("x-stainless-lang") == "my-overriding-header"
def test_validate_headers(self) -> None:
- client = AsyncPrelude(
- base_url=base_url, api_key=api_key, customer_uuid=customer_uuid, _strict_response_validation=True
- )
+ client = AsyncPrelude(base_url=base_url, api_token=api_token, _strict_response_validation=True)
request = client._build_request(FinalRequestOptions(method="get", url="/foo"))
- assert request.headers.get("x-api-key") == api_key
+ assert request.headers.get("Authorization") == f"Bearer {api_token}"
with pytest.raises(PreludeError):
- with update_env(**{"PRELUDE_API_KEY": Omit()}):
- client2 = AsyncPrelude(
- base_url=base_url, api_key=None, customer_uuid=customer_uuid, _strict_response_validation=True
- )
+ with update_env(**{"API_TOKEN": Omit()}):
+ client2 = AsyncPrelude(base_url=base_url, api_token=None, _strict_response_validation=True)
_ = client2
def test_default_query_option(self) -> None:
client = AsyncPrelude(
base_url=base_url,
- api_key=api_key,
- customer_uuid=customer_uuid,
+ api_token=api_token,
_strict_response_validation=True,
default_query={"query_param": "bar"},
)
@@ -1445,10 +1354,7 @@ class Model(BaseModel):
def test_base_url_setter(self) -> None:
client = AsyncPrelude(
- base_url="https://example.com/from_init",
- api_key=api_key,
- customer_uuid=customer_uuid,
- _strict_response_validation=True,
+ base_url="https://example.com/from_init", api_token=api_token, _strict_response_validation=True
)
assert client.base_url == "https://example.com/from_init/"
@@ -1458,22 +1364,18 @@ def test_base_url_setter(self) -> None:
def test_base_url_env(self) -> None:
with update_env(PRELUDE_BASE_URL="http://localhost:5000/from/env"):
- client = AsyncPrelude(api_key=api_key, customer_uuid=customer_uuid, _strict_response_validation=True)
+ client = AsyncPrelude(api_token=api_token, _strict_response_validation=True)
assert client.base_url == "http://localhost:5000/from/env/"
@pytest.mark.parametrize(
"client",
[
AsyncPrelude(
- base_url="http://localhost:5000/custom/path/",
- api_key=api_key,
- customer_uuid=customer_uuid,
- _strict_response_validation=True,
+ base_url="http://localhost:5000/custom/path/", api_token=api_token, _strict_response_validation=True
),
AsyncPrelude(
base_url="http://localhost:5000/custom/path/",
- api_key=api_key,
- customer_uuid=customer_uuid,
+ api_token=api_token,
_strict_response_validation=True,
http_client=httpx.AsyncClient(),
),
@@ -1494,15 +1396,11 @@ def test_base_url_trailing_slash(self, client: AsyncPrelude) -> None:
"client",
[
AsyncPrelude(
- base_url="http://localhost:5000/custom/path/",
- api_key=api_key,
- customer_uuid=customer_uuid,
- _strict_response_validation=True,
+ base_url="http://localhost:5000/custom/path/", api_token=api_token, _strict_response_validation=True
),
AsyncPrelude(
base_url="http://localhost:5000/custom/path/",
- api_key=api_key,
- customer_uuid=customer_uuid,
+ api_token=api_token,
_strict_response_validation=True,
http_client=httpx.AsyncClient(),
),
@@ -1523,15 +1421,11 @@ def test_base_url_no_trailing_slash(self, client: AsyncPrelude) -> None:
"client",
[
AsyncPrelude(
- base_url="http://localhost:5000/custom/path/",
- api_key=api_key,
- customer_uuid=customer_uuid,
- _strict_response_validation=True,
+ base_url="http://localhost:5000/custom/path/", api_token=api_token, _strict_response_validation=True
),
AsyncPrelude(
base_url="http://localhost:5000/custom/path/",
- api_key=api_key,
- customer_uuid=customer_uuid,
+ api_token=api_token,
_strict_response_validation=True,
http_client=httpx.AsyncClient(),
),
@@ -1549,9 +1443,7 @@ def test_absolute_request_url(self, client: AsyncPrelude) -> None:
assert request.url == "https://myapi.com/foo"
async def test_copied_client_does_not_close_http(self) -> None:
- client = AsyncPrelude(
- base_url=base_url, api_key=api_key, customer_uuid=customer_uuid, _strict_response_validation=True
- )
+ client = AsyncPrelude(base_url=base_url, api_token=api_token, _strict_response_validation=True)
assert not client.is_closed()
copied = client.copy()
@@ -1563,9 +1455,7 @@ async def test_copied_client_does_not_close_http(self) -> None:
assert not client.is_closed()
async def test_client_context_manager(self) -> None:
- client = AsyncPrelude(
- base_url=base_url, api_key=api_key, customer_uuid=customer_uuid, _strict_response_validation=True
- )
+ client = AsyncPrelude(base_url=base_url, api_token=api_token, _strict_response_validation=True)
async with client as c2:
assert c2 is client
assert not c2.is_closed()
@@ -1588,11 +1478,7 @@ class Model(BaseModel):
async def test_client_max_retries_validation(self) -> None:
with pytest.raises(TypeError, match=r"max_retries cannot be None"):
AsyncPrelude(
- base_url=base_url,
- api_key=api_key,
- customer_uuid=customer_uuid,
- _strict_response_validation=True,
- max_retries=cast(Any, None),
+ base_url=base_url, api_token=api_token, _strict_response_validation=True, max_retries=cast(Any, None)
)
@pytest.mark.respx(base_url=base_url)
@@ -1603,16 +1489,12 @@ class Model(BaseModel):
respx_mock.get("/foo").mock(return_value=httpx.Response(200, text="my-custom-format"))
- strict_client = AsyncPrelude(
- base_url=base_url, api_key=api_key, customer_uuid=customer_uuid, _strict_response_validation=True
- )
+ strict_client = AsyncPrelude(base_url=base_url, api_token=api_token, _strict_response_validation=True)
with pytest.raises(APIResponseValidationError):
await strict_client.get("/foo", cast_to=Model)
- client = AsyncPrelude(
- base_url=base_url, api_key=api_key, customer_uuid=customer_uuid, _strict_response_validation=False
- )
+ client = AsyncPrelude(base_url=base_url, api_token=api_token, _strict_response_validation=False)
response = await client.get("/foo", cast_to=Model)
assert isinstance(response, str) # type: ignore[unreachable]
@@ -1641,25 +1523,29 @@ class Model(BaseModel):
@mock.patch("time.time", mock.MagicMock(return_value=1696004797))
@pytest.mark.asyncio
async def test_parse_retry_after_header(self, remaining_retries: int, retry_after: str, timeout: float) -> None:
- client = AsyncPrelude(
- base_url=base_url, api_key=api_key, customer_uuid=customer_uuid, _strict_response_validation=True
- )
+ client = AsyncPrelude(base_url=base_url, api_token=api_token, _strict_response_validation=True)
headers = httpx.Headers({"retry-after": retry_after})
options = FinalRequestOptions(method="get", url="/foo", max_retries=3)
calculated = client._calculate_retry_timeout(remaining_retries, options, headers)
assert calculated == pytest.approx(timeout, 0.5 * 0.875) # pyright: ignore[reportUnknownMemberType]
- @mock.patch("prelude._base_client.BaseClient._calculate_retry_timeout", _low_retry_timeout)
+ @mock.patch("prelude_sdk._base_client.BaseClient._calculate_retry_timeout", _low_retry_timeout)
@pytest.mark.respx(base_url=base_url)
async def test_retrying_timeout_errors_doesnt_leak(self, respx_mock: MockRouter) -> None:
- respx_mock.post("/authentication").mock(side_effect=httpx.TimeoutException("Test timeout error"))
+ respx_mock.post("/v2/verification").mock(side_effect=httpx.TimeoutException("Test timeout error"))
with pytest.raises(APITimeoutError):
await self.client.post(
- "/authentication",
+ "/v2/verification",
body=cast(
- object, dict(customer_uuid="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", phone_number="+1234567890")
+ object,
+ dict(
+ target={
+ "type": "phone_number",
+ "value": "+30123456789",
+ }
+ ),
),
cast_to=httpx.Response,
options={"headers": {RAW_RESPONSE_HEADER: "stream"}},
@@ -1667,16 +1553,22 @@ async def test_retrying_timeout_errors_doesnt_leak(self, respx_mock: MockRouter)
assert _get_open_connections(self.client) == 0
- @mock.patch("prelude._base_client.BaseClient._calculate_retry_timeout", _low_retry_timeout)
+ @mock.patch("prelude_sdk._base_client.BaseClient._calculate_retry_timeout", _low_retry_timeout)
@pytest.mark.respx(base_url=base_url)
async def test_retrying_status_errors_doesnt_leak(self, respx_mock: MockRouter) -> None:
- respx_mock.post("/authentication").mock(return_value=httpx.Response(500))
+ respx_mock.post("/v2/verification").mock(return_value=httpx.Response(500))
with pytest.raises(APIStatusError):
await self.client.post(
- "/authentication",
+ "/v2/verification",
body=cast(
- object, dict(customer_uuid="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", phone_number="+1234567890")
+ object,
+ dict(
+ target={
+ "type": "phone_number",
+ "value": "+30123456789",
+ }
+ ),
),
cast_to=httpx.Response,
options={"headers": {RAW_RESPONSE_HEADER: "stream"}},
@@ -1685,7 +1577,7 @@ async def test_retrying_status_errors_doesnt_leak(self, respx_mock: MockRouter)
assert _get_open_connections(self.client) == 0
@pytest.mark.parametrize("failures_before_success", [0, 2, 4])
- @mock.patch("prelude._base_client.BaseClient._calculate_retry_timeout", _low_retry_timeout)
+ @mock.patch("prelude_sdk._base_client.BaseClient._calculate_retry_timeout", _low_retry_timeout)
@pytest.mark.respx(base_url=base_url)
@pytest.mark.asyncio
@pytest.mark.parametrize("failure_mode", ["status", "exception"])
@@ -1709,17 +1601,20 @@ def retry_handler(_request: httpx.Request) -> httpx.Response:
return httpx.Response(500)
return httpx.Response(200)
- respx_mock.post("/authentication").mock(side_effect=retry_handler)
+ respx_mock.post("/v2/verification").mock(side_effect=retry_handler)
- response = await client.authentication.with_raw_response.create(
- customer_uuid="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", phone_number="+1234567890"
+ response = await client.verification.with_raw_response.create(
+ target={
+ "type": "phone_number",
+ "value": "+30123456789",
+ }
)
assert response.retries_taken == failures_before_success
assert int(response.http_request.headers.get("x-stainless-retry-count")) == failures_before_success
@pytest.mark.parametrize("failures_before_success", [0, 2, 4])
- @mock.patch("prelude._base_client.BaseClient._calculate_retry_timeout", _low_retry_timeout)
+ @mock.patch("prelude_sdk._base_client.BaseClient._calculate_retry_timeout", _low_retry_timeout)
@pytest.mark.respx(base_url=base_url)
@pytest.mark.asyncio
async def test_omit_retry_count_header(
@@ -1736,18 +1631,20 @@ def retry_handler(_request: httpx.Request) -> httpx.Response:
return httpx.Response(500)
return httpx.Response(200)
- respx_mock.post("/authentication").mock(side_effect=retry_handler)
+ respx_mock.post("/v2/verification").mock(side_effect=retry_handler)
- response = await client.authentication.with_raw_response.create(
- customer_uuid="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
- phone_number="+1234567890",
+ response = await client.verification.with_raw_response.create(
+ target={
+ "type": "phone_number",
+ "value": "+30123456789",
+ },
extra_headers={"x-stainless-retry-count": Omit()},
)
assert len(response.http_request.headers.get_list("x-stainless-retry-count")) == 0
@pytest.mark.parametrize("failures_before_success", [0, 2, 4])
- @mock.patch("prelude._base_client.BaseClient._calculate_retry_timeout", _low_retry_timeout)
+ @mock.patch("prelude_sdk._base_client.BaseClient._calculate_retry_timeout", _low_retry_timeout)
@pytest.mark.respx(base_url=base_url)
@pytest.mark.asyncio
async def test_overwrite_retry_count_header(
@@ -1764,11 +1661,13 @@ def retry_handler(_request: httpx.Request) -> httpx.Response:
return httpx.Response(500)
return httpx.Response(200)
- respx_mock.post("/authentication").mock(side_effect=retry_handler)
+ respx_mock.post("/v2/verification").mock(side_effect=retry_handler)
- response = await client.authentication.with_raw_response.create(
- customer_uuid="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
- phone_number="+1234567890",
+ response = await client.verification.with_raw_response.create(
+ target={
+ "type": "phone_number",
+ "value": "+30123456789",
+ },
extra_headers={"x-stainless-retry-count": "42"},
)
diff --git a/tests/test_deepcopy.py b/tests/test_deepcopy.py
index 78c2485..4257532 100644
--- a/tests/test_deepcopy.py
+++ b/tests/test_deepcopy.py
@@ -1,4 +1,4 @@
-from prelude._utils import deepcopy_minimal
+from prelude_sdk._utils import deepcopy_minimal
def assert_different_identities(obj1: object, obj2: object) -> None:
diff --git a/tests/test_extract_files.py b/tests/test_extract_files.py
index 6cdfe0a..38d5dcd 100644
--- a/tests/test_extract_files.py
+++ b/tests/test_extract_files.py
@@ -4,8 +4,8 @@
import pytest
-from prelude._types import FileTypes
-from prelude._utils import extract_files
+from prelude_sdk._types import FileTypes
+from prelude_sdk._utils import extract_files
def test_removes_files_from_input() -> None:
diff --git a/tests/test_files.py b/tests/test_files.py
index ed4a919..8ebddf6 100644
--- a/tests/test_files.py
+++ b/tests/test_files.py
@@ -4,7 +4,7 @@
import pytest
from dirty_equals import IsDict, IsList, IsBytes, IsTuple
-from prelude._files import to_httpx_files, async_to_httpx_files
+from prelude_sdk._files import to_httpx_files, async_to_httpx_files
readme_path = Path(__file__).parent.parent.joinpath("README.md")
diff --git a/tests/test_models.py b/tests/test_models.py
index 1faee23..6cee2a3 100644
--- a/tests/test_models.py
+++ b/tests/test_models.py
@@ -7,9 +7,9 @@
import pydantic
from pydantic import Field
-from prelude._utils import PropertyInfo
-from prelude._compat import PYDANTIC_V2, parse_obj, model_dump, model_json
-from prelude._models import BaseModel, construct_type
+from prelude_sdk._utils import PropertyInfo
+from prelude_sdk._compat import PYDANTIC_V2, parse_obj, model_dump, model_json
+from prelude_sdk._models import BaseModel, construct_type
class BasicModel(BaseModel):
diff --git a/tests/test_qs.py b/tests/test_qs.py
index 2165d01..9248a25 100644
--- a/tests/test_qs.py
+++ b/tests/test_qs.py
@@ -4,7 +4,7 @@
import pytest
-from prelude._qs import Querystring, stringify
+from prelude_sdk._qs import Querystring, stringify
def test_empty() -> None:
diff --git a/tests/test_required_args.py b/tests/test_required_args.py
index 92264cf..63ad3ea 100644
--- a/tests/test_required_args.py
+++ b/tests/test_required_args.py
@@ -2,7 +2,7 @@
import pytest
-from prelude._utils import required_args
+from prelude_sdk._utils import required_args
def test_too_many_positional_params() -> None:
diff --git a/tests/test_response.py b/tests/test_response.py
index 9da1d2e..7fbb499 100644
--- a/tests/test_response.py
+++ b/tests/test_response.py
@@ -6,8 +6,8 @@
import pytest
import pydantic
-from prelude import Prelude, BaseModel, AsyncPrelude
-from prelude._response import (
+from prelude_sdk import Prelude, BaseModel, AsyncPrelude
+from prelude_sdk._response import (
APIResponse,
BaseAPIResponse,
AsyncAPIResponse,
@@ -15,8 +15,8 @@
AsyncBinaryAPIResponse,
extract_response_type,
)
-from prelude._streaming import Stream
-from prelude._base_client import FinalRequestOptions
+from prelude_sdk._streaming import Stream
+from prelude_sdk._base_client import FinalRequestOptions
class ConcreteBaseAPIResponse(APIResponse[bytes]): ...
@@ -37,7 +37,7 @@ def test_extract_response_type_direct_classes() -> None:
def test_extract_response_type_direct_class_missing_type_arg() -> None:
with pytest.raises(
RuntimeError,
- match="Expected type to have a type argument at index 0 but it did not",
+ match="Expected type to have a type argument at index 0 but it did not",
):
extract_response_type(AsyncAPIResponse)
@@ -68,7 +68,7 @@ def test_response_parse_mismatched_basemodel(client: Prelude) -> None:
with pytest.raises(
TypeError,
- match="Pydantic models must subclass our base model type, e.g. `from prelude import BaseModel`",
+ match="Pydantic models must subclass our base model type, e.g. `from prelude_sdk import BaseModel`",
):
response.parse(to=PydanticModel)
@@ -86,7 +86,7 @@ async def test_async_response_parse_mismatched_basemodel(async_client: AsyncPrel
with pytest.raises(
TypeError,
- match="Pydantic models must subclass our base model type, e.g. `from prelude import BaseModel`",
+ match="Pydantic models must subclass our base model type, e.g. `from prelude_sdk import BaseModel`",
):
await response.parse(to=PydanticModel)
diff --git a/tests/test_streaming.py b/tests/test_streaming.py
index 6a6b7c2..e7a655b 100644
--- a/tests/test_streaming.py
+++ b/tests/test_streaming.py
@@ -5,8 +5,8 @@
import httpx
import pytest
-from prelude import Prelude, AsyncPrelude
-from prelude._streaming import Stream, AsyncStream, ServerSentEvent
+from prelude_sdk import Prelude, AsyncPrelude
+from prelude_sdk._streaming import Stream, AsyncStream, ServerSentEvent
@pytest.mark.asyncio
diff --git a/tests/test_transform.py b/tests/test_transform.py
index 100a246..3d0e246 100644
--- a/tests/test_transform.py
+++ b/tests/test_transform.py
@@ -8,15 +8,15 @@
import pytest
-from prelude._types import Base64FileInput
-from prelude._utils import (
+from prelude_sdk._types import Base64FileInput
+from prelude_sdk._utils import (
PropertyInfo,
transform as _transform,
parse_datetime,
async_transform as _async_transform,
)
-from prelude._compat import PYDANTIC_V2
-from prelude._models import BaseModel
+from prelude_sdk._compat import PYDANTIC_V2
+from prelude_sdk._models import BaseModel
_T = TypeVar("_T")
diff --git a/tests/test_utils/test_proxy.py b/tests/test_utils/test_proxy.py
index f0407a3..62a48ec 100644
--- a/tests/test_utils/test_proxy.py
+++ b/tests/test_utils/test_proxy.py
@@ -2,7 +2,7 @@
from typing import Any
from typing_extensions import override
-from prelude._utils import LazyProxy
+from prelude_sdk._utils import LazyProxy
class RecursiveLazyProxy(LazyProxy[Any]):
diff --git a/tests/test_utils/test_typing.py b/tests/test_utils/test_typing.py
index db1fd6b..41abca9 100644
--- a/tests/test_utils/test_typing.py
+++ b/tests/test_utils/test_typing.py
@@ -2,7 +2,7 @@
from typing import Generic, TypeVar, cast
-from prelude._utils import extract_type_var_from_base
+from prelude_sdk._utils import extract_type_var_from_base
_T = TypeVar("_T")
_T2 = TypeVar("_T2")
diff --git a/tests/utils.py b/tests/utils.py
index b6ce849..54e69bf 100644
--- a/tests/utils.py
+++ b/tests/utils.py
@@ -8,8 +8,8 @@
from datetime import date, datetime
from typing_extensions import Literal, get_args, get_origin, assert_type
-from prelude._types import Omit, NoneType
-from prelude._utils import (
+from prelude_sdk._types import Omit, NoneType
+from prelude_sdk._utils import (
is_dict,
is_list,
is_list_type,
@@ -17,8 +17,8 @@
extract_type_arg,
is_annotated_type,
)
-from prelude._compat import PYDANTIC_V2, field_outer_type, get_model_fields
-from prelude._models import BaseModel
+from prelude_sdk._compat import PYDANTIC_V2, field_outer_type, get_model_fields
+from prelude_sdk._models import BaseModel
BaseModelT = TypeVar("BaseModelT", bound=BaseModel)