Skip to content

Commit

Permalink
update readmes and versioning
Browse files Browse the repository at this point in the history
  • Loading branch information
maxkahan committed Nov 6, 2024
1 parent 4d53afa commit 52ae54f
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 33 deletions.
26 changes: 18 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,11 @@ It's recommended to create a new virtual environment to install the SDK. You can
# Create the virtual environment
python3 -m venv venv

# Activate the virtual environment
# Activate the virtual environment in Mac/Linux
. ./venv/bin/activate

# Or on Windows Command Prompt
venv\Scripts\activate
```

To install the Python SDK package using pip:
Expand All @@ -62,13 +65,7 @@ To upgrade your installed client library using pip:
pip install vonage --upgrade
```

Alternatively, you can clone the repository via the command line:

```bash
git clone git@github.com:Vonage/vonage-python-sdk.git
```

or by opening it on GitHub desktop.
Alternatively, you can clone the repository via the command line, or by opening it on GitHub desktop.

## Migration Guides

Expand Down Expand Up @@ -99,6 +96,8 @@ print(response.model_dump(exclude_unset=True))

## Usage

Many of the use cases require you to buy a Vonage Number, which you can [do in the Vonage Developer Dashboard](https://dashboard.nexmo.com/).

```python
from vonage import Vonage, Auth, HttpClientOptions

Expand Down Expand Up @@ -129,6 +128,17 @@ You can also access the underlying `HttpClient` instance through the `http_clien
user_agent = vonage.http_client.user_agent
```

### Convert a Pydantic Model to Dict or Json

Most responses to API calls in the SDK are Pydantic models. To convert a Pydantic model to a dict, use `model.model_dump`. To convert to a JSON string, use `model.model_dump_json`

```python
response = vonage.api_package.api_call(...)

response_dict = response.model_dump()
response_json = response.model_dump_json()
```

## Account API

### Get Account Balance
Expand Down
3 changes: 2 additions & 1 deletion V3_TO_V4_SDK_MIGRATION_GUIDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ vonage_client.messages.send(message)

In v3 of the SDK, the APIs returned Python dictionaries. In v4, almost all responses are now deserialized from the returned JSON into Pydantic models. Response data models are accessed in the same way as the other data models above and are also fully documented with useful docstrings.

If you want to convert the Pydantic responses into dictionaries, just use the `model_dump` method on the response. For example:
If you want to convert the Pydantic responses into dictionaries, just use the `model_dump` method on the response. You can also use the `model_dump_json` method. For example:

```python
from vonage_account import SettingsResponse
Expand All @@ -153,6 +153,7 @@ settings: SettingsResponse = vonage_client.account.update_default_sms_webhook(
)

print(settings.model_dump())
print(settings.model_dump_json())
```

Response fields are also converted into snake_case where applicable, so as to be more pythonic. This means they won't necessarily match the API one-to-one.
Expand Down
2 changes: 1 addition & 1 deletion verify/CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# 2.0.0
- Rename `vonage-verify-v2` package -> `vonage-verify`, `VerifyV2` -> `Verify`, etc.
- Rename `vonage-verify-v2` package -> `vonage-verify`, `VerifyV2` -> `Verify`, etc. This package now contains code for the Verify v2 API
- Update dependency versions

# 1.1.4
Expand Down
21 changes: 1 addition & 20 deletions verify_legacy/CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,2 @@
# 2.0.0
- Rename to "Verify Legacy", rename `vonage-verify` -> `vonage-verify-legacy`, `Verify` -> `VerifyLegacy`, etc.
- Update dependency versions

# 1.1.3
- Support for Python 3.13, drop support for 3.8

# 1.1.2
- Add docstrings to data models

# 1.1.1
- Update minimum dependency version

# 1.1.0
- Add `http_client` property

# 1.0.1
- Internal refactoring

# 1.0.0
- Initial upload
- Initial upload as `legacy` package
2 changes: 1 addition & 1 deletion verify_legacy/src/vonage_verify_legacy/_version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = '2.0.0'
__version__ = '1.0.0'
4 changes: 2 additions & 2 deletions vonage/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ requires-python = ">=3.9"
dependencies = [
"vonage-utils>=1.1.4",
"vonage-http-client>=1.4.3",
"vonage-account>=1.0.3",
"vonage-account>=1.1.0",
"vonage-application>=2.0.0",
"vonage-messages>=1.2.3",
"vonage-network-auth>=1.0.1",
Expand All @@ -19,7 +19,7 @@ dependencies = [
"vonage-subaccounts>=1.0.4",
"vonage-users>=1.2.0",
"vonage-verify>=2.0.0",
"vonage-verify-legacy>=2.0.0",
"vonage-verify-legacy>=1.0.0",
"vonage-video>=1.0.2",
"vonage-voice>=1.0.6",
]
Expand Down

0 comments on commit 52ae54f

Please sign in to comment.