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

TF verification changes in go sdk #188

Merged
merged 20 commits into from
Oct 31, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
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
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Change Log

## [7.41.0](https://github.com/plivo/plivo-go/tree/v7.41.0) (2023-10-31)
**Feature - TollFree Verification API Support**
- API support for Create, Update, Get, Delete and List Tollfree Verification.
- Added New Param `toll_free_sms_verification_id` and `toll_free_sms_verification_order_status `in to the response of the [list all numbers API], [list single number API]
- Added `toll_free_sms_verification_order_status` filter to AccountPhoneNumber - list all my numbers API.

## [7.40.0](https://github.com/plivo/plivo-go/tree/v7.40.0) (2023-10-18)
**Feature - Fixes for Campaign services list API meta data**
- Fixed Meta data response for campaign, brand and profile list
Expand Down
2 changes: 1 addition & 1 deletion baseclient.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (
"github.com/google/go-querystring/query"
)

const sdkVersion = "7.40.0"
const sdkVersion = "7.41.0"

const lookupBaseUrl = "lookup.plivo.com"

Expand Down
4 changes: 4 additions & 0 deletions common.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,10 @@ func (self Number) ID() string {
return self.Number
}

func (self TollfreeVerification) ID() string {
return self.UUID
}

func (self PhoneNumber) ID() string {
return self.Number
}
Expand Down
4 changes: 3 additions & 1 deletion fixtures/numberGetResponse.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,7 @@
"tendlc_campaign_id": "ACB1234",
"tendlc_registration_status": "COMPLETED",
"toll_free_sms_verification": "verified",
"renewal_date":"2014-03-14"
"renewal_date":"2014-03-14",
"toll_free_sms_verification_id": "gd4de006-1c95-11e4-8a4a-12ff40008dd",
"toll_free_sms_verification_order_status": "APPROVED"
}
12 changes: 9 additions & 3 deletions fixtures/numberListResponse.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@
"tendlc_campaign_id": "ACB1234",
"tendlc_registration_status": "COMPLETED",
"toll_free_sms_verification": "verified",
"renewal_date":"2014-09-15"
"renewal_date":"2014-09-15",
"toll_free_sms_verification_id": "ff4de006-1c95-11e4-8a33-123140008edf",
"toll_free_sms_verification_order_status": "APPROVED"
},
{
"added_on": "2013-01-01",
Expand All @@ -48,7 +50,9 @@
"tendlc_campaign_id": "ACB1235",
"tendlc_registration_status": "COMPLETED",
"toll_free_sms_verification": "unverified",
"renewal_date":"2014-02-01"
"renewal_date":"2014-02-01",
"toll_free_sms_verification_id": "5g4ge006-1c95-11e4-8a4a-123140008edf",
"toll_free_sms_verification_order_status": "APPROVED"
},
{
"added_on": "2013-03-25",
Expand All @@ -69,7 +73,9 @@
"tendlc_campaign_id": "ACB1236",
"tendlc_registration_status": "COMPLETED",
"toll_free_sms_verification": "verified",
"renewal_date":"2013-04-25"
"renewal_date":"2013-04-25",
"toll_free_sms_verification_id": "457de006-1c95-11e4-8a4a-123140008efd",
"toll_free_sms_verification_order_status": "APPROVED"
}
]
}
5 changes: 5 additions & 0 deletions fixtures/tollFreeRequestVerificationCreateResponse.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"api_id": "5a9fcb68-582d-11e1-86da-6ff39efcb949",
"message": "Tollfree verification request for 18339404937 submitted succesfully",
"uuid": "f19c4773-4ae6-4b75-92ea-9cf3ea4227d6"
}
20 changes: 20 additions & 0 deletions fixtures/tollFreeRequestVerificationGetResponse.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"api_id": "4e1f954c-baf3-11ec-bafe-0242ac110003",
"additional_information": "",
"callback_method": "POST",
"callback_url": "http://plivobin-prod-usw1.plivops.com/1e4jvpt1",
"created": "2023-10-12T15:28:10.216507Z",
"extra_data": "",
"message_sample": "1.Your Plivo verification code is xxxx. 2.Dear <customer name>, you have signed up on Plivo successfully.",
"number": "18449605287",
"optin_image_url": "https://www.plivo.com",
"optin_type": "MOBILE_QR_CODE",
"profile_uuid": "0ead82e0-fc80-4dc3-888b-7778932cf134",
"error_message": "Demo Testing Sanity",
"status": "REJECTED",
"last_modified": "2023-10-13T08:24:26.619565Z",
"usecase": "2FA",
"usecase_summary": "1.We send 2FA codes to customers when they signup. 2.Dear <customer name>, you have signed up on Plivo successfully.",
"uuid": "8163b5f2-7955-498b-780f-b5e6f1062396",
"volume": "100"
}
69 changes: 69 additions & 0 deletions fixtures/tollFreeRequestVerificationListResponse.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
{
"api_id": "4e15f360-72fe-11ee-8538-e20bbbfb283e",
"meta": {
"count": 3,
"limit": 20,
"next": null,
"offset": 0,
"previous": null
},
"objects": [
{
"additional_information": "",
"callback_method": "POST",
"callback_url": "http://plivobin-prod-usw1.plivops.com/1e4jvpt1",
"created": "2023-10-12T15:28:10.216507Z",
"extra_data": "",
"message_sample": "1.Your Plivo verification code is xxxx. 2.Dear <customer name>, you have signed up on Plivo successfully.",
"number": "18449605287",
"optin_image_url": "https://www.plivo.com",
"optin_type": "MOBILE_QR_CODE",
"profile_uuid": "0ead82e0-fc80-4dc3-888b-7778932cf134",
"error_message": "Demo Testing Sanity",
"status": "REJECTED",
"last_modified": "2023-10-13T08:24:26.619565Z",
"usecase": "2FA",
"usecase_summary": "1.We send 2FA codes to customers when they signup. 2.Dear <customer name>, you have signed up on Plivo successfully.",
"uuid": "8163b5f2-7955-498b-780f-b5e6f1062396",
"volume": "100"
},
{
"additional_information": "",
"callback_method": "POST",
"callback_url": "http://plivobin-prod-usw1.plivops.com/1e4jvpt1",
"created": "2023-10-12T12:06:46.527653Z",
"extra_data": "",
"message_sample": "1.Your Plivo verification code is xxxx. 2.Dear <customer name>, you have signed up on Plivo successfully.",
"number": "18449605287",
"optin_image_url": "https://www.plivo.com",
"optin_type": "MOBILE_QR_CODE",
"profile_uuid": "0ead82e0-fc80-4dc3-888b-7778932cf134",
"error_message": "Demo Testing Sanity",
"status": "REJECTED",
"last_modified": "2023-10-12T15:27:56.052433Z",
"usecase": "2FA",
"usecase_summary": "1.We send 2FA codes to customers when they signup. 2.Dear <customer name>, you have signed up on Plivo successfully.",
"uuid": "96ec880d-b7ee-4eb5-7c9a-3ff28826e77c",
"volume": "100"
},
{
"additional_information": "",
"callback_method": "POST",
"callback_url": "http://plivobin-prod-usw1.plivops.com/1e4jvpt1",
"created": "2023-10-12T12:04:39.232025Z",
"extra_data": "",
"message_sample": "1.Your Plivo verification code is xxxx. 2.Dear <customer name>, you have signed up on Plivo successfully.",
"number": "18449605287",
"optin_image_url": "https://www.plivo.com",
"optin_type": "MOBILE_QR_CODE",
"profile_uuid": "0ead82e0-fc80-4dc3-888b-7778932cf134",
"error_message": "Demo Testing Sanity",
"status": "REJECTED",
"last_modified": "2023-10-12T12:05:25.779062Z",
"usecase": "2FA",
"usecase_summary": "1.We send 2FA codes to customers when they signup. 2.Dear <customer name>, you have signed up on Plivo successfully.",
"uuid": "cde56ce5-7005-41f1-6cb4-1af81fa89675",
"volume": "100"
}
]
}
4 changes: 4 additions & 0 deletions fixtures/tollFreeRequestVerificationUpdateResponse.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"api_id": "4e1f954c-baf3-11ec-bafe-0242ac110003",
"message": "Tollfree verification request for 18339404937 updated succesfully"
}
81 changes: 42 additions & 39 deletions numbers.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,29 +5,31 @@ type NumberService struct {
}

type Number struct {
Alias string `json:"alias,omitempty" url:"alias,omitempty"`
VoiceEnabled bool `json:"voice_enabled,omitempty" url:"voice_enabled,omitempty"`
SMSEnabled bool `json:"sms_enabled,omitempty" url:"sms_enabled,omitempty"`
MMSEnabled bool `json:"mms_enabled,omitempty" url:"mms_enabled,omitempty"`
Description string `json:"description,omitempty" url:"description,omitempty"`
PlivoNumber bool `json:"plivo_number,omitempty" url:"plivo_number,omitempty"`
City string `json:"city,omitempty" url:"city,omitempty"`
Country string `json:"country,omitempty" url:"country,omitempty"`
Carrier string `json:"carrier,omitempty" url:"carrier,omitempty"`
Number string `json:"number,omitempty" url:"number,omitempty"`
NumberType string `json:"number_type,omitempty" url:"number_type,omitempty"`
MonthlyRentalRate string `json:"monthly_rental_rate,omitempty" url:"monthly_rental_rate,omitempty"`
Application string `json:"application,omitempty" url:"application,omitempty"`
RenewalDate string `json:"renewal_date,omitempty" url:"renewal_date,omitempty"`
CNAMLookup string `json:"cnam_lookup,omitempty" url:"cnam_lookup,omitempty"`
AddedOn string `json:"added_on,omitempty" url:"added_on,omitempty"`
ResourceURI string `json:"resource_uri,omitempty" url:"resource_uri,omitempty"`
VoiceRate string `json:"voice_rate,omitempty" url:"voice_rate,omitempty"`
SMSRate string `json:"sms_rate,omitempty" url:"sms_rate,omitempty"`
MMSRate string `json:"mms_rate,omitempty" url:"mms_rate,omitempty"`
TendlcCampaignID string `json:"tendlc_campaign_id,omitempty" url:"tendlc_campaign_id,omitempty"`
TendlcRegistrationStatus string `json:"tendlc_registration_status,omitempty" url:"tendlc_registration_status,omitempty"`
TollFreeSMSVerification string `json:"toll_free_sms_verification,omitempty" url:"toll_free_sms_verification,omitempty"`
Alias string `json:"alias,omitempty" url:"alias,omitempty"`
VoiceEnabled bool `json:"voice_enabled,omitempty" url:"voice_enabled,omitempty"`
SMSEnabled bool `json:"sms_enabled,omitempty" url:"sms_enabled,omitempty"`
MMSEnabled bool `json:"mms_enabled,omitempty" url:"mms_enabled,omitempty"`
Description string `json:"description,omitempty" url:"description,omitempty"`
PlivoNumber bool `json:"plivo_number,omitempty" url:"plivo_number,omitempty"`
City string `json:"city,omitempty" url:"city,omitempty"`
Country string `json:"country,omitempty" url:"country,omitempty"`
Carrier string `json:"carrier,omitempty" url:"carrier,omitempty"`
Number string `json:"number,omitempty" url:"number,omitempty"`
NumberType string `json:"number_type,omitempty" url:"number_type,omitempty"`
MonthlyRentalRate string `json:"monthly_rental_rate,omitempty" url:"monthly_rental_rate,omitempty"`
Application string `json:"application,omitempty" url:"application,omitempty"`
RenewalDate string `json:"renewal_date,omitempty" url:"renewal_date,omitempty"`
CNAMLookup string `json:"cnam_lookup,omitempty" url:"cnam_lookup,omitempty"`
AddedOn string `json:"added_on,omitempty" url:"added_on,omitempty"`
ResourceURI string `json:"resource_uri,omitempty" url:"resource_uri,omitempty"`
VoiceRate string `json:"voice_rate,omitempty" url:"voice_rate,omitempty"`
SMSRate string `json:"sms_rate,omitempty" url:"sms_rate,omitempty"`
MMSRate string `json:"mms_rate,omitempty" url:"mms_rate,omitempty"`
TendlcCampaignID string `json:"tendlc_campaign_id,omitempty" url:"tendlc_campaign_id,omitempty"`
TendlcRegistrationStatus string `json:"tendlc_registration_status,omitempty" url:"tendlc_registration_status,omitempty"`
TollFreeSMSVerification string `json:"toll_free_sms_verification,omitempty" url:"toll_free_sms_verification,omitempty"`
TollFreeSMSVerificationID string `json:"toll_free_sms_verification_id,omitempty" url:"toll_free_sms_verification_id,omitempty"`
TollFreeSMSVerificationOrderStatus string `json:"toll_free_sms_verification_order_status,omitempty" url:"toll_free_sms_verification_order_status,omitempty"`
}

type NumberCreateParams struct {
Expand All @@ -50,22 +52,23 @@ type NumberUpdateParams struct {
}

type NumberListParams struct {
NumberType string `json:"number_type,omitempty" url:"number_type,omitempty"`
NumberStartsWith string `json:"number_startswith,omitempty" url:"number_startswith,omitempty"`
Subaccount string `json:"subaccount,omitempty" url:"subaccount,omitempty"`
RenewalDate string `json:"renewal_date,omitempty" url:"renewal_date,omitempty"`
RenewalDateLt string `json:"renewal_date__lt,omitempty" url:"renewal_date__lt,omitempty"`
RenewalDateLte string `json:"renewal_date__lte,omitempty" url:"renewal_date__lte,omitempty"`
RenewalDateGt string `json:"renewal_date__gt,omitempty" url:"renewal_date__gt,omitempty"`
RenewalDateGte string `json:"renewal_date__gte,omitempty" url:"renewal_date__gte,omitempty"`
Services string `json:"services,omitempty" url:"services,omitempty"`
Alias string `json:"alias,omitempty" url:"alias,omitempty"`
Limit int64 `json:"limit,omitempty" url:"limit,omitempty"`
Offset int64 `json:"offset,omitempty" url:"offset,omitempty"`
TendlcCampaignID string `json:"tendlc_campaign_id,omitempty" url:"tendlc_campaign_id,omitempty"`
TendlcRegistrationStatus string `json:"tendlc_registration_status,omitempty" url:"tendlc_registration_status,omitempty"`
TollFreeSMSVerification string `json:"toll_free_sms_verification,omitempty" url:"toll_free_sms_verification,omitempty"`
CNAMLookup string `json:"cnam_lookup,omitempty" url:"cnam_lookup,omitempty"`
NumberType string `json:"number_type,omitempty" url:"number_type,omitempty"`
NumberStartsWith string `json:"number_startswith,omitempty" url:"number_startswith,omitempty"`
Subaccount string `json:"subaccount,omitempty" url:"subaccount,omitempty"`
RenewalDate string `json:"renewal_date,omitempty" url:"renewal_date,omitempty"`
RenewalDateLt string `json:"renewal_date__lt,omitempty" url:"renewal_date__lt,omitempty"`
RenewalDateLte string `json:"renewal_date__lte,omitempty" url:"renewal_date__lte,omitempty"`
RenewalDateGt string `json:"renewal_date__gt,omitempty" url:"renewal_date__gt,omitempty"`
RenewalDateGte string `json:"renewal_date__gte,omitempty" url:"renewal_date__gte,omitempty"`
Services string `json:"services,omitempty" url:"services,omitempty"`
Alias string `json:"alias,omitempty" url:"alias,omitempty"`
Limit int64 `json:"limit,omitempty" url:"limit,omitempty"`
Offset int64 `json:"offset,omitempty" url:"offset,omitempty"`
TendlcCampaignID string `json:"tendlc_campaign_id,omitempty" url:"tendlc_campaign_id,omitempty"`
TendlcRegistrationStatus string `json:"tendlc_registration_status,omitempty" url:"tendlc_registration_status,omitempty"`
TollFreeSMSVerification string `json:"toll_free_sms_verification,omitempty" url:"toll_free_sms_verification,omitempty"`
CNAMLookup string `json:"cnam_lookup,omitempty" url:"cnam_lookup,omitempty"`
TollFreeSMSVerificationOrderStatus string `json:"toll_free_sms_verification_order_status,omitempty" url:"toll_free_sms_verification_order_status,omitempty"`
}

type NumberListResponse struct {
Expand Down
62 changes: 32 additions & 30 deletions plivoclient.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,36 +20,37 @@ const baseRequestString = "/v1/Account/%s/"

type Client struct {
BaseClient
Messages *MessageService
Accounts *AccountService
Subaccounts *SubaccountService
Applications *ApplicationService
Endpoints *EndpointService
Numbers *NumberService
PhoneNumbers *PhoneNumberService
Pricing *PricingService // TODO Rename?
Recordings *RecordingService
Calls *CallService
Token *TokenService
LiveCalls *LiveCallService
QueuedCalls *QueuedCallService
Conferences *ConferenceService
CallFeedback *CallFeedbackService
Powerpack *PowerpackService
Media *MediaService
Lookup *LookupService
EndUsers *EndUserService
ComplianceDocuments *ComplianceDocumentService
ComplianceDocumentTypes *ComplianceDocumentTypeService
ComplianceRequirements *ComplianceRequirementService
ComplianceApplications *ComplianceApplicationService
MultiPartyCall *MultiPartyCallService
Brand *BrandService
Profile *ProfileService
Campaign *CampaignService
MaskingSession *MaskingSessionService
VerifySession *VerifyService
VerifyCallerId *VerifyCallerIdService
Messages *MessageService
Accounts *AccountService
Subaccounts *SubaccountService
Applications *ApplicationService
Endpoints *EndpointService
Numbers *NumberService
PhoneNumbers *PhoneNumberService
Pricing *PricingService // TODO Rename?
Recordings *RecordingService
Calls *CallService
Token *TokenService
LiveCalls *LiveCallService
QueuedCalls *QueuedCallService
Conferences *ConferenceService
CallFeedback *CallFeedbackService
Powerpack *PowerpackService
Media *MediaService
Lookup *LookupService
EndUsers *EndUserService
ComplianceDocuments *ComplianceDocumentService
ComplianceDocumentTypes *ComplianceDocumentTypeService
ComplianceRequirements *ComplianceRequirementService
ComplianceApplications *ComplianceApplicationService
MultiPartyCall *MultiPartyCallService
Brand *BrandService
Profile *ProfileService
Campaign *CampaignService
MaskingSession *MaskingSessionService
VerifySession *VerifyService
VerifyCallerId *VerifyCallerIdService
TollFreeRequestVerification *TollfreeVerificationService
}

/*
Expand Down Expand Up @@ -121,6 +122,7 @@ func NewClient(authId, authToken string, options *ClientOptions) (client *Client
client.Profile = &ProfileService{client: client}
client.MaskingSession = &MaskingSessionService{client: client}
client.VerifySession = &VerifyService{client: client}
client.TollFreeRequestVerification = &TollfreeVerificationService{client: client}
client.VerifyCallerId = &VerifyCallerIdService{client: client}
return
}
Expand Down
Loading
Loading