-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Verify caller ID for outbound voice calls - Go SDK changes (#187)
* Verify caller ID for outbound voice calls - Go SDK changes * fixed response structure * added versions
- Loading branch information
1 parent
5428c02
commit d6cff0d
Showing
11 changed files
with
365 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"alias": "test", | ||
"api_id": "ee7c3cb1-c921-42c9-832b-950fb8344b9b", | ||
"country": "IN", | ||
"created_at": "2023-09-22T14:11:03.091534Z", | ||
"modified_at": "2023-09-22T14:11:03.091534Z", | ||
"phone_number": "+919768368718", | ||
"subaccount": "", | ||
"verification_uuid": "0f978b20-9e2b-4cfe-99fe-f7087c03b8e1" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"api_id": "2a5e81d7-deb3-46cd-ac34-c05ca9139b6f", | ||
"message": "Verification code is sent to number +919768368717 which is valid for 15 minutes", | ||
"verification_uuid": "407796a6-1f3e-4607-a9d9-5a5376b59a7b" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
{ | ||
"api_id": "3b21c7d7-09f7-489b-b753-659814a676bf", | ||
"meta": { | ||
"limit": 20, | ||
"next": null, | ||
"offset": 0, | ||
"previous": null, | ||
"total_count": 4 | ||
}, | ||
"objects": [ | ||
{ | ||
"alias": "abhishek", | ||
"country": "IN", | ||
"created_at": "2023-09-25T14:40:38.68729Z", | ||
"modified_at": "2023-09-25T14:40:38.68729Z", | ||
"phone_number": "+919653244280", | ||
"resource_uri": "/v1/Account/MADCHANDRESH02TANK06/VerifiedCallerId/919653244280", | ||
"subaccount": "", | ||
"verification_uuid": "01be6b07-b106-46e2-8dfc-096d8e22cc0e" | ||
}, | ||
{ | ||
"alias": "abhishek", | ||
"country": "IN", | ||
"created_at": "2023-09-25T13:10:39.968133Z", | ||
"modified_at": "2023-09-25T13:10:39.968133Z", | ||
"phone_number": "+919768368717", | ||
"resource_uri": "/v1/Account/MADCHANDRESH02TANK06/VerifiedCallerId/919768368717", | ||
"subaccount": "", | ||
"verification_uuid": "2e68eb73-4d54-4391-bc98-71cd380911a4" | ||
}, | ||
{ | ||
"alias": "test", | ||
"country": "IN", | ||
"created_at": "2023-09-22T14:11:03.091534Z", | ||
"modified_at": "2023-09-22T14:11:03.091534Z", | ||
"phone_number": "+919768368718", | ||
"resource_uri": "/v1/Account/MADCHANDRESH02TANK06/VerifiedCallerId/919768368718", | ||
"subaccount": "", | ||
"verification_uuid": "0f978b20-9e2b-4cfe-99fe-f7087c03b8e1" | ||
}, | ||
{ | ||
"alias": "Test2", | ||
"country": "", | ||
"created_at": "2023-08-30T07:47:43.87171Z", | ||
"modified_at": "2023-08-30T07:47:43.87171Z", | ||
"phone_number": "+917691021365", | ||
"resource_uri": "/v1/Account/MADCHANDRESH02TANK06/VerifiedCallerId/917691021365", | ||
"subaccount": "SAMTU0Y2FKNGETYZDKNI", | ||
"verification_uuid": "20265c57-2d8e-46fe-8fa8-e8ab4ee58a8c" | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"alias": "testAbhishek", | ||
"api_id": "6b143cb3-9c8a-42ad-b6b7-412ebd5c60a9", | ||
"country": "IN", | ||
"created_at": "2023-09-22T14:11:03.091534Z", | ||
"modified_at": "2023-09-22T14:11:03.091534Z", | ||
"phone_number": "+919768368718", | ||
"subaccount": "SAMTU0Y2FKNGETYZDKNI", | ||
"verification_uuid": "0f978b20-9e2b-4cfe-99fe-f7087c03b8e1" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"alias": "abhishek", | ||
"api_id": "584a97aa-ca1d-44f2-9dd3-e58fbacd6649", | ||
"channel": "call", | ||
"country": "IN", | ||
"created_at": "2023-09-25T13:10:39.968133341Z", | ||
"phone_number": "+919768368717", | ||
"verification_uuid": "2e68eb73-4d54-4391-bc98-71cd380911a4" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,138 @@ | ||
package plivo | ||
|
||
import ( | ||
"time" | ||
) | ||
|
||
type VerifyCallerIdService struct { | ||
client *Client | ||
} | ||
|
||
type InitiateVerify struct { | ||
PhoneNumber string `json:"phone_number"` | ||
Alias string `json:"alias"` | ||
Channel string `json:"channel"` | ||
Country string `json:"country"` | ||
SubAccount string `json:"subaccount"` | ||
AccountID int64 `json:"account_id"` | ||
AuthID string `json:"auth_id"` | ||
AuthToken string `json:"auth_token"` | ||
} | ||
|
||
type InitiateVerifyResponse struct { | ||
ApiID string `json:"api_id,omitempty" url:"api_id,omitempty"` | ||
Message string `json:"message,omitempty" url:"message,omitempty"` | ||
VerificationUUID string `json:"verification_uuid,omitempty" url:"verification_uuid,omitempty"` | ||
} | ||
|
||
type ListVerifiedCallerIdParams struct { | ||
Country string `json:"country,omitempty" url:"country,omitempty"` | ||
SubAccount string `json:"subaccount,omitempty" url:"subaccount,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"` | ||
} | ||
|
||
type VerifyResponse struct { | ||
Alias string `json:"alias,omitempty"` | ||
ApiID string `json:"api_id,omitempty" url:"api_id,omitempty"` | ||
Channel string `json:"channel"` | ||
Country string `json:"country"` | ||
CreatedAt time.Time `json:"created_at"` | ||
PhoneNumber string `json:"phone_number"` | ||
VerificationUUID string `json:"verification_uuid"` | ||
SubAccount string `json:"subaccount,omitempty"` | ||
} | ||
|
||
type UpdateVerifiedCallerIDParams struct { | ||
Alias string `json:"alias,omitempty"` | ||
SubAccount string `json:"subaccount,omitempty"` | ||
} | ||
|
||
type GetVerifyResponse struct { | ||
Alias string `json:"alias,omitempty"` | ||
ApiID string `json:"api_id,omitempty" url:"api_id,omitempty"` | ||
Country string `json:"country"` | ||
CreatedAt time.Time `json:"created_at"` | ||
ModifiedAt time.Time `json:"modified_at"` | ||
PhoneNumber string `json:"phone_number"` | ||
SubAccount string `json:"subaccount,omitempty" url:"subaccount,omitempty"` | ||
VerificationUUID string `json:"verification_uuid"` | ||
} | ||
|
||
type ListVerifyResponse struct { | ||
Alias string `json:"alias,omitempty"` | ||
Country string `json:"country"` | ||
CreatedAt time.Time `json:"created_at"` | ||
ModifiedAt time.Time `json:"modified_at"` | ||
PhoneNumber string `json:"phone_number"` | ||
ResourceUri string `json:"resource_uri,omitempty"` | ||
SubAccount string `json:"subaccount,omitempty"` | ||
VerificationUUID string `json:"verification_uuid"` | ||
} | ||
|
||
type ListVerifiedCallerIDResponse struct { | ||
ApiID string `json:"api_id,omitempty" url:"api_id,omitempty"` | ||
Meta Meta `json:"meta" url:"meta"` | ||
Objects []ListVerifyResponse `json:"objects" url:"objects"` | ||
} | ||
|
||
func (service *VerifyCallerIdService) InitiateVerify(params InitiateVerify) (response *InitiateVerifyResponse, err error) { | ||
req, err := service.client.NewRequest("POST", params, "VerifiedCallerId") | ||
if err != nil { | ||
return | ||
} | ||
response = &InitiateVerifyResponse{} | ||
err = service.client.ExecuteRequest(req, response, isVoiceRequest()) | ||
return | ||
} | ||
|
||
func (service *VerifyCallerIdService) VerifyCallerID(verificationUuid string, otp string) (response *VerifyResponse, err error) { | ||
req, err := service.client.NewRequest("POST", map[string]string{"otp": otp}, "VerifiedCallerId/Verification/%s", verificationUuid) | ||
if err != nil { | ||
return | ||
} | ||
response = &VerifyResponse{} | ||
err = service.client.ExecuteRequest(req, response, isVoiceRequest()) | ||
return | ||
} | ||
|
||
func (service *VerifyCallerIdService) DeleteVerifiedCallerID(phoneNumber string) (err error) { | ||
req, err := service.client.NewRequest("DELETE", nil, "VerifiedCallerId/%s", phoneNumber) | ||
if err != nil { | ||
return | ||
} | ||
err = service.client.ExecuteRequest(req, nil, isVoiceRequest()) | ||
|
||
return | ||
} | ||
|
||
func (service *VerifyCallerIdService) UpdateVerifiedCallerID(phoneNumber string, params UpdateVerifiedCallerIDParams) (response *GetVerifyResponse, err error) { | ||
req, err := service.client.NewRequest("POST", params, "VerifiedCallerId/%s", phoneNumber) | ||
if err != nil { | ||
return | ||
} | ||
response = &GetVerifyResponse{} | ||
err = service.client.ExecuteRequest(req, response, isVoiceRequest()) | ||
return | ||
} | ||
|
||
func (service *VerifyCallerIdService) GetVerifiedCallerID(phoneNumber string) (response *GetVerifyResponse, err error) { | ||
req, err := service.client.NewRequest("GET", nil, "VerifiedCallerId/%s", phoneNumber) | ||
if err != nil { | ||
return | ||
} | ||
response = &GetVerifyResponse{} | ||
err = service.client.ExecuteRequest(req, response, isVoiceRequest()) | ||
return | ||
} | ||
|
||
func (service *VerifyCallerIdService) ListVerifiedCallerID(params ListVerifiedCallerIdParams) (response *ListVerifiedCallerIDResponse, err error) { | ||
req, err := service.client.NewRequest("GET", params, "VerifiedCallerId") | ||
if err != nil { | ||
return | ||
} | ||
response = &ListVerifiedCallerIDResponse{} | ||
err = service.client.ExecuteRequest(req, response, isVoiceRequest()) | ||
return | ||
} |
Oops, something went wrong.