> For the complete documentation index, see [llms.txt](https://developers.incidents.cloud.solarwinds.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developers.incidents.cloud.solarwinds.com/go-sdk/docs/sdks/workflows.md).

# Workflows

## Overview

### Available Operations

* [List](#list) - List Workflows
* [Create](#create) - Create Workflow
* [BulkEnableDisable](#bulkenabledisable) - Bulk Enable/Disable Workflows
* [Delete](#delete) - Delete Workflow
* [GetByID](#getbyid) - Get Workflow By ID
* [Update](#update) - Update Workflow
* [UpdateActionsOrder](#updateactionsorder) - Update Actions Order
* [DeleteAction](#deleteaction) - Delete Workflow Action
* [GetAction](#getaction) - Get Workflow Action By ID
* [UpdateAction](#updateaction) - Update Workflow Action
* [ToggleEnable](#toggleenable) - Enable/Disable Workflow
* [GetLogs](#getlogs) - Get Workflow Logs

## List

Get a list of all Workflows

### Example Usage

```go
package main

import(
	"context"
	"os"
	squadcastsdk "github.com/solarwinds/squadcast-sdk-go"
	"github.com/solarwinds/squadcast-sdk-go/models/operations"
	"log"
)

func main() {
    ctx := context.Background()

    s := squadcastsdk.New(
        squadcastsdk.WithSecurity(os.Getenv("SQUADCASTSDK_REFRESH_TOKEN_AUTH")),
    )

    res, err := s.Workflows.List(ctx, operations.WorkflowsListWorkflowsRequest{
        OwnerID: "<id>",
    })
    if err != nil {
        log.Fatal(err)
    }
    if res.V3WorkflowsListWorkflowAPIResponse != nil {
        for {
            // handle items

            res, err = res.Next()

            if err != nil {
                // handle error
            }

            if res == nil {
                break
            }
        }
    }
}
```

### Parameters

| Parameter | Type                                                                                                                                                         | Required             | Description                                |
| --------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | -------------------- | ------------------------------------------ |
| `ctx`     | [context.Context](https://pkg.go.dev/context#Context)                                                                                                        | :heavy\_check\_mark: | The context to use for the request.        |
| `request` | [operations.WorkflowsListWorkflowsRequest](https://developers.incidents.cloud.solarwinds.com/go-sdk/docs/models/operations/workflowslistworkflowsrequest.md) | :heavy\_check\_mark: | The request object to use for the request. |
| `opts`    | \[][operations.Option](https://developers.incidents.cloud.solarwinds.com/go-sdk/docs/models/operations/option.md)                                            | :heavy\_minus\_sign: | The options for this request.              |

### Response

[**\*operations.WorkflowsListWorkflowsResponse**](https://developers.incidents.cloud.solarwinds.com/go-sdk/docs/models/operations/workflowslistworkflowsresponse.md)**, error**

### Errors

| Error Type                         | Status Code | Content Type     |
| ---------------------------------- | ----------- | ---------------- |
| apierrors.BadRequestError          | 400         | application/json |
| apierrors.UnauthorizedError        | 401         | application/json |
| apierrors.PaymentRequiredError     | 402         | application/json |
| apierrors.ForbiddenError           | 403         | application/json |
| apierrors.NotFoundError            | 404         | application/json |
| apierrors.ConflictError            | 409         | application/json |
| apierrors.UnprocessableEntityError | 422         | application/json |
| apierrors.InternalServerError      | 500         | application/json |
| apierrors.BadGatewayError          | 502         | application/json |
| apierrors.ServiceUnavailableError  | 503         | application/json |
| apierrors.GatewayTimeoutError      | 504         | application/json |
| apierrors.APIError                 | 4XX, 5XX    | \*/\*            |

## Create

Create a Workflow

### Example Usage

```go
package main

import(
	"context"
	"os"
	squadcastsdk "github.com/solarwinds/squadcast-sdk-go"
	"github.com/solarwinds/squadcast-sdk-go/models/components"
	"log"
)

func main() {
    ctx := context.Background()

    s := squadcastsdk.New(
        squadcastsdk.WithSecurity(os.Getenv("SQUADCASTSDK_REFRESH_TOKEN_AUTH")),
    )

    res, err := s.Workflows.Create(ctx, components.V3WorkflowsCreateWorkflowRequest{
        Title: "<value>",
        OwnerID: "<id>",
        Trigger: components.V3WorkflowsWorkflowTriggerIncidentAcknowledged,
        Filters: components.V3WorkflowsCreateWorkflowFilter{},
        Actions: []components.V3WorkflowsActionRequest{
            components.CreateV3WorkflowsActionRequestV3WorkflowsSqTriggerManualWebhook(
                components.V3WorkflowsSqTriggerManualWebhook{
                    Name: components.V3WorkflowsSqTriggerManualWebhookNameSqTriggerManualWebhook,
                    Data: components.V3WorkflowsSqTriggerManualWebhookData{
                        ID: "<id>",
                    },
                },
            ),
        },
    })
    if err != nil {
        log.Fatal(err)
    }
    if res.Object != nil {
        // handle response
    }
}
```

### Parameters

| Parameter | Type                                                                                                                                                               | Required             | Description                                |
| --------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -------------------- | ------------------------------------------ |
| `ctx`     | [context.Context](https://pkg.go.dev/context#Context)                                                                                                              | :heavy\_check\_mark: | The context to use for the request.        |
| `request` | [components.V3WorkflowsCreateWorkflowRequest](https://developers.incidents.cloud.solarwinds.com/go-sdk/docs/models/components/v3workflowscreateworkflowrequest.md) | :heavy\_check\_mark: | The request object to use for the request. |
| `opts`    | \[][operations.Option](https://developers.incidents.cloud.solarwinds.com/go-sdk/docs/models/operations/option.md)                                                  | :heavy\_minus\_sign: | The options for this request.              |

### Response

[**\*operations.WorkflowsCreateWorkflowResponse**](https://developers.incidents.cloud.solarwinds.com/go-sdk/docs/models/operations/workflowscreateworkflowresponse.md)**, error**

### Errors

| Error Type                         | Status Code | Content Type     |
| ---------------------------------- | ----------- | ---------------- |
| apierrors.BadRequestError          | 400         | application/json |
| apierrors.UnauthorizedError        | 401         | application/json |
| apierrors.PaymentRequiredError     | 402         | application/json |
| apierrors.ForbiddenError           | 403         | application/json |
| apierrors.NotFoundError            | 404         | application/json |
| apierrors.ConflictError            | 409         | application/json |
| apierrors.UnprocessableEntityError | 422         | application/json |
| apierrors.InternalServerError      | 500         | application/json |
| apierrors.BadGatewayError          | 502         | application/json |
| apierrors.ServiceUnavailableError  | 503         | application/json |
| apierrors.GatewayTimeoutError      | 504         | application/json |
| apierrors.APIError                 | 4XX, 5XX    | \*/\*            |

## BulkEnableDisable

Bulk enable or disable workflows

### Example Usage

```go
package main

import(
	"context"
	"os"
	squadcastsdk "github.com/solarwinds/squadcast-sdk-go"
	"github.com/solarwinds/squadcast-sdk-go/models/components"
	"log"
)

func main() {
    ctx := context.Background()

    s := squadcastsdk.New(
        squadcastsdk.WithSecurity(os.Getenv("SQUADCASTSDK_REFRESH_TOKEN_AUTH")),
    )

    res, err := s.Workflows.BulkEnableDisable(ctx, components.V3WorkflowsBulkEnableDisableWorkflowsRequest{
        OwnerID: "<id>",
        Enabled: false,
        WorkflowIds: []int{
            124939,
        },
    })
    if err != nil {
        log.Fatal(err)
    }
    if res.Body != nil {
        // handle response
    }
}
```

### Parameters

| Parameter | Type                                                                                                                                                                                       | Required             | Description                                |
| --------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -------------------- | ------------------------------------------ |
| `ctx`     | [context.Context](https://pkg.go.dev/context#Context)                                                                                                                                      | :heavy\_check\_mark: | The context to use for the request.        |
| `request` | [components.V3WorkflowsBulkEnableDisableWorkflowsRequest](https://developers.incidents.cloud.solarwinds.com/go-sdk/docs/models/components/v3workflowsbulkenabledisableworkflowsrequest.md) | :heavy\_check\_mark: | The request object to use for the request. |
| `opts`    | \[][operations.Option](https://developers.incidents.cloud.solarwinds.com/go-sdk/docs/models/operations/option.md)                                                                          | :heavy\_minus\_sign: | The options for this request.              |

### Response

[**\*operations.WorkflowsBulkEnabledisableWorkflowsResponse**](https://developers.incidents.cloud.solarwinds.com/go-sdk/docs/models/operations/workflowsbulkenabledisableworkflowsresponse.md)**, error**

### Errors

| Error Type                         | Status Code | Content Type     |
| ---------------------------------- | ----------- | ---------------- |
| apierrors.BadRequestError          | 400         | application/json |
| apierrors.UnauthorizedError        | 401         | application/json |
| apierrors.PaymentRequiredError     | 402         | application/json |
| apierrors.ForbiddenError           | 403         | application/json |
| apierrors.NotFoundError            | 404         | application/json |
| apierrors.ConflictError            | 409         | application/json |
| apierrors.UnprocessableEntityError | 422         | application/json |
| apierrors.InternalServerError      | 500         | application/json |
| apierrors.BadGatewayError          | 502         | application/json |
| apierrors.ServiceUnavailableError  | 503         | application/json |
| apierrors.GatewayTimeoutError      | 504         | application/json |
| apierrors.APIError                 | 4XX, 5XX    | \*/\*            |

## Delete

Delete a workflow by ID

### Example Usage

```go
package main

import(
	"context"
	"os"
	squadcastsdk "github.com/solarwinds/squadcast-sdk-go"
	"log"
)

func main() {
    ctx := context.Background()

    s := squadcastsdk.New(
        squadcastsdk.WithSecurity(os.Getenv("SQUADCASTSDK_REFRESH_TOKEN_AUTH")),
    )

    res, err := s.Workflows.Delete(ctx, "<id>")
    if err != nil {
        log.Fatal(err)
    }
    if res.Body != nil {
        // handle response
    }
}
```

### Parameters

| Parameter    | Type                                                                                                              | Required             | Description                         |
| ------------ | ----------------------------------------------------------------------------------------------------------------- | -------------------- | ----------------------------------- |
| `ctx`        | [context.Context](https://pkg.go.dev/context#Context)                                                             | :heavy\_check\_mark: | The context to use for the request. |
| `workflowID` | `string`                                                                                                          | :heavy\_check\_mark: | N/A                                 |
| `opts`       | \[][operations.Option](https://developers.incidents.cloud.solarwinds.com/go-sdk/docs/models/operations/option.md) | :heavy\_minus\_sign: | The options for this request.       |

### Response

[**\*operations.WorkflowsDeleteWorkflowResponse**](https://developers.incidents.cloud.solarwinds.com/go-sdk/docs/models/operations/workflowsdeleteworkflowresponse.md)**, error**

### Errors

| Error Type                         | Status Code | Content Type     |
| ---------------------------------- | ----------- | ---------------- |
| apierrors.BadRequestError          | 400         | application/json |
| apierrors.UnauthorizedError        | 401         | application/json |
| apierrors.PaymentRequiredError     | 402         | application/json |
| apierrors.ForbiddenError           | 403         | application/json |
| apierrors.NotFoundError            | 404         | application/json |
| apierrors.ConflictError            | 409         | application/json |
| apierrors.UnprocessableEntityError | 422         | application/json |
| apierrors.InternalServerError      | 500         | application/json |
| apierrors.BadGatewayError          | 502         | application/json |
| apierrors.ServiceUnavailableError  | 503         | application/json |
| apierrors.GatewayTimeoutError      | 504         | application/json |
| apierrors.APIError                 | 4XX, 5XX    | \*/\*            |

## GetByID

Get a workflow by ID

### Example Usage

```go
package main

import(
	"context"
	"os"
	squadcastsdk "github.com/solarwinds/squadcast-sdk-go"
	"log"
)

func main() {
    ctx := context.Background()

    s := squadcastsdk.New(
        squadcastsdk.WithSecurity(os.Getenv("SQUADCASTSDK_REFRESH_TOKEN_AUTH")),
    )

    res, err := s.Workflows.GetByID(ctx, "<id>")
    if err != nil {
        log.Fatal(err)
    }
    if res.V3WorkflowsGetWorkflowByIDResponse != nil {
        // handle response
    }
}
```

### Parameters

| Parameter    | Type                                                                                                              | Required             | Description                         |
| ------------ | ----------------------------------------------------------------------------------------------------------------- | -------------------- | ----------------------------------- |
| `ctx`        | [context.Context](https://pkg.go.dev/context#Context)                                                             | :heavy\_check\_mark: | The context to use for the request. |
| `workflowID` | `string`                                                                                                          | :heavy\_check\_mark: | N/A                                 |
| `opts`       | \[][operations.Option](https://developers.incidents.cloud.solarwinds.com/go-sdk/docs/models/operations/option.md) | :heavy\_minus\_sign: | The options for this request.       |

### Response

[**\*operations.WorkflowsGetWorkflowByIDResponse**](https://developers.incidents.cloud.solarwinds.com/go-sdk/docs/models/operations/workflowsgetworkflowbyidresponse.md)**, error**

### Errors

| Error Type                         | Status Code | Content Type     |
| ---------------------------------- | ----------- | ---------------- |
| apierrors.BadRequestError          | 400         | application/json |
| apierrors.UnauthorizedError        | 401         | application/json |
| apierrors.PaymentRequiredError     | 402         | application/json |
| apierrors.ForbiddenError           | 403         | application/json |
| apierrors.NotFoundError            | 404         | application/json |
| apierrors.ConflictError            | 409         | application/json |
| apierrors.UnprocessableEntityError | 422         | application/json |
| apierrors.InternalServerError      | 500         | application/json |
| apierrors.BadGatewayError          | 502         | application/json |
| apierrors.ServiceUnavailableError  | 503         | application/json |
| apierrors.GatewayTimeoutError      | 504         | application/json |
| apierrors.APIError                 | 4XX, 5XX    | \*/\*            |

## Update

Update a Workflow

### Example Usage

```go
package main

import(
	"context"
	"os"
	squadcastsdk "github.com/solarwinds/squadcast-sdk-go"
	"github.com/solarwinds/squadcast-sdk-go/models/components"
	"log"
)

func main() {
    ctx := context.Background()

    s := squadcastsdk.New(
        squadcastsdk.WithSecurity(os.Getenv("SQUADCASTSDK_REFRESH_TOKEN_AUTH")),
    )

    res, err := s.Workflows.Update(ctx, "<id>", components.V3WorkflowsCreateWorkflowRequestUpdate{})
    if err != nil {
        log.Fatal(err)
    }
    if res.Object != nil {
        // handle response
    }
}
```

### Parameters

| Parameter                                | Type                                                                                                                                                                           | Required             | Description                         |
| ---------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -------------------- | ----------------------------------- |
| `ctx`                                    | [context.Context](https://pkg.go.dev/context#Context)                                                                                                                          | :heavy\_check\_mark: | The context to use for the request. |
| `workflowID`                             | `string`                                                                                                                                                                       | :heavy\_check\_mark: | N/A                                 |
| `v3WorkflowsCreateWorkflowRequestUpdate` | [components.V3WorkflowsCreateWorkflowRequestUpdate](https://developers.incidents.cloud.solarwinds.com/go-sdk/docs/models/components/v3workflowscreateworkflowrequestupdate.md) | :heavy\_check\_mark: | N/A                                 |
| `opts`                                   | \[][operations.Option](https://developers.incidents.cloud.solarwinds.com/go-sdk/docs/models/operations/option.md)                                                              | :heavy\_minus\_sign: | The options for this request.       |

### Response

[**\*operations.WorkflowsUpdateWorkflowResponse**](https://developers.incidents.cloud.solarwinds.com/go-sdk/docs/models/operations/workflowsupdateworkflowresponse.md)**, error**

### Errors

| Error Type                         | Status Code | Content Type     |
| ---------------------------------- | ----------- | ---------------- |
| apierrors.BadRequestError          | 400         | application/json |
| apierrors.UnauthorizedError        | 401         | application/json |
| apierrors.PaymentRequiredError     | 402         | application/json |
| apierrors.ForbiddenError           | 403         | application/json |
| apierrors.NotFoundError            | 404         | application/json |
| apierrors.ConflictError            | 409         | application/json |
| apierrors.UnprocessableEntityError | 422         | application/json |
| apierrors.InternalServerError      | 500         | application/json |
| apierrors.BadGatewayError          | 502         | application/json |
| apierrors.ServiceUnavailableError  | 503         | application/json |
| apierrors.GatewayTimeoutError      | 504         | application/json |
| apierrors.APIError                 | 4XX, 5XX    | \*/\*            |

## UpdateActionsOrder

Update action order in a workflow

### Example Usage

```go
package main

import(
	"context"
	"os"
	squadcastsdk "github.com/solarwinds/squadcast-sdk-go"
	"github.com/solarwinds/squadcast-sdk-go/models/components"
	"log"
)

func main() {
    ctx := context.Background()

    s := squadcastsdk.New(
        squadcastsdk.WithSecurity(os.Getenv("SQUADCASTSDK_REFRESH_TOKEN_AUTH")),
    )

    res, err := s.Workflows.UpdateActionsOrder(ctx, "<id>", components.V3WorkflowsUpdateActionsOrderRequest{})
    if err != nil {
        log.Fatal(err)
    }
    if res.V3WorkflowsUpdateActionsOrderResponse != nil {
        // handle response
    }
}
```

### Parameters

| Parameter                              | Type                                                                                                                                                                       | Required             | Description                         |
| -------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------- | ----------------------------------- |
| `ctx`                                  | [context.Context](https://pkg.go.dev/context#Context)                                                                                                                      | :heavy\_check\_mark: | The context to use for the request. |
| `workflowID`                           | `string`                                                                                                                                                                   | :heavy\_check\_mark: | N/A                                 |
| `v3WorkflowsUpdateActionsOrderRequest` | [components.V3WorkflowsUpdateActionsOrderRequest](https://developers.incidents.cloud.solarwinds.com/go-sdk/docs/models/components/v3workflowsupdateactionsorderrequest.md) | :heavy\_check\_mark: | N/A                                 |
| `opts`                                 | \[][operations.Option](https://developers.incidents.cloud.solarwinds.com/go-sdk/docs/models/operations/option.md)                                                          | :heavy\_minus\_sign: | The options for this request.       |

### Response

[**\*operations.WorkflowsUpdateActionsOrderResponse**](https://developers.incidents.cloud.solarwinds.com/go-sdk/docs/models/operations/workflowsupdateactionsorderresponse.md)**, error**

### Errors

| Error Type                         | Status Code | Content Type     |
| ---------------------------------- | ----------- | ---------------- |
| apierrors.BadRequestError          | 400         | application/json |
| apierrors.UnauthorizedError        | 401         | application/json |
| apierrors.PaymentRequiredError     | 402         | application/json |
| apierrors.ForbiddenError           | 403         | application/json |
| apierrors.NotFoundError            | 404         | application/json |
| apierrors.ConflictError            | 409         | application/json |
| apierrors.UnprocessableEntityError | 422         | application/json |
| apierrors.InternalServerError      | 500         | application/json |
| apierrors.BadGatewayError          | 502         | application/json |
| apierrors.ServiceUnavailableError  | 503         | application/json |
| apierrors.GatewayTimeoutError      | 504         | application/json |
| apierrors.APIError                 | 4XX, 5XX    | \*/\*            |

## DeleteAction

Delete an action by action ID

### Example Usage

```go
package main

import(
	"context"
	"os"
	squadcastsdk "github.com/solarwinds/squadcast-sdk-go"
	"log"
)

func main() {
    ctx := context.Background()

    s := squadcastsdk.New(
        squadcastsdk.WithSecurity(os.Getenv("SQUADCASTSDK_REFRESH_TOKEN_AUTH")),
    )

    res, err := s.Workflows.DeleteAction(ctx, "<id>", "<id>")
    if err != nil {
        log.Fatal(err)
    }
    if res.Body != nil {
        // handle response
    }
}
```

### Parameters

| Parameter    | Type                                                                                                              | Required             | Description                         |
| ------------ | ----------------------------------------------------------------------------------------------------------------- | -------------------- | ----------------------------------- |
| `ctx`        | [context.Context](https://pkg.go.dev/context#Context)                                                             | :heavy\_check\_mark: | The context to use for the request. |
| `workflowID` | `string`                                                                                                          | :heavy\_check\_mark: | N/A                                 |
| `actionID`   | `string`                                                                                                          | :heavy\_check\_mark: | N/A                                 |
| `opts`       | \[][operations.Option](https://developers.incidents.cloud.solarwinds.com/go-sdk/docs/models/operations/option.md) | :heavy\_minus\_sign: | The options for this request.       |

### Response

[**\*operations.WorkflowsDeleteWorkflowActionResponse**](https://developers.incidents.cloud.solarwinds.com/go-sdk/docs/models/operations/workflowsdeleteworkflowactionresponse.md)**, error**

### Errors

| Error Type                         | Status Code | Content Type     |
| ---------------------------------- | ----------- | ---------------- |
| apierrors.BadRequestError          | 400         | application/json |
| apierrors.UnauthorizedError        | 401         | application/json |
| apierrors.PaymentRequiredError     | 402         | application/json |
| apierrors.ForbiddenError           | 403         | application/json |
| apierrors.NotFoundError            | 404         | application/json |
| apierrors.ConflictError            | 409         | application/json |
| apierrors.UnprocessableEntityError | 422         | application/json |
| apierrors.InternalServerError      | 500         | application/json |
| apierrors.BadGatewayError          | 502         | application/json |
| apierrors.ServiceUnavailableError  | 503         | application/json |
| apierrors.GatewayTimeoutError      | 504         | application/json |
| apierrors.APIError                 | 4XX, 5XX    | \*/\*            |

## GetAction

Get workflow action by ID

### Example Usage

```go
package main

import(
	"context"
	"os"
	squadcastsdk "github.com/solarwinds/squadcast-sdk-go"
	"log"
)

func main() {
    ctx := context.Background()

    s := squadcastsdk.New(
        squadcastsdk.WithSecurity(os.Getenv("SQUADCASTSDK_REFRESH_TOKEN_AUTH")),
    )

    res, err := s.Workflows.GetAction(ctx, "<id>", "<id>")
    if err != nil {
        log.Fatal(err)
    }
    if res.Object != nil {
        // handle response
    }
}
```

### Parameters

| Parameter    | Type                                                                                                              | Required             | Description                         |
| ------------ | ----------------------------------------------------------------------------------------------------------------- | -------------------- | ----------------------------------- |
| `ctx`        | [context.Context](https://pkg.go.dev/context#Context)                                                             | :heavy\_check\_mark: | The context to use for the request. |
| `workflowID` | `string`                                                                                                          | :heavy\_check\_mark: | N/A                                 |
| `actionID`   | `string`                                                                                                          | :heavy\_check\_mark: | N/A                                 |
| `opts`       | \[][operations.Option](https://developers.incidents.cloud.solarwinds.com/go-sdk/docs/models/operations/option.md) | :heavy\_minus\_sign: | The options for this request.       |

### Response

[**\*operations.WorkflowsGetWorkflowActionByIDResponse**](https://developers.incidents.cloud.solarwinds.com/go-sdk/docs/models/operations/workflowsgetworkflowactionbyidresponse.md)**, error**

### Errors

| Error Type                         | Status Code | Content Type     |
| ---------------------------------- | ----------- | ---------------- |
| apierrors.BadRequestError          | 400         | application/json |
| apierrors.UnauthorizedError        | 401         | application/json |
| apierrors.PaymentRequiredError     | 402         | application/json |
| apierrors.ForbiddenError           | 403         | application/json |
| apierrors.NotFoundError            | 404         | application/json |
| apierrors.ConflictError            | 409         | application/json |
| apierrors.UnprocessableEntityError | 422         | application/json |
| apierrors.InternalServerError      | 500         | application/json |
| apierrors.BadGatewayError          | 502         | application/json |
| apierrors.ServiceUnavailableError  | 503         | application/json |
| apierrors.GatewayTimeoutError      | 504         | application/json |
| apierrors.APIError                 | 4XX, 5XX    | \*/\*            |

## UpdateAction

Update an action by action ID

### Example Usage

```go
package main

import(
	"context"
	"os"
	squadcastsdk "github.com/solarwinds/squadcast-sdk-go"
	"github.com/solarwinds/squadcast-sdk-go/models/components"
	"log"
	"github.com/solarwinds/squadcast-sdk-go/models/operations"
)

func main() {
    ctx := context.Background()

    s := squadcastsdk.New(
        squadcastsdk.WithSecurity(os.Getenv("SQUADCASTSDK_REFRESH_TOKEN_AUTH")),
    )

    res, err := s.Workflows.UpdateAction(ctx, "<id>", "<id>", components.CreateV3WorkflowsActionRequestUpdateAny(
        map[string]any{
            "name": "slack_message_channel",
        },
    ))
    if err != nil {
        log.Fatal(err)
    }
    if res.OneOf != nil {
        switch res.OneOf.Type {
            case operations.WorkflowsUpdateWorkflowActionResponseBodyTypeSqAttachRunbooks:
                // res.OneOf.SqAttachRunbooks is populated
            case operations.WorkflowsUpdateWorkflowActionResponseBodyTypeV3WorkflowsSqMarkIncidentSLOAffecting:
                // res.OneOf.V3WorkflowsSqMarkIncidentSLOAffecting is populated
            case operations.WorkflowsUpdateWorkflowActionResponseBodyTypeV3WorkflowsSqTriggerManualWebhook:
                // res.OneOf.V3WorkflowsSqTriggerManualWebhook is populated
            case operations.WorkflowsUpdateWorkflowActionResponseBodyTypeV3WorkflowsUpdateIncidentPriority:
                // res.OneOf.V3WorkflowsUpdateIncidentPriority is populated
            case operations.WorkflowsUpdateWorkflowActionResponseBodyTypeV3WorkflowsSqCreateStatusPageIssue:
                // res.OneOf.V3WorkflowsSqCreateStatusPageIssue is populated
            case operations.WorkflowsUpdateWorkflowActionResponseBodyTypeV3WorkflowsSqAddIncidentNote:
                // res.OneOf.V3WorkflowsSqAddIncidentNote is populated
            case operations.WorkflowsUpdateWorkflowActionResponseBodyTypeV3WorkflowsSlackArchiveChannel:
                // res.OneOf.V3WorkflowsSlackArchiveChannel is populated
            case operations.WorkflowsUpdateWorkflowActionResponseBodyTypeV3WorkflowsSqAddCommunicationChannel:
                // res.OneOf.V3WorkflowsSqAddCommunicationChannel is populated
            case operations.WorkflowsUpdateWorkflowActionResponseBodyTypeV3WorkflowsSlackMessageChannel:
                // res.OneOf.V3WorkflowsSlackMessageChannel is populated
            case operations.WorkflowsUpdateWorkflowActionResponseBodyTypeV3WorkflowsSlackMessageUser:
                // res.OneOf.V3WorkflowsSlackMessageUser is populated
            case operations.WorkflowsUpdateWorkflowActionResponseBodyTypeV3WorkflowsSqMakeHTTPCall:
                // res.OneOf.V3WorkflowsSqMakeHTTPCall is populated
            case operations.WorkflowsUpdateWorkflowActionResponseBodyTypeV3WorkflowsSlackCreateIncidentChannel:
                // res.OneOf.V3WorkflowsSlackCreateIncidentChannel is populated
            case operations.WorkflowsUpdateWorkflowActionResponseBodyTypeV3WorkflowsJiraCreateTicket:
                // res.OneOf.V3WorkflowsJiraCreateTicket is populated
            case operations.WorkflowsUpdateWorkflowActionResponseBodyTypeV3WorkflowsMsTeamsMessageChannel:
                // res.OneOf.V3WorkflowsMsTeamsMessageChannel is populated
            case operations.WorkflowsUpdateWorkflowActionResponseBodyTypeV3WorkflowsMsTeamsMessageUser:
                // res.OneOf.V3WorkflowsMsTeamsMessageUser is populated
            case operations.WorkflowsUpdateWorkflowActionResponseBodyTypeV3WorkflowsSqSendEmail:
                // res.OneOf.V3WorkflowsSqSendEmail is populated
            case operations.WorkflowsUpdateWorkflowActionResponseBodyTypeV3WorkflowsMsTeamsCreateMeetingLink:
                // res.OneOf.V3WorkflowsMsTeamsCreateMeetingLink is populated
            case operations.WorkflowsUpdateWorkflowActionResponseBodyTypeAny:
                // res.OneOf.Any is populated
        }

    }
}
```

### Parameters

| Parameter                        | Type                                                                                                                                                           | Required             | Description                         |
| -------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------- | ----------------------------------- |
| `ctx`                            | [context.Context](https://pkg.go.dev/context#Context)                                                                                                          | :heavy\_check\_mark: | The context to use for the request. |
| `workflowID`                     | `string`                                                                                                                                                       | :heavy\_check\_mark: | N/A                                 |
| `actionID`                       | `string`                                                                                                                                                       | :heavy\_check\_mark: | N/A                                 |
| `v3WorkflowsActionRequestUpdate` | [components.V3WorkflowsActionRequestUpdate](https://developers.incidents.cloud.solarwinds.com/go-sdk/docs/models/components/v3workflowsactionrequestupdate.md) | :heavy\_check\_mark: | N/A                                 |
| `opts`                           | \[][operations.Option](https://developers.incidents.cloud.solarwinds.com/go-sdk/docs/models/operations/option.md)                                              | :heavy\_minus\_sign: | The options for this request.       |

### Response

[**\*operations.WorkflowsUpdateWorkflowActionResponse**](https://developers.incidents.cloud.solarwinds.com/go-sdk/docs/models/operations/workflowsupdateworkflowactionresponse.md)**, error**

### Errors

| Error Type                         | Status Code | Content Type     |
| ---------------------------------- | ----------- | ---------------- |
| apierrors.BadRequestError          | 400         | application/json |
| apierrors.UnauthorizedError        | 401         | application/json |
| apierrors.PaymentRequiredError     | 402         | application/json |
| apierrors.ForbiddenError           | 403         | application/json |
| apierrors.NotFoundError            | 404         | application/json |
| apierrors.ConflictError            | 409         | application/json |
| apierrors.UnprocessableEntityError | 422         | application/json |
| apierrors.InternalServerError      | 500         | application/json |
| apierrors.BadGatewayError          | 502         | application/json |
| apierrors.ServiceUnavailableError  | 503         | application/json |
| apierrors.GatewayTimeoutError      | 504         | application/json |
| apierrors.APIError                 | 4XX, 5XX    | \*/\*            |

## ToggleEnable

Enable or disable workflow by ID

### Example Usage

```go
package main

import(
	"context"
	"os"
	squadcastsdk "github.com/solarwinds/squadcast-sdk-go"
	"github.com/solarwinds/squadcast-sdk-go/models/components"
	"log"
)

func main() {
    ctx := context.Background()

    s := squadcastsdk.New(
        squadcastsdk.WithSecurity(os.Getenv("SQUADCASTSDK_REFRESH_TOKEN_AUTH")),
    )

    res, err := s.Workflows.ToggleEnable(ctx, "<id>", components.V3WorkflowsEnableDisableWorkflowRequest{})
    if err != nil {
        log.Fatal(err)
    }
    if res.Body != nil {
        // handle response
    }
}
```

### Parameters

| Parameter                                 | Type                                                                                                                                                                             | Required             | Description                         |
| ----------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------- | ----------------------------------- |
| `ctx`                                     | [context.Context](https://pkg.go.dev/context#Context)                                                                                                                            | :heavy\_check\_mark: | The context to use for the request. |
| `workflowID`                              | `string`                                                                                                                                                                         | :heavy\_check\_mark: | N/A                                 |
| `v3WorkflowsEnableDisableWorkflowRequest` | [components.V3WorkflowsEnableDisableWorkflowRequest](https://developers.incidents.cloud.solarwinds.com/go-sdk/docs/models/components/v3workflowsenabledisableworkflowrequest.md) | :heavy\_check\_mark: | N/A                                 |
| `opts`                                    | \[][operations.Option](https://developers.incidents.cloud.solarwinds.com/go-sdk/docs/models/operations/option.md)                                                                | :heavy\_minus\_sign: | The options for this request.       |

### Response

[**\*operations.WorkflowsEnabledisableWorkflowResponse**](https://developers.incidents.cloud.solarwinds.com/go-sdk/docs/models/operations/workflowsenabledisableworkflowresponse.md)**, error**

### Errors

| Error Type                         | Status Code | Content Type     |
| ---------------------------------- | ----------- | ---------------- |
| apierrors.BadRequestError          | 400         | application/json |
| apierrors.UnauthorizedError        | 401         | application/json |
| apierrors.PaymentRequiredError     | 402         | application/json |
| apierrors.ForbiddenError           | 403         | application/json |
| apierrors.NotFoundError            | 404         | application/json |
| apierrors.ConflictError            | 409         | application/json |
| apierrors.UnprocessableEntityError | 422         | application/json |
| apierrors.InternalServerError      | 500         | application/json |
| apierrors.BadGatewayError          | 502         | application/json |
| apierrors.ServiceUnavailableError  | 503         | application/json |
| apierrors.GatewayTimeoutError      | 504         | application/json |
| apierrors.APIError                 | 4XX, 5XX    | \*/\*            |

## GetLogs

Get workflow logs

### Example Usage

```go
package main

import(
	"context"
	"os"
	squadcastsdk "github.com/solarwinds/squadcast-sdk-go"
	"log"
)

func main() {
    ctx := context.Background()

    s := squadcastsdk.New(
        squadcastsdk.WithSecurity(os.Getenv("SQUADCASTSDK_REFRESH_TOKEN_AUTH")),
    )

    res, err := s.Workflows.GetLogs(ctx, "<id>", nil, nil)
    if err != nil {
        log.Fatal(err)
    }
    if res.V3WorkflowsGetWorkflowLogsResponse != nil {
        for {
            // handle items

            res, err = res.Next()

            if err != nil {
                // handle error
            }

            if res == nil {
                break
            }
        }
    }
}
```

### Parameters

| Parameter    | Type                                                                                                              | Required             | Description                         |
| ------------ | ----------------------------------------------------------------------------------------------------------------- | -------------------- | ----------------------------------- |
| `ctx`        | [context.Context](https://pkg.go.dev/context#Context)                                                             | :heavy\_check\_mark: | The context to use for the request. |
| `workflowID` | `string`                                                                                                          | :heavy\_check\_mark: | N/A                                 |
| `pageSize`   | `*int64`                                                                                                          | :heavy\_minus\_sign: | N/A                                 |
| `pageNumber` | `*int64`                                                                                                          | :heavy\_minus\_sign: | N/A                                 |
| `opts`       | \[][operations.Option](https://developers.incidents.cloud.solarwinds.com/go-sdk/docs/models/operations/option.md) | :heavy\_minus\_sign: | The options for this request.       |

### Response

[**\*operations.WorkflowsGetWorkflowLogsResponse**](https://developers.incidents.cloud.solarwinds.com/go-sdk/docs/models/operations/workflowsgetworkflowlogsresponse.md)**, error**

### Errors

| Error Type                         | Status Code | Content Type     |
| ---------------------------------- | ----------- | ---------------- |
| apierrors.BadRequestError          | 400         | application/json |
| apierrors.UnauthorizedError        | 401         | application/json |
| apierrors.PaymentRequiredError     | 402         | application/json |
| apierrors.ForbiddenError           | 403         | application/json |
| apierrors.NotFoundError            | 404         | application/json |
| apierrors.ConflictError            | 409         | application/json |
| apierrors.UnprocessableEntityError | 422         | application/json |
| apierrors.InternalServerError      | 500         | application/json |
| apierrors.BadGatewayError          | 502         | application/json |
| apierrors.ServiceUnavailableError  | 503         | application/json |
| apierrors.GatewayTimeoutError      | 504         | application/json |
| apierrors.APIError                 | 4XX, 5XX    | \*/\*            |
