# README

## Incident Response SDK for Go

Developer-friendly & type-safe Go SDK specifically catered to leverage *Incident Response* API.

[![Built by Speakeasy](https://img.shields.io/badge/Built_by-SPEAKEASY-374151?style=for-the-badge\&labelColor=f3f4f6)](https://www.speakeasy.com/?utm_source=squadcast-sdk\&utm_campaign=go) [![License: MIT](https://img.shields.io/badge/LICENSE_//_MIT-3b5bdb?style=for-the-badge\&labelColor=eff6ff)](https://opensource.org/licenses/MIT)

### Summary

The Squadcast API provides developers the capability to extend and utilize Squadcast in conjunction with other services. Our API has resource-oriented URLs, accepts JSON-encoded request bodies, returns JSON-encoded responses, and uses standard HTTP response codes, authentication, and verbs.

> **Note:** Customers using the V2 version of the Squadcast API would need to migrate to Squadcast API V3, as the former would be deprecated shortly.

#### Service Regions

Squadcast allows customers to choose the geographic region of the Squadcast data centers that host their account. When signing up, you can choose the service region. Currently, the available options are the United States (US) and Europe (EU).

| Service Region | API Endpoints                                                                                |
| -------------- | -------------------------------------------------------------------------------------------- |
| US             | Authentication: <https://auth.squadcast.com> · Other APIs: <https://api.squadcast.com>       |
| EU             | Authentication: <https://auth.eu.squadcast.com> · Other APIs: <https://api.eu.squadcast.com> |

#### Authentication

In order to access the API programmatically, HTTP bearer authentication needs to be used. HTTP bearer authentication must be constructed using an `access_token`, passed as the `Authorization` header for each request, for example `Authorization: Bearer eyJleHAiOjE2MzU1OTE1OTIsImp0aSI6Im`.

Steps to procure the `access_token`:

1. Generate a `refresh_token` (API Token) from the Squadcast web app. More details on how to get the `refresh_token` can be found in the Squadcast support documentation.
2. Call the authentication API with the `refresh_token` to obtain an `access_token`.
3. Use the `access_token` as a Bearer token in the `Authorization` header for all subsequent API requests.

**Example — Generating an Access Token**

```bash
curl --location --request GET 'https://auth.squadcast.com/oauth/access-token' \
--header 'X-Refresh-Token: 0d2a1a9a454dxxxxxxxxxxxx'
```

The API response will look similar to:

```json
{
  "data": {
    "access_token": "eyJhbGciOiJIUxxxxx.xxxxxxxxxxxxxxx.xxxxxxxxxxxxxxx",
    "expires_at": 1587412870,
    "issued_at": 1587240070,
    "refresh_token": "0d2a1a9a454dxxxxxxxxxxxx",
    "type": "bearer"
  }
}
```

#### Access Control

There are three different types of user roles in Squadcast: `account_owner`, `stakeholder`, and `user`. Refresh tokens upon creation are mapped with one of the mentioned user roles, and access to different resources is dependent on the permissions granted to these roles. For more information, please refer to the Squadcast support documentation.

#### Authorization

The access token authorizes users the ability to access different APIs, based on the user roles described above. Pass the access token as a Bearer token in the `Authorization` header of every request.

### Table of Contents

* [Incident Response SDK for Go](#incident-response-sdk-for-go)
  * [SDK Installation](#sdk-installation)
  * [SDK Example Usage](#sdk-example-usage)
  * [Authentication](#authentication)
  * [Available Resources and Operations](#available-resources-and-operations)
  * [Pagination](#pagination)
  * [Retries](#retries)
  * [Error Handling](#error-handling)
  * [Server Selection](#server-selection)
  * [Custom HTTP Client](#custom-http-client)
  * [Special Types](#special-types)
* [Development](#development)
  * [Maturity](#maturity)
  * [Contributions](#contributions)

### SDK Installation

To add the SDK as a dependency to your project:

```bash
go get github.com/solarwinds/squadcast-sdk-go
```

### SDK Example Usage

#### Example

```go
package main

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

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

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

	res, err := s.Analytics.GetOrganization(ctx, "<value>", "<value>", nil, nil)
	if err != nil {
		log.Fatal(err)
	}
	if res.Object != nil {
		// handle response
	}
}

```

### Authentication

#### Per-Client Security Schemes

This SDK supports the following security scheme globally:

| Name               | Type | Scheme      | Environment Variable              |
| ------------------ | ---- | ----------- | --------------------------------- |
| `RefreshTokenAuth` | http | Custom HTTP | `SQUADCASTSDK_REFRESH_TOKEN_AUTH` |

You can configure it using the `WithSecurity` option when initializing the SDK client instance. For example:

```go
package main

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

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

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

	res, err := s.Analytics.GetOrganization(ctx, "<value>", "<value>", nil, nil)
	if err != nil {
		log.Fatal(err)
	}
	if res.Object != nil {
		// handle response
	}
}

```

### Available Resources and Operations

<details open>

<summary>Available methods</summary>

#### [Analytics](/go-sdk/docs/sdks/analytics.md)

* [GetOrganization](/go-sdk/docs/sdks/analytics.md#getorganization) - Get Org level analytics
* [GetTeam](/go-sdk/docs/sdks/analytics.md#getteam) - Get Team level analytics

#### [ApiTokens](/go-sdk/docs/sdks/apitokens.md)

* [List](/go-sdk/docs/sdks/apitokens.md#list) - Get All Tokens

#### [AuditLogs](/go-sdk/docs/sdks/auditlogs.md)

* [List](/go-sdk/docs/sdks/auditlogs.md#list) - List all Audit Logs
* [Export](/go-sdk/docs/sdks/auditlogs.md#export) - Initiate an asynchronous export of audit logs based on the provided filters. The export file will be generated and available for download. Use 'Get details of Audit Logs export history by ID' API to retrieve the download URL.
* [ListExportHistory](/go-sdk/docs/sdks/auditlogs.md#listexporthistory) - List all Audit Logs export history
* [GetExportHistoryByID](/go-sdk/docs/sdks/auditlogs.md#getexporthistorybyid) - Get details of Audit Logs export history by ID
* [GetByID](/go-sdk/docs/sdks/auditlogs.md#getbyid) - Get audit log by ID

#### [CommunicationCards](/go-sdk/docs/sdks/communicationcards.md)

* [CreateSlackChannel](/go-sdk/docs/sdks/communicationcards.md#createslackchannel) - Create Slack Channel in Communication Card
* [ArchiveSlackChannel](/go-sdk/docs/sdks/communicationcards.md#archiveslackchannel) - Archive Slack Channel

#### [EscalationPolicies](/go-sdk/docs/sdks/escalationpolicies.md)

* [GetByTeam](/go-sdk/docs/sdks/escalationpolicies.md#getbyteam) - Get Escalation Policy By team
* [Create](/go-sdk/docs/sdks/escalationpolicies.md#create) - Create Escalation Policies
* [Remove](/go-sdk/docs/sdks/escalationpolicies.md#remove) - Remove Escalation Policy
* [GetByID](/go-sdk/docs/sdks/escalationpolicies.md#getbyid) - Get Escalation Policy By ID
* [Update](/go-sdk/docs/sdks/escalationpolicies.md#update) - Update Escalation Policy

#### [Exports](/go-sdk/docs/sdks/exports.md)

* [GetDetails](/go-sdk/docs/sdks/exports.md#getdetails) - Get Export Details

#### [Extensions.Msteams](/go-sdk/docs/sdks/extensionsmsteams.md)

* [UpsertConfig](/go-sdk/docs/sdks/extensionsmsteams.md#upsertconfig) - Create Or Update MSTeams Configuration

#### [Extensions.Webhooks](/go-sdk/docs/sdks/extensionswebhooks.md)

* [Delete](/go-sdk/docs/sdks/extensionswebhooks.md#delete) - Delete Webhook
* [GetByID](/go-sdk/docs/sdks/extensionswebhooks.md#getbyid) - Get Webhook By ID

#### [GlobalEventRules](/go-sdk/docs/sdks/globaleventrules.md)

* [List](/go-sdk/docs/sdks/globaleventrules.md#list) - List Global Event Rules
* [Create](/go-sdk/docs/sdks/globaleventrules.md#create) - Create Global Event Rule
* [DeleteRule](/go-sdk/docs/sdks/globaleventrules.md#deleterule) - Delete Global Event Rule by ID
* [GetByID](/go-sdk/docs/sdks/globaleventrules.md#getbyid) - Get Global Event Rule by ID
* [UpdateByID](/go-sdk/docs/sdks/globaleventrules.md#updatebyid) - Update Global Event Rule by ID
* [GetRuleset](/go-sdk/docs/sdks/globaleventrules.md#getruleset) - Get Ruleset
* [UpdateRuleset](/go-sdk/docs/sdks/globaleventrules.md#updateruleset) - Update Ruleset
* [UpdateRule](/go-sdk/docs/sdks/globaleventrules.md#updaterule) - Update Rule by ID

[**GlobalEventRules.Rules**](/go-sdk/docs/sdks/rules.md)

* [ReorderByIndex](/go-sdk/docs/sdks/rules.md#reorderbyindex) - Reorder Ruleset By Index

[**GlobalEventRules.Rulesets**](/go-sdk/docs/sdks/rulesets.md)

* [Create](/go-sdk/docs/sdks/rulesets.md#create) - Create Ruleset
* [Reorder](/go-sdk/docs/sdks/rulesets.md#reorder) - Reorder Ruleset
* [ListRulesetRules](/go-sdk/docs/sdks/rulesets.md#listrulesetrules) - List Ruleset Rules

[**GlobalEventRules.Rulesets.Rules**](/go-sdk/docs/sdks/rulesetsrules.md)

* [Create](/go-sdk/docs/sdks/rulesetsrules.md#create) - Create Rule
* [GetByID](/go-sdk/docs/sdks/rulesetsrules.md#getbyid) - Get Rule by ID

#### [GlobalEventRulesRulesets](/go-sdk/docs/sdks/globaleventrulesrulesets.md)

* [Delete](/go-sdk/docs/sdks/globaleventrulesrulesets.md#delete) - Delete GER Ruleset

#### [GlobalEventRulesRulesetsRules](/go-sdk/docs/sdks/globaleventrulesrulesetsrules.md)

* [DeleteByID](/go-sdk/docs/sdks/globaleventrulesrulesetsrules.md#deletebyid) - Delete Rule by ID

#### [GlobalOncallReminderRules](/go-sdk/docs/sdks/globaloncallreminderrules.md)

* [Delete](/go-sdk/docs/sdks/globaloncallreminderrules.md#delete) - Delete Global Oncall Reminder Rules
* [List](/go-sdk/docs/sdks/globaloncallreminderrules.md#list) - Get Global Oncall Reminder Rules
* [Create](/go-sdk/docs/sdks/globaloncallreminderrules.md#create) - Create Global Oncall Reminder Rules
* [Update](/go-sdk/docs/sdks/globaloncallreminderrules.md#update) - Update Global Oncall Reminder Rules

#### [IncidentActions.Circleci](/go-sdk/docs/sdks/circleci.md)

* [Rebuild](/go-sdk/docs/sdks/circleci.md#rebuild) - Rebuild a Project In CircleCI

#### [Incidents](/go-sdk/docs/sdks/incidents.md)

* [BulkAcknowledge](/go-sdk/docs/sdks/incidents.md#bulkacknowledge) - Bulk Acknowledge Incidents
* [Export](/go-sdk/docs/sdks/incidents.md#export) - Incident Export
* [ExportAsync](/go-sdk/docs/sdks/incidents.md#exportasync) - Incident Export Async
* [BulkUpdatePriority](/go-sdk/docs/sdks/incidents.md#bulkupdatepriority) - Bulk Incidents Priority Update
* [BulkResolve](/go-sdk/docs/sdks/incidents.md#bulkresolve) - Bulk Resolve Incidents
* [GetByID](/go-sdk/docs/sdks/incidents.md#getbyid) - Get Incident by ID
* [Acknowledge](/go-sdk/docs/sdks/incidents.md#acknowledge) - Acknowledge Incident
* [MarkSloFalsePositive](/go-sdk/docs/sdks/incidents.md#markslofalsepositive) - Mark Incident SLO False Positive
* [UpdatePriority](/go-sdk/docs/sdks/incidents.md#updatepriority) - Incident Priority Update
* [Reassign](/go-sdk/docs/sdks/incidents.md#reassign) - Reassign Incident
* [Resolve](/go-sdk/docs/sdks/incidents.md#resolve) - Resolve Incident
* [GetStatusByRequestIds](/go-sdk/docs/sdks/incidents.md#getstatusbyrequestids) - Get Incidents Status By RequestIDs
* [GetAllPostmortems](/go-sdk/docs/sdks/incidents.md#getallpostmortems) - Get All Postmortems
* [MarkAsTransient](/go-sdk/docs/sdks/incidents.md#markastransient) - Mark as Transient
* [UpdatePostmortem](/go-sdk/docs/sdks/incidents.md#updatepostmortem) - Update Postmortem By Incident
* [UnsnoozeNotifications](/go-sdk/docs/sdks/incidents.md#unsnoozenotifications) - Unsnooze Incident Notifications

#### [Incidents.Actions](/go-sdk/docs/sdks/incidentsactions.md)

* [CreateJiraCloudTicket](/go-sdk/docs/sdks/incidentsactions.md#createjiracloudticket) - Create a Ticket on Jira Cloud
* [CreateJiraServerTicket](/go-sdk/docs/sdks/incidentsactions.md#createjiraserverticket) - Create a Ticket on Jira Server
* [CreateInServicenow](/go-sdk/docs/sdks/incidentsactions.md#createinservicenow) - Create an Incident in ServiceNow

[**Incidents.Actions.Webhook**](/go-sdk/docs/sdks/webhook.md)

* [TriggerManually](/go-sdk/docs/sdks/webhook.md#triggermanually) - Trigger a Webhook Manually

#### [Incidents.AdditionalResponders](/go-sdk/docs/sdks/additionalresponders.md)

* [Get](/go-sdk/docs/sdks/additionalresponders.md#get) - Get Additional Responders
* [Add](/go-sdk/docs/sdks/additionalresponders.md#add) - Add Additional Responders
* [Delete](/go-sdk/docs/sdks/additionalresponders.md#delete) - Remove Additional Responders

#### [Incidents.AutoPauseTransientAlerts](/go-sdk/docs/sdks/autopausetransientalerts.md)

* [MarkAsNotTransient](/go-sdk/docs/sdks/autopausetransientalerts.md#markasnottransient) - Mark as Not Transient

#### [Incidents.CommunicationCard](/go-sdk/docs/sdks/communicationcard.md)

* [Update](/go-sdk/docs/sdks/communicationcard.md#update) - Update Communication Card

#### [Incidents.CommunicationCards](/go-sdk/docs/sdks/incidentscommunicationcards.md)

* [GetAll](/go-sdk/docs/sdks/incidentscommunicationcards.md#getall) - Get All Communication Card
* [Create](/go-sdk/docs/sdks/incidentscommunicationcards.md#create) - Create Communication Card
* [Delete](/go-sdk/docs/sdks/incidentscommunicationcards.md#delete) - Delete Communication Card

#### [Incidents.Events](/go-sdk/docs/sdks/events.md)

* [List](/go-sdk/docs/sdks/events.md#list) - Get Incident Events

#### [Incidents.Notes](/go-sdk/docs/sdks/incidentsnotes.md)

* [Create](/go-sdk/docs/sdks/incidentsnotes.md#create) - Create Notes
* [Delete](/go-sdk/docs/sdks/incidentsnotes.md#delete) - Delete Note
* [Update](/go-sdk/docs/sdks/incidentsnotes.md#update) - Update Note

#### [Incidents.Postmortems](/go-sdk/docs/sdks/postmortems.md)

* [DeleteByIncident](/go-sdk/docs/sdks/postmortems.md#deletebyincident) - Delete Postmortem By Incident
* [GetByIncident](/go-sdk/docs/sdks/postmortems.md#getbyincident) - Get Postmortem By Incident
* [Create](/go-sdk/docs/sdks/postmortems.md#create) - Create Postmortem

#### [Incidents.Runbooks](/go-sdk/docs/sdks/incidentsrunbooks.md)

* [Attach](/go-sdk/docs/sdks/incidentsrunbooks.md#attach) - Attach Runbooks

#### [Incidents.SnoozeNotifications](/go-sdk/docs/sdks/snoozenotifications.md)

* [Snooze](/go-sdk/docs/sdks/snoozenotifications.md#snooze) - Snooze Incident Notifications

#### [Incidents.Tags](/go-sdk/docs/sdks/tags.md)

* [Update](/go-sdk/docs/sdks/tags.md#update) - Update Tag
* [Append](/go-sdk/docs/sdks/tags.md#append) - Append Tag

#### [Msteams](/go-sdk/docs/sdks/msteams.md)

* [GetConfig](/go-sdk/docs/sdks/msteams.md#getconfig) - Get MSTeams Config

#### [Notes](/go-sdk/docs/sdks/notes.md)

* [List](/go-sdk/docs/sdks/notes.md#list) - Get All Notes

#### [Overlays](/go-sdk/docs/sdks/overlays.md)

* [DeleteNotificationTemplate](/go-sdk/docs/sdks/overlays.md#deletenotificationtemplate) - Delete Notification Template Overlay

#### [Overrides](/go-sdk/docs/sdks/overrides.md)

* [GetByID](/go-sdk/docs/sdks/overrides.md#getbyid) - Get Override by ID
* [Update](/go-sdk/docs/sdks/overrides.md#update) - Update Schedule Override

#### [Rotations](/go-sdk/docs/sdks/rotations.md)

* [Create](/go-sdk/docs/sdks/rotations.md#create) - Create Rotation
* [GetByID](/go-sdk/docs/sdks/rotations.md#getbyid) - Get Schedule Rotation by ID
* [Update](/go-sdk/docs/sdks/rotations.md#update) - Update Rotation
* [GetParticipants](/go-sdk/docs/sdks/rotations.md#getparticipants) - Get Rotation Participants
* [UpdateParticipants](/go-sdk/docs/sdks/rotations.md#updateparticipants) - Update Rotation Participants

#### [Runbooks](/go-sdk/docs/sdks/runbooks.md)

* [ListByTeam](/go-sdk/docs/sdks/runbooks.md#listbyteam) - Get All Runbooks By Team
* [Create](/go-sdk/docs/sdks/runbooks.md#create) - Create Runbook
* [Remove](/go-sdk/docs/sdks/runbooks.md#remove) - Remove Runbook
* [GetByID](/go-sdk/docs/sdks/runbooks.md#getbyid) - Get Runbook By ID
* [Update](/go-sdk/docs/sdks/runbooks.md#update) - Update Runbook

#### [Schedules](/go-sdk/docs/sdks/schedules.md)

* [List](/go-sdk/docs/sdks/schedules.md#list) - List Schedules
* [Create](/go-sdk/docs/sdks/schedules.md#create) - Create Schedule
* [Delete](/go-sdk/docs/sdks/schedules.md#delete) - Delete Schedule
* [GetByID](/go-sdk/docs/sdks/schedules.md#getbyid) - Get Schedule by ID
* [Update](/go-sdk/docs/sdks/schedules.md#update) - Update Schedule
* [PauseResume](/go-sdk/docs/sdks/schedules.md#pauseresume) - Pause/Resume Schedule
* [ChangeTimezone](/go-sdk/docs/sdks/schedules.md#changetimezone) - Change Timezone
* [Clone](/go-sdk/docs/sdks/schedules.md#clone) - Clone Schedule
* [GetIcalLink](/go-sdk/docs/sdks/schedules.md#geticallink) - Get Schedule ICal Link
* [RefreshIcalLink](/go-sdk/docs/sdks/schedules.md#refreshicallink) - Refresh Schedule ICal Link
* [CreateIcalLink](/go-sdk/docs/sdks/schedules.md#createicallink) - Create Schedule ICal Link
* [CreateScheduleOverride](/go-sdk/docs/sdks/schedules.md#createscheduleoverride) - Create Schedule Override
* [DeleteRotation](/go-sdk/docs/sdks/schedules.md#deleterotation) - Delete Rotation

[**Schedules.Export**](/go-sdk/docs/sdks/export.md)

* [DeleteIcalLink](/go-sdk/docs/sdks/export.md#deleteicallink) - Delete ICal Link

[**Schedules.Overrides**](/go-sdk/docs/sdks/schedulesoverrides.md)

* [List](/go-sdk/docs/sdks/schedulesoverrides.md#list) - List Overrides
* [Delete](/go-sdk/docs/sdks/schedulesoverrides.md#delete) - Delete Schedule Override

[**Schedules.Rotations**](/go-sdk/docs/sdks/schedulesrotations.md)

* [List](/go-sdk/docs/sdks/schedulesrotations.md#list) - List Schedule Rotations

#### [Services](/go-sdk/docs/sdks/services.md)

* [List](/go-sdk/docs/sdks/services.md#list) - Get All Services
* [Create](/go-sdk/docs/sdks/services.md#create) - Create Service
* [GetByName](/go-sdk/docs/sdks/services.md#getbyname) - Get Services By Name
* [GetByID](/go-sdk/docs/sdks/services.md#getbyid) - Get Service By ID
* [Update](/go-sdk/docs/sdks/services.md#update) - Update Service
* [Delete](/go-sdk/docs/sdks/services.md#delete) - Delete Service
* [CreateOrUpdateAptaConfig](/go-sdk/docs/sdks/services.md#createorupdateaptaconfig) - Auto Pause Transient Alerts (APTA)
* [UpsertIagConfig](/go-sdk/docs/sdks/services.md#upsertiagconfig) - Intelligent Alert Grouping (IAG)
* [UpdateNotificationDelayConfig](/go-sdk/docs/sdks/services.md#updatenotificationdelayconfig) - Delayed Notification Config
* [CreateOrUpdateDependencies](/go-sdk/docs/sdks/services.md#createorupdatedependencies) - Create or Update Dependencies
* [CreateOrUpdateNotificationTemplateOverlay](/go-sdk/docs/sdks/services.md#createorupdatenotificationtemplateoverlay) - Create or Update Notification Template Overlay
* [GetAllDedupKeyOverlays](/go-sdk/docs/sdks/services.md#getalldedupkeyoverlays) - Get All Dedup Key Overlay by Service
* [UpdateDedupKeyOverlay](/go-sdk/docs/sdks/services.md#updatededupkeyoverlay) - Update Dedup Key Overlay
* [GetRoutingRules](/go-sdk/docs/sdks/services.md#getroutingrules) - Get Routing Rules
* [CreateOrUpdateSuppressionRules](/go-sdk/docs/sdks/services.md#createorupdatesuppressionrules) - Create or Update Suppression Rules
* [CreateOrUpdateTaggingRules](/go-sdk/docs/sdks/services.md#createorupdatetaggingrules) - Create or Update Tagging Rules

#### [Services.DeduplicationRules](/go-sdk/docs/sdks/deduplicationrules.md)

* [Get](/go-sdk/docs/sdks/deduplicationrules.md#get) - Get Deduplication Rules
* [CreateOrUpdate](/go-sdk/docs/sdks/deduplicationrules.md#createorupdate) - Create or Update Deduplication Rules

#### [Services.Extensions](/go-sdk/docs/sdks/servicesextensions.md)

* [UpdateSlack](/go-sdk/docs/sdks/servicesextensions.md#updateslack) - Update Slack Extension

#### [Services.MaintenanceMode](/go-sdk/docs/sdks/maintenancemode.md)

* [Get](/go-sdk/docs/sdks/maintenancemode.md#get) - Get Maintenance Mode
* [CreateOrUpdate](/go-sdk/docs/sdks/maintenancemode.md#createorupdate) - Create or Update Maintenance Mode

#### [Services.Overlay](/go-sdk/docs/sdks/overlay.md)

* [GetKeyBasedDeduplicationOptin](/go-sdk/docs/sdks/overlay.md#getkeybaseddeduplicationoptin) - Get Opt-in for Key Based Deduplication for a service
* [OptInForKeyBasedDeduplication](/go-sdk/docs/sdks/overlay.md#optinforkeybaseddeduplication) - Opt-in for Key Based Deduplication for a service

#### [Services.Overlays](/go-sdk/docs/sdks/servicesoverlays.md)

* [GetCustomContentTemplates](/go-sdk/docs/sdks/servicesoverlays.md#getcustomcontenttemplates) - Get All Custom Content Template Overlay by Service
* [GetCustomContent](/go-sdk/docs/sdks/servicesoverlays.md#getcustomcontent) - Get Custom Content Template Overlay
* [GetDedupKey](/go-sdk/docs/sdks/servicesoverlays.md#getdedupkey) - Get Dedup Key Overlay for Alert Source

[**Services.Overlays.CustomContent**](/go-sdk/docs/sdks/customcontent.md)

* [Render](/go-sdk/docs/sdks/customcontent.md#render) - Render Custom Content Overlay

[**Services.Overlays.DedupKey**](/go-sdk/docs/sdks/dedupkey.md)

* [Render](/go-sdk/docs/sdks/dedupkey.md#render) - Render Dedup Key template
* [Delete](/go-sdk/docs/sdks/dedupkey.md#delete) - Delete Dedup Key Overlay

#### [Services.RoutingRules](/go-sdk/docs/sdks/routingrules.md)

* [CreateOrUpdate](/go-sdk/docs/sdks/routingrules.md#createorupdate) - Create or Update Routing Rules

#### [Services.SuppressionRules](/go-sdk/docs/sdks/suppressionrules.md)

* [Get](/go-sdk/docs/sdks/suppressionrules.md#get) - Get Suppression Rules

#### [Services.TaggingRules](/go-sdk/docs/sdks/taggingrules.md)

* [Get](/go-sdk/docs/sdks/taggingrules.md#get) - Get Tagging Rules

#### [Slos](/go-sdk/docs/sdks/slos.md)

* [ListAll](/go-sdk/docs/sdks/slos.md#listall) - Get All SLOs
* [Create](/go-sdk/docs/sdks/slos.md#create) - Create SLO
* [Update](/go-sdk/docs/sdks/slos.md#update) - Update SLO
* [Remove](/go-sdk/docs/sdks/slos.md#remove) - Remove SLO
* [GetByID](/go-sdk/docs/sdks/slos.md#getbyid) - Get SLO By ID
* [MarkAffected](/go-sdk/docs/sdks/slos.md#markaffected) - Mark SLO Affected
* [MarkFalsePositive](/go-sdk/docs/sdks/slos.md#markfalsepositive) - Mark SLO False Positive

#### [Squads](/go-sdk/docs/sdks/squads.md)

* [List](/go-sdk/docs/sdks/squads.md#list) - Get All Squads
* [RemoveMember](/go-sdk/docs/sdks/squads.md#removemember) - Remove Squad Member
* [UpdateMemberRole](/go-sdk/docs/sdks/squads.md#updatememberrole) - Update Squad Member
* [UpdateName](/go-sdk/docs/sdks/squads.md#updatename) - Update Squad Name
* [Delete](/go-sdk/docs/sdks/squads.md#delete) - Delete Squad

[**Squads.V4**](/go-sdk/docs/sdks/squadsv4.md)

* [Create](/go-sdk/docs/sdks/squadsv4.md#create) - Create Squad
* [GetByID](/go-sdk/docs/sdks/squadsv4.md#getbyid) - Get Squad By ID

#### [StatusPages](/go-sdk/docs/sdks/statuspages.md)

* [List](/go-sdk/docs/sdks/statuspages.md#list) - List Status Pages
* [Create](/go-sdk/docs/sdks/statuspages.md#create) - Create Status Page
* [DeleteByID](/go-sdk/docs/sdks/statuspages.md#deletebyid) - Delete Status Page By ID
* [GetByID](/go-sdk/docs/sdks/statuspages.md#getbyid) - Get Status Page By ID
* [UpdateByID](/go-sdk/docs/sdks/statuspages.md#updatebyid) - Update Status Page By ID
* [CreateIssue](/go-sdk/docs/sdks/statuspages.md#createissue) - Create Issue
* [UpdateIssue](/go-sdk/docs/sdks/statuspages.md#updateissue) - Update Issue
* [ListMaintenances](/go-sdk/docs/sdks/statuspages.md#listmaintenances) - List Maintenances
* [GetMaintenanceByID](/go-sdk/docs/sdks/statuspages.md#getmaintenancebyid) - Get Maintenance By ID
* [GetStatuses](/go-sdk/docs/sdks/statuspages.md#getstatuses) - List Status Page Statuses

[**StatusPages.ComponentGroups**](/go-sdk/docs/sdks/componentgroups.md)

* [List](/go-sdk/docs/sdks/componentgroups.md#list) - List Component Groups
* [Create](/go-sdk/docs/sdks/componentgroups.md#create) - Create Component Group
* [DeleteByID](/go-sdk/docs/sdks/componentgroups.md#deletebyid) - Delete Component Group By ID
* [GetByID](/go-sdk/docs/sdks/componentgroups.md#getbyid) - Get Component Group By ID

[**StatusPages.Components**](/go-sdk/docs/sdks/components.md)

* [List](/go-sdk/docs/sdks/components.md#list) - List Components
* [Create](/go-sdk/docs/sdks/components.md#create) - Create Component
* [DeleteByID](/go-sdk/docs/sdks/components.md#deletebyid) - Delete Component By ID
* [GetByID](/go-sdk/docs/sdks/components.md#getbyid) - Get Component By ID
* [UpdateByID](/go-sdk/docs/sdks/components.md#updatebyid) - Update Component By ID

[**StatusPages.Issues**](/go-sdk/docs/sdks/issues.md)

* [List](/go-sdk/docs/sdks/issues.md#list) - List Issues
* [Delete](/go-sdk/docs/sdks/issues.md#delete) - Delete Issue By ID
* [GetByID](/go-sdk/docs/sdks/issues.md#getbyid) - Get Issue By ID
* [ListStates](/go-sdk/docs/sdks/issues.md#liststates) - List Status Page Issue States

[**StatusPages.Maintenances**](/go-sdk/docs/sdks/maintenances.md)

* [Create](/go-sdk/docs/sdks/maintenances.md#create) - Create Maintenance
* [DeleteByID](/go-sdk/docs/sdks/maintenances.md#deletebyid) - Delete Maintenance By ID
* [UpdateByID](/go-sdk/docs/sdks/maintenances.md#updatebyid) - Update Maintenance By ID

[**StatusPages.Subscribers**](/go-sdk/docs/sdks/subscribers.md)

* [List](/go-sdk/docs/sdks/subscribers.md#list) - List Subscribers

#### [Teams](/go-sdk/docs/sdks/teams.md)

* [GetAll](/go-sdk/docs/sdks/teams.md#getall) - Get All Teams
* [Create](/go-sdk/docs/sdks/teams.md#create) - Create Team
* [GetByID](/go-sdk/docs/sdks/teams.md#getbyid) - Get Team By ID
* [Update](/go-sdk/docs/sdks/teams.md#update) - Update Team
* [Delete](/go-sdk/docs/sdks/teams.md#delete) - Remove Team
* [AddMember](/go-sdk/docs/sdks/teams.md#addmember) - Add Team Member
* [AddBulkMember](/go-sdk/docs/sdks/teams.md#addbulkmember) - Add Bulk Team Member
* [RemoveMember](/go-sdk/docs/sdks/teams.md#removemember) - Remove Team Member
* [UpdateMember](/go-sdk/docs/sdks/teams.md#updatemember) - Update Team Member
* [GetAllRoles](/go-sdk/docs/sdks/teams.md#getallroles) - Get All Team Roles
* [CreateRole](/go-sdk/docs/sdks/teams.md#createrole) - Create Team Role
* [RemoveRole](/go-sdk/docs/sdks/teams.md#removerole) - Remove Team Role
* [UpdateRole](/go-sdk/docs/sdks/teams.md#updaterole) - Update Team Role

#### [Teams.Members](/go-sdk/docs/sdks/members.md)

* [GetAll](/go-sdk/docs/sdks/members.md#getall) - Get All Team Members

#### [Tokens](/go-sdk/docs/sdks/tokens.md)

* [CreateUserToken](/go-sdk/docs/sdks/tokens.md#createusertoken) - Create Token

#### [Users](/go-sdk/docs/sdks/users.md)

* [GetAll](/go-sdk/docs/sdks/users.md#getall) - Get All Users
* [Add](/go-sdk/docs/sdks/users.md#add) - Add User
* [UpdateOrgLevelPermissions](/go-sdk/docs/sdks/users.md#updateorglevelpermissions) - Update Org Level Permissions
* [Delete](/go-sdk/docs/sdks/users.md#delete) - Delete User
* [GetRoles](/go-sdk/docs/sdks/users.md#getroles) - Get User Roles
* [RemoveFromOrg](/go-sdk/docs/sdks/users.md#removefromorg) - Remove User From Org
* [GetByID](/go-sdk/docs/sdks/users.md#getbyid) - Get User By ID
* [Update](/go-sdk/docs/sdks/users.md#update) - Update User by userID

[**Users.ApiToken**](/go-sdk/docs/sdks/apitoken.md)

* [Remove](/go-sdk/docs/sdks/apitoken.md#remove) - Remove Token

#### [V4.Squads](/go-sdk/docs/sdks/v4squads.md)

* [Update](/go-sdk/docs/sdks/v4squads.md#update) - Update Squad

#### [Webforms](/go-sdk/docs/sdks/webforms.md)

* [GetAll](/go-sdk/docs/sdks/webforms.md#getall) - Get All Webforms
* [Create](/go-sdk/docs/sdks/webforms.md#create) - Create Webform
* [Update](/go-sdk/docs/sdks/webforms.md#update) - Update Webform
* [Remove](/go-sdk/docs/sdks/webforms.md#remove) - Remove Webform
* [Get](/go-sdk/docs/sdks/webforms.md#get) - Get Webform By ID

#### [Webhooks](/go-sdk/docs/sdks/webhooks.md)

* [GetAll](/go-sdk/docs/sdks/webhooks.md#getall) - Get All Webhooks
* [Create](/go-sdk/docs/sdks/webhooks.md#create) - Create Webhook
* [Update](/go-sdk/docs/sdks/webhooks.md#update) - Update Webhook

#### [Workflows](/go-sdk/docs/sdks/workflows.md)

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

#### [Workflows.Actions](/go-sdk/docs/sdks/workflowsactions.md)

* [Create](/go-sdk/docs/sdks/workflowsactions.md#create) - Create Action

</details>

### Pagination

Some of the endpoints in this SDK support pagination. To use pagination, you make your SDK calls as usual, but the returned response object will have a `Next` method that can be called to pull down the next group of results. If the return value of `Next` is `nil`, then there are no more pages to be fetched.

Here's an example of one such pagination call:

```go
package main

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

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

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

	res, err := s.AuditLogs.List(ctx, operations.AuditLogsListAuditLogsRequest{
		PageSize:   832442,
		PageNumber: 555332,
		StartDate:  types.MustDateFromString("2023-03-04"),
		EndDate:    types.MustDateFromString("2024-08-07"),
	})
	if err != nil {
		log.Fatal(err)
	}
	if res.V3AuditLogsListAuditLogsResponse != nil {
		for {
			// handle items

			res, err = res.Next()

			if err != nil {
				// handle error
			}

			if res == nil {
				break
			}
		}
	}
}

```

### Retries

Some of the endpoints in this SDK support retries. If you use the SDK without any configuration, it will fall back to the default retry strategy provided by the API. However, the default retry strategy can be overridden on a per-operation basis, or across the entire SDK.

To change the default retry strategy for a single API call, simply provide a `retry.Config` object to the call by using the `WithRetries` option:

```go
package main

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

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

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

	res, err := s.Analytics.GetOrganization(ctx, "<value>", "<value>", nil, nil, operations.WithRetries(
		retry.Config{
			Strategy: "backoff",
			Backoff: &retry.BackoffStrategy{
				InitialInterval: 1,
				MaxInterval:     50,
				Exponent:        1.1,
				MaxElapsedTime:  100,
			},
			RetryConnectionErrors: false,
		}))
	if err != nil {
		log.Fatal(err)
	}
	if res.Object != nil {
		// handle response
	}
}

```

If you'd like to override the default retry strategy for all operations that support retries, you can use the `WithRetryConfig` option at SDK initialization:

```go
package main

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

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

	s := squadcastsdk.New(
		squadcastsdk.WithRetryConfig(
			retry.Config{
				Strategy: "backoff",
				Backoff: &retry.BackoffStrategy{
					InitialInterval: 1,
					MaxInterval:     50,
					Exponent:        1.1,
					MaxElapsedTime:  100,
				},
				RetryConnectionErrors: false,
			}),
		squadcastsdk.WithSecurity(os.Getenv("SQUADCASTSDK_REFRESH_TOKEN_AUTH")),
	)

	res, err := s.Analytics.GetOrganization(ctx, "<value>", "<value>", nil, nil)
	if err != nil {
		log.Fatal(err)
	}
	if res.Object != nil {
		// handle response
	}
}

```

### Error Handling

Handling errors in this SDK should largely match your expectations. All operations return a response object or an error, they will never return both.

By Default, an API error will return `apierrors.APIError`. When custom error responses are specified for an operation, the SDK may also return their associated error. You can refer to respective *Errors* tables in SDK docs for more details on possible error types for each operation.

For example, the `GetOrganization` function may return the following 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    | \*/\*            |

#### Example

```go
package main

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

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

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

	res, err := s.Analytics.GetOrganization(ctx, "<value>", "<value>", nil, nil)
	if err != nil {

		var e *apierrors.BadRequestError
		if errors.As(err, &e) {
			// handle error
			log.Fatal(e.Error())
		}

		var e *apierrors.UnauthorizedError
		if errors.As(err, &e) {
			// handle error
			log.Fatal(e.Error())
		}

		var e *apierrors.PaymentRequiredError
		if errors.As(err, &e) {
			// handle error
			log.Fatal(e.Error())
		}

		var e *apierrors.ForbiddenError
		if errors.As(err, &e) {
			// handle error
			log.Fatal(e.Error())
		}

		var e *apierrors.NotFoundError
		if errors.As(err, &e) {
			// handle error
			log.Fatal(e.Error())
		}

		var e *apierrors.ConflictError
		if errors.As(err, &e) {
			// handle error
			log.Fatal(e.Error())
		}

		var e *apierrors.UnprocessableEntityError
		if errors.As(err, &e) {
			// handle error
			log.Fatal(e.Error())
		}

		var e *apierrors.InternalServerError
		if errors.As(err, &e) {
			// handle error
			log.Fatal(e.Error())
		}

		var e *apierrors.BadGatewayError
		if errors.As(err, &e) {
			// handle error
			log.Fatal(e.Error())
		}

		var e *apierrors.ServiceUnavailableError
		if errors.As(err, &e) {
			// handle error
			log.Fatal(e.Error())
		}

		var e *apierrors.GatewayTimeoutError
		if errors.As(err, &e) {
			// handle error
			log.Fatal(e.Error())
		}

		var e *apierrors.APIError
		if errors.As(err, &e) {
			// handle error
			log.Fatal(e.Error())
		}
	}
}

```

### Server Selection

#### Select Server by Index

You can override the default server globally using the `WithServerIndex(serverIndex int)` option when initializing the SDK client instance. The selected server will then be used as the default on the operations that use it. This table lists the indexes associated with the available servers:

| # | Server                         | Description       |
| - | ------------------------------ | ----------------- |
| 0 | `https://api.squadcast.com`    | production US env |
| 1 | `https://api.eu.squadcast.com` | production EU env |

**Example**

```go
package main

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

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

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

	res, err := s.Analytics.GetOrganization(ctx, "<value>", "<value>", nil, nil)
	if err != nil {
		log.Fatal(err)
	}
	if res.Object != nil {
		// handle response
	}
}

```

#### Override Server URL Per-Client

The default server can also be overridden globally using the `WithServerURL(serverURL string)` option when initializing the SDK client instance. For example:

```go
package main

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

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

	s := squadcastsdk.New(
		squadcastsdk.WithServerURL("https://api.eu.squadcast.com"),
		squadcastsdk.WithSecurity(os.Getenv("SQUADCASTSDK_REFRESH_TOKEN_AUTH")),
	)

	res, err := s.Analytics.GetOrganization(ctx, "<value>", "<value>", nil, nil)
	if err != nil {
		log.Fatal(err)
	}
	if res.Object != nil {
		// handle response
	}
}

```

### Custom HTTP Client

The Go SDK makes API calls that wrap an internal HTTP client. The requirements for the HTTP client are very simple. It must match this interface:

```go
type HTTPClient interface {
	Do(req *http.Request) (*http.Response, error)
}
```

The built-in `net/http` client satisfies this interface and a default client based on the built-in is provided by default. To replace this default with a client of your own, you can implement this interface yourself or provide your own client configured as desired. Here's a simple example, which adds a client with a 30 second timeout.

```go
import (
	"net/http"
	"time"

	"github.com/solarwinds/squadcast-sdk-go"
)

var (
	httpClient = &http.Client{Timeout: 30 * time.Second}
	sdkClient  = squadcastsdk.New(squadcastsdk.WithClient(httpClient))
)
```

This can be a convenient way to configure timeouts, cookies, proxies, custom headers, and other low-level configuration.

### Special Types

This SDK defines the following custom types to assist with marshalling and unmarshalling data.

#### Date

`types.Date` is a wrapper around time.Time that allows for JSON marshaling a date string formatted as "2006-01-02".

**Usage**

```go
d1 := types.NewDate(time.Now()) // returns *types.Date

d2 := types.DateFromTime(time.Now()) // returns types.Date

d3, err := types.NewDateFromString("2019-01-01") // returns *types.Date, error

d4, err := types.DateFromString("2019-01-01") // returns types.Date, error

d5 := types.MustNewDateFromString("2019-01-01") // returns *types.Date and panics on error

d6 := types.MustDateFromString("2019-01-01") // returns types.Date and panics on error
```

## Development

### Maturity

This SDK is in beta, and there may be breaking changes between versions without a major version update. Therefore, we recommend pinning usage to a specific package version. This way, you can install the same version each time without breaking changes unless you are intentionally looking for the latest version.

### Contributions

While we value open-source contributions to this SDK, this library is generated programmatically. Any manual changes added to internal files will be overwritten on the next generation. We look forward to hearing your feedback. Feel free to open a PR or an issue with a proof of concept and we'll do our best to include it in a future release.

#### SDK Created by [Speakeasy](https://www.speakeasy.com/?utm_source=squadcast-sdk\&utm_campaign=go)


---

# 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/readme.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.
