Skip to content

Commit

Permalink
Merge branch 'master' into VT-3196
Browse files Browse the repository at this point in the history
  • Loading branch information
nixonsam authored Jun 23, 2021
2 parents ed60c28 + 4b402ae commit be3178a
Show file tree
Hide file tree
Showing 15 changed files with 233 additions and 241 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
## [5.6.0](https://github.com/plivo/plivo-go/tree/v5.6.0) (2021-06-15)
- Add stir verification param as part of Get CDR and live call APIs

## [5.5.2](https://github.com/plivo/plivo-go/tree/v5.5.2) (2021-04-08)
- Read origination prefix from voice pricing

## [5.5.1](https://github.com/plivo/plivo-go/tree/v5.5.1) (2020-12-16)
- Add SSML utilities

Expand Down
2 changes: 1 addition & 1 deletion accounts.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ type SubaccountCreateParams struct {
type SubaccountUpdateParams SubaccountCreateParams

type SubaccountDeleteParams struct {
Cascade bool `json:"cascade,omitempty" url:"cascade,omitempty"` // Specify if the sub account should be cascade deleted or not. Takes a value of True or False. Defaults to False
Cascade bool `json:"cascade,omitempty" url:"cascade,omitempty"` // Specify if the sub account should be cascade deleted or not. Takes a value of True or False. Defaults to False
}

type SubaccountCreateResponse struct {
Expand Down
16 changes: 8 additions & 8 deletions compliance_document_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,19 @@ type ComplianceDocumentTypeService struct {
}

type GetComplianceDocumentTypeResponse struct {
APIID string `json:"api_id"`
APIID string `json:"api_id"`
CreatedAt time.Time `json:"created_at"`
Description string `json:"description"`
DocumentName string `json:"document_name"`
DocumentTypeID string `json:"document_type_id"`
Information []struct {
FieldName string `json:"field_name"`
FieldType string `json:"field_type"`
FriendlyName string `json:"friendly_name"`
HelpText string `json:"help_text,omitempty"`
MaxLength int `json:"max_length,omitempty"`
MinLength int `json:"min_length,omitempty"`
Format string `json:"format,omitempty"`
FieldName string `json:"field_name"`
FieldType string `json:"field_type"`
FriendlyName string `json:"friendly_name"`
HelpText string `json:"help_text,omitempty"`
MaxLength int `json:"max_length,omitempty"`
MinLength int `json:"min_length,omitempty"`
Format string `json:"format,omitempty"`
Enums []string `json:"enums,omitempty"`
} `json:"information"`
ProofRequired interface{} `json:"proof_required"`
Expand Down
168 changes: 84 additions & 84 deletions compliance_documents.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,37 +17,37 @@ type ComplianceDocumentService struct {
}

type GetComplianceDocumentResponse struct {
APIID string `json:"api_id"`
DocumentID string `json:"document_id"`
EndUserID string `json:"end_user_id"`
DocumentTypeID string `json:"document_type_id"`
Alias string `json:"alias"`
FileName string `json:"file_name,omitempty"`
APIID string `json:"api_id"`
DocumentID string `json:"document_id"`
EndUserID string `json:"end_user_id"`
DocumentTypeID string `json:"document_type_id"`
Alias string `json:"alias"`
FileName string `json:"file_name,omitempty"`
MetaInformation struct {
LastName string `json:"last_name,omitempty"`
FirstName string `json:"first_name,omitempty"`
DateOfBirth string `json:"date_of_birth,omitempty"`
AddressLine1 string `json:"address_line_1,omitempty"`
AddressLine2 string `json:"address_line_2,omitempty"`
City string `json:"city,omitempty"`
Country string `json:"country,omitempty"`
PostalCode string `json:"postal_code,omitempty"`
UniqueIdentificationNumber string `json:"unique_identification_number,omitempty"`
Nationality string `json:"nationality,omitempty"`
PlaceOfBirth string `json:"place_of_birth,omitempty"`
DateOfIssue string `json:"date_of_issue,omitempty"`
DateOfExpiration string `json:"date_of_expiration,omitempty"`
TypeOfUtility string `json:"type_of_utility,omitempty"`
BillingId string `json:"billing_id,omitempty"`
BillingDate string `json:"billing_date,omitempty"`
BusinessName string `json:"business_name,omitempty"`
TypeOfId string `json:"type_of_id,omitempty"`
SupportPhoneNumber string `json:"support_phone_number,omitempty"`
SupportEmail string `json:"support_email,omitempty"`
AuthorizedRepresentativeName string `json:"authorized_representative_name,omitempty"`
BillDate string `json:"bill_date,omitempty"`
BillId string `json:"bill_id,omitempty"`
UseCaseDescription string `json:"use_case_description,omitempty"`
LastName string `json:"last_name,omitempty"`
FirstName string `json:"first_name,omitempty"`
DateOfBirth string `json:"date_of_birth,omitempty"`
AddressLine1 string `json:"address_line_1,omitempty"`
AddressLine2 string `json:"address_line_2,omitempty"`
City string `json:"city,omitempty"`
Country string `json:"country,omitempty"`
PostalCode string `json:"postal_code,omitempty"`
UniqueIdentificationNumber string `json:"unique_identification_number,omitempty"`
Nationality string `json:"nationality,omitempty"`
PlaceOfBirth string `json:"place_of_birth,omitempty"`
DateOfIssue string `json:"date_of_issue,omitempty"`
DateOfExpiration string `json:"date_of_expiration,omitempty"`
TypeOfUtility string `json:"type_of_utility,omitempty"`
BillingId string `json:"billing_id,omitempty"`
BillingDate string `json:"billing_date,omitempty"`
BusinessName string `json:"business_name,omitempty"`
TypeOfId string `json:"type_of_id,omitempty"`
SupportPhoneNumber string `json:"support_phone_number,omitempty"`
SupportEmail string `json:"support_email,omitempty"`
AuthorizedRepresentativeName string `json:"authorized_representative_name,omitempty"`
BillDate string `json:"bill_date,omitempty"`
BillId string `json:"bill_id,omitempty"`
UseCaseDescription string `json:"use_case_description,omitempty"`
} `json:"meta_information"`
CreatedAt string `json:"created_at"`
}
Expand All @@ -74,30 +74,30 @@ type ListComplianceDocumentResponse struct {
ComplianceDocumentID string `json:"compliance_document_id"`
Alias string `json:"alias"`
MetaInformation struct {
LastName string `json:"last_name,omitempty"`
FirstName string `json:"first_name,omitempty"`
DateOfBirth string `json:"date_of_birth,omitempty"`
AddressLine1 string `json:"address_line_1,omitempty"`
AddressLine2 string `json:"address_line_2,omitempty"`
City string `json:"city,omitempty"`
Country string `json:"country,omitempty"`
PostalCode string `json:"postal_code,omitempty"`
UniqueIdentificationNumber string `json:"unique_identification_number,omitempty"`
Nationality string `json:"nationality,omitempty"`
PlaceOfBirth string `json:"place_of_birth,omitempty"`
DateOfIssue string `json:"date_of_issue,omitempty"`
DateOfExpiration string `json:"date_of_expiration,omitempty"`
TypeOfUtility string `json:"type_of_utility,omitempty"`
BillingId string `json:"billing_id,omitempty"`
BillingDate string `json:"billing_date,omitempty"`
BusinessName string `json:"business_name,omitempty"`
TypeOfId string `json:"type_of_id,omitempty"`
SupportPhoneNumber string `json:"support_phone_number,omitempty"`
SupportEmail string `json:"support_email,omitempty"`
AuthorizedRepresentativeName string `json:"authorized_representative_name,omitempty"`
BillDate string `json:"bill_date,omitempty"`
BillId string `json:"bill_id,omitempty"`
UseCaseDescription string `json:"use_case_description,omitempty"`
LastName string `json:"last_name,omitempty"`
FirstName string `json:"first_name,omitempty"`
DateOfBirth string `json:"date_of_birth,omitempty"`
AddressLine1 string `json:"address_line_1,omitempty"`
AddressLine2 string `json:"address_line_2,omitempty"`
City string `json:"city,omitempty"`
Country string `json:"country,omitempty"`
PostalCode string `json:"postal_code,omitempty"`
UniqueIdentificationNumber string `json:"unique_identification_number,omitempty"`
Nationality string `json:"nationality,omitempty"`
PlaceOfBirth string `json:"place_of_birth,omitempty"`
DateOfIssue string `json:"date_of_issue,omitempty"`
DateOfExpiration string `json:"date_of_expiration,omitempty"`
TypeOfUtility string `json:"type_of_utility,omitempty"`
BillingId string `json:"billing_id,omitempty"`
BillingDate string `json:"billing_date,omitempty"`
BusinessName string `json:"business_name,omitempty"`
TypeOfId string `json:"type_of_id,omitempty"`
SupportPhoneNumber string `json:"support_phone_number,omitempty"`
SupportEmail string `json:"support_email,omitempty"`
AuthorizedRepresentativeName string `json:"authorized_representative_name,omitempty"`
BillDate string `json:"bill_date,omitempty"`
BillId string `json:"bill_id,omitempty"`
UseCaseDescription string `json:"use_case_description,omitempty"`
} `json:"meta_information"`
File string `json:"file,omitempty"`
EndUserID string `json:"end_user_id"`
Expand All @@ -106,34 +106,34 @@ type ListComplianceDocumentResponse struct {
}

type CreateComplianceDocumentParams struct {
File string `json:"file,omitempty"`
EndUserID string `json:"end_user_id,omitempty"`
DocumentTypeID string `json:"document_type_id,omitempty"`
Alias string `json:"alias,omitempty"`
LastName string `json:"last_name,omitempty"`
FirstName string `json:"first_name,omitempty"`
DateOfBirth string `json:"date_of_birth,omitempty"`
AddressLine1 string `json:"address_line_1,omitempty"`
AddressLine2 string `json:"address_line_2,omitempty"`
City string `json:"city,omitempty"`
Country string `json:"country,omitempty"`
PostalCode string `json:"postal_code,omitempty"`
UniqueIdentificationNumber string `json:"unique_identification_number,omitempty"`
Nationality string `json:"nationality,omitempty"`
PlaceOfBirth string `json:"place_of_birth,omitempty"`
DateOfIssue string `json:"date_of_issue,omitempty"`
DateOfExpiration string `json:"date_of_expiration,omitempty"`
TypeOfUtility string `json:"type_of_utility,omitempty"`
BillingId string `json:"billing_id,omitempty"`
BillingDate string `json:"billing_date,omitempty"`
BusinessName string `json:"business_name,omitempty"`
TypeOfId string `json:"type_of_id,omitempty"`
SupportPhoneNumber string `json:"support_phone_number,omitempty"`
SupportEmail string `json:"support_email,omitempty"`
AuthorizedRepresentativeName string `json:"authorized_representative_name,omitempty"`
BillDate string `json:"bill_date,omitempty"`
BillId string `json:"bill_id,omitempty"`
UseCaseDescription string `json:"use_case_description,omitempty"`
File string `json:"file,omitempty"`
EndUserID string `json:"end_user_id,omitempty"`
DocumentTypeID string `json:"document_type_id,omitempty"`
Alias string `json:"alias,omitempty"`
LastName string `json:"last_name,omitempty"`
FirstName string `json:"first_name,omitempty"`
DateOfBirth string `json:"date_of_birth,omitempty"`
AddressLine1 string `json:"address_line_1,omitempty"`
AddressLine2 string `json:"address_line_2,omitempty"`
City string `json:"city,omitempty"`
Country string `json:"country,omitempty"`
PostalCode string `json:"postal_code,omitempty"`
UniqueIdentificationNumber string `json:"unique_identification_number,omitempty"`
Nationality string `json:"nationality,omitempty"`
PlaceOfBirth string `json:"place_of_birth,omitempty"`
DateOfIssue string `json:"date_of_issue,omitempty"`
DateOfExpiration string `json:"date_of_expiration,omitempty"`
TypeOfUtility string `json:"type_of_utility,omitempty"`
BillingId string `json:"billing_id,omitempty"`
BillingDate string `json:"billing_date,omitempty"`
BusinessName string `json:"business_name,omitempty"`
TypeOfId string `json:"type_of_id,omitempty"`
SupportPhoneNumber string `json:"support_phone_number,omitempty"`
SupportEmail string `json:"support_email,omitempty"`
AuthorizedRepresentativeName string `json:"authorized_representative_name,omitempty"`
BillDate string `json:"bill_date,omitempty"`
BillId string `json:"bill_id,omitempty"`
UseCaseDescription string `json:"use_case_description,omitempty"`
}

type UpdateComplianceDocumentParams struct {
Expand Down Expand Up @@ -209,7 +209,7 @@ func (service *ComplianceDocumentService) Create(params CreateComplianceDocument
fields := reflect.TypeOf(params)
values := reflect.ValueOf(params)
num := fields.NumField()
for i:=0; i<num; i++ {
for i := 0; i < num; i++ {
field := strings.Split(fields.Field(i).Tag.Get("json"), ",")[0]
value := values.Field(i)
if field != "file" {
Expand Down Expand Up @@ -237,7 +237,7 @@ func (service *ComplianceDocumentService) Update(params UpdateComplianceDocument
fields := reflect.TypeOf(params)
values := reflect.ValueOf(params)
num := fields.NumField()
for i:=0; i<num; i++ {
for i := 0; i < num; i++ {
field := strings.Split(fields.Field(i).Tag.Get("json"), ",")[0]
value := values.Field(i)
if field != "file" {
Expand Down
10 changes: 5 additions & 5 deletions examples/application.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ func main() {
// create app
createResponse, er := CreateApplication(input)
if er != nil {
fmt.Printf("Error occured while creating application. error:%+v\n", er)
fmt.Printf("Error occurred while creating application. error:%+v\n", er)
os.Exit(1)
} else {
fmt.Printf("%+v\n", createResponse)
Expand All @@ -59,7 +59,7 @@ func main() {
// get app
appDetails, er := GetApplication(createResponse.AppID)
if er != nil {
fmt.Printf("Error occured while getting application details. error:%+v\n", er)
fmt.Printf("Error occurred while getting application details. error:%+v\n", er)
os.Exit(1)
} else {
fmt.Printf("%+v\n", appDetails)
Expand All @@ -73,7 +73,7 @@ func main() {
}
updateResponse, er := UpdateApplication(createResponse.AppID, updatedApp)
if er != nil {
fmt.Printf("Error occured while updating application. error:%+v\n", er)
fmt.Printf("Error occurred while updating application. error:%+v\n", er)
os.Exit(1)
} else {
fmt.Printf("%+v\n", updateResponse)
Expand All @@ -83,15 +83,15 @@ func main() {
updatedApp.PublicURI = true
updateResponse, er = UpdateApplication(createResponse.AppID, updatedApp)
if er != nil {
fmt.Printf("Error occured while making the application public. error:%+v\n", er)
fmt.Printf("Error occurred while making the application public. error:%+v\n", er)
os.Exit(1)
} else {
fmt.Printf("%+v\n", updateResponse)
}

appDetails, er = GetApplication(createResponse.AppID)
if er != nil {
fmt.Printf("Error occured while getting application details. error:%+v\n", er)
fmt.Printf("Error occurred while getting application details. error:%+v\n", er)
os.Exit(1)
} else {
fmt.Printf("%+v\n", appDetails)
Expand Down
4 changes: 2 additions & 2 deletions jwt/jwt_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ import (

func TestJwt(t *testing.T) {
token := AccessToken{}
err := token.New("MADADADADADADADADADA", "qwerty", "username", time.Unix(12121212, 0), time.Duration(30) * time.Second, time.Time{}, "username-12345")
err := token.New("MADADADADADADADADADA", "qwerty", "username", time.Unix(12121212, 0), time.Duration(30)*time.Second, time.Time{}, "username-12345")
assert.EqualError(t, err, "lifetime out of [180, 86400]")
_ = token.New("MADADADADADADADADADA", "qwerty", "username", time.Unix(12121212, 0), time.Duration(300) * time.Second, time.Time{}, "username-12345")
_ = token.New("MADADADADADADADADADA", "qwerty", "username", time.Unix(12121212, 0), time.Duration(300)*time.Second, time.Time{}, "username-12345")
token.AddVoiceGrants(VoiceGrants{true, true})
assert.Equal(t,
"eyJhbGciOiJIUzI1NiIsImN0eSI6InBsaXZvO3Y9MSIsInR5cCI6IkpXVCJ9.eyJleHAiOjEyMTIxNTEyLCJqdGkiOiJ1c2VybmFtZS0xMjM0NSIsImlzcyI6Ik1BREFEQURBREFEQURBREFEQURBIiwibmJmIjoxMjEyMTIxMiwic3ViIjoidXNlcm5hbWUiLCJncmFudHMiOnsidm9pY2UiOnsiaW5jb21pbmdfYWxsb3ciOnRydWUsIm91dGdvaW5nX2FsbG93Ijp0cnVlfX19.51cD6eyvu_wvQ_3ag2i_8_T4cvbkU__rnkyH2MBA5Nk",
Expand Down
6 changes: 2 additions & 4 deletions nodes.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,10 @@ type PhloMultiPartyCallActionPayload struct {
TriggerSource string `json:"trigger_source" url:"trigger_source"`
}


func (self *PhloMultiPartyCall) update(params PhloMultiPartyCallActionPayload) (response *NodeActionResponse, err error) {
req, err := self.client.NewRequest("POST", params, "phlo/%s/%s/%s", self.PhloID, self.NodeType,
self.NodeID)
if (err != nil) {
if err != nil {
return
}
response = &NodeActionResponse{}
Expand All @@ -53,7 +52,6 @@ func (self *PhloMultiPartyCall) ColdTransfer(params PhloMultiPartyCallActionPayl
return self.update(params)
}


const HOLD = "hold"
const UNHOLD = "unhold"
const HANGUP = "hangup"
Expand All @@ -78,7 +76,7 @@ func (self *PhloMultiPartyCall) Member(memberID string) (response *PhloMultiPart
return
}

func (self *PhloMultiPartyCallMember) AbortTransfer() (*NodeActionResponse,error) {
func (self *PhloMultiPartyCallMember) AbortTransfer() (*NodeActionResponse, error) {
return self.update(PhloMultiPartyCallMemberActionPayload{ABORT_TRANSFER})
}

Expand Down
3 changes: 0 additions & 3 deletions nodes_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@ func TestMultiPartyCallCall_Post(t *testing.T) {
assertPhloRequest(t, "POST", "phlo/%s/%s/%s", phloGet.PhloId, nodeType, multiPartyCallGet.NodeID)
}



func TestMultiPartyCallWarmTransfer_Post(t *testing.T) {
expectResponse("MultiPartyCallResponse.json", 200)
testPhloId := "PhloId"
Expand Down Expand Up @@ -84,7 +82,6 @@ func TestMultiPartyCallMemberAbortTransfer_Post(t *testing.T) {
phloGet, _ := phloClient.Phlos.Get(testPhloId)
multiPartyCallGet, err := phloGet.MultiPartyCall(testNodeId)


cl := phloClient.httpClient
phloClient.httpClient = nil
expectResponse("multiPartyCallMemberActionResponse.json", 200)
Expand Down
2 changes: 1 addition & 1 deletion phloclient.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ func NewPhloClient(authId, authToken string, options *ClientOptions) (client *Ph
}

func (client *PhloClient) NewRequest(method string, params interface{}, formatString string,
formatParams ...interface{}) (*http.Request, error) {
formatParams ...interface{}) (*http.Request, error) {

return client.BaseClient.NewRequest(method, params, phloBaseRequestString, formatString, formatParams...)
}
Loading

0 comments on commit be3178a

Please sign in to comment.