forked from railwayapp/cli
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathworkflow.go
More file actions
31 lines (26 loc) · 680 Bytes
/
Copy pathworkflow.go
File metadata and controls
31 lines (26 loc) · 680 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
package gateway
import (
context "context"
"github.com/railwayapp/cli/entity"
"github.com/railwayapp/cli/errors"
)
func (g *Gateway) GetWorkflowStatus(ctx context.Context, workflowID string) (entity.WorkflowStatus, error) {
gqlReq, err := g.NewRequestWithAuth(`
query($workflowId: String!) {
getWorkflowStatus(workflowId: $workflowId) {
status
}
}
`)
if err != nil {
return "", err
}
gqlReq.Var("workflowId", workflowID)
var resp struct {
WorkflowStatus *entity.WorkflowStatusResponse `json:"getWorkflowStatus"`
}
if err := gqlReq.Run(ctx, &resp); err != nil {
return "", errors.ProjectCreateFailed
}
return resp.WorkflowStatus.Status, nil
}