From bd9691bbedf20fc64bff46fc7ccec7f5ef7d906b Mon Sep 17 00:00:00 2001 From: ajay-plivo <96424204+ajay-plivo@users.noreply.github.com> Date: Thu, 2 May 2024 14:04:14 +0530 Subject: [PATCH] geoMatch_And_SubAccount (#202) * geoMatch_And_SubAccount * geomatchremoved * unitTestCases * golangVersionFix * descriptionChnaged * Update description --------- Co-authored-by: manjunath-plivo <85923934+manjunath-plivo@users.noreply.github.com> --- .github/workflows/test.yml | 2 +- CHANGELOG.md | 4 +++ baseclient.go | 2 +- maskingsession.go | 6 ++++ maskingsession_test.go | 60 ++++++++++++++++++++++++++++++++++++++ 5 files changed, 72 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index bf8ed620..e9878af6 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -11,7 +11,7 @@ jobs: unittest: strategy: matrix: - go-version: [1.13, 1.14, 1.15, 1.16, 1.17] + go-version: ['1.18', '1.19', '1.20', '1.21.0', '1.22.0'] os: [ubuntu-latest, macos-latest, windows-latest] runs-on: ${{ matrix.os }} steps: diff --git a/CHANGELOG.md b/CHANGELOG.md index 87ba507d..fce6ec92 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Change Log +## [7.47.0](https://github.com/plivo/plivo-go/tree/v7.47.0) (2024-05-02) +**Feature - Added SubAccount and GeoMatch for Create Masking Session API of Number Masking.** +- Added sub_account and geo_match support in MaskingSession APIs + ## [7.46.0](https://github.com/plivo/plivo-go/tree/v7.46.0) (2024-04-18) **Feature - Support for dynamic button components when sending a templated WhatsApp message** - Added new param `payload` in templates to support dynamic payload in templates diff --git a/baseclient.go b/baseclient.go index 3696460d..897d65fa 100644 --- a/baseclient.go +++ b/baseclient.go @@ -13,7 +13,7 @@ import ( "github.com/google/go-querystring/query" ) -const sdkVersion = "7.46.0" +const sdkVersion = "7.47.0" const lookupBaseUrl = "lookup.plivo.com" diff --git a/maskingsession.go b/maskingsession.go index d6f7c29a..9d47a9b2 100644 --- a/maskingsession.go +++ b/maskingsession.go @@ -43,6 +43,7 @@ type MaskingSession struct { IncorrectPinPlay string `json:"incorrect_pin_play" url:"incorrect_pin_play"` UnknownCallerPlay string `json:"unknown_caller_play" url:"unknown_caller_play"` } + type CreateMaskingSessionParams struct { FirstParty string `json:"first_party,omitempty" url:"first_party,omitempty"` SecondParty string `json:"second_party,omitempty" url:"second_party,omitempty"` @@ -68,6 +69,8 @@ type CreateMaskingSessionParams struct { PinRetryWait int64 `json:"pin_retry_wait,omitempty" url:"pin_retry_wait,omitempty"` IncorrectPinPlay string `json:"incorrect_pin_play,omitempty" url:"incorrect_pin_play,omitempty"` UnknownCallerPlay string `json:"unknown_caller_play,omitempty" url:"unknown_caller_play,omitempty"` + SubAccount string `json:"subaccount,omitempty" url:"subaccount,omitempty"` + GeoMatch *bool `json:"geomatch,omitempty" url:"geomatch,omitempty"` } type UpdateMaskingSessionParams struct { @@ -82,6 +85,8 @@ type UpdateMaskingSessionParams struct { FirstPartyPlayUrl string `json:"first_party_play_url,omitempty" url:"first_party_play_url,omitempty"` SecondPartyPlayUrl string `json:"second_party_play_url,omitempty" url:"second_party_play_url,omitempty"` RecordingCallbackMethod string `json:"recording_callback_method,omitempty" url:"recording_callback_method,omitempty"` + SubAccount string `json:"subaccount,omitempty" url:"subaccount,omitempty"` + GeoMatch *bool `json:"geomatch,omitempty" url:"geomatch,omitempty"` } type ListSessionFilterParams struct { @@ -107,6 +112,7 @@ type ListSessionFilterParams struct { DurationGreaterOrEqual int64 `json:"duration__gte,omitempty" url:"duration__gte,omitempty"` Limit int64 `json:"limit,omitempty" url:"limit,omitempty"` Offset int64 `json:"offset,omitempty" url:"offset,omitempty"` + SubAccount string `json:"subaccount,omitempty" url:"subaccount,omitempty"` } type VoiceInteractionResponse struct { diff --git a/maskingsession_test.go b/maskingsession_test.go index af4b1a81..720bc8b7 100644 --- a/maskingsession_test.go +++ b/maskingsession_test.go @@ -5,6 +5,66 @@ import ( "testing" ) +func TestMaskingSessionService_CreateMaskingSession_GeoMatch(t *testing.T) { + t.Run("GeoMatch::False", func(t *testing.T) { + falseValue := false + _, err := client.MaskingSession.CreateMaskingSession(CreateMaskingSessionParams{ + FirstParty: "+919999323467", + SecondParty: "+919891865130", + GeoMatch: &falseValue, + }) + if err != nil { + t.Logf("err :: %v", err) + } + }) + + t.Run("GeoMatch::True", func(t *testing.T) { + trueValue := true + _, err := client.MaskingSession.CreateMaskingSession(CreateMaskingSessionParams{ + FirstParty: "+919999323467", + SecondParty: "+919891865130", + GeoMatch: &trueValue, + }) + if err != nil { + t.Logf("err :: %v", err) + } + }) + + t.Run("GeoMatch::nil", func(t *testing.T) { + _, err := client.MaskingSession.CreateMaskingSession(CreateMaskingSessionParams{ + FirstParty: "+919999323467", + SecondParty: "+919891865130", + GeoMatch: nil, + }) + if err != nil { + t.Logf("err :: %v", err) + } + }) +} + +func TestMaskingSessionService_CreateMaskingSession_SubAccount(t *testing.T) { + t.Run("SubAccount::Empty", func(t *testing.T) { + _, err := client.MaskingSession.CreateMaskingSession(CreateMaskingSessionParams{ + FirstParty: "+919999323467", + SecondParty: "+919891865130", + }) + if err != nil { + t.Logf("err :: %v", err) + } + }) + + t.Run("SubAccount::Valid SubAccount", func(t *testing.T) { + _, err := client.MaskingSession.CreateMaskingSession(CreateMaskingSessionParams{ + FirstParty: "+919999323467", + SecondParty: "+919891865130", + SubAccount: "SAZTA0ZJJHMDETOWQ4YI", + }) + if err != nil { + t.Logf("err :: %v", err) + } + }) +} + func TestMaskingSessionService_CreateMaskingSession(t *testing.T) { expectResponse("createMaskingSessionResponse.json", 200)