| 1 | package slackscip-go gomod github.com/slack-go/slack . `github.com/slack-go/slack`/ |
| 2 | |
| 3 | import ( |
| 4 | "contextscip-go gomod github.com/golang/go/src go1.16 context/" |
| 5 | "encoding/jsonscip-go gomod github.com/golang/go/src go1.16 `encoding/json`/" |
| 6 | ) |
| 7 | |
| 8 | type ( |
| 9 | WorkflowStepCompletedRequestscip-go gomod github.com/slack-go/slack . `github.com/slack-go/slack`/WorkflowStepCompletedRequest# struct { |
| 10 | WorkflowStepExecuteIDscip-go gomod github.com/slack-go/slack . `github.com/slack-go/slack`/WorkflowStepCompletedRequest#WorkflowStepExecuteID. string `json:"workflow_step_execute_id"` |
| 11 | Outputsscip-go gomod github.com/slack-go/slack . `github.com/slack-go/slack`/WorkflowStepCompletedRequest#Outputs. map[string]string `json:"outputs"` |
| 12 | } |
| 13 | |
| 14 | WorkflowStepFailedRequestscip-go gomod github.com/slack-go/slack . `github.com/slack-go/slack`/WorkflowStepFailedRequest# struct { |
| 15 | WorkflowStepExecuteIDscip-go gomod github.com/slack-go/slack . `github.com/slack-go/slack`/WorkflowStepFailedRequest#WorkflowStepExecuteID. string `json:"workflow_step_execute_id"` |
| 16 | Errorscip-go gomod github.com/slack-go/slack . `github.com/slack-go/slack`/WorkflowStepFailedRequest#Error. struct { |
| 17 | Messagescip-go gomod github.com/slack-go/slack . `github.com/slack-go/slack`/WorkflowStepFailedRequest#$anon_c7f0bc6f155121ad#Message. string `json:"message"` |
| 18 | } `json:"error"` |
| 19 | } |
| 20 | ) |
| 21 | |
| 22 | type WorkflowStepCompletedRequestOptionscip-go gomod github.com/slack-go/slack . `github.com/slack-go/slack`/WorkflowStepCompletedRequestOption# func(opt WorkflowStepCompletedRequestscip-go gomod github.com/slack-go/slack . `github.com/slack-go/slack`/WorkflowStepCompletedRequest#) error |
| 23 | |
| 24 | func WorkflowStepCompletedRequestOptionOutputscip-go gomod github.com/slack-go/slack . `github.com/slack-go/slack`/WorkflowStepCompletedRequestOptionOutput().(outputs map[string]string) WorkflowStepCompletedRequestOptionscip-go gomod github.com/slack-go/slack . `github.com/slack-go/slack`/WorkflowStepCompletedRequestOption# { |
| 25 | return func(opt WorkflowStepCompletedRequestscip-go gomod github.com/slack-go/slack . `github.com/slack-go/slack`/WorkflowStepCompletedRequest#) error { |
| 26 | if len(outputs) > 0 { |
| 27 | opt.Outputsscip-go gomod github.com/slack-go/slack . `github.com/slack-go/slack`/WorkflowStepCompletedRequest#Outputs. = outputs |
| 28 | } |
| 29 | return nil |
| 30 | } |
| 31 | } |
| 32 | |
| 33 | // WorkflowStepCompleted indicates step is completed |
| 34 | func (api *Clientscip-go gomod github.com/slack-go/slack . `github.com/slack-go/slack`/Client#) WorkflowStepCompletedscip-go gomod github.com/slack-go/slack . `github.com/slack-go/slack`/Client#WorkflowStepCompleted().(workflowStepExecuteID string, options ...WorkflowStepCompletedRequestOptionscip-go gomod github.com/slack-go/slack . `github.com/slack-go/slack`/WorkflowStepCompletedRequestOption#) error { |
| 35 | // More information: https://api.slack.com/methods/workflows.stepCompleted |
| 36 | r := WorkflowStepCompletedRequestscip-go gomod github.com/slack-go/slack . `github.com/slack-go/slack`/WorkflowStepCompletedRequest#{ |
| 37 | WorkflowStepExecuteIDscip-go gomod github.com/slack-go/slack . `github.com/slack-go/slack`/WorkflowStepCompletedRequest#WorkflowStepExecuteID.: workflowStepExecuteID, |
| 38 | } |
| 39 | for _, option := range options { |
| 40 | option(r) |
| 41 | } |
| 42 | |
| 43 | endpoint := api.endpointscip-go gomod github.com/slack-go/slack . `github.com/slack-go/slack`/Client#endpoint. + "workflows.stepCompleted" |
| 44 | jsonData, err := jsonscip-go gomod github.com/golang/go/src go1.16 `encoding/json`/.Marshalscip-go gomod github.com/golang/go/src go1.16 `encoding/json`/Marshal().(r) |
| 45 | if err != nil { |
| 46 | return err |
| 47 | } |
| 48 | |
| 49 | response := &SlackResponsescip-go gomod github.com/slack-go/slack . `github.com/slack-go/slack`/SlackResponse#{} |
| 50 | if err := postJSONscip-go gomod github.com/slack-go/slack . `github.com/slack-go/slack`/postJSON().(contextscip-go gomod github.com/golang/go/src go1.16 context/.Backgroundscip-go gomod github.com/golang/go/src go1.16 context/Background().(), api.httpclientscip-go gomod github.com/slack-go/slack . `github.com/slack-go/slack`/Client#httpclient., endpoint, api.tokenscip-go gomod github.com/slack-go/slack . `github.com/slack-go/slack`/Client#token., jsonData, response, api); err != nil { |
| 51 | return err |
| 52 | } |
| 53 | |
| 54 | if !response.Okscip-go gomod github.com/slack-go/slack . `github.com/slack-go/slack`/SlackResponse#Ok. { |
| 55 | return response.Errscip-go gomod github.com/slack-go/slack . `github.com/slack-go/slack`/SlackResponse#Err().() |
| 56 | } |
| 57 | |
| 58 | return nil |
| 59 | } |
| 60 | |
| 61 | // WorkflowStepFailed indicates step is failed |
| 62 | func (api *Clientscip-go gomod github.com/slack-go/slack . `github.com/slack-go/slack`/Client#) WorkflowStepFailedscip-go gomod github.com/slack-go/slack . `github.com/slack-go/slack`/Client#WorkflowStepFailed().(workflowStepExecuteID string, errorMessage string) error { |
| 63 | // More information: https://api.slack.com/methods/workflows.stepFailed |
| 64 | r := WorkflowStepFailedRequestscip-go gomod github.com/slack-go/slack . `github.com/slack-go/slack`/WorkflowStepFailedRequest#{ |
| 65 | WorkflowStepExecuteIDscip-go gomod github.com/slack-go/slack . `github.com/slack-go/slack`/WorkflowStepFailedRequest#WorkflowStepExecuteID.: workflowStepExecuteID, |
| 66 | } |
| 67 | r.Errorscip-go gomod github.com/slack-go/slack . `github.com/slack-go/slack`/WorkflowStepFailedRequest#Error..Messagescip-go gomod github.com/slack-go/slack . `github.com/slack-go/slack`/WorkflowStepFailedRequest#$anon_c7f0bc6f155121ad#Message. = errorMessage |
| 68 | |
| 69 | endpoint := api.endpointscip-go gomod github.com/slack-go/slack . `github.com/slack-go/slack`/Client#endpoint. + "workflows.stepFailed" |
| 70 | jsonData, err := jsonscip-go gomod github.com/golang/go/src go1.16 `encoding/json`/.Marshalscip-go gomod github.com/golang/go/src go1.16 `encoding/json`/Marshal().(r) |
| 71 | if err != nil { |
| 72 | return err |
| 73 | } |
| 74 | |
| 75 | response := &SlackResponsescip-go gomod github.com/slack-go/slack . `github.com/slack-go/slack`/SlackResponse#{} |
| 76 | if err := postJSONscip-go gomod github.com/slack-go/slack . `github.com/slack-go/slack`/postJSON().(contextscip-go gomod github.com/golang/go/src go1.16 context/.Backgroundscip-go gomod github.com/golang/go/src go1.16 context/Background().(), api.httpclientscip-go gomod github.com/slack-go/slack . `github.com/slack-go/slack`/Client#httpclient., endpoint, api.tokenscip-go gomod github.com/slack-go/slack . `github.com/slack-go/slack`/Client#token., jsonData, response, api); err != nil { |
| 77 | return err |
| 78 | } |
| 79 | |
| 80 | if !response.Okscip-go gomod github.com/slack-go/slack . `github.com/slack-go/slack`/SlackResponse#Ok. { |
| 81 | return response.Errscip-go gomod github.com/slack-go/slack . `github.com/slack-go/slack`/SlackResponse#Err().() |
| 82 | } |
| 83 | |
| 84 | return nil |
| 85 | } |