Skip to content
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
2 changes: 1 addition & 1 deletion examples/go/go-client/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ go 1.21
require (
github.com/golang/mock v1.6.0
github.com/stretchr/testify v1.7.0
github.com/twilio/twilio-go v0.25.0
github.com/twilio/twilio-go v1.29.1
)

require (
Expand Down
8 changes: 5 additions & 3 deletions examples/go/go-client/go.sum
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
github.com/beevik/etree v1.1.0/go.mod h1:r8Aw8JqVegEf0w2fDnATrX9VpkMcyFeM0FhwO62wh+A=
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/golang-jwt/jwt v3.2.2+incompatible/go.mod h1:8pz2t5EyA70fFQQSrl6XZXzqecmYZeUEB8OUGHkxJ+I=
github.com/golang-jwt/jwt/v5 v5.2.2/go.mod h1:pqrtFR0X4osieyHYxtmOUWsAWrfe1Q5UVIyoH402zdk=
github.com/golang/mock v1.6.0 h1:ErTB+efbowRARo13NNdxyJji2egdxLGQhRaY+DUumQc=
github.com/golang/mock v1.6.0/go.mod h1:p6yTPP+5HYm5mzsMV8JkE6ZKdX+/wYM6Hr+LicevLPs=
github.com/kr/pretty v0.2.1 h1:Fmg33tUaq4/8ym9TJN1x7sLJnHVwhP33CNkpYV/7rwI=
Expand All @@ -11,6 +12,7 @@ github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
github.com/localtunnel/go-localtunnel v0.0.0-20170326223115-8a804488f275/go.mod h1:zt6UU74K6Z6oMOYJbJzYpYucqdcQwSMPBEdSvGiaUMw=
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno=
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
Expand All @@ -19,8 +21,8 @@ github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZN
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY=
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/twilio/twilio-go v0.25.0 h1:Vk3OjsIcm//WTpywp3y+HD+Goiyf1SIiLQR+sxw+/gM=
github.com/twilio/twilio-go v0.25.0/go.mod h1:lz62Hopu4vicpQ056H5TJ0JE4AP0rS3sQ35/ejmgOwE=
github.com/twilio/twilio-go v1.29.1 h1:4dx1d9EhRUhL5ubzYrDROERAiw55s7mBE6/w3q2epVg=
github.com/twilio/twilio-go v1.29.1/go.mod h1:FpgNWMoD8CFnmukpKq9RNpUSGXC0BwnbeKZj2YHlIkw=
github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
Expand Down
40 changes: 36 additions & 4 deletions examples/go/go-client/helper/client/mock_client.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 5 additions & 3 deletions examples/go/go-client/helper/client/test_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ type BaseClient interface {
AccountSid() string
SetTimeout(timeout time.Duration)
SendRequest(method string, rawURL string, data url.Values,
headers map[string]interface{}) (*http.Response, error)
headers map[string]interface{}, body ...byte) (*http.Response, error)
SetOauth(auth client.OAuth)
OAuth() client.OAuth
}

type TestClient struct {
Expand All @@ -37,6 +39,6 @@ func (tc *TestClient) getParsedUrl(path string) *url.URL {
return parsedUrl
}

func (tc *TestClient) SendRequest(method string, rawURL string, data url.Values, headers map[string]interface{}) (*http.Response, error) {
return tc.Client.SendRequest(method, tc.getParsedUrl(rawURL).String(), data, headers)
func (tc *TestClient) SendRequest(method string, rawURL string, data url.Values, headers map[string]interface{}, body ...byte) (*http.Response, error) {
return tc.Client.SendRequest(method, tc.getParsedUrl(rawURL).String(), data, headers, body...)
}
24 changes: 12 additions & 12 deletions examples/go/go-client/helper/rest/api/v2010/unit_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ func TestPathIsCorrect(t *testing.T) {
gomock.Any(),
gomock.Any()).
DoAndReturn(func(method string, rawURL string, data url.Values,
headers map[string]interface{}) (*http.Response, error) {
headers map[string]interface{}, body ...byte) (*http.Response, error) {
assert.Equal(t, "https://api.twilio.com/2010-04-01/Accounts/AC222222222222222222222222222222/Calls/123.json", rawURL)
return &http.Response{Body: getEmptyBody()}, nil
},
Expand All @@ -50,7 +50,7 @@ func TestAccountSidAsOptionalParam(t *testing.T) {
gomock.Any(),
gomock.Any()).
DoAndReturn(func(method string, rawURL string, data url.Values,
headers map[string]interface{}) (*http.Response, error) {
headers map[string]interface{}, body ...byte) (*http.Response, error) {
assert.Equal(t, "https://api.twilio.com/2010-04-01/Accounts/AC444444444444444444444444444444/Calls/123.json", rawURL)
return &http.Response{Body: getEmptyBody()}, nil
},
Expand Down Expand Up @@ -81,7 +81,7 @@ func TestAddingHeader(t *testing.T) {
gomock.Any(),
gomock.Any()).
DoAndReturn(func(method string, rawURL string, data url.Values,
headers map[string]interface{}) (*http.Response, error) {
headers map[string]interface{}, body ...byte) (*http.Response, error) {
assert.Equal(t, expectedHeader, headers)
return &http.Response{Body: getEmptyBody()}, nil
},
Expand Down Expand Up @@ -118,7 +118,7 @@ func TestQueryParams(t *testing.T) {
gomock.Any(),
gomock.Any()).
DoAndReturn(func(method string, rawURL string, data url.Values,
headers map[string]interface{}) (*http.Response, error) {
headers map[string]interface{}, body ...byte) (*http.Response, error) {
assert.Equal(t, expectedData, data)
return &http.Response{Body: getEmptyBody()}, nil
},
Expand Down Expand Up @@ -150,7 +150,7 @@ func TestArrayTypeParam(t *testing.T) {
gomock.Any(),
gomock.Any()).
DoAndReturn(func(method string, rawURL string, data url.Values,
headers map[string]interface{}) (*http.Response, error) {
headers map[string]interface{}, body ...byte) (*http.Response, error) {
assert.Equal(t, expectedData, data)
return &http.Response{Body: getEmptyBody()}, nil
},
Expand All @@ -169,7 +169,7 @@ func TestResponseDecodeTypes(t *testing.T) {
gomock.Any(),
gomock.Any(),
gomock.Any()).
DoAndReturn(func(method string, rawURL string, data url.Values, headers map[string]interface{}) (*http.Response, error) {
DoAndReturn(func(method string, rawURL string, data url.Values, headers map[string]interface{}, body ...byte) (*http.Response, error) {
response := map[string]interface{}{
"test_number": 123.45,
"test_number_float": "67.89",
Expand Down Expand Up @@ -205,7 +205,7 @@ func TestList(t *testing.T) {
gomock.Any(),
gomock.Any()).
DoAndReturn(func(method string, rawURL string, data url.Values,
headers map[string]interface{}) (*http.Response, error) {
headers map[string]interface{}, body ...byte) (*http.Response, error) {
response := map[string]interface{}{
"accounts": []map[string]interface{}{
{
Expand Down Expand Up @@ -271,7 +271,7 @@ func TestListPaging(t *testing.T) {
gomock.Any(),
gomock.Any()).
DoAndReturn(func(method string, rawURL string, data url.Values,
headers map[string]interface{}) (*http.Response, error) {
headers map[string]interface{}, body ...byte) (*http.Response, error) {
response := map[string]interface{}{
"accounts": []map[string]interface{}{
{
Expand All @@ -296,7 +296,7 @@ func TestListPaging(t *testing.T) {
gomock.Any(),
gomock.Any()).
DoAndReturn(func(method string, rawURL string, data url.Values,
headers map[string]interface{}) (*http.Response, error) {
headers map[string]interface{}, body ...byte) (*http.Response, error) {
response := map[string]interface{}{
"accounts": []map[string]interface{}{
{
Expand All @@ -318,7 +318,7 @@ func TestListPaging(t *testing.T) {
gomock.Any(),
gomock.Any()).
DoAndReturn(func(method string, rawURL string, data url.Values,
headers map[string]interface{}) (*http.Response, error) {
headers map[string]interface{}, body ...byte) (*http.Response, error) {
return &http.Response{Body: getEmptyBody()}, nil
},
)
Expand Down Expand Up @@ -353,7 +353,7 @@ func TestListPagingError(t *testing.T) {
gomock.InOrder(
testClient.EXPECT().SendRequest(gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any()).
DoAndReturn(func(method string, rawURL string, data url.Values,
headers map[string]interface{}) (*http.Response, error) {
headers map[string]interface{}, body ...byte) (*http.Response, error) {
response := map[string]interface{}{
"recordings": []map[string]interface{}{
{
Expand All @@ -372,7 +372,7 @@ func TestListPagingError(t *testing.T) {
}),
testClient.EXPECT().SendRequest(gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any()).
DoAndReturn(func(method string, rawURL string, data url.Values,
headers map[string]interface{}) (*http.Response, error) {
headers map[string]interface{}, body ...byte) (*http.Response, error) {
return &http.Response{Body: io.NopCloser(bytes.NewReader(nil))}, nil
}),
)
Expand Down
1 change: 1 addition & 0 deletions examples/go/go-client/helper/rest/flex/v1/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ Class | Method | HTTP request | Description
*CredentialsAWSApi* | [**DeleteCredentialAws**](docs/CredentialsAWSApi.md#deletecredentialaws) | **Delete** /v1/Credentials/AWS/{Sid} |
*CredentialsAWSApi* | [**FetchCredentialAws**](docs/CredentialsAWSApi.md#fetchcredentialaws) | **Get** /v1/Credentials/AWS/{Sid} |
*CredentialsAWSApi* | [**ListCredentialAws**](docs/CredentialsAWSApi.md#listcredentialaws) | **Get** /v1/Credentials/AWS |
*CredentialsAWSApi* | [**PatchCredentialAws**](docs/CredentialsAWSApi.md#patchcredentialaws) | **Patch** /v1/Credentials/AWS/{Sid} |
*CredentialsAWSApi* | [**UpdateCredentialAws**](docs/CredentialsAWSApi.md#updatecredentialaws) | **Post** /v1/Credentials/AWS/{Sid} |
*CredentialsAWSHistoryApi* | [**FetchCredentialHistory**](docs/CredentialsAWSHistoryApi.md#fetchcredentialhistory) | **Get** /v1/Credentials/AWS/{Sid}/History |
*VoiceApi* | [**UpdateCall**](docs/VoiceApi.md#updatecall) | **Post** /v1/Voice/{Sid} |
Expand Down
48 changes: 48 additions & 0 deletions examples/go/go-client/helper/rest/flex/v1/credentials_aws.go
Original file line number Diff line number Diff line change
Expand Up @@ -417,6 +417,54 @@ func (c *ApiService) getNextListCredentialAwsResponse(nextPageUrl string) (inter
return ps, nil
}

// Optional parameters for the method 'PatchCredentialAws'
type PatchCredentialAwsParams struct {
//
TestString *string `json:"TestString,omitempty"`
//
TestBoolean *bool `json:"TestBoolean,omitempty"`
}

func (params *PatchCredentialAwsParams) SetTestString(TestString string) *PatchCredentialAwsParams {
params.TestString = &TestString
return params
}
func (params *PatchCredentialAwsParams) SetTestBoolean(TestBoolean bool) *PatchCredentialAwsParams {
params.TestBoolean = &TestBoolean
return params
}

func (c *ApiService) PatchCredentialAws(Sid string, params *PatchCredentialAwsParams) (*TestResponseObject, error) {
path := "/v1/Credentials/AWS/{Sid}"
path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1)

data := url.Values{}
headers := map[string]interface{}{
"Content-Type": "application/x-www-form-urlencoded",
}

if params != nil && params.TestString != nil {
data.Set("TestString", *params.TestString)
}
if params != nil && params.TestBoolean != nil {
data.Set("TestBoolean", fmt.Sprint(*params.TestBoolean))
}

resp, err := c.requestHandler.Patch(c.baseURL+path, data, headers)
if err != nil {
return nil, err
}

defer resp.Body.Close()

ps := &TestResponseObject{}
if err := json.NewDecoder(resp.Body).Decode(ps); err != nil {
return nil, err
}

return ps, err
}

// Optional parameters for the method 'UpdateCredentialAws'
type UpdateCredentialAwsParams struct {
//
Expand Down
10 changes: 5 additions & 5 deletions examples/go/go-client/helper/rest/flex/v1/unit_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ func TestObjectArrayTypeParam(t *testing.T) {
gomock.Any(),
gomock.Any()).
DoAndReturn(func(method string, rawURL string, data url.Values,
headers map[string]interface{}) (*http.Response, error) {
headers map[string]interface{}, body ...byte) (*http.Response, error) {
assert.Equal(t, expectedData, data)
return &http.Response{Body: getEmptyBody()}, nil
},
Expand All @@ -59,7 +59,7 @@ func TestUpdateOperation(t *testing.T) {
gomock.Any(),
gomock.Any(),
gomock.Any()).
DoAndReturn(func(method string, rawURL string, data url.Values, headers map[string]interface{}) (*http.Response, error) {
DoAndReturn(func(method string, rawURL string, data url.Values, headers map[string]interface{}, body ...byte) (*http.Response, error) {
assert.Equal(t, "POST", method)
assert.Equal(t, "https://flex-api.twilio.com/v1/Voice/VO123", rawURL)
return &http.Response{Body: getEmptyBody()}, nil
Expand All @@ -83,7 +83,7 @@ func TestListError(t *testing.T) {
gomock.Any(),
gomock.Any()).
DoAndReturn(func(method string, rawURL string, data url.Values,
headers map[string]interface{}) (*http.Response, error) {
headers map[string]interface{}, body ...byte) (*http.Response, error) {
response := map[string]interface{}{
"credentials": []map[string]interface{}{
{
Expand Down Expand Up @@ -129,7 +129,7 @@ func TestListNoNextPage(t *testing.T) {
gomock.Any(),
gomock.Any()).
DoAndReturn(func(method string, rawURL string, data url.Values,
headers map[string]interface{}) (*http.Response, error) {
headers map[string]interface{}, body ...byte) (*http.Response, error) {
response := map[string]interface{}{
"credentials": []map[string]interface{}{
{
Expand Down Expand Up @@ -176,7 +176,7 @@ func TestPageToken(t *testing.T) {
gomock.Any(),
gomock.Any(),
gomock.Any()).
DoAndReturn(func(method string, rawURL string, data url.Values, headers map[string]interface{}) (*http.Response, error) {
DoAndReturn(func(method string, rawURL string, data url.Values, headers map[string]interface{}, body ...byte) (*http.Response, error) {
assert.Equal(t, expectedData, data)
return &http.Response{Body: getEmptyBody()}, nil
}).AnyTimes()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,12 @@ public static AwsReader reader() {










public static AwsUpdater updater(final String pathSid) {
return new AwsUpdater(
Expand Down
Loading