Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cnam storage python sdk #237

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Change Log

## [4.38.0](https://github.com/plivo/plivo-python/tree/v4.37.0) (2023-06-30)
**Feature - CNAM Storage**
- Added New Param `cnam` in to the response of the [list all numbers API], [list single number API]
- Added `cnam` filter to AccountPhoneNumber - list all my numbers API.
- Added `cnam`, `callback_url`, `callback_method` parameter to buy number[Buy a Phone Number] to configure CNAM storage while buying a US number
- Added `cnam`, `callback_url`, `callback_method` parameter to update number[Update an account phone number] to configure CNAM storage while updating a US number
-
## [4.37.0](https://github.com/plivo/plivo-python/tree/v4.37.0) (2022-06-38)
**Feature - Streaming API and XML**
- Added Stream API endpoints
Expand Down
15 changes: 12 additions & 3 deletions plivo/resources/numbers.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ class Number(PlivoResource):
def delete(self):
return self.client.numbers.delete(self.id)

#here to make changes
def update(self,
app_id=None,
subaccount=None,
Expand All @@ -34,8 +35,12 @@ def __init__(self, client):
number=[is_phonenumber()],
app_id=[optional(of_type(six.text_type))],
verification_info=[optional(of_type_exact(dict))],
cnam_lookup=[optional(of_type(six.text_type))],)
def buy(self, number, app_id=None, verification_info=None, cnam_lookup=None):
cnam_lookup=[optional(of_type(six.text_type))],
cnam=[optional(of_type(six.text_type))],
callback_url=[optional(of_type(six.text_type))],
callback_method=[optional(of_type(six.text_type))],
)
def buy(self, number, app_id=None, verification_info=None, cnam_lookup=None, cnam=None, callback_url=None, callback_method=None):
return self.client.request('POST', ('PhoneNumber', number),
to_param_dict(self.buy, locals()))

Expand Down Expand Up @@ -90,6 +95,7 @@ def list(self,
renewal_date__gte=None,
renewal_date__gt=None,
cnam_lookup=None,
cnam=None
limit=20,
offset=0):
return self.client.request(
Expand Down Expand Up @@ -131,7 +137,10 @@ def update(self,
subaccount=None,
alias=None,
verification_info=None,
cnam_lookup=None,):
cnam_lookup=None,
cnam=None,
callback_url=None,
callback_method=None):
return self.client.request('POST', ('Number', number),
to_param_dict(self.update, locals()))

Expand Down
1 change: 1 addition & 0 deletions tests/resources/fixtures/numberGetResponse.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"number_type": "local",
"city": "USA",
"cnam_lookup": "enabled",
"cnam": "plivo",
"compliance_application_id": null,
"compliance_status": null,
"country": "United States",
Expand Down
3 changes: 3 additions & 0 deletions tests/resources/fixtures/numberListResponse.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
"toll_free_sms_verification": null,
"renewal_date": "2014-09-05",
"cnam_lookup": "enabled",
"cnam": "plivo",
"voice_enabled": true,
"voice_rate": "0.00850"
},
Expand Down Expand Up @@ -61,6 +62,7 @@
"toll_free_sms_verification": null,
"renewal_date": "2013-02-01",
"cnam_lookup": "enabled",
"cnam": "numbers",
"voice_enabled": true,
"voice_rate": "0.00850"
},
Expand Down Expand Up @@ -88,6 +90,7 @@
"toll_free_sms_verification": "verified",
"renewal_date": "2013-04-25",
"cnam_lookup": "disabled",
"cnam": "plivo12",
"voice_enabled": true,
"voice_rate": "0.00850"
}
Expand Down