Skip to content

Commit

Permalink
Merge pull request #12 from samir-gandhi/11-add-sdk-api-function-to-d…
Browse files Browse the repository at this point in the history
…elete-a-flow-version-for-a-flow

Add SDK function to delete a flow version
  • Loading branch information
patrickcping authored Nov 28, 2024
2 parents 76030a3 + b370921 commit 6d03dfd
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions davinci/flows.go
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,31 @@ func (c *APIClient) DeleteFlowWithResponse(companyId string, flowId string) (*Me
return &resp, res, nil
}

func (c *APIClient) DeleteFlowVersion(companyId string, flowId string, flowVersionId string) (*Message, error) {
r, _, err := c.DeleteFlowVersionWithResponse(companyId, flowId, flowVersionId)
return r, err
}

func (c *APIClient) DeleteFlowVersionWithResponse(companyId string, flowId string, flowVersionId string) (*Message, *http.Response, error) {

req := DvHttpRequest{
Method: "DELETE",
Url: fmt.Sprintf("%s/flows/%s/versions/%s", c.HostURL, flowId, flowVersionId),
}
body, res, err := c.doRequestRetryable(&companyId, req, nil)
if err != nil {
return nil, res, err
}

resp := Message{}
err = json.Unmarshal(body, &resp)
if err != nil {
return nil, res, err
}

return &resp, res, nil
}

// ReadFlows only accepts Limit as a param
func (c *APIClient) DeployFlow(companyId string, flowId string) (*Message, error) {
r, _, err := c.DeployFlowWithResponse(companyId, flowId)
Expand Down

0 comments on commit 6d03dfd

Please sign in to comment.