/// <summary> /// Initializes a new instance of the <see cref="SonarrClient"/> class. /// </summary> /// <param name="host">The host.</param> /// <param name="port">The port.</param> /// <param name="apiKey">The API key.</param> /// <param name="urlBase">The URL base.</param> /// <param name="useSsl">if set to <c>true</c> [use SSL].</param> public SonarrClient(string host, int port, string apiKey, [Optional] string urlBase, [Optional] bool useSsl) { // Initialize properties Host = host; Port = port; ApiKey = apiKey; UrlBase = urlBase; UseSsl = useSsl; // Set API URL ApiUrl = $"http{(UseSsl ? "s" : "")}://{Host}:{Port}{("/" + UrlBase ?? "")}/api"; // Initialize endpoints Calendar = new Calendar(this); Command = new Command(this); Diskspace = new Diskspace(this); Episode = new Episode(this); EpisodeFile = new EpisodeFile(this); History = new History(this); Wanted = new Wanted(this); Queue = new Queue(this); Parse = new Parse(this); Profile = new Profile(this); Release = new Release(this); ReleasePush = new ReleasePush(this); Rootfolder = new Rootfolder(this); Series = new Series(this); SeriesLookup = new SeriesLookup(this); SystemStatus = new SystemStatus(this); SystemBackup = new SystemBackup(this); Log = new Log(this); QualityDefinition = new QualityDefinition(this); }
public void should_have_utc_date() { var body = new Dictionary <string, object>(); body.Add("guid", "sdfsdfsdf"); body.Add("title", "The.Series.S01E01"); body.Add("publishDate", DateTime.UtcNow.ToString("yyyy-MM-dd HH:mm:ssZ", CultureInfo.InvariantCulture)); var request = ReleasePush.BuildRequest(); request.AddBody(body); var result = ReleasePush.Post <ReleaseResource>(request, HttpStatusCode.OK); result.Should().NotBeNull(); result.AgeHours.Should().BeApproximately(0, 0.1); }
public void should_have_utc_date() { var body = new Dictionary <string, object>(); body.Add("title", "The Author - The Book (2008) [FLAC]"); body.Add("protocol", "Torrent"); body.Add("downloadUrl", "https://readarr.com/test.torrent"); body.Add("publishDate", DateTime.UtcNow.ToString("yyyy-MM-dd HH:mm:ssZ", CultureInfo.InvariantCulture)); var request = ReleasePush.BuildRequest(); request.AddJsonBody(body); var result = ReleasePush.Post <ReleaseResource>(request, HttpStatusCode.OK); result.Should().NotBeNull(); result.AgeHours.Should().BeApproximately(0, 0.1); }