diff --git a/examples/go/go-client/helper/rest/api/v2010/accounts.go b/examples/go/go-client/helper/rest/api/v2010/accounts.go index 2da3f9447..f8a8bfc68 100644 --- a/examples/go/go-client/helper/rest/api/v2010/accounts.go +++ b/examples/go/go-client/helper/rest/api/v2010/accounts.go @@ -15,6 +15,7 @@ package openapi import ( + "context" "encoding/json" "fmt" "net/url" @@ -48,6 +49,10 @@ func (params *CreateAccountParams) SetRecordingStatusCallbackEvent(RecordingStat } func (c *ApiService) CreateAccount(params *CreateAccountParams) (*TestResponseObject, error) { + return c.CreateAccountWithCtx(context.TODO(), params) +} + +func (c *ApiService) CreateAccountWithCtx(ctx context.Context, params *CreateAccountParams) (*TestResponseObject, error) { path := "/2010-04-01/Accounts.json" data := url.Values{} @@ -66,7 +71,7 @@ func (c *ApiService) CreateAccount(params *CreateAccountParams) (*TestResponseOb headers["X-Twilio-Webhook-Enabled"] = *params.XTwilioWebhookEnabled } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + resp, err := c.requestHandler.Post(ctx, c.baseURL+path, data, headers) if err != nil { return nil, err } @@ -82,13 +87,17 @@ func (c *ApiService) CreateAccount(params *CreateAccountParams) (*TestResponseOb } func (c *ApiService) DeleteAccount(Sid string) error { + return c.DeleteAccountWithCtx(context.TODO(), Sid) +} + +func (c *ApiService) DeleteAccountWithCtx(ctx context.Context, Sid string) error { path := "/2010-04-01/Accounts/{Sid}.json" path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) data := url.Values{} headers := make(map[string]interface{}) - resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) + resp, err := c.requestHandler.Delete(ctx, c.baseURL+path, data, headers) if err != nil { return err } @@ -99,13 +108,17 @@ func (c *ApiService) DeleteAccount(Sid string) error { } func (c *ApiService) FetchAccount(Sid string) (*TestResponseObject, error) { + return c.FetchAccountWithCtx(context.TODO(), Sid) +} + +func (c *ApiService) FetchAccountWithCtx(ctx context.Context, Sid string) (*TestResponseObject, error) { path := "/2010-04-01/Accounts/{Sid}.json" path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) data := url.Values{} headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + resp, err := c.requestHandler.Get(ctx, c.baseURL+path, data, headers) if err != nil { return nil, err } @@ -163,6 +176,11 @@ func (params *ListAccountParams) SetLimit(Limit int) *ListAccountParams { // Retrieve a single page of Account records from the API. Request is executed immediately. func (c *ApiService) PageAccount(params *ListAccountParams, pageToken, pageNumber string) (*ListAccountResponse, error) { + return c.PageAccountWithCtx(context.TODO(), params, pageToken, pageNumber) +} + +// Retrieve a single page of Account records from the API. Request is executed immediately. +func (c *ApiService) PageAccountWithCtx(ctx context.Context, params *ListAccountParams, pageToken, pageNumber string) (*ListAccountResponse, error) { path := "/2010-04-01/Accounts.json" data := url.Values{} @@ -191,7 +209,7 @@ func (c *ApiService) PageAccount(params *ListAccountParams, pageToken, pageNumbe data.Set("Page", pageNumber) } - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + resp, err := c.requestHandler.Get(ctx, c.baseURL+path, data, headers) if err != nil { return nil, err } @@ -208,7 +226,12 @@ func (c *ApiService) PageAccount(params *ListAccountParams, pageToken, pageNumbe // Lists Account records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. func (c *ApiService) ListAccount(params *ListAccountParams) ([]TestResponseObject, error) { - response, errors := c.StreamAccount(params) + return c.ListAccountWithCtx(context.TODO(), params) +} + +// Lists Account records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. +func (c *ApiService) ListAccountWithCtx(ctx context.Context, params *ListAccountParams) ([]TestResponseObject, error) { + response, errors := c.StreamAccountWithCtx(ctx, params) records := make([]TestResponseObject, 0) for record := range response { @@ -224,6 +247,11 @@ func (c *ApiService) ListAccount(params *ListAccountParams) ([]TestResponseObjec // Streams Account records from the API as a channel stream. This operation lazily loads records as efficiently as possible until the limit is reached. func (c *ApiService) StreamAccount(params *ListAccountParams) (chan TestResponseObject, chan error) { + c.StreamAccountWithCtx(context.TODO(), params) +} + +// Streams Account records from the API as a channel stream. This operation lazily loads records as efficiently as possible until the limit is reached. +func (c *ApiService) StreamAccountWithCtx(ctx context.Context, params *ListAccountParams) (chan TestResponseObject, chan error) { if params == nil { params = &ListAccountParams{} } @@ -232,19 +260,19 @@ func (c *ApiService) StreamAccount(params *ListAccountParams) (chan TestResponse recordChannel := make(chan TestResponseObject, 1) errorChannel := make(chan error, 1) - response, err := c.PageAccount(params, "", "") + response, err := c.PageAccountWithCtx(ctx, params, "", "") if err != nil { errorChannel <- err close(recordChannel) close(errorChannel) } else { - go c.streamAccount(response, params, recordChannel, errorChannel) + go c.streamAccount(ctx, response, params, recordChannel, errorChannel) } return recordChannel, errorChannel } -func (c *ApiService) streamAccount(response *ListAccountResponse, params *ListAccountParams, recordChannel chan TestResponseObject, errorChannel chan error) { +func (c *ApiService) streamAccount(ctx context.Context, response *ListAccountResponse, params *ListAccountParams, recordChannel chan TestResponseObject, errorChannel chan error) { curRecord := 1 for response != nil { @@ -259,7 +287,7 @@ func (c *ApiService) streamAccount(response *ListAccountResponse, params *ListAc } } - record, err := client.GetNext(c.baseURL, response, c.getNextListAccountResponse) + record, err := client.GetNextWithCtx(ctx, c.baseURL, response, c.getNextListAccountResponse) if err != nil { errorChannel <- err break @@ -274,11 +302,11 @@ func (c *ApiService) streamAccount(response *ListAccountResponse, params *ListAc close(errorChannel) } -func (c *ApiService) getNextListAccountResponse(nextPageUrl string) (interface{}, error) { +func (c *ApiService) getNextListAccountResponse(ctx context.Context, nextPageUrl string) (interface{}, error) { if nextPageUrl == "" { return nil, nil } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + resp, err := c.requestHandler.Get(ctx, nextPageUrl, nil, nil) if err != nil { return nil, err } @@ -310,6 +338,10 @@ func (params *UpdateAccountParams) SetStatus(Status string) *UpdateAccountParams } func (c *ApiService) UpdateAccount(Sid string, params *UpdateAccountParams) (*TestResponseObject, error) { + return c.UpdateAccountWithCtx(context.TODO(), Sid, params) +} + +func (c *ApiService) UpdateAccountWithCtx(ctx context.Context, Sid string, params *UpdateAccountParams) (*TestResponseObject, error) { path := "/2010-04-01/Accounts/{Sid}.json" path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) @@ -323,7 +355,7 @@ func (c *ApiService) UpdateAccount(Sid string, params *UpdateAccountParams) (*Te data.Set("Status", *params.Status) } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + resp, err := c.requestHandler.Post(ctx, c.baseURL+path, data, headers) if err != nil { return nil, err } diff --git a/examples/go/go-client/helper/rest/api/v2010/accounts_calls.go b/examples/go/go-client/helper/rest/api/v2010/accounts_calls.go index e94843eb2..c400a3061 100644 --- a/examples/go/go-client/helper/rest/api/v2010/accounts_calls.go +++ b/examples/go/go-client/helper/rest/api/v2010/accounts_calls.go @@ -15,6 +15,7 @@ package openapi import ( + "context" "encoding/json" "fmt" "net/url" @@ -51,6 +52,10 @@ func (params *CreateCallParams) SetTestArrayOfUri(TestArrayOfUri []string) *Crea } func (c *ApiService) CreateCall(params *CreateCallParams) (*TestResponseObject, error) { + return c.CreateCallWithCtx(context.TODO(), params) +} + +func (c *ApiService) CreateCallWithCtx(ctx context.Context, params *CreateCallParams) (*TestResponseObject, error) { path := "/2010-04-01/Accounts/{AccountSid}/Calls.json" if params != nil && params.PathAccountSid != nil { path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) @@ -75,7 +80,7 @@ func (c *ApiService) CreateCall(params *CreateCallParams) (*TestResponseObject, } } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + resp, err := c.requestHandler.Post(ctx, c.baseURL+path, data, headers) if err != nil { return nil, err } @@ -102,6 +107,10 @@ func (params *DeleteCallParams) SetPathAccountSid(PathAccountSid string) *Delete } func (c *ApiService) DeleteCall(TestInteger int, params *DeleteCallParams) error { + return c.DeleteCallWithCtx(context.TODO(), TestInteger, params) +} + +func (c *ApiService) DeleteCallWithCtx(ctx context.Context, TestInteger int, params *DeleteCallParams) error { path := "/2010-04-01/Accounts/{AccountSid}/Calls/{TestInteger}.json" if params != nil && params.PathAccountSid != nil { path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) @@ -113,7 +122,7 @@ func (c *ApiService) DeleteCall(TestInteger int, params *DeleteCallParams) error data := url.Values{} headers := make(map[string]interface{}) - resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) + resp, err := c.requestHandler.Delete(ctx, c.baseURL+path, data, headers) if err != nil { return err } @@ -135,6 +144,10 @@ func (params *FetchCallParams) SetPathAccountSid(PathAccountSid string) *FetchCa } func (c *ApiService) FetchCall(TestInteger int, params *FetchCallParams) (*TestResponseObject, error) { + return c.FetchCallWithCtx(context.TODO(), TestInteger, params) +} + +func (c *ApiService) FetchCallWithCtx(ctx context.Context, TestInteger int, params *FetchCallParams) (*TestResponseObject, error) { path := "/2010-04-01/Accounts/{AccountSid}/Calls/{TestInteger}.json" if params != nil && params.PathAccountSid != nil { path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) @@ -146,7 +159,7 @@ func (c *ApiService) FetchCall(TestInteger int, params *FetchCallParams) (*TestR data := url.Values{} headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + resp, err := c.requestHandler.Get(ctx, c.baseURL+path, data, headers) if err != nil { return nil, err } diff --git a/examples/go/go-client/helper/rest/api/v2010/accounts_calls_feedback_summary.go b/examples/go/go-client/helper/rest/api/v2010/accounts_calls_feedback_summary.go index 2af1473db..da30d5095 100644 --- a/examples/go/go-client/helper/rest/api/v2010/accounts_calls_feedback_summary.go +++ b/examples/go/go-client/helper/rest/api/v2010/accounts_calls_feedback_summary.go @@ -15,6 +15,7 @@ package openapi import ( + "context" "encoding/json" "fmt" "net/url" @@ -51,6 +52,10 @@ func (params *UpdateCallFeedbackSummaryParams) SetStartDate(StartDate string) *U } func (c *ApiService) UpdateCallFeedbackSummary(Sid string, params *UpdateCallFeedbackSummaryParams) (*TestResponseObject, error) { + return c.UpdateCallFeedbackSummaryWithCtx(context.TODO(), Sid, params) +} + +func (c *ApiService) UpdateCallFeedbackSummaryWithCtx(ctx context.Context, Sid string, params *UpdateCallFeedbackSummaryParams) (*TestResponseObject, error) { path := "/2010-04-01/Accounts/{AccountSid}/Calls/Feedback/Summary/{Sid}.json" if params != nil && params.PathAccountSid != nil { path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) @@ -72,7 +77,7 @@ func (c *ApiService) UpdateCallFeedbackSummary(Sid string, params *UpdateCallFee data.Set("StartDate", fmt.Sprint(*params.StartDate)) } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + resp, err := c.requestHandler.Post(ctx, c.baseURL+path, data, headers) if err != nil { return nil, err } diff --git a/examples/go/go-client/helper/rest/api/v2010/api_service.go b/examples/go/go-client/helper/rest/api/v2010/api_service.go index ec27f348d..786e678fc 100644 --- a/examples/go/go-client/helper/rest/api/v2010/api_service.go +++ b/examples/go/go-client/helper/rest/api/v2010/api_service.go @@ -20,10 +20,14 @@ import ( type ApiService struct { baseURL string - requestHandler *twilio.RequestHandler + requestHandler *twilio.RequestHandlerWithCtx } func NewApiService(requestHandler *twilio.RequestHandler) *ApiService { + return NewApiServiceWithCtx(twilio.UpgradeRequestHandler(requestHandler)) +} + +func NewApiServiceWithCtx(requestHandler *twilio.RequestHandlerWithCtx) *ApiService { return &ApiService{ requestHandler: requestHandler, baseURL: "https://api.twilio.com", @@ -33,3 +37,7 @@ func NewApiService(requestHandler *twilio.RequestHandler) *ApiService { func NewApiServiceWithClient(client twilio.BaseClient) *ApiService { return NewApiService(twilio.NewRequestHandler(client)) } + +func NewApiServiceWithClientWithCtx(client twilio.BaseClientWithCtx) *ApiService { + return NewApiServiceWithCtx(twilio.NewRequestHandlerWithCtx(client)) +} diff --git a/examples/go/go-client/helper/rest/flex/v1/api_service.go b/examples/go/go-client/helper/rest/flex/v1/api_service.go index 82f8c08f2..04fdff0d6 100644 --- a/examples/go/go-client/helper/rest/flex/v1/api_service.go +++ b/examples/go/go-client/helper/rest/flex/v1/api_service.go @@ -20,10 +20,14 @@ import ( type ApiService struct { baseURL string - requestHandler *twilio.RequestHandler + requestHandler *twilio.RequestHandlerWithCtx } func NewApiService(requestHandler *twilio.RequestHandler) *ApiService { + return NewApiServiceWithCtx(twilio.UpgradeRequestHandler(requestHandler)) +} + +func NewApiServiceWithCtx(requestHandler *twilio.RequestHandlerWithCtx) *ApiService { return &ApiService{ requestHandler: requestHandler, baseURL: "https://flex-api.twilio.com", @@ -33,3 +37,7 @@ func NewApiService(requestHandler *twilio.RequestHandler) *ApiService { func NewApiServiceWithClient(client twilio.BaseClient) *ApiService { return NewApiService(twilio.NewRequestHandler(client)) } + +func NewApiServiceWithClientWithCtx(client twilio.BaseClientWithCtx) *ApiService { + return NewApiServiceWithCtx(twilio.NewRequestHandlerWithCtx(client)) +} diff --git a/examples/go/go-client/helper/rest/flex/v1/credentials_aws.go b/examples/go/go-client/helper/rest/flex/v1/credentials_aws.go index ae5082be5..b2176e015 100644 --- a/examples/go/go-client/helper/rest/flex/v1/credentials_aws.go +++ b/examples/go/go-client/helper/rest/flex/v1/credentials_aws.go @@ -15,6 +15,7 @@ package openapi import ( + "context" "encoding/json" "fmt" "net/url" @@ -120,6 +121,10 @@ func (params *CreateCredentialAwsParams) SetPermissions(Permissions []string) *C } func (c *ApiService) CreateCredentialAws(params *CreateCredentialAwsParams) (*TestResponseObject, error) { + return c.CreateCredentialAwsWithCtx(context.TODO(), params) +} + +func (c *ApiService) CreateCredentialAwsWithCtx(ctx context.Context, params *CreateCredentialAwsParams) (*TestResponseObject, error) { path := "/v1/Credentials/AWS" data := url.Values{} @@ -193,7 +198,7 @@ func (c *ApiService) CreateCredentialAws(params *CreateCredentialAwsParams) (*Te } } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + resp, err := c.requestHandler.Post(ctx, c.baseURL+path, data, headers) if err != nil { return nil, err } @@ -209,13 +214,17 @@ func (c *ApiService) CreateCredentialAws(params *CreateCredentialAwsParams) (*Te } func (c *ApiService) DeleteCredentialAws(Sid string) error { + return c.DeleteCredentialAwsWithCtx(context.TODO(), Sid) +} + +func (c *ApiService) DeleteCredentialAwsWithCtx(ctx context.Context, Sid string) error { path := "/v1/Credentials/AWS/{Sid}" path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) data := url.Values{} headers := make(map[string]interface{}) - resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) + resp, err := c.requestHandler.Delete(ctx, c.baseURL+path, data, headers) if err != nil { return err } @@ -226,13 +235,17 @@ func (c *ApiService) DeleteCredentialAws(Sid string) error { } func (c *ApiService) FetchCredentialAws(Sid string) (*TestResponseObject, error) { + return c.FetchCredentialAwsWithCtx(context.TODO(), Sid) +} + +func (c *ApiService) FetchCredentialAwsWithCtx(ctx context.Context, Sid string) (*TestResponseObject, error) { path := "/v1/Credentials/AWS/{Sid}" path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) data := url.Values{} headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + resp, err := c.requestHandler.Get(ctx, c.baseURL+path, data, headers) if err != nil { return nil, err } @@ -266,6 +279,11 @@ func (params *ListCredentialAwsParams) SetLimit(Limit int) *ListCredentialAwsPar // Retrieve a single page of CredentialAws records from the API. Request is executed immediately. func (c *ApiService) PageCredentialAws(params *ListCredentialAwsParams, pageToken, pageNumber string) (*ListCredentialAwsResponse, error) { + return c.PageCredentialAwsWithCtx(context.TODO(), params, pageToken, pageNumber) +} + +// Retrieve a single page of CredentialAws records from the API. Request is executed immediately. +func (c *ApiService) PageCredentialAwsWithCtx(ctx context.Context, params *ListCredentialAwsParams, pageToken, pageNumber string) (*ListCredentialAwsResponse, error) { path := "/v1/Credentials/AWS" data := url.Values{} @@ -282,7 +300,7 @@ func (c *ApiService) PageCredentialAws(params *ListCredentialAwsParams, pageToke data.Set("Page", pageNumber) } - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + resp, err := c.requestHandler.Get(ctx, c.baseURL+path, data, headers) if err != nil { return nil, err } @@ -299,7 +317,12 @@ func (c *ApiService) PageCredentialAws(params *ListCredentialAwsParams, pageToke // Lists CredentialAws records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. func (c *ApiService) ListCredentialAws(params *ListCredentialAwsParams) ([]TestResponseObject, error) { - response, errors := c.StreamCredentialAws(params) + return c.ListCredentialAwsWithCtx(context.TODO(), params) +} + +// Lists CredentialAws records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. +func (c *ApiService) ListCredentialAwsWithCtx(ctx context.Context, params *ListCredentialAwsParams) ([]TestResponseObject, error) { + response, errors := c.StreamCredentialAwsWithCtx(ctx, params) records := make([]TestResponseObject, 0) for record := range response { @@ -315,6 +338,11 @@ func (c *ApiService) ListCredentialAws(params *ListCredentialAwsParams) ([]TestR // Streams CredentialAws records from the API as a channel stream. This operation lazily loads records as efficiently as possible until the limit is reached. func (c *ApiService) StreamCredentialAws(params *ListCredentialAwsParams) (chan TestResponseObject, chan error) { + c.StreamCredentialAwsWithCtx(context.TODO(), params) +} + +// Streams CredentialAws records from the API as a channel stream. This operation lazily loads records as efficiently as possible until the limit is reached. +func (c *ApiService) StreamCredentialAwsWithCtx(ctx context.Context, params *ListCredentialAwsParams) (chan TestResponseObject, chan error) { if params == nil { params = &ListCredentialAwsParams{} } @@ -323,19 +351,19 @@ func (c *ApiService) StreamCredentialAws(params *ListCredentialAwsParams) (chan recordChannel := make(chan TestResponseObject, 1) errorChannel := make(chan error, 1) - response, err := c.PageCredentialAws(params, "", "") + response, err := c.PageCredentialAwsWithCtx(ctx, params, "", "") if err != nil { errorChannel <- err close(recordChannel) close(errorChannel) } else { - go c.streamCredentialAws(response, params, recordChannel, errorChannel) + go c.streamCredentialAws(ctx, response, params, recordChannel, errorChannel) } return recordChannel, errorChannel } -func (c *ApiService) streamCredentialAws(response *ListCredentialAwsResponse, params *ListCredentialAwsParams, recordChannel chan TestResponseObject, errorChannel chan error) { +func (c *ApiService) streamCredentialAws(ctx context.Context, response *ListCredentialAwsResponse, params *ListCredentialAwsParams, recordChannel chan TestResponseObject, errorChannel chan error) { curRecord := 1 for response != nil { @@ -350,7 +378,7 @@ func (c *ApiService) streamCredentialAws(response *ListCredentialAwsResponse, pa } } - record, err := client.GetNext(c.baseURL, response, c.getNextListCredentialAwsResponse) + record, err := client.GetNextWithCtx(ctx, c.baseURL, response, c.getNextListCredentialAwsResponse) if err != nil { errorChannel <- err break @@ -365,11 +393,11 @@ func (c *ApiService) streamCredentialAws(response *ListCredentialAwsResponse, pa close(errorChannel) } -func (c *ApiService) getNextListCredentialAwsResponse(nextPageUrl string) (interface{}, error) { +func (c *ApiService) getNextListCredentialAwsResponse(ctx context.Context, nextPageUrl string) (interface{}, error) { if nextPageUrl == "" { return nil, nil } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + resp, err := c.requestHandler.Get(ctx, nextPageUrl, nil, nil) if err != nil { return nil, err } @@ -401,6 +429,10 @@ func (params *UpdateCredentialAwsParams) SetTestBoolean(TestBoolean bool) *Updat } func (c *ApiService) UpdateCredentialAws(Sid string, params *UpdateCredentialAwsParams) (*TestResponseObject, error) { + return c.UpdateCredentialAwsWithCtx(context.TODO(), Sid, params) +} + +func (c *ApiService) UpdateCredentialAwsWithCtx(ctx context.Context, Sid string, params *UpdateCredentialAwsParams) (*TestResponseObject, error) { path := "/v1/Credentials/AWS/{Sid}" path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) @@ -414,7 +446,7 @@ func (c *ApiService) UpdateCredentialAws(Sid string, params *UpdateCredentialAws data.Set("TestBoolean", fmt.Sprint(*params.TestBoolean)) } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + resp, err := c.requestHandler.Post(ctx, c.baseURL+path, data, headers) if err != nil { return nil, err } diff --git a/examples/go/go-client/helper/rest/flex/v1/voice.go b/examples/go/go-client/helper/rest/flex/v1/voice.go index 88f989e29..c6db7dcbd 100644 --- a/examples/go/go-client/helper/rest/flex/v1/voice.go +++ b/examples/go/go-client/helper/rest/flex/v1/voice.go @@ -15,19 +15,24 @@ package openapi import ( + "context" "encoding/json" "net/url" "strings" ) func (c *ApiService) UpdateCall(Sid string) (*UpdateCall200Response, error) { + return c.UpdateCallWithCtx(context.TODO(), Sid) +} + +func (c *ApiService) UpdateCallWithCtx(ctx context.Context, Sid string) (*UpdateCall200Response, error) { path := "/v1/Voice/{Sid}" path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) data := url.Values{} headers := make(map[string]interface{}) - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + resp, err := c.requestHandler.Post(ctx, c.baseURL+path, data, headers) if err != nil { return nil, err }