Skip to content

Commit

Permalink
rename verify -> verify_legacy and verify_v2 -> verify
Browse files Browse the repository at this point in the history
  • Loading branch information
maxkahan committed Oct 22, 2024
1 parent 62ef878 commit 67d53da
Show file tree
Hide file tree
Showing 65 changed files with 1,336 additions and 1,319 deletions.
44 changes: 22 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ This is the Python server SDK to help you use Vonage APIs in your Python applica
- [SMS API](#sms-api)
- [Subaccounts API](#subaccounts-api)
- [Users API](#users-api)
- [Verify v2 API](#verify-v2-api)
- [Verify v1 API (Legacy)](#verify-v1-api-legacy)
- [Verify API](#verify-api)
- [Verify API (Legacy)](#verify-api-legacy)
- [Video API](#video-api)
- [Voice API](#voice-api)
- [Vonage Utils Package](#vonage-utils-package)
Expand Down Expand Up @@ -824,12 +824,12 @@ user = vonage_client.users.update_user(id, user_options)
vonage_client.users.delete_user(id)
```

## Verify v2 API
## Verify API

### Make a Verify Request

```python
from vonage_verify_v2 import VerifyRequest, SmsChannel
from vonage_verify import VerifyRequest, SmsChannel
# All channels have associated models
sms_channel = SmsChannel(to='1234567890')
params = {
Expand All @@ -838,7 +838,7 @@ params = {
}
verify_request = VerifyRequest(**params)

response = vonage_client.verify_v2.start_verification(verify_request)
response = vonage_client.verify.start_verification(verify_request)
```

If using silent authentication, the response will include a `check_url` field with a url that should be accessed on the user's device to proceed with silent authentication. If used, silent auth must be the first element in the `workflow` list.
Expand All @@ -852,81 +852,81 @@ params = {
}
verify_request = VerifyRequest(**params)

response = vonage_client.verify_v2.start_verification(verify_request)
response = vonage_client.verify.start_verification(verify_request)
```

### Check a Verification Code

```python
vonage_client.verify_v2.check_code(request_id='my_request_id', code='1234')
vonage_client.verify.check_code(request_id='my_request_id', code='1234')
```

### Cancel a Verification

```python
vonage_client.verify_v2.cancel_verification('my_request_id')
vonage_client.verify.cancel_verification('my_request_id')
```

### Trigger the Next Workflow Event

```python
vonage_client.verify_v2.trigger_next_workflow('my_request_id')
vonage_client.verify.trigger_next_workflow('my_request_id')
```

## Verify v1 API (Legacy)
## Verify API (Legacy)

### Make a Verify Request

```python
from vonage_verify import VerifyRequest
from vonage_verify_legacy import VerifyRequest
params = {'number': '1234567890', 'brand': 'Acme Inc.'}
request = VerifyRequest(**params)
response = vonage_client.verify.start_verification(request)
response = vonage_client.verify_legacy.start_verification(request)
```

### Make a PSD2 (Payment Services Directive v2) Request

```python
from vonage_verify import Psd2Request
from vonage_verify_legacy import Psd2Request
params = {'number': '1234567890', 'payee': 'Acme Inc.', 'amount': 99.99}
request = VerifyRequest(**params)
response = vonage_client.verify.start_verification(request)
response = vonage_client.verify_legacy.start_verification(request)
```

### Check a Verification Code

```python
vonage_client.verify.check_code(request_id='my_request_id', code='1234')
vonage_client.verify_legacy.check_code(request_id='my_request_id', code='1234')
```

### Search Verification Requests

```python
# Search for single request
response = vonage_client.verify.search('my_request_id')
response = vonage_client.verify_legacy.search('my_request_id')

# Search for multiple requests
response = vonage_client.verify.search(['my_request_id_1', 'my_request_id_2'])
response = vonage_client.verify_legacy.search(['my_request_id_1', 'my_request_id_2'])
```

### Cancel a Verification

```python
response = vonage_client.verify.cancel_verification('my_request_id')
response = vonage_client.verify_legacy.cancel_verification('my_request_id')
```

### Trigger the Next Workflow Event

```python
response = vonage_client.verify.trigger_next_event('my_request_id')
response = vonage_client.verify_legacy.trigger_next_event('my_request_id')
```

### Request a Network Unblock

Note: Network Unblock is switched off by default. Contact Sales to enable the Network Unblock API for your account.

```python
response = vonage_client.verify.request_network_unblock('23410')
response = vonage_client.verify_legacy.request_network_unblock('23410')
```

## Video API
Expand Down Expand Up @@ -1407,8 +1407,8 @@ The following is a list of Vonage APIs and whether the Python SDK provides suppo
| Reports API | Beta ||
| SMS API | General Availability ||
| Subaccounts API | General Availability ||
| Verify API v2 | General Availability ||
| Verify API v1 (Legacy)| General Availability ||
| Verify API | General Availability ||
| Verify API (Legacy) | General Availability ||
| Video API | General Availability ||
| Voice API | General Availability ||

Expand Down
25 changes: 17 additions & 8 deletions V3_TO_V4_SDK_MIGRATION_GUIDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,12 +114,12 @@ Unlike the methods to call each Vonage API, the data models and errors specific
For most APIs, data models and errors can be accessed from the top level of the API package, e.g. to send a Verify request, do this:

```python
from vonage_verify_v2 import VerifyRequest, SmsChannel
from vonage_verify import VerifyRequest, SmsChannel

sms_channel = SmsChannel(to='1234567890')
verify_request = VerifyRequest(brand='Vonage', workflow=[sms_channel])

response = vonage_client.verify_v2.start_verification(verify_request)
response = vonage_client.verify.start_verification(verify_request)
print(response)
```

Expand Down Expand Up @@ -195,9 +195,11 @@ See the [Voice API samples](voice/README.md) for more information.

The process for verifying a number using the Network Number Verification API has been simplified. In v3 it was required to exchange a code for a token then use this token in the verify request. In v4, these steps are combined so both functions are taken care of in the `NetworkNumberVerification.verify` method.

### Verify V2 API
### Verify API Name Changes

Verify v2 functionality is accessed from `vonage_client.verify2` in v3 and `vonage_client.verify_v2` in v4.
The functionality previously named "Verify V2" in v3 of the SDK has been renamed "Verify", along with associated methods. The old Verify product in v3 has been renamed "Verify Legacy".

Verify v2 functionality is now accessed from `vonage_client.verify` in v4, which exposes the `vonage_verify.Verify` class. The legacy Verify v1 objects are accessed from `vonage_client.verify_legacy` in v4, in the new package `vonage-verify-legacy`.

### SMS API

Expand All @@ -223,10 +225,17 @@ Some methods from v3 have had their names changed in v4. Assuming you access all
| `numbers.get_account_numbers` | `numbers.list_owned_numbers` |
| `numbers.get_available_numbers` | `numbers.search_available_numbers` |
| `sms.send_message` | `sms.send` |
| `verify.psd2` | `verify.start_psd2_verification` |
| `verify.check` | `verify.check_code` |
| `verify.check` | `verify.check_code` |
| `verify2.new_request` | `verify_v2.start_verification` |
| `verify.start_verification` | `verify_legacy.start_verification` |
| `verify.psd2` | `verify_legacy.start_psd2_verification` |
| `verify.check` | `verify_legacy.check_code` |
| `verify.search` | `verify_legacy.search` |
| `verify.cancel_verification` | `verify_legacy.cancel_verification` |
| `verify.trigger_next_event` | `verify_legacy.trigger_next_event` |
| `verify.request_network_unblock` | `verify_legacy.request_network_unblock` |
| `verify2.new_request` | `verify.start_verification` |
| `verify2.check_code` | `verify.check_code` |
| `verify2.cancel_verification` | `verify.cancel_verification` |
| `verify2.trigger_next_workflow` | `verify.trigger_next_workflow` |
| `video.set_stream_layout` | `video.change_stream_layout` |
| `video.create_archive` | `video.start_archive` |
| `video.create_sip_call` | `video.initiate_sip_call` |
Expand Down
4 changes: 2 additions & 2 deletions number_insight/src/vonage_number_insight/number_insight.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@ def __init__(self, http_client: HttpClient) -> None:

@property
def http_client(self) -> HttpClient:
"""The HTTP client used to make requests to the Verify V2 API.
"""The HTTP client used to make requests to the Vonage Number Insight API.
Returns:
HttpClient: The HTTP client used to make requests to the Verify V2 API.
HttpClient: The HTTP client used to make requests to the Number Insight API.
"""
return self._http_client

Expand Down
2 changes: 1 addition & 1 deletion pants.toml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ filter = [
'utils/src',
'testutils',
'verify/src',
'verify_v2/src',
'verify_legacy/src',
'video/src',
'voice/src',
'vonage_utils/src',
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ toml>=0.10.2
-e subaccounts
-e users
-e verify
-e verify_v2
-e verify_legacy
-e video
-e voice
-e vonage_utils
Expand Down
13 changes: 8 additions & 5 deletions verify/CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,20 @@
# 1.1.3
# 2.0.0
- Rename `vonage-verify-v2` package -> `vonage-verify`, `VerifyV2` -> `Verify`, etc.

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

# 1.1.3
- Add docstrings for data models

# 1.1.2
- Add docstrings to data models
- Allow minimum `channel_timeout` value to be 15 seconds

# 1.1.1
- Update minimum dependency version

# 1.1.0
- Add `http_client` property

# 1.0.1
- Internal refactoring

# 1.0.0
- Initial upload
57 changes: 24 additions & 33 deletions verify/README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
# Vonage Verify Package

This package contains the code to use Vonage's Verify API in Python. This package includes methods for working with 2-factor authentication (2FA) messages sent via SMS or TTS.

Note: There is a more current package available: [Vonage's Verify v2 API](https://developer.vonage.com/en/verify/overview) which is recommended for most use cases. The v2 API lets you send messages via multiple channels, including Email, SMS, MMS, WhatsApp, Messenger and others. You can also make Silent Authentication requests with Verify v2 to give an end user a more seamless experience.
This package contains the code to use [Vonage's Verify API](https://developer.vonage.com/en/verify/overview) in Python. This package includes methods for working with 2-factor authentication (2FA) messages sent via SMS, Voice, WhatsApp and Email. You can also make Silent Authentication requests with Verify to give your end user a more seamless experience.

## Usage

Expand All @@ -11,19 +9,30 @@ It is recommended to use this as part of the main `vonage` package. The examples
### Make a Verify Request

```python
from vonage_verify import VerifyRequest
params = {'number': '1234567890', 'brand': 'Acme Inc.'}
request = VerifyRequest(**params)
response = vonage_client.verify.start_verification(request)
from vonage_verify import VerifyRequest, SmsChannel
# All channels have associated models
sms_channel = SmsChannel(to='1234567890')
params = {
'brand': 'Vonage',
'workflow': [sms_channel],
}
verify_request = VerifyRequest(**params)

response = vonage_client.verify.start_verification(verify_request)
```

### Make a PSD2 (Payment Services Directive v2) Request
If using silent authentication, the response will include a `check_url` field with a url that should be accessed on the user's device to proceed with silent authentication. If used, silent auth must be the first element in the `workflow` list.

```python
from vonage_verify import Psd2Request
params = {'number': '1234567890', 'payee': 'Acme Inc.', 'amount': 99.99}
request = VerifyRequest(**params)
response = vonage_client.verify.start_verification(request)
silent_auth_channel = SilentAuthChannel(channel=ChannelType.SILENT_AUTH, to='1234567890')
sms_channel = SmsChannel(to='1234567890')
params = {
'brand': 'Vonage',
'workflow': [silent_auth_channel, sms_channel],
}
verify_request = VerifyRequest(**params)

response = vonage_client.verify.start_verification(verify_request)
```

### Check a Verification Code
Expand All @@ -32,32 +41,14 @@ response = vonage_client.verify.start_verification(request)
vonage_client.verify.check_code(request_id='my_request_id', code='1234')
```

### Search Verification Requests

```python
# Search for single request
response = vonage_client.verify.search('my_request_id')

# Search for multiple requests
response = vonage_client.verify.search(['my_request_id_1', 'my_request_id_2'])
```

### Cancel a Verification

```python
response = vonage_client.verify.cancel_verification('my_request_id')
vonage_client.verify.cancel_verification('my_request_id')
```

### Trigger the Next Workflow Event

```python
response = vonage_client.verify.trigger_next_event('my_request_id')
```

### Request a Network Unblock

Note: Network Unblock is switched off by default. Contact Sales to enable the Network Unblock API for your account.

```python
response = vonage_client.verify.request_network_unblock('23410')
```
vonage_client.verify.trigger_next_workflow('my_request_id')
```
32 changes: 17 additions & 15 deletions verify/src/vonage_verify/__init__.py
Original file line number Diff line number Diff line change
@@ -1,25 +1,27 @@
from .enums import ChannelType, Locale
from .errors import VerifyError
from .language_codes import LanguageCode, Psd2LanguageCode
from .requests import Psd2Request, VerifyRequest
from .responses import (
CheckCodeResponse,
NetworkUnblockStatus,
StartVerificationResponse,
VerifyControlStatus,
VerifyStatus,
from .requests import (
EmailChannel,
SilentAuthChannel,
SmsChannel,
VerifyRequest,
VoiceChannel,
WhatsappChannel,
)
from .responses import CheckCodeResponse, StartVerificationResponse
from .verify import Verify

__all__ = [
'Verify',
'VerifyError',
'LanguageCode',
'Psd2LanguageCode',
'Psd2Request',
'VerifyRequest',
'ChannelType',
'CheckCodeResponse',
'NetworkUnblockStatus',
'Locale',
'VerifyRequest',
'SilentAuthChannel',
'SmsChannel',
'WhatsappChannel',
'VoiceChannel',
'EmailChannel',
'StartVerificationResponse',
'VerifyControlStatus',
'VerifyStatus',
]
2 changes: 1 addition & 1 deletion verify/src/vonage_verify/_version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = '1.1.3'
__version__ = '2.0.0'
File renamed without changes.
Loading

0 comments on commit 67d53da

Please sign in to comment.