class

Sonarr::Client

Inherits Reference < Object

Constructors

new(endpoint : String, api_key : String, read_timeout : Time::Span | Nil = nil, connect_timeout : Time::Span | Nil = nil)
Source

Class methods

default_connect_timeout

Global default connect timeout applied to clients constructed without an explicit connect_timeout (or with an explicit nil). Time to wait for a connection to be established before giving up; tunable globally.

Source
default_connect_timeout=(default_connect_timeout : Time::Span | Nil)

Global default connect timeout applied to clients constructed without an explicit connect_timeout (or with an explicit nil). Time to wait for a connection to be established before giving up; tunable globally.

Source
default_read_timeout

Global default read timeout applied to clients constructed without an explicit read_timeout (or with an explicit nil). Time to wait for the server to send response data before giving up; tunable globally.

Source
default_read_timeout=(default_read_timeout : Time::Span | Nil)

Global default read timeout applied to clients constructed without an explicit read_timeout (or with an explicit nil). Time to wait for the server to send response data before giving up; tunable globally.

Source
delete(path : String, params = {} of String => String) : String
Source
deserialize_many(body : String | Nil, type : T.class) : Array(T) forall T

Parses body into an Array(type); returns [] of T for empty/204 bodies.

Source
deserialize_one(body : String | Nil, type : T.class) : T | Nil forall T

Parses body into a single type; returns nil for empty/204 bodies.

Source
encode_body(body : Nil) : Nil

Normalizes a request body into a JSON string (or nil for no body).

Source
encode_body(body : String) : String

Normalizes a request body into a JSON string (or nil for no body).

Source
encode_body(body) : String

Normalizes a request body into a JSON string (or nil for no body).

Source
get(path : String, params = {} of String => String) : String
Source
instance
Source
post(path : String, params = {} of String => String) : String
Source
put(path : String, params = {} of String => String) : String
Source

Instance methods

connect_timeout

The effective connect timeout applied to every request.

Source
delete(path : String, params = {} of String => String) : String
Source
endpoint
Source
get(path : String, params = {} of String => String) : String
Source
post(path : String, params = {} of String => String) : String
Source
put(path : String, params = {} of String => String) : String
Source
read_timeout

The effective read timeout applied to every request.

Source
request(method : Symbol, path : String, query : Sonarr::Query | Nil = nil, body = nil) : Crest::Response

Issues method against path (relative to the configured endpoint) and returns the raw Crest::Response.

  • query — an optional Sonarr::Query of paging params / filters.
  • body — an optional request body: a String, or any object that responds to #to_json (a model or Array of models). When present the Content-Type: application/json header is added.

The apikey query param and X-Api-Key header are always attached. Non-2xx responses raise Sonarr::ApiError (wrapping crest's failure).

resp = client.request(:get, "api/v3/series", Sonarr::Query.paging(page: 1))
series = Array(Sonarr::Model::SeriesResource).from_json(resp.body)
Source
request_many(method : Symbol, path : String, type : T.class, query : Sonarr::Query | Nil = nil, body = nil) : Array(T) forall T

Requests and deserializes a JSON array of type (empty for empty bodies).

Source
request_one(method : Symbol, path : String, type : T.class, query : Sonarr::Query | Nil = nil, body = nil) : T | Nil forall T

Requests and deserializes a single object of type (nil for empty bodies).

Source