Skip to content

devopsarr/sonarr-go

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Go API client for sonarr

Sonarr API docs - The v3 API docs apply to both v3 and v4 versions of Sonarr. Some functionality may only be available in v4 of the Sonarr application.

Overview

This API client was generated by the OpenAPI Generator project. By using the OpenAPI-spec from a remote server, you can easily generate an API client.

  • API version: v4.0.9.2244
  • Package version: 1.0.1
  • Generator version: 7.9.0
  • Build package: org.openapitools.codegen.languages.GoClientCodegen

Installation

Install the following dependencies:

go get github.com/stretchr/testify/assert
go get golang.org/x/net/context

Put the package under your project folder and add the following in import:

import sonarr "github.com/devopsarr/sonarr-go/sonarr"

To use a proxy, set the environment variable HTTP_PROXY:

os.Setenv("HTTP_PROXY", "http://proxy_name:proxy_port")

Configuration of Server URL

Default configuration comes with Servers field that contains server objects as defined in the OpenAPI specification.

Select Server Configuration

For using other server than the one defined on index 0 set context value sonarr.ContextServerIndex of type int.

ctx := context.WithValue(context.Background(), sonarr.ContextServerIndex, 1)

Templated Server URL

Templated server URL is formatted using default variables from configuration or from context value sonarr.ContextServerVariables of type map[string]string.

ctx := context.WithValue(context.Background(), sonarr.ContextServerVariables, map[string]string{
	"basePath": "v2",
})

Note, enum values are always validated and all unused variables are silently ignored.

URLs Configuration per Operation

Each operation can use different server URL defined using OperationServers map in the Configuration. An operation is uniquely identified by "{classname}Service.{nickname}" string. Similar rules for overriding default operation server index and variables applies by using sonarr.ContextOperationServerIndices and sonarr.ContextOperationServerVariables context maps.

ctx := context.WithValue(context.Background(), sonarr.ContextOperationServerIndices, map[string]int{
	"{classname}Service.{nickname}": 2,
})
ctx = context.WithValue(context.Background(), sonarr.ContextOperationServerVariables, map[string]map[string]string{
	"{classname}Service.{nickname}": {
		"port": "8443",
	},
})

Documentation for API Endpoints

All URIs are relative to http://localhost:8989

Class Method HTTP request Description
ApiInfoAPI GetApi Get /api
AuthenticationAPI CreateLogin Post /login
AuthenticationAPI GetLogout Get /logout
AutoTaggingAPI CreateAutoTagging Post /api/v3/autotagging
AutoTaggingAPI DeleteAutoTagging Delete /api/v3/autotagging/{id}
AutoTaggingAPI GetAutoTaggingById Get /api/v3/autotagging/{id}
AutoTaggingAPI ListAutoTagging Get /api/v3/autotagging
AutoTaggingAPI ListAutoTaggingSchema Get /api/v3/autotagging/schema
AutoTaggingAPI UpdateAutoTagging Put /api/v3/autotagging/{id}
BackupAPI CreateSystemBackupRestoreById Post /api/v3/system/backup/restore/{id}
BackupAPI CreateSystemBackupRestoreUpload Post /api/v3/system/backup/restore/upload
BackupAPI DeleteSystemBackup Delete /api/v3/system/backup/{id}
BackupAPI ListSystemBackup Get /api/v3/system/backup
BlocklistAPI DeleteBlocklist Delete /api/v3/blocklist/{id}
BlocklistAPI DeleteBlocklistBulk Delete /api/v3/blocklist/bulk
BlocklistAPI GetBlocklist Get /api/v3/blocklist
CalendarAPI GetCalendarById Get /api/v3/calendar/{id}
CalendarAPI ListCalendar Get /api/v3/calendar
CalendarFeedAPI GetFeedV3CalendarSonarrIcs Get /feed/v3/calendar/sonarr.ics
CommandAPI CreateCommand Post /api/v3/command
CommandAPI DeleteCommand Delete /api/v3/command/{id}
CommandAPI GetCommandById Get /api/v3/command/{id}
CommandAPI ListCommand Get /api/v3/command
CustomFilterAPI CreateCustomFilter Post /api/v3/customfilter
CustomFilterAPI DeleteCustomFilter Delete /api/v3/customfilter/{id}
CustomFilterAPI GetCustomFilterById Get /api/v3/customfilter/{id}
CustomFilterAPI ListCustomFilter Get /api/v3/customfilter
CustomFilterAPI UpdateCustomFilter Put /api/v3/customfilter/{id}
CustomFormatAPI CreateCustomFormat Post /api/v3/customformat
CustomFormatAPI DeleteCustomFormat Delete /api/v3/customformat/{id}
CustomFormatAPI GetCustomFormatById Get /api/v3/customformat/{id}
CustomFormatAPI ListCustomFormat Get /api/v3/customformat
CustomFormatAPI ListCustomFormatSchema Get /api/v3/customformat/schema
CustomFormatAPI UpdateCustomFormat Put /api/v3/customformat/{id}
CutoffAPI GetWantedCutoff Get /api/v3/wanted/cutoff
CutoffAPI GetWantedCutoffById Get /api/v3/wanted/cutoff/{id}
DelayProfileAPI CreateDelayProfile Post /api/v3/delayprofile
DelayProfileAPI DeleteDelayProfile Delete /api/v3/delayprofile/{id}
DelayProfileAPI GetDelayProfileById Get /api/v3/delayprofile/{id}
DelayProfileAPI ListDelayProfile Get /api/v3/delayprofile
DelayProfileAPI UpdateDelayProfile Put /api/v3/delayprofile/{id}
DelayProfileAPI UpdateDelayProfileReorder Put /api/v3/delayprofile/reorder/{id}
DiskSpaceAPI ListDiskSpace Get /api/v3/diskspace
DownloadClientAPI CreateDownloadClient Post /api/v3/downloadclient
DownloadClientAPI CreateDownloadClientActionByName Post /api/v3/downloadclient/action/{name}
DownloadClientAPI DeleteDownloadClient Delete /api/v3/downloadclient/{id}
DownloadClientAPI DeleteDownloadClientBulk Delete /api/v3/downloadclient/bulk
DownloadClientAPI GetDownloadClientById Get /api/v3/downloadclient/{id}
DownloadClientAPI ListDownloadClient Get /api/v3/downloadclient
DownloadClientAPI ListDownloadClientSchema Get /api/v3/downloadclient/schema
DownloadClientAPI PutDownloadClientBulk Put /api/v3/downloadclient/bulk
DownloadClientAPI TestDownloadClient Post /api/v3/downloadclient/test
DownloadClientAPI TestallDownloadClient Post /api/v3/downloadclient/testall
DownloadClientAPI UpdateDownloadClient Put /api/v3/downloadclient/{id}
DownloadClientConfigAPI GetDownloadClientConfig Get /api/v3/config/downloadclient
DownloadClientConfigAPI GetDownloadClientConfigById Get /api/v3/config/downloadclient/{id}
DownloadClientConfigAPI UpdateDownloadClientConfig Put /api/v3/config/downloadclient/{id}
EpisodeAPI GetEpisodeById Get /api/v3/episode/{id}
EpisodeAPI ListEpisode Get /api/v3/episode
EpisodeAPI PutEpisodeMonitor Put /api/v3/episode/monitor
EpisodeAPI UpdateEpisode Put /api/v3/episode/{id}
EpisodeFileAPI DeleteEpisodeFile Delete /api/v3/episodefile/{id}
EpisodeFileAPI DeleteEpisodeFileBulk Delete /api/v3/episodefile/bulk
EpisodeFileAPI GetEpisodeFileById Get /api/v3/episodefile/{id}
EpisodeFileAPI ListEpisodeFile Get /api/v3/episodefile
EpisodeFileAPI PutEpisodeFileBulk Put /api/v3/episodefile/bulk
EpisodeFileAPI PutEpisodeFileEditor Put /api/v3/episodefile/editor
EpisodeFileAPI UpdateEpisodeFile Put /api/v3/episodefile/{id}
FileSystemAPI GetFileSystem Get /api/v3/filesystem
FileSystemAPI GetFileSystemMediafiles Get /api/v3/filesystem/mediafiles
FileSystemAPI GetFileSystemType Get /api/v3/filesystem/type
HealthAPI ListHealth Get /api/v3/health
HistoryAPI CreateHistoryFailedById Post /api/v3/history/failed/{id}
HistoryAPI GetHistory Get /api/v3/history
HistoryAPI ListHistorySeries Get /api/v3/history/series
HistoryAPI ListHistorySince Get /api/v3/history/since
HostConfigAPI GetHostConfig Get /api/v3/config/host
HostConfigAPI GetHostConfigById Get /api/v3/config/host/{id}
HostConfigAPI UpdateHostConfig Put /api/v3/config/host/{id}
ImportListAPI CreateImportList Post /api/v3/importlist
ImportListAPI CreateImportListActionByName Post /api/v3/importlist/action/{name}
ImportListAPI DeleteImportList Delete /api/v3/importlist/{id}
ImportListAPI DeleteImportListBulk Delete /api/v3/importlist/bulk
ImportListAPI GetImportListById Get /api/v3/importlist/{id}
ImportListAPI ListImportList Get /api/v3/importlist
ImportListAPI ListImportListSchema Get /api/v3/importlist/schema
ImportListAPI PutImportListBulk Put /api/v3/importlist/bulk
ImportListAPI TestImportList Post /api/v3/importlist/test
ImportListAPI TestallImportList Post /api/v3/importlist/testall
ImportListAPI UpdateImportList Put /api/v3/importlist/{id}
ImportListConfigAPI GetImportListConfig Get /api/v3/config/importlist
ImportListConfigAPI GetImportListConfigById Get /api/v3/config/importlist/{id}
ImportListConfigAPI UpdateImportListConfig Put /api/v3/config/importlist/{id}
ImportListExclusionAPI CreateImportListExclusion Post /api/v3/importlistexclusion
ImportListExclusionAPI DeleteImportListExclusion Delete /api/v3/importlistexclusion/{id}
ImportListExclusionAPI DeleteImportListExclusionBulk Delete /api/v3/importlistexclusion/bulk
ImportListExclusionAPI GetImportListExclusionById Get /api/v3/importlistexclusion/{id}
ImportListExclusionAPI GetImportListExclusionPaged Get /api/v3/importlistexclusion/paged
ImportListExclusionAPI ListImportListExclusion Get /api/v3/importlistexclusion
ImportListExclusionAPI UpdateImportListExclusion Put /api/v3/importlistexclusion/{id}
IndexerAPI CreateIndexer Post /api/v3/indexer
IndexerAPI CreateIndexerActionByName Post /api/v3/indexer/action/{name}
IndexerAPI DeleteIndexer Delete /api/v3/indexer/{id}
IndexerAPI DeleteIndexerBulk Delete /api/v3/indexer/bulk
IndexerAPI GetIndexerById Get /api/v3/indexer/{id}
IndexerAPI ListIndexer Get /api/v3/indexer
IndexerAPI ListIndexerSchema Get /api/v3/indexer/schema
IndexerAPI PutIndexerBulk Put /api/v3/indexer/bulk
IndexerAPI TestIndexer Post /api/v3/indexer/test
IndexerAPI TestallIndexer Post /api/v3/indexer/testall
IndexerAPI UpdateIndexer Put /api/v3/indexer/{id}
IndexerConfigAPI GetIndexerConfig Get /api/v3/config/indexer
IndexerConfigAPI GetIndexerConfigById Get /api/v3/config/indexer/{id}
IndexerConfigAPI UpdateIndexerConfig Put /api/v3/config/indexer/{id}
IndexerFlagAPI ListIndexerFlag Get /api/v3/indexerflag
LanguageAPI GetLanguageById Get /api/v3/language/{id}
LanguageAPI ListLanguage Get /api/v3/language
LanguageProfileAPI CreateLanguageProfile Post /api/v3/languageprofile
LanguageProfileAPI DeleteLanguageProfile Delete /api/v3/languageprofile/{id}
LanguageProfileAPI GetLanguageProfileById Get /api/v3/languageprofile/{id}
LanguageProfileAPI ListLanguageProfile Get /api/v3/languageprofile
LanguageProfileAPI UpdateLanguageProfile Put /api/v3/languageprofile/{id}
LanguageProfileSchemaAPI GetLanguageprofileSchema Get /api/v3/languageprofile/schema
LocalizationAPI GetLocalization Get /api/v3/localization
LocalizationAPI GetLocalizationById Get /api/v3/localization/{id}
LocalizationAPI GetLocalizationLanguage Get /api/v3/localization/language
LogAPI GetLog Get /api/v3/log
LogFileAPI GetLogFileByFilename Get /api/v3/log/file/{filename}
LogFileAPI ListLogFile Get /api/v3/log/file
ManualImportAPI CreateManualImport Post /api/v3/manualimport
ManualImportAPI ListManualImport Get /api/v3/manualimport
MediaCoverAPI GetMediaCoverByFilename Get /api/v3/mediacover/{seriesId}/{filename}
MediaManagementConfigAPI GetMediaManagementConfig Get /api/v3/config/mediamanagement
MediaManagementConfigAPI GetMediaManagementConfigById Get /api/v3/config/mediamanagement/{id}
MediaManagementConfigAPI UpdateMediaManagementConfig Put /api/v3/config/mediamanagement/{id}
MetadataAPI CreateMetadata Post /api/v3/metadata
MetadataAPI CreateMetadataActionByName Post /api/v3/metadata/action/{name}
MetadataAPI DeleteMetadata Delete /api/v3/metadata/{id}
MetadataAPI GetMetadataById Get /api/v3/metadata/{id}
MetadataAPI ListMetadata Get /api/v3/metadata
MetadataAPI ListMetadataSchema Get /api/v3/metadata/schema
MetadataAPI TestMetadata Post /api/v3/metadata/test
MetadataAPI TestallMetadata Post /api/v3/metadata/testall
MetadataAPI UpdateMetadata Put /api/v3/metadata/{id}
MissingAPI GetWantedMissing Get /api/v3/wanted/missing
MissingAPI GetWantedMissingById Get /api/v3/wanted/missing/{id}
NamingConfigAPI GetNamingConfig Get /api/v3/config/naming
NamingConfigAPI GetNamingConfigById Get /api/v3/config/naming/{id}
NamingConfigAPI GetNamingConfigExamples Get /api/v3/config/naming/examples
NamingConfigAPI UpdateNamingConfig Put /api/v3/config/naming/{id}
NotificationAPI CreateNotification Post /api/v3/notification
NotificationAPI CreateNotificationActionByName Post /api/v3/notification/action/{name}
NotificationAPI DeleteNotification Delete /api/v3/notification/{id}
NotificationAPI GetNotificationById Get /api/v3/notification/{id}
NotificationAPI ListNotification Get /api/v3/notification
NotificationAPI ListNotificationSchema Get /api/v3/notification/schema
NotificationAPI TestNotification Post /api/v3/notification/test
NotificationAPI TestallNotification Post /api/v3/notification/testall
NotificationAPI UpdateNotification Put /api/v3/notification/{id}
ParseAPI GetParse Get /api/v3/parse
PingAPI GetPing Get /ping
PingAPI HeadPing Head /ping
QualityDefinitionAPI GetQualityDefinitionById Get /api/v3/qualitydefinition/{id}
QualityDefinitionAPI ListQualityDefinition Get /api/v3/qualitydefinition
QualityDefinitionAPI PutQualityDefinitionUpdate Put /api/v3/qualitydefinition/update
QualityDefinitionAPI UpdateQualityDefinition Put /api/v3/qualitydefinition/{id}
QualityProfileAPI CreateQualityProfile Post /api/v3/qualityprofile
QualityProfileAPI DeleteQualityProfile Delete /api/v3/qualityprofile/{id}
QualityProfileAPI GetQualityProfileById Get /api/v3/qualityprofile/{id}
QualityProfileAPI ListQualityProfile Get /api/v3/qualityprofile
QualityProfileAPI UpdateQualityProfile Put /api/v3/qualityprofile/{id}
QualityProfileSchemaAPI GetQualityprofileSchema Get /api/v3/qualityprofile/schema
QueueAPI DeleteQueue Delete /api/v3/queue/{id}
QueueAPI DeleteQueueBulk Delete /api/v3/queue/bulk
QueueAPI GetQueue Get /api/v3/queue
QueueActionAPI CreateQueueGrabBulk Post /api/v3/queue/grab/bulk
QueueActionAPI CreateQueueGrabById Post /api/v3/queue/grab/{id}
QueueDetailsAPI ListQueueDetails Get /api/v3/queue/details
QueueStatusAPI GetQueueStatus Get /api/v3/queue/status
ReleaseAPI CreateRelease Post /api/v3/release
ReleaseAPI ListRelease Get /api/v3/release
ReleaseProfileAPI CreateReleaseProfile Post /api/v3/releaseprofile
ReleaseProfileAPI DeleteReleaseProfile Delete /api/v3/releaseprofile/{id}
ReleaseProfileAPI GetReleaseProfileById Get /api/v3/releaseprofile/{id}
ReleaseProfileAPI ListReleaseProfile Get /api/v3/releaseprofile
ReleaseProfileAPI UpdateReleaseProfile Put /api/v3/releaseprofile/{id}
ReleasePushAPI CreateReleasePush Post /api/v3/release/push
RemotePathMappingAPI CreateRemotePathMapping Post /api/v3/remotepathmapping
RemotePathMappingAPI DeleteRemotePathMapping Delete /api/v3/remotepathmapping/{id}
RemotePathMappingAPI GetRemotePathMappingById Get /api/v3/remotepathmapping/{id}
RemotePathMappingAPI ListRemotePathMapping Get /api/v3/remotepathmapping
RemotePathMappingAPI UpdateRemotePathMapping Put /api/v3/remotepathmapping/{id}
RenameEpisodeAPI ListRename Get /api/v3/rename
RootFolderAPI CreateRootFolder Post /api/v3/rootfolder
RootFolderAPI DeleteRootFolder Delete /api/v3/rootfolder/{id}
RootFolderAPI GetRootFolderById Get /api/v3/rootfolder/{id}
RootFolderAPI ListRootFolder Get /api/v3/rootfolder
SeasonPassAPI CreateSeasonPass Post /api/v3/seasonpass
SeriesAPI CreateSeries Post /api/v3/series
SeriesAPI DeleteSeries Delete /api/v3/series/{id}
SeriesAPI GetSeriesById Get /api/v3/series/{id}
SeriesAPI ListSeries Get /api/v3/series
SeriesAPI UpdateSeries Put /api/v3/series/{id}
SeriesEditorAPI DeleteSeriesEditor Delete /api/v3/series/editor
SeriesEditorAPI PutSeriesEditor Put /api/v3/series/editor
SeriesImportAPI CreateSeriesImport Post /api/v3/series/import
SeriesLookupAPI ListSeriesLookup Get /api/v3/series/lookup
StaticResourceAPI Get Get /
StaticResourceAPI GetByPath Get /{path}
StaticResourceAPI GetContentByPath Get /content/{path}
StaticResourceAPI GetLogin Get /login
SystemAPI CreateSystemRestart Post /api/v3/system/restart
SystemAPI CreateSystemShutdown Post /api/v3/system/shutdown
SystemAPI GetSystemRoutes Get /api/v3/system/routes
SystemAPI GetSystemRoutesDuplicate Get /api/v3/system/routes/duplicate
SystemAPI GetSystemStatus Get /api/v3/system/status
TagAPI CreateTag Post /api/v3/tag
TagAPI DeleteTag Delete /api/v3/tag/{id}
TagAPI GetTagById Get /api/v3/tag/{id}
TagAPI ListTag Get /api/v3/tag
TagAPI UpdateTag Put /api/v3/tag/{id}
TagDetailsAPI GetTagDetailById Get /api/v3/tag/detail/{id}
TagDetailsAPI ListTagDetail Get /api/v3/tag/detail
TaskAPI GetSystemTaskById Get /api/v3/system/task/{id}
TaskAPI ListSystemTask Get /api/v3/system/task
UiConfigAPI GetUiConfig Get /api/v3/config/ui
UiConfigAPI GetUiConfigById Get /api/v3/config/ui/{id}
UiConfigAPI UpdateUiConfig Put /api/v3/config/ui/{id}
UpdateAPI ListUpdate Get /api/v3/update
UpdateLogFileAPI GetLogFileUpdateByFilename Get /api/v3/log/file/update/{filename}
UpdateLogFileAPI ListLogFileUpdate Get /api/v3/log/file/update

Documentation For Models

Documentation For Authorization

Authentication schemes defined for the API:

X-Api-Key

  • Type: API key
  • API key parameter name: X-Api-Key
  • Location: HTTP header

Note, each API key must be added to a map of map[string]APIKey where the key is: X-Api-Key and passed in as the auth context for each request.

Example

auth := context.WithValue(
		context.Background(),
		sonarr.ContextAPIKeys,
		map[string]sonarr.APIKey{
			"X-Api-Key": {Key: "API_KEY_STRING"},
		},
	)
r, err := client.Service.Operation(auth, args)

apikey

  • Type: API key
  • API key parameter name: apikey
  • Location: URL query string

Note, each API key must be added to a map of map[string]APIKey where the key is: apikey and passed in as the auth context for each request.

Example

auth := context.WithValue(
		context.Background(),
		sonarr.ContextAPIKeys,
		map[string]sonarr.APIKey{
			"apikey": {Key: "API_KEY_STRING"},
		},
	)
r, err := client.Service.Operation(auth, args)

Documentation for Utility Methods

Due to the fact that model structure members are all pointers, this package contains a number of utility functions to easily obtain pointers to values of basic types. Each of these functions takes a value of the given basic type and returns a pointer to it:

  • PtrBool
  • PtrInt
  • PtrInt32
  • PtrInt64
  • PtrFloat
  • PtrFloat32
  • PtrFloat64
  • PtrString
  • PtrTime

Author