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

workflow_step: add SaveWorkflowStepConfigurationConetxt & fix return err #1042

Merged
merged 1 commit into from Mar 11, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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 {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @zchee,

there is a little typo in apt.SaveWorkflowStepConfigurationConetxt()

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should be ...Context()

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah... fix ASAP

// 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