> 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/squadsv4.md).

# Squads.V4

## Overview

### Available Operations

* [Create](#create) - Create Squad
* [GetByID](#getbyid) - Get Squad By ID

## Create

This endpoint is used to create a new squad. The role will be considered only if your organization is on the OBAC permission model; otherwise, the role field will be ignored, and only the member will be added to the squad.

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.V4.Create(ctx, components.V4SquadsCreateSquadRequest{
        OwnerID: "<id>",
        Name: "<value>",
        Members: []components.V4SquadsSquadMember{},
    })
    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.V4SquadsCreateSquadRequest](https://developers.incidents.cloud.solarwinds.com/go-sdk/docs/models/components/v4squadscreatesquadrequest.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.SquadsCreateSquadResponse**](https://developers.incidents.cloud.solarwinds.com/go-sdk/docs/models/operations/squadscreatesquadresponse.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

This endpoint is used to get the squads details by id. 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.V4.GetByID(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. |
| `squadID` | `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.SquadsGetSquadByIDResponse**](https://developers.incidents.cloud.solarwinds.com/go-sdk/docs/models/operations/squadsgetsquadbyidresponse.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                          | \*/\*            |
