Skip to content

Commit

Permalink
Merge pull request #1042 from slack-go/1027-ctx-aware
Browse files Browse the repository at this point in the history
workflow_step: add SaveWorkflowStepConfigurationConetxt & fix return err
  • Loading branch information
zchee committed Mar 11, 2022
2 parents 6ae6da1 + e8852bf commit 90b1ed4
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions workflow_step.go
Expand Up @@ -3,7 +3,6 @@ package slack
import (
"context"
"encoding/json"
"fmt"
)

const VTWorkflowStep ViewType = "workflow_step"
Expand Down Expand Up @@ -46,6 +45,10 @@ func NewConfigurationModalRequest(blocks Blocks, privateMetaData string, externa
}

func (api *Client) SaveWorkflowStepConfiguration(workflowStepEditID string, inputs *WorkflowStepInputs, outputs *[]WorkflowStepOutput) error {
return api.SaveWorkflowStepConfigurationConetxt(context.Background(), workflowStepEditID, inputs, outputs)
}

func (api *Client) SaveWorkflowStepConfigurationConetxt(ctx context.Context, workflowStepEditID string, inputs *WorkflowStepInputs, outputs *[]WorkflowStepOutput) error {
// More information: https://api.slack.com/methods/workflows.updateStep
wscr := WorkflowStepCompleteResponse{
WorkflowStepEditID: workflowStepEditID,
Expand All @@ -60,12 +63,12 @@ func (api *Client) SaveWorkflowStepConfiguration(workflowStepEditID string, inpu
}

response := &SlackResponse{}
if err := postJSON(context.Background(), api.httpclient, endpoint, api.token, jsonData, response, api); err != nil {
if err := postJSON(ctx, api.httpclient, endpoint, api.token, jsonData, response, api); err != nil {
return err
}

if !response.Ok {
return fmt.Errorf(" %s", response.Error)
return response.Err()
}

return nil
Expand Down

0 comments on commit 90b1ed4

Please sign in to comment.