Skip to content

Commit

Permalink
rebase (#197)
Browse files Browse the repository at this point in the history
* VT-5031: Number Masking Implementation (#156)

* VT-5031: Number Masking Implementation

* VT-5031: Implementing review comments

* VT-6047 GoLang SDK implementation for Number Masking - Number Masking Phase2 and Private Beta changes

* renamed fixture file

* added masking session code separately outside calls

* Fixed UTs

* Fixed UTs

* added sdk versioning

* added sdk versioning

---------

Co-authored-by: abinaya-plivo <abinaya.s@plivo.com>

* SMS-6010: Add DLT Params to Send and Get Message APIs (#178)

* SMS-6010: Add DLT Params to Send and Get Message APIs

* Version update

* SMS-6060 WhatsApp message support in Go SDK (#179)

* SMS-6060 WhatsApp message support in Go SDK

* SMS-6060 adding proper template validation

* SMS-6060 adding go.mod and go.sum

* SMS-6060 updating go.mod and go.sum

* SMS-6060 adding unit test and version bump

* SMS-6060 update log

* update log

* SMS-6060 go mod and go sum change

* go sum change

* SMS-6060 go validitor version downgarde

* SMS-6060 go universal-translator

* version upgrade

* SMS-6060 version upgrade changes

* SMS-6060 changing currency and datetime model

* SMS-6060 downgrading version

* SMS-6060 updating CHANGELOG.md

* SMS-6060 adding versioning and unit tests

* updating Changelog.md file

* updating Changelog.md file

* SMS-6063: Go SDK for Verify Session APIs (#180)

* Added create and get functions for verify go sdk

* Added list function (without query params) for verify go sdk

* Added validate function for verify go sdk

* List function name changes

* List function query params added

* Added testcases for verify function sdks

* Updated the version

* Updated the changelog

* Name updated

* version added

* Subaccount param added

* updated the version

* SMS-6066 - adding new param on mdr object (#183)

* adding new param on mdr object

* updated date

---------

Co-authored-by: renoldthomas-plivo <renold.thomas@plivo.com>

* import campaign support (#184)

* import campaign support

* brand id filter fix

* version update

* remove space

---------

Co-authored-by: renoldthomas-plivo <renold.thomas@plivo.com>

* 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

* SMS-6099: Added meta data for List Brand, Campaign, Profile (#186)

* Added meta data for List Brand, Campaign, Profile

* Test commit

* Test commit removed

* Added total_count field to meta data for campaign and brand list response

* Updating version

* version update

---------

Co-authored-by: renoldthomas-plivo <renold.thomas@plivo.com>

* TF verification changes in go sdk (#188)

* TF verification changes in go sdk

* Adding numberAPI changes and UTC for TF Verification APIs

* Changing parameter names

* Removing error in response structs

* Adding _ in list API params

* Changing field names

* Removing _ from function names

* TF verification changes in go sdk

* Adding numberAPI changes and UTC for TF Verification APIs

* Changing parameter names

* Removing error in response structs

* Adding _ in list API params

* Changing field names

* Removing _ from function names

* Rebasing from master

* Adding another filter TollFreeSMSVerificationOrderStatus

* Correcting TF create response

* bump version

* refactored field names

---------

Co-authored-by: kalyan-plivo <kalyan.sunku@plivo.com>
Co-authored-by: kapilp93 <kapil.patwa@plivo.com>

* Added registration_status filter to Go SDK (#189)

* SMS-6495 Ppk Bug Fix (#191)

* SMS-6495 Ppk Bug Fix

* Changelog and version updated

* Adds error detail for list and get campaign (#190)

* add error details for list and get campaign

* field type change

* Added param to GET/LIST Campaign APIs (#192)

* added param to GET/LIST Campaign APIs

* Update CHANGELOG.md

---------

Co-authored-by: Thumpala Vinay Kumar <vinay.kumar@ThumpalumarsAir.lan>
Co-authored-by: Renold Jose Thomas <renold.thomas@plivo.com>

* paramAddedInSpeakApi (#193)

* paramAddedInSpeakApi

* callbackUrl

* callback

* New parameter `create_mpc_if_alone` in MPC Add Participant API (#195)

* New parameter `create_mpc_if_alone` in MPC Add Participant API

* param name change

* parameter name change

* Version commit

* changelog update

* changes

---------

Co-authored-by: eniyavan <eniyavan@plivo.com>

---------

Co-authored-by: prashantp-plivo <90573250+prashantp-plivo@users.noreply.github.com>
Co-authored-by: abinaya-plivo <abinaya.s@plivo.com>
Co-authored-by: Mohsin Mamoon Hafiz <84492744+mohsin-plivo@users.noreply.github.com>
Co-authored-by: Kaushik <122255717+KaushikDas-Plivo@users.noreply.github.com>
Co-authored-by: Rajneesh Katkam <110394672+rajneeshkatkam-plivo@users.noreply.github.com>
Co-authored-by: Narayana Shanbhog <narayana@plivo.com>
Co-authored-by: renoldthomas-plivo <renold.thomas@plivo.com>
Co-authored-by: Abinaya-plivo <92303844+Abinaya-Shunmugavel@users.noreply.github.com>
Co-authored-by: Aditya Gupta <86413940+aditya-gupta-plivo@users.noreply.github.com>
Co-authored-by: kalyan-plivo <kalyan.sunku@plivo.com>
Co-authored-by: kapilp93 <kapil.patwa@plivo.com>
Co-authored-by: eshangupta-plivo <136313079+eshangupta-plivo@users.noreply.github.com>
Co-authored-by: Prashant <prashant.jha@plivo.com>
Co-authored-by: vinaykumar-plivo <136321153+vinaykumar-plivo@users.noreply.github.com>
Co-authored-by: Thumpala Vinay Kumar <vinay.kumar@ThumpalumarsAir.lan>
Co-authored-by: ajay-plivo <96424204+ajay-plivo@users.noreply.github.com>
Co-authored-by: eniyavan <eniyavan@plivo.com>
  • Loading branch information
18 people authored Jan 30, 2024
1 parent cda8ae3 commit 4558983
Show file tree
Hide file tree
Showing 50 changed files with 2,435 additions and 198 deletions.
75 changes: 75 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,80 @@
# Change Log

## [7.45.2](https://github.com/plivo/plivo-go/tree/v7.45.2) (2024-01-25)
**Feature - Added new params 'create_mpc_with_single_participant' for Add Participant API of MPC**
- Added new params 'create_mpc_with_single_participant' for Add Participant API of MPC

## [7.45.1](https://github.com/plivo/plivo-go/tree/v7.45.1) (2023-12-19)
**Feature - Added type params for speak api in call and mpc**
- Added params 'type' for POST Speak API for Call and MPC

## [7.45.0](https://github.com/plivo/plivo-go/tree/v7.45.0) (2023-12-14)
**Feature - Added params for GET and LIST Campaign APIs**
- Added params 'vertical', 'campaign_alias' for GET and LIST Campaign APIs

## [7.44.0](https://github.com/plivo/plivo-go/tree/v7.44.0) (2023-11-20)
**Feature - New params for GET and LIST Campaign API**
- Added new params 'error_code', 'error_reason' for GET and LIST Campaign API

## [7.43.0](https://github.com/plivo/plivo-go/tree/v7.43.0) (2023-11-29)
**Bug Fix - Create Powerpack and Update Powerpack**
- Create Powerpack and Update Powerpack now take boolean inputs for sticky sender and local connect.

## [7.42.0](https://github.com/plivo/plivo-go/tree/v7.42.0) (2023-11-07)
**Feature - Campaign List API Enhancements**
- registration_status field in LIST API

## [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

## [7.39.0](https://github.com/plivo/plivo-go/tree/v7.39.0) (2023-10-18)
**Feature - Verify CallerID**
- Added Initiate and Verify VerifyCallerID API
- Added Update, Delete, Get and List verified CallerIDs API

## [7.38.0](https://github.com/plivo/plivo-go/tree/v7.38.0) (2023-10-16)
**Feature - Campaign API Enhancements & New API for Importing Partner Campaigns**
- Import Partner Campaign API
- campaign_source field in LIST / GET API

## [7.37.0](https://github.com/plivo/plivo-go/tree/v7.37.0) (2023-08-25)
**Feature - Added New Param 'carrier_fees', 'carrier_fees_rate', 'destination_network' in Get Message and List Message APIs**
- Added new params on message get and list response

## [7.36.0] (https://github.com/plivo/plivo-go/tree/v7.36.0) (2023-08-10)
**Feature - Verify**
- Added Create Session API
- Added Get Session API
- Added List Session API
- Added Validate Session API

## [7.35.0](https://github.com/plivo/plivo-go/tree/v7.35.0) (2023-08-07)
**Feature - WhatsApp message support**
- Added new param `template` and new message_type `whatsapp` to [send message API](https://www.plivo.com/docs/sms/api/message#send-a-message)
- Added new `message_states` (`read`) `message_type`(`whatsapp`),`conversation_id`, `conversation_origin`, `conversation_expiry_timestamp` in [list all messages API](https://www.plivo.com/docs/sms/api/message#list-all-messages) and [get message details API](https://www.plivo.com/docs/sms/api/message#retrieve-a-message) response


## [7.34.0](https://github.com/plivo/plivo-go/tree/v7.34.0) (2023-08-03)
**Feature - DLT parameters**
- Added new params `DLTEntityID`, `DLTTemplateID`, `DLTTemplateCategory` to the [send message API](https://www.plivo.com/docs/sms/api/message/send-a-message/)
- Added new params `DLTEntityID`, `DLTTemplateID`, `DLTTemplateCategory` to the response for the [list all messages API](https://www.plivo.com/docs/sms/api/message/list-all-messages/) and the [get message details API](https://www.plivo.com/docs/sms/api/message#retrieve-a-message)

## [7.33.0](https://github.com/plivo/plivo-go/tree/v7.33.0) (2023-07-31)
**Feature - Number Masking**
- Added Get, Update and List Masking Session API and modified the Create and Delete API
## [7.32.0](https://github.com/plivo/plivo-go/tree/v7.32.0) (2023-06-28)
**Audio Streaming**
- API support for starting, deleting, getting streams on a live call
- XML creation support for stream element


## [7.31.0](https://github.com/plivo/plivo-go/tree/v7.31.0) (2023-06-02)
**Feature - CNAM Lookup**
- Added New Param `cnam_lookup` in to the response of the [list all numbers API], [list single number API]
Expand Down Expand Up @@ -71,6 +141,11 @@ and the [list all campaigns API](https://www.plivo.com/docs/sms/api/10dlc/campai
**Feature - Adding new param 'message_expiry' in Send Message API**
- Added new param 'message_expiry' in Send Message API


## [7.17.0](https://github.com/plivo/plivo-go/tree/v7.17.0) (2023-01-10)
**Feature - Number Masking**
- Added Create and Delete Masking Session API

## [7.16.0](https://github.com/plivo/plivo-go/tree/v7.16.0) (2022-12-16)
**Feature - Update campaign**
- Update campaign API
Expand Down
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
build:
docker-compose up --build --remove-orphans

start:
docker-compose up --build --remove-orphans --detach
docker attach $(shell docker-compose ps -q goSDK)

test:
@[ "${CONTAINER}" ] && \
(docker exec -it $$CONTAINER /bin/bash -c "go test -v -race -cover") || \
Expand Down
4 changes: 2 additions & 2 deletions 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.32.0"
const sdkVersion = "7.45.2"

const lookupBaseUrl = "lookup.plivo.com"

Expand Down Expand Up @@ -72,7 +72,7 @@ func (client *BaseClient) NewRequest(method string, params interface{}, baseRequ

requestUrl.RawQuery = values.Encode()
} else {
if reflect.ValueOf(params).Kind().String() != "map" {
if reflect.ValueOf(params).Kind().String() != "map" && params != nil {
if err = json.NewEncoder(buffer).Encode(params); err != nil {
return
}
Expand Down
9 changes: 8 additions & 1 deletion brand.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,14 @@ type Usecase struct {
}

type BrandListResponse struct {
ApiID string `json:"api_id,omitempty"`
ApiID string `json:"api_id,omitempty"`
Meta struct {
Previous *string
Next *string
Offset int64
Limit int64
TotalCount int64 `json:"total_count"`
} `json:"meta"`
BrandResponse []Brand `json:"brands,omitempty"`
}

Expand Down
15 changes: 9 additions & 6 deletions calls.go
Original file line number Diff line number Diff line change
Expand Up @@ -201,12 +201,15 @@ type CallPlayResponse struct {
}

type CallSpeakParams struct {
Text string `json:"text" url:"text"`
Voice string `json:"length,omitempty" url:"length,omitempty"`
Language string `json:"language,omitempty" url:"language,omitempty"`
Legs string `json:"legs,omitempty" url:"legs,omitempty"`
Loop bool `json:"loop,omitempty" url:"loop,omitempty"`
Mix bool `json:"mix,omitempty" url:"mix,omitempty"`
Text string `json:"text" url:"text"`
Voice string `json:"length,omitempty" url:"length,omitempty"`
Language string `json:"language,omitempty" url:"language,omitempty"`
Legs string `json:"legs,omitempty" url:"legs,omitempty"`
Loop bool `json:"loop,omitempty" url:"loop,omitempty"`
Mix bool `json:"mix,omitempty" url:"mix,omitempty"`
Type string `json:"type,omitempty" url:"type,omitempty"`
CallbackURL string `json:"callback_url,omitempty" url:"callback_url,omitempty"`
CallbackMethod string `json:"callback_method,omitempty" url:"callback_method,omitempty"`
}

type CallSpeakResponse struct {
Expand Down
40 changes: 35 additions & 5 deletions campaign.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@ package plivo
type CampaignService struct {
client *Client
}
type ImportCampaignParams struct {
CampaignID string `json:"campaign_id,omitempty" url:"campaign_id,omitempty"`
CampaignAlias string `json:"campaign_alias,omitempty" url:"campaign_alias,omitempty"`
URL string `json:"url,omitempty" url:"url,omitempty"`
Method string `json:"method,omitempty" url:"method,omitempty"`
}
type CampaignCreationParams struct {
BrandID string `json:"brand_id" url:"brand_id" validate:"required"`
CampaignAlias *string `json:"campaign_alias,omitempty" url:"campaign_alias,omitempty"`
Expand Down Expand Up @@ -47,7 +53,14 @@ type CampaignUpdateParams struct {
}

type CampaignListResponse struct {
ApiID string `json:"api_id,omitempty"`
ApiID string `json:"api_id,omitempty"`
Meta struct {
Previous *string
Next *string
Offset int64
Limit int64
TotalCount int64 `json:"total_count"`
} `json:"meta"`
CampaignResponse []Campaign `json:"campaigns,omitempty"`
}

Expand Down Expand Up @@ -88,6 +101,11 @@ type Campaign struct {
CampaignDescription string `json:"description,omitempty"`
CampaignAttributes CampaignAttributes `json:"campaign_attributes,omitempty"`
CreatedAt string `json:"created_at,omitempty"`
CampaignSource string `json:"campaign_source,omitempty"`
ErrorCode string `json:"error_code,omitempty"`
ErrorReason string `json:"error_reason,omitempty"`
Vertical string `json:"vertical,omitempty"`
CampaignAlias string `json:"campaign_alias,omitempty"`
}

type CampaignAttributes struct {
Expand All @@ -112,10 +130,12 @@ type OperatorDetail struct {
TPM int `json:"tpm,omitempty"`
}
type CampaignListParams struct {
BrandID *string `json:"brand,omitempty"`
Usecase *string `json:"usecase,omitempty"`
Limit int `url:"limit,omitempty"`
Offset int `url:"offset,omitempty"`
BrandID *string `url:"brand_id,omitempty"`
Usecase *string `url:"usecase,omitempty"`
RegistrationStatus *string `url:"registration_status,omitempty"`
CampaignSource *string `url:"campaign_source,omitempty"`
Limit int `url:"limit,omitempty"`
Offset int `url:"offset,omitempty"`
}

type CampaignNumberLinkParams struct {
Expand Down Expand Up @@ -184,6 +204,16 @@ func (service *CampaignService) Create(params CampaignCreationParams) (response
return
}

func (service *CampaignService) Import(params ImportCampaignParams) (response *CampaignCreateResponse, err error) {
req, err := service.client.NewRequest("POST", params, "10dlc/Campaign/Import")
if err != nil {
return
}
response = &CampaignCreateResponse{}
err = service.client.ExecuteRequest(req, response)
return
}

func (service *CampaignService) Update(campaignID string, params CampaignUpdateParams) (response *CampaignGetResponse, err error) {
// response needs to be same as CampaignGetResponse
req, err := service.client.NewRequest("POST", params, "10dlc/Campaign/%s", campaignID)
Expand Down
26 changes: 25 additions & 1 deletion campaign_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,30 @@ func TestCampaign_Get(t *testing.T) {
assertRequest(t, "GET", "10dlc/Campaign/%s", CampaignID)
}

func TestImportCampaign(t *testing.T) {
expectResponse("campaignImportResponse.json", 200)
assert := require.New(t)
resp, err := client.Campaign.Import(ImportCampaignParams{
CampaignID: "C1QGYD1",
CampaignAlias: "import campaign",
})
assert.NotNil(resp)
assert.Nil(err)
assert.NotEmpty(resp.ApiID)
assert.NotEmpty(resp.CampaignID)
cl := client.httpClient
client.httpClient = nil
resp, err = client.Campaign.Import(ImportCampaignParams{
CampaignID: "C1QGYD1",
CampaignAlias: "import campaign",
})
assert.NotNil(err)
assert.Nil(resp)
client.httpClient = cl

assertRequest(t, "POST", "10dlc/Campaign/Import")
}

func TestCampaign_Create(t *testing.T) {
expectResponse("campaignCreationResponse.json", 200)
assert := require.New(t)
Expand Down Expand Up @@ -306,4 +330,4 @@ func TestCampaign_Delete(t *testing.T) {
client.httpClient = cl

assertRequest(t, "DELETE", "10dlc/Campaign/%s", CampaignID)
}
}
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
5 changes: 5 additions & 0 deletions fixtures/campaignImportResponse.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"api_id": "2c6c5e16-090a-11ed-bb48-0242ac110004",
"campaign_id": "C1QGYD1",
"message": "Request to import campaign was received and is being processed."
}
35 changes: 35 additions & 0 deletions fixtures/createMaskingSessionResponse.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{
"api_id": "1c8beb2c-01bf-4649-b0fb-5e3bd7836311",
"session_uuid": "c2146ba4-798d-49b0-8580-53851a16e055",
"virtual_number": "+916361728680",
"message": "Session created",
"session": {
"first_party": "917708772011",
"second_party": "919976106830",
"virtual_number": "916361728680",
"status": "active",
"initiate_call_to_first_party": false,
"session_uuid": "c2146ba4-798d-49b0-8580-53851a16e055",
"callback_url": "http://plivobin.non-prod.plivops.com/w7mf5kw7",
"callback_method": "GET",
"created_time": "2023-07-05 10:25:40.877364 +0000 UTC",
"modified_time": "2023-07-05 16:33:08.444312 +0000 UTC",
"expiry_time": "2023-07-05 12:43:08.222701 +0000 UTC",
"duration": 8247,
"amount": 0,
"call_time_limit": 14400,
"ring_timeout": 120,
"first_party_play_url": "https://s3.amazonaws.com/plivosamplexml/play_url.xml",
"second_party_play_url": "https://plivobin-prod-usw.plivops.com/api/v1/speak.xml",
"record": false,
"record_file_format": "mp3",
"recording_callback_url": "https://plivobin-prod-usw.plivops.com/api/v1/speak.xml",
"recording_callback_method": "GET",
"interaction": null,
"total_call_amount": 0,
"total_call_count": 0,
"total_call_billed_duration": 0,
"total_session_amount": 0,
"last_interaction_time": ""
}
}
4 changes: 4 additions & 0 deletions fixtures/deleteMaskingSessionResponse.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"api_id": "f91f459a-283d-4850-9b33-ad914dcb64c0",
"message": "Session Deleted"
}
32 changes: 32 additions & 0 deletions fixtures/getMaskingSessionResponse.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"api_id": "b503c0b9-a419-406f-8e49-9856844600ab",
"response": {
"first_party": "917708772011",
"second_party": "919976106830",
"virtual_number": "916361728680",
"status": "active",
"initiate_call_to_first_party": false,
"session_uuid": "c2146ba4-798d-49b0-8580-53851a16e055",
"callback_url": "http://plivobin.non-prod.plivops.com/w7mf5kw7",
"callback_method": "GET",
"created_time": "2023-07-05 10:25:40.877364 +0000 UTC",
"modified_time": "2023-07-05 10:25:40.877364 +0000 UTC",
"expiry_time": "2023-07-05 12:05:40.877364 +0000 UTC",
"duration": 6000,
"amount": 0,
"call_time_limit": 14400,
"ring_timeout": 120,
"first_party_play_url": "https://s3.amazonaws.com/plivosamplexml/play_url.xml",
"second_party_play_url": "https://plivobin-prod-usw.plivops.com/api/v1/speak.xml",
"record": false,
"record_file_format": "mp3",
"recording_callback_url": "https://plivobin-prod-usw.plivops.com/api/v1/speak.xml",
"recording_callback_method": "GET",
"interaction": null,
"total_call_amount": 0,
"total_call_count": 0,
"total_call_billed_duration": 0,
"total_session_amount": 0,
"last_interaction_time": ""
}
}
10 changes: 10 additions & 0 deletions fixtures/getVerifiedCallerIDResponse.json
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"
}
5 changes: 5 additions & 0 deletions fixtures/initiateVerifyResponse.json
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"
}
Loading

0 comments on commit 4558983

Please sign in to comment.