Skip to content

Commit

Permalink
geoMatch_And_SubAccount (#202)
Browse files Browse the repository at this point in the history
* geoMatch_And_SubAccount

* geomatchremoved

* unitTestCases

* golangVersionFix

* descriptionChnaged

* Update description

---------

Co-authored-by: manjunath-plivo <[email protected]>
  • Loading branch information
ajay-plivo and manjunath-plivo authored May 2, 2024
1 parent da8edd9 commit bd9691b
Show file tree
Hide file tree
Showing 5 changed files with 72 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
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.46.0"
const sdkVersion = "7.47.0"

const lookupBaseUrl = "lookup.plivo.com"

Expand Down
6 changes: 6 additions & 0 deletions maskingsession.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"`
Expand All @@ -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 {
Expand All @@ -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 {
Expand All @@ -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 {
Expand Down
60 changes: 60 additions & 0 deletions maskingsession_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down

0 comments on commit bd9691b

Please sign in to comment.