Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sync with master #51

Merged
merged 12 commits into from
Nov 13, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Change Log

## [4.1.1](https://github.com/plivo/plivo-go/tree/v4.1.1) (2019-11-05)
- Add SSML support

## [4.1.0](https://github.com/plivo/plivo-go/tree/v4.1.0) (2019-03-12)
- Add PHLO support
- Add Multi-party call triggers
Expand Down
7 changes: 7 additions & 0 deletions Jenkinsfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!groovy

@Library('plivo_standard_libs@sdks') _

sdksPipeline ([
buildContainer: 'plivo/jenkins-ci/debian:stretch'
])
18 changes: 9 additions & 9 deletions baseclient.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,15 @@ import (
"encoding/json"
"errors"
"fmt"
"github.com/google/go-querystring/query"
"io/ioutil"
"net/http"
"net/url"
"reflect"

"github.com/google/go-querystring/query"
)

const sdkVersion = "4.1.0"
const sdkVersion = "4.1.1"

type ClientOptions struct {
HttpClient *http.Client
Expand All @@ -31,8 +32,8 @@ type BaseClient struct {
ResponseInterceptor func(response *http.Response)
}

func (client *BaseClient) NewRequest(method string, params interface{}, baseRequestString string, formatString string,
formatParams ...interface{}) (request *http.Request, err error) {
func (client *BaseClient) NewRequest(method string, params interface{}, baseRequestString string, formatString string,
formatParams ...interface{}) (request *http.Request, err error) {

if client == nil || client.httpClient == nil {
err = errors.New("client and httpClient cannot be nil")
Expand All @@ -58,11 +59,11 @@ formatParams ...interface{}) (request *http.Request, err error) {

requestUrl.RawQuery = values.Encode()
} else {
if(reflect.ValueOf(params).Kind().String() != "map"){
if reflect.ValueOf(params).Kind().String() != "map" {
if err = json.NewEncoder(buffer).Encode(params); err != nil {
return
}
}else if (reflect.ValueOf(params).Kind().String() == "map" && !reflect.ValueOf(params).IsNil()) {
} else if reflect.ValueOf(params).Kind().String() == "map" && !reflect.ValueOf(params).IsNil() {
if err = json.NewEncoder(buffer).Encode(params); err != nil {
return
}
Expand All @@ -89,7 +90,6 @@ func (client *BaseClient) ExecuteRequest(request *http.Request, body interface{}
return errors.New("httpClient cannot be nil")
}


response, err := client.httpClient.Do(request)
if err != nil {
return
Expand All @@ -102,9 +102,9 @@ func (client *BaseClient) ExecuteRequest(request *http.Request, body interface{}
err = json.Unmarshal(data, body)
}
} else {
if (string(data) == "{}" && response.StatusCode == 404){
if string(data) == "{}" && response.StatusCode == 404 {
err = errors.New(string("Resource not found exception \n" + response.Status))
}else{
} else {
err = errors.New(string(data))
}
}
Expand Down
4 changes: 4 additions & 0 deletions ci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
parent: central
serviceName: plivo-go
language: go-sdk