Example #1
0
 public AddTvShowCommandHandler(IRequestContext context, ISonarrClient client, IAccountRepository accountRepository,
                                IAddedContentRepository addedContentRepository)
 {
     _context                = context;
     _client                 = client;
     _accountRepository      = accountRepository;
     _addedContentRepository = addedContentRepository;
 }
Example #2
0
        public async static Task <ITagManager> GenerateAsync(ISonarrClient client, bool addApiToPath)
        {
            TagManager    manager = new TagManager(client, addApiToPath);
            TagCollection tagCol  = await manager.LoadTagsAsync().ConfigureAwait(false);

            manager.AllTags = tagCol;
            return(manager);
        }
Example #3
0
 public ContentStorePreRequestUpdater(IContentStore <RadarrMovie> movieStore, IContentStore <SonarrTvShow> tvShowStore,
                                      IRadarrClient radarrClient, ISonarrClient sonarrClient)
 {
     _movieStore   = movieStore;
     _tvShowStore  = tvShowStore;
     _radarrClient = radarrClient;
     _sonarrClient = sonarrClient;
 }
Example #4
0
        private TagManager(ISonarrClient restClient, bool addApi)
        {
            if (restClient.IsAuthenticated)
            {
                if (addApi)
                {
                    this.Endpoint = "/api" + ApiEndpoints.Tag;
                }
                ID_END = this.Endpoint + ApiEndpoints.BY_ID;

                _client = restClient;
                //this.LoadTags();
            }
            else
            {
                throw new ArgumentException("The specified rest client is not properly authenticated.");
            }
        }
Example #5
0
        internal static void Initialize(ISonarrClient client, bool useApiPrefix, bool useCache)
        {
            ApiCaller = client;

            if (IsConnected)
            {
                if (useApiPrefix)
                {
                    Prefix = "/api";
                }

                InitializeAsync(ApiCaller, useApiPrefix, useCache).ConfigureAwait(false).GetAwaiter().GetResult();
            }
            else
            {
                ApiCaller = null;
            }
        }
Example #6
0
        private async static Task InitializeAsync(ISonarrClient client, bool useApiPrefix, bool useCache)
        {
            if (client.IsAuthenticated)
            {
                Task <IndexerSchemaCollection> schemaTask = GetIndexerSchemasAsync(client);
                Task <QualityDictionary>       defTask    = GetQualityDictionaryAsync(client);
                Task <ITagManager>             tagTask    = SonarrFactory.GenerateTagManagerAsync(client, useApiPrefix);

                if (!History.IsInitialized())
                {
                    History.Initialize();
                }

                NoCache = !useCache;

                IndexerSchemas = await schemaTask;
                AllQualities   = await defTask;
                TagManager     = await tagTask;
            }
        }
Example #7
0
 /// <summary>
 /// Initializes a new instance of <see cref="ITagManager"/> to manage <see cref="Tag"/> objects within Sonarr.
 /// </summary>
 /// <param name="client">The HTTP client used in all tag API operations.</param>
 /// <param name="addApiToPath">Indicates whether or not all RESTful requests should append "/api".</param>
 /// <returns>An <see cref="ITagManager"/> instance.</returns>
 public static Task <ITagManager> GenerateTagManagerAsync(ISonarrClient client, bool addApiToPath) => TagManager.GenerateAsync(client, addApiToPath);
 public GetTvShowQueueQueryHandler(ISonarrClient client)
 {
     _client = client;
 }
 public GetTvShowCalendarQueryHandler(ISonarrClient client)
 {
     _client = client;
 }
Example #10
0
        private async static Task <IndexerSchemaCollection> GetIndexerSchemasAsync(ISonarrClient client)
        {
            IRestListResponse <IndexerSchema> schResponse = await client.GetAsJsonListAsync <IndexerSchema>(GetEndpoint(ApiEndpoints.IndexerSchema));

            return(!schResponse.IsFaulted ? IndexerSchemaCollection.FromSchemas(schResponse.Content) : null);
        }
Example #11
0
        private async static Task <QualityDictionary> GetQualityDictionaryAsync(ISonarrClient client)
        {
            IRestListResponse <QualityDefinition> defResponse = await client.GetAsJsonListAsync <QualityDefinition>(GetEndpoint(ApiEndpoints.QualityDefinitions));

            return(!defResponse.IsFaulted ? new QualityDictionary(defResponse.Content.Select(x => x.Quality)) : null);
        }