# Rotations

## Overview

### Available Operations

* [Create](#create) - Create Rotation
* [GetByID](#getbyid) - Get Schedule Rotation by ID
* [Update](#update) - Update Rotation
* [GetParticipants](#getparticipants) - Get Rotation Participants
* [UpdateParticipants](#updateparticipants) - Update Rotation Participants

## Create

Create Rotation

### 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.Rotations.Create(ctx, "<id>", components.V4CreateRotationRequest{
        Name: "<value>",
        StartDate: "<value>",
        Period: "<value>",
        ChangeParticipantsFrequency: 62013,
        ChangeParticipantsUnit: "<value>",
        ParticipantGroups: []components.V4ParticipantGroup{},
    })
    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. |
| `scheduleID`              | `string`                                                                                        | :heavy\_check\_mark: | N/A                                 |
| `v4CreateRotationRequest` | [components.V4CreateRotationRequest](/go-sdk/docs/models/components/v4createrotationrequest.md) | :heavy\_check\_mark: | N/A                                 |
| `opts`                    | \[][operations.Option](/go-sdk/docs/models/operations/option.md)                                | :heavy\_minus\_sign: | The options for this request.       |

### Response

[**\*operations.RotationsCreateRotationResponse**](/go-sdk/docs/models/operations/rotationscreaterotationresponse.md)**, error**

### Errors

| Error Type              | Status Code                       | Content Type     |
| ----------------------- | --------------------------------- | ---------------- |
| apierrors.CommonV4Error | 400, 401, 402, 403, 404, 409, 422 | application/json |
| apierrors.CommonV4Error | 500, 502, 503, 504                | application/json |
| apierrors.APIError      | 4XX, 5XX                          | \*/\*            |

## GetByID

Get Schedule Rotation 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.Rotations.GetByID(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. |
| `scheduleID` | `string`                                                         | :heavy\_check\_mark: | N/A                                 |
| `rotationID` | `string`                                                         | :heavy\_check\_mark: | N/A                                 |
| `opts`       | \[][operations.Option](/go-sdk/docs/models/operations/option.md) | :heavy\_minus\_sign: | The options for this request.       |

### Response

[**\*operations.RotationsGetScheduleRotationByIDResponse**](/go-sdk/docs/models/operations/rotationsgetschedulerotationbyidresponse.md)**, error**

### Errors

| Error Type              | Status Code                       | Content Type     |
| ----------------------- | --------------------------------- | ---------------- |
| apierrors.CommonV4Error | 400, 401, 402, 403, 404, 409, 422 | application/json |
| apierrors.CommonV4Error | 500, 502, 503, 504                | application/json |
| apierrors.APIError      | 4XX, 5XX                          | \*/\*            |

## Update

Update Rotation

### 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.Rotations.Update(ctx, "<id>", "<id>", components.V4UpdateRotationRequest{
        Name: "<value>",
        StartDate: "<value>",
        Period: "<value>",
        ChangeParticipantsFrequency: 183098,
        ChangeParticipantsUnit: "<value>",
    })
    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. |
| `scheduleID`              | `string`                                                                                        | :heavy\_check\_mark: | N/A                                 |
| `rotationID`              | `string`                                                                                        | :heavy\_check\_mark: | N/A                                 |
| `v4UpdateRotationRequest` | [components.V4UpdateRotationRequest](/go-sdk/docs/models/components/v4updaterotationrequest.md) | :heavy\_check\_mark: | N/A                                 |
| `opts`                    | \[][operations.Option](/go-sdk/docs/models/operations/option.md)                                | :heavy\_minus\_sign: | The options for this request.       |

### Response

[**\*operations.RotationsUpdateRotationResponse**](/go-sdk/docs/models/operations/rotationsupdaterotationresponse.md)**, error**

### Errors

| Error Type              | Status Code                       | Content Type     |
| ----------------------- | --------------------------------- | ---------------- |
| apierrors.CommonV4Error | 400, 401, 402, 403, 404, 409, 422 | application/json |
| apierrors.CommonV4Error | 500, 502, 503, 504                | application/json |
| apierrors.APIError      | 4XX, 5XX                          | \*/\*            |

## GetParticipants

Get Rotation Participants

### 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.Rotations.GetParticipants(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. |
| `scheduleID` | `string`                                                         | :heavy\_check\_mark: | N/A                                 |
| `rotationID` | `string`                                                         | :heavy\_check\_mark: | N/A                                 |
| `opts`       | \[][operations.Option](/go-sdk/docs/models/operations/option.md) | :heavy\_minus\_sign: | The options for this request.       |

### Response

[**\*operations.RotationsGetRotationParticipantsResponse**](/go-sdk/docs/models/operations/rotationsgetrotationparticipantsresponse.md)**, error**

### Errors

| Error Type              | Status Code                       | Content Type     |
| ----------------------- | --------------------------------- | ---------------- |
| apierrors.CommonV4Error | 400, 401, 402, 403, 404, 409, 422 | application/json |
| apierrors.CommonV4Error | 500, 502, 503, 504                | application/json |
| apierrors.APIError      | 4XX, 5XX                          | \*/\*            |

## UpdateParticipants

Update Rotation Participants

### 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.Rotations.UpdateParticipants(ctx, "<id>", "<id>", components.V4UpdateRotationParticipantsRequest{
        ParticipantGroups: []components.V4ParticipantGroup{},
    })
    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. |
| `scheduleID`                          | `string`                                                                                                                | :heavy\_check\_mark: | N/A                                 |
| `rotationID`                          | `string`                                                                                                                | :heavy\_check\_mark: | N/A                                 |
| `v4UpdateRotationParticipantsRequest` | [components.V4UpdateRotationParticipantsRequest](/go-sdk/docs/models/components/v4updaterotationparticipantsrequest.md) | :heavy\_check\_mark: | N/A                                 |
| `opts`                                | \[][operations.Option](/go-sdk/docs/models/operations/option.md)                                                        | :heavy\_minus\_sign: | The options for this request.       |

### Response

[**\*operations.RotationsUpdateRotationParticipantsResponse**](/go-sdk/docs/models/operations/rotationsupdaterotationparticipantsresponse.md)**, error**

### Errors

| Error Type              | Status Code                       | Content Type     |
| ----------------------- | --------------------------------- | ---------------- |
| apierrors.CommonV4Error | 400, 401, 402, 403, 404, 409, 422 | application/json |
| apierrors.CommonV4Error | 500, 502, 503, 504                | application/json |
| apierrors.APIError      | 4XX, 5XX                          | \*/\*            |


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://developers.incidents.cloud.solarwinds.com/go-sdk/docs/sdks/rotations.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
