# Squads

## Overview

### Available Operations

* [List](#list) - Get All Squads
* [RemoveMember](#removemember) - Remove Squad Member
* [UpdateMemberRole](#updatememberrole) - Update Squad Member
* [UpdateName](#updatename) - Update Squad Name
* [Delete](#delete) - Delete Squad

## List

This endpoint is used to get all the squads details of your organization. Requires `access_token` as a `Bearer {{token}}` in the `Authorization` header with `squad-read` scope.

### 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.Squads.List(ctx, "<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. |
| `ownerID` | `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.SquadsGetAllSquadsResponse**](/go-sdk/docs/models/operations/squadsgetallsquadsresponse.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                          | \*/\*            |

## RemoveMember

This endpoint is used to update squad member's role.

If you're attempting to remove a member whose role is 'owner', and that 'owner' is the last squad owner, then the 'replaceWith' query parameter is required. Setting 'replaceWith' to 'member' will promote another member as the owner, and the specified member will be removed.

Requires `access_token` as a `Bearer {{token}}` in the `Authorization` header with `squad-create` scope.

### 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.Squads.RemoveMember(ctx, "<id>", "<id>", "<value>")
    if err != nil {
        log.Fatal(err)
    }
    if res.V4SquadsRemoveSquadMemberResponse != 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. |
| `squadID`     | `string`                                                         | :heavy\_check\_mark: | N/A                                 |
| `memberID`    | `string`                                                         | :heavy\_check\_mark: | N/A                                 |
| `replaceWith` | `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.SquadsRemoveSquadMemberResponse**](/go-sdk/docs/models/operations/squadsremovesquadmemberresponse.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                          | \*/\*            |

## UpdateMemberRole

This endpoint is used to update a squad member's role and is only accessible if your organization is using the OBAC permission model.

If you're attempting to update a member's role from 'owner' to 'member', and that 'owner' is the last squad owner, then the 'replaceWith' query parameter is required. Setting 'replaceWith' to 'member' will promote the member to the role of owner.

Requires `access_token` as a `Bearer {{token}}` in the `Authorization` header with `squad-create` scope.

### 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.Squads.UpdateMemberRole(ctx, "<id>", "<id>", "<value>", components.V4SquadsUpdateSquadMemberRequest{
        Role: "<value>",
    })
    if err != nil {
        log.Fatal(err)
    }
    if res.V4SquadsUpdateSquadMemberResponse != 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. |
| `squadID`                          | `string`                                                                                                          | :heavy\_check\_mark: | N/A                                 |
| `memberID`                         | `string`                                                                                                          | :heavy\_check\_mark: | N/A                                 |
| `replaceWith`                      | `string`                                                                                                          | :heavy\_check\_mark: | N/A                                 |
| `v4SquadsUpdateSquadMemberRequest` | [components.V4SquadsUpdateSquadMemberRequest](/go-sdk/docs/models/components/v4squadsupdatesquadmemberrequest.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.SquadsUpdateSquadMemberResponse**](/go-sdk/docs/models/operations/squadsupdatesquadmemberresponse.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                          | \*/\*            |

## UpdateName

This endpoint is used to update squad's name. Requires `access_token` as a `Bearer {{token}}` in the `Authorization` header with `squad-create` scope.

### 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.Squads.UpdateName(ctx, "<id>", components.V4SquadsUpdateSquadNameRequest{
        Name: "<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. |
| `squadID`                        | `string`                                                                                                      | :heavy\_check\_mark: | N/A                                 |
| `v4SquadsUpdateSquadNameRequest` | [components.V4SquadsUpdateSquadNameRequest](/go-sdk/docs/models/components/v4squadsupdatesquadnamerequest.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.SquadsUpdateSquadNameResponse**](/go-sdk/docs/models/operations/squadsupdatesquadnameresponse.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                          | \*/\*            |

## Delete

This endpoint is used to delete the squad. Squad should not be assigned to any incident or part of any escalation policy. Requires `access_token` as a `Bearer {{token}}` in the `Authorization` header with `squad-update` scope.

### 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.Squads.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. |
| `squadID` | `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.SquadsDeleteSquadResponse**](/go-sdk/docs/models/operations/squadsdeletesquadresponse.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/squads.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.
