diff --git a/verify.go b/verify.go index 089f109..63cb7a5 100644 --- a/verify.go +++ b/verify.go @@ -1,6 +1,7 @@ package vonage import ( + "context" "encoding/json" "io/ioutil" @@ -74,7 +75,8 @@ func (client *VerifyClient) Request(number string, brand string, opts VerifyOpts verifyOpts.SenderId = optional.NewString(opts.SenderID) } - result, resp, err := verifyClient.DefaultApi.VerifyRequest(nil, "json", client.apiKey, client.apiSecret, number, brand, &verifyOpts) + ctx := context.Background() + result, resp, err := verifyClient.DefaultApi.VerifyRequest(ctx, "json", client.apiKey, client.apiSecret, number, brand, &verifyOpts) // catch HTTP errors if err != nil { @@ -110,7 +112,8 @@ func (client *VerifyClient) Check(requestID string, code string) (VerifyCheckRes // set up and then parse the options verifyOpts := verify.VerifyCheckOpts{} - result, resp, err := verifyClient.DefaultApi.VerifyCheck(nil, "json", client.apiKey, client.apiSecret, requestID, code, &verifyOpts) + ctx := context.Background() + result, resp, err := verifyClient.DefaultApi.VerifyCheck(ctx, "json", client.apiKey, client.apiSecret, requestID, code, &verifyOpts) // catch HTTP errors if err != nil { @@ -156,7 +159,8 @@ func (client *VerifyClient) Search(requestID string) (VerifySearchResponse, Veri // set up and then parse the options verifyOpts := verify.VerifySearchOpts{} verifyOpts.RequestId = optional.NewString(requestID) - result, resp, err := verifyClient.DefaultApi.VerifySearch(nil, "json", client.apiKey, client.apiSecret, &verifyOpts) + ctx := context.Background() + result, resp, err := verifyClient.DefaultApi.VerifySearch(ctx, "json", client.apiKey, client.apiSecret, &verifyOpts) // catch HTTP errors if err != nil { @@ -187,7 +191,8 @@ func (client *VerifyClient) Cancel(requestID string) (VerifyControlResponse, Ver // create the client verifyClient := verify.NewAPIClient(client.Config) - result, resp, err := verifyClient.DefaultApi.VerifyControl(nil, "json", client.apiKey, client.apiSecret, requestID, "cancel") + ctx := context.Background() + result, resp, err := verifyClient.DefaultApi.VerifyControl(ctx, "json", client.apiKey, client.apiSecret, requestID, "cancel") // catch HTTP errors if err != nil { @@ -213,7 +218,8 @@ func (client *VerifyClient) TriggerNextEvent(requestID string) (VerifyControlRes // create the client verifyClient := verify.NewAPIClient(client.Config) - result, resp, err := verifyClient.DefaultApi.VerifyControl(nil, "json", client.apiKey, client.apiSecret, requestID, "trigger_next_event") + ctx := context.Background() + result, resp, err := verifyClient.DefaultApi.VerifyControl(ctx, "json", client.apiKey, client.apiSecret, requestID, "trigger_next_event") // catch HTTP errors if err != nil { @@ -264,7 +270,8 @@ func (client *VerifyClient) Psd2(number string, payee string, amount float64, op verifyOpts.WorkflowId = optional.NewInt32(opts.WorkflowID) } - result, resp, err := verifyClient.DefaultApi.VerifyRequestWithPSD2(nil, "json", client.apiKey, client.apiSecret, number, payee, float32(amount), &verifyOpts) + ctx := context.Background() + result, resp, err := verifyClient.DefaultApi.VerifyRequestWithPSD2(ctx, "json", client.apiKey, client.apiSecret, number, payee, float32(amount), &verifyOpts) // catch HTTP errors if err != nil {