Example #1
0
        protected virtual void InitRestClients()
        {
            RestClient = new RestClient(RootUrl + "api/");
            RestClient.AddDefaultHeader("Authentication", ApiKey);
            RestClient.AddDefaultHeader("X-Api-Key", ApiKey);

            RestClientv3 = new RestClient(RootUrl + "api/v3/");
            RestClientv3.AddDefaultHeader("Authentication", ApiKey);
            RestClientv3.AddDefaultHeader("X-Api-Key", ApiKey);

            Blocklist         = new ClientBase <BlocklistResource>(RestClient, ApiKey);
            Commands          = new CommandClient(RestClient, ApiKey);
            DownloadClients   = new DownloadClientClient(RestClient, ApiKey);
            Episodes          = new EpisodeClient(RestClient, ApiKey);
            History           = new ClientBase <HistoryResource>(RestClient, ApiKey);
            HostConfig        = new ClientBase <HostConfigResource>(RestClient, ApiKey, "config/host");
            Indexers          = new IndexerClient(RestClient, ApiKey);
            Indexersv3        = new IndexerClient(RestClientv3, ApiKey);
            Logs              = new LogsClient(RestClient, ApiKey);
            NamingConfig      = new ClientBase <NamingConfigResource>(RestClient, ApiKey, "config/naming");
            Notifications     = new NotificationClient(RestClient, ApiKey);
            Profiles          = new ClientBase <ProfileResource>(RestClient, ApiKey);
            Releases          = new ReleaseClient(RestClient, ApiKey);
            ReleasePush       = new ReleasePushClient(RestClient, ApiKey);
            RootFolders       = new ClientBase <RootFolderResource>(RestClient, ApiKey);
            Series            = new SeriesClient(RestClient, ApiKey);
            Tags              = new ClientBase <TagResource>(RestClient, ApiKey);
            WantedMissing     = new ClientBase <EpisodeResource>(RestClient, ApiKey, "wanted/missing");
            WantedCutoffUnmet = new ClientBase <EpisodeResource>(RestClient, ApiKey, "wanted/cutoff");
        }
Example #2
0
        protected virtual void InitRestClients()
        {
            RestClient = new RestClient(RootUrl + "api/v1/");
            RestClient.AddDefaultHeader("Authentication", ApiKey);
            RestClient.AddDefaultHeader("X-Api-Key", ApiKey);

            Blacklist         = new ClientBase <BlacklistResource>(RestClient, ApiKey);
            Commands          = new CommandClient(RestClient, ApiKey);
            DownloadClients   = new DownloadClientClient(RestClient, ApiKey);
            Albums            = new AlbumClient(RestClient, ApiKey);
            Tracks            = new TrackClient(RestClient, ApiKey);
            History           = new ClientBase <HistoryResource>(RestClient, ApiKey);
            HostConfig        = new ClientBase <HostConfigResource>(RestClient, ApiKey, "config/host");
            Indexers          = new IndexerClient(RestClient, ApiKey);
            Logs              = new LogsClient(RestClient, ApiKey);
            NamingConfig      = new ClientBase <NamingConfigResource>(RestClient, ApiKey, "config/naming");
            Notifications     = new NotificationClient(RestClient, ApiKey);
            Profiles          = new ClientBase <QualityProfileResource>(RestClient, ApiKey);
            Releases          = new ReleaseClient(RestClient, ApiKey);
            ReleasePush       = new ReleasePushClient(RestClient, ApiKey);
            RootFolders       = new ClientBase <RootFolderResource>(RestClient, ApiKey);
            Artist            = new ArtistClient(RestClient, ApiKey);
            Tags              = new ClientBase <TagResource>(RestClient, ApiKey);
            WantedMissing     = new ClientBase <AlbumResource>(RestClient, ApiKey, "wanted/missing");
            WantedCutoffUnmet = new ClientBase <AlbumResource>(RestClient, ApiKey, "wanted/cutoff");
        }
Example #3
0
        public WalletRepository(IndexerClient indexer,
                                Func <Scope, ChainTable <Models.BalanceSummary> > getBalancesCacheTable,
                                CrudTableFactory tableFactory)
        {
            if (indexer == null)
            {
                throw new ArgumentNullException("indexer");
            }
            if (tableFactory == null)
            {
                throw new ArgumentNullException("tableFactory");
            }
            if (getBalancesCacheTable == null)
            {
                throw new ArgumentNullException("getBalancesCacheTable");
            }

            GetBalancesCacheTable = getBalancesCacheTable;
            _walletAddressesTable = tableFactory.GetTable <WalletAddress>("wa");
            _walletTable          = tableFactory.GetTable <WalletModel>("wm");
            _keySetTable          = tableFactory.GetTable <KeySetData>("ks");
            _keyDataTable         = tableFactory.GetTable <HDKeyData>("kd");
            Scope    = tableFactory.Scope;
            _indexer = indexer;
        }
        private static string[] GetTransactionHashes(IndexerClient indexerClient, IndexerTypes.SearchKey searchKey)
        {
            List <string> txHashes    = new();
            string?       afterCursor = null;
            int           limit       = 100;

            while (true)
            {
                var result = indexerClient.GetTransactions(searchKey, order: "desc", limit: limit, afterCursor: afterCursor);
                if (result == null || result.LastCursor == null)
                {
                    break;
                }
                afterCursor = result.LastCursor;

                foreach (var obj in result.Objects)
                {
                    txHashes.Add(obj.TxHash);
                }

                if (result.Objects.Length < limit)
                {
                    break;
                }
            }

            return(txHashes.Distinct().ToArray());
        }
Example #5
0
        public override void SetUp()
        {
            base.SetUp();

            root      = CreateOneItem <PersistableItem>(1, "The Root Page", null);
            indexer   = new IndexerClient(new Configuration.DatabaseSection());
            searcher  = new SearcherClient(persister, new Configuration.DatabaseSection());
            extractor = new TextExtractor();
        }
Example #6
0
 public ParseBlockCommandQueueConsumer(ILog log,
                                       IAssetDefinitionParsedBlockRepository assetDefinitionParsedBlockRepository,
                                       IAssetDefinitionCommandProducer assetDefinitionCommandProducer,
                                       IndexerClient indexerClient, IConsole console)
 {
     _log = log;
     _assetDefinitionParsedBlockRepository = assetDefinitionParsedBlockRepository;
     _assetDefinitionCommandProducer       = assetDefinitionCommandProducer;
     _indexerClient = indexerClient;
     _console       = console;
 }
Example #7
0
        public JsonResult insight(MediaSearchCriteria searchCriteria)
        {
            JObject       results       = null;
            string        authToken     = homeController.GetAuthToken(this.Request, this.Response);
            IndexerClient indexerClient = new IndexerClient(authToken);

            if (indexerClient.IndexerEnabled)
            {
                results = indexerClient.Search(searchCriteria);
            }
            return(Json(results));
        }
Example #8
0
 private void InitRestClients()
 {
     RestClient = new RestClient("http://localhost:8989/api");
     Series = new SeriesClient(RestClient, _runner.ApiKey);
     Releases = new ReleaseClient(RestClient, _runner.ApiKey);
     RootFolders = new ClientBase<RootFolderResource>(RestClient, _runner.ApiKey);
     Commands = new ClientBase<CommandResource>(RestClient, _runner.ApiKey);
     History = new ClientBase<HistoryResource>(RestClient, _runner.ApiKey);
     Indexers = new IndexerClient(RestClient, _runner.ApiKey);
     Episodes = new EpisodeClient(RestClient, _runner.ApiKey);
     NamingConfig = new ClientBase<NamingConfigResource>(RestClient, _runner.ApiKey, "config/naming");
 }
Example #9
0
 private void InitRestClients()
 {
     RestClient   = new RestClient("http://localhost:8989/api");
     Series       = new SeriesClient(RestClient);
     Releases     = new ReleaseClient(RestClient);
     RootFolders  = new ClientBase <RootFolderResource>(RestClient);
     Commands     = new ClientBase <CommandResource>(RestClient);
     History      = new ClientBase <HistoryResource>(RestClient);
     Indexers     = new IndexerClient(RestClient);
     Episodes     = new EpisodeClient(RestClient);
     NamingConfig = new ClientBase <NamingConfigResource>(RestClient, "config/naming");
 }
Example #10
0
 private void InitRestClients()
 {
     RestClient    = new RestClient(RootUrl + "api/");
     Series        = new SeriesClient(RestClient, _runner.ApiKey);
     Releases      = new ReleaseClient(RestClient, _runner.ApiKey);
     RootFolders   = new ClientBase <RootFolderResource>(RestClient, _runner.ApiKey);
     Commands      = new ClientBase <CommandResource>(RestClient, _runner.ApiKey);
     History       = new ClientBase <HistoryResource>(RestClient, _runner.ApiKey);
     Indexers      = new IndexerClient(RestClient, _runner.ApiKey);
     Episodes      = new EpisodeClient(RestClient, _runner.ApiKey);
     NamingConfig  = new ClientBase <NamingConfigResource>(RestClient, _runner.ApiKey, "config/naming");
     Notifications = new NotificationClient(RestClient, _runner.ApiKey);
 }
Example #11
0
        public JArray GetAccounts()
        {
            JArray accounts  = null;
            string authToken = homeController.GetAuthToken(this.Request, this.Response);

            if (!string.IsNullOrEmpty(authToken))
            {
                IndexerClient indexerClient = new IndexerClient(authToken);
                if (indexerClient.IndexerEnabled)
                {
                    accounts = indexerClient.GetAccounts();
                }
            }
            return(accounts);
        }
Example #12
0
        private Block GetHeader(uint256 hash, IndexerClient client)
        {
            var header = Chain.GetBlock(hash);

            if (header == null)
            {
                var b = client.GetBlock(hash);
                if (b == null)
                {
                    return(null);
                }
                return(new Block(b.Header));
            }
            return(new Block(header.Header));
        }
Example #13
0
        public JObject GetInsight(string indexId, string languageId, bool processingState)
        {
            JObject index     = null;
            string  authToken = homeController.GetAuthToken(this.Request, this.Response);

            if (!string.IsNullOrEmpty(authToken))
            {
                IndexerClient indexerClient = new IndexerClient(authToken);
                if (indexerClient.IndexerEnabled)
                {
                    index = indexerClient.GetIndex(indexId, languageId, processingState);
                }
            }
            return(index);
        }
Example #14
0
        public void DeleteVideo(string indexId, bool deleteInsight)
        {
            string authToken = homeController.GetAuthToken(this.Request, this.Response);

            if (!string.IsNullOrEmpty(authToken))
            {
                IndexerClient indexerClient = new IndexerClient(authToken);
                if (indexerClient.IndexerEnabled)
                {
                    indexerClient.DeleteVideo(indexId, deleteInsight);
                }

                DocumentClient documentClient = new DocumentClient();
                string         collectionId   = Constant.Database.Collection.ContentInsight;
                documentClient.DeleteDocument(collectionId, indexId);
            }
        }
        protected virtual void InitRestClients()
        {
            RestClient = new RestClient(RootUrl + "api/v1/");
            RestClient.AddDefaultHeader("Authentication", ApiKey);
            RestClient.AddDefaultHeader("X-Api-Key", ApiKey);
            RestClient.UseSystemTextJson();

            Commands      = new CommandClient(RestClient, ApiKey);
            Tasks         = new ClientBase <TaskResource>(RestClient, ApiKey, "system/task");
            History       = new ClientBase <HistoryResource>(RestClient, ApiKey);
            HostConfig    = new ClientBase <HostConfigResource>(RestClient, ApiKey, "config/host");
            Indexers      = new IndexerClient(RestClient, ApiKey);
            Logs          = new LogsClient(RestClient, ApiKey);
            Notifications = new NotificationClient(RestClient, ApiKey);

            //Releases = new ReleaseClient(RestClient, ApiKey);
            Tags = new ClientBase <TagResource>(RestClient, ApiKey);
        }
Example #16
0
 public WalletRepository(IndexerClient indexer,
                         CrudTableFactory tableFactory)
 {
     if (indexer == null)
     {
         throw new ArgumentNullException("indexer");
     }
     if (tableFactory == null)
     {
         throw new ArgumentNullException("tableFactory");
     }
     _walletAddressesTable = tableFactory.GetTable <WalletAddress>("wa");
     _walletTable          = tableFactory.GetTable <WalletModel>("wm");
     _keySetTable          = tableFactory.GetTable <KeySetData>("ks");
     _keyDataTable         = tableFactory.GetTable <HDKeyData>("kd");
     Scope    = tableFactory.Scope;
     _indexer = indexer;
 }
Example #17
0
        protected virtual void InitRestClients()
        {
            RestClient = new RestClient(RootUrl + "api/");
            RestClient.AddDefaultHeader("Authentication", ApiKey);
            RestClient.AddDefaultHeader("X-Api-Key", ApiKey);

            Blacklist       = new ClientBase <BlacklistResource>(RestClient, ApiKey);
            Commands        = new CommandClient(RestClient, ApiKey);
            DownloadClients = new DownloadClientClient(RestClient, ApiKey);
            Episodes        = new EpisodeClient(RestClient, ApiKey);
            History         = new ClientBase <HistoryResource>(RestClient, ApiKey);
            Indexers        = new IndexerClient(RestClient, ApiKey);
            NamingConfig    = new ClientBase <NamingConfigResource>(RestClient, ApiKey, "config/naming");
            Notifications   = new NotificationClient(RestClient, ApiKey);
            Releases        = new ReleaseClient(RestClient, ApiKey);
            RootFolders     = new ClientBase <RootFolderResource>(RestClient, ApiKey);
            Series          = new SeriesClient(RestClient, ApiKey);
            Tags            = new ClientBase <TagResource>(RestClient, ApiKey);
        }
Example #18
0
        public IActionResult OnGet(string address)
        {
            IndexerClient indexerClient = IndexerRpc();

            string prefix = AddressPrefix();
            Script lockScript;

            try
            {
                lockScript = Address.ParseAddress(address, prefix);
            }
            catch
            {
                return(NotFound());
            }

            SearchKey    searchKey    = new(lockScript, "lock");
            CellCapacity?cellCapacity = indexerClient.GetCellsCapacity(searchKey);
            UInt64       balance      = 0;

            if (cellCapacity != null)
            {
                balance = Hex.HexToUInt64(cellCapacity.Capacity);
            }

            int cellsCount = GetCellsCount(indexerClient, searchKey);

            AddressResult = new()
            {
                AddressHash    = address,
                LockScript     = lockScript,
                Balance        = balance.ToString(),
                LiveCellsCount = cellsCount.ToString(),
            };

            return(Page());
        }
Example #19
0
        private async Task LoadChain(QBitNinjaConfiguration configuration, IndexerClient client, ConcurrentChain chain, ChainSynchronizeStatus status)
        {
            await Task.Delay(1).ConfigureAwait(false);

            LoadCache(chain, configuration.LocalChain, configuration.Indexer.Network);
            status.FileCachedHeight = chain.Height;
            var changes = client.GetChainChangesUntilFork(chain.Tip, false);

            try
            {
                await changes.UpdateChain(chain, _Cts.Token);
            }
            catch (ArgumentException) //Happen when chain in table is corrupted
            {
                client.Configuration.GetChainTable().DeleteIfExists();
                for (int i = 0; i < 20; i++)
                {
                    try
                    {
                        if (client.Configuration.GetChainTable().CreateIfNotExists())
                        {
                            break;
                        }
                    }
                    catch
                    {
                    }
                    await Task.Delay(10000);
                }
                status.ReindexHeaders = true;
                await client.Configuration.CreateIndexer().IndexChain(chain, _Cts.Token);
            }
            status.TableFetchedHeight = chain.Height;
            SaveChainCache(chain, configuration.LocalChain);
            status.Synchronizing = false;
            Interlocked.Decrement(ref _UpdateChain);
        }
Example #20
0
        private static int GetCellsCount(IndexerClient indexerClient, SearchKey searchKey)
        {
            string?afterCursor = null;
            int    totalCount  = 0;
            int    limit       = 100;

            while (true)
            {
                var result = indexerClient.GetCells(searchKey, limit: limit, afterCursor: afterCursor);
                if (result == null || result.LastCursor == null)
                {
                    break;
                }
                afterCursor = result.LastCursor;
                int count = result.Objects.Length;
                totalCount += count;
                if (count < limit)
                {
                    break;
                }
            }

            return(totalCount);
        }
 public IndexerBlocksRepository(IndexerClient client)
 {
     _Client = client;
 }
Example #22
0
 public BlockService(AppSettings settings, IndexerClient indexerClient)
 {
     _settings      = settings;
     _indexerClient = indexerClient;
 }
        protected virtual void InitRestClients()
        {
            RestClient = new RestClient(RootUrl + "api/");
            RestClient.AddDefaultHeader("Authentication", ApiKey);
            RestClient.AddDefaultHeader("X-Api-Key", ApiKey);

            Blacklist = new ClientBase<BlacklistResource>(RestClient, ApiKey);
            Commands = new CommandClient(RestClient, ApiKey);
            DownloadClients = new DownloadClientClient(RestClient, ApiKey);
            Episodes = new EpisodeClient(RestClient, ApiKey);
            History = new ClientBase<HistoryResource>(RestClient, ApiKey);
            HostConfig = new ClientBase<HostConfigResource>(RestClient, ApiKey, "config/host");
            Indexers = new IndexerClient(RestClient, ApiKey);
            NamingConfig = new ClientBase<NamingConfigResource>(RestClient, ApiKey, "config/naming");
            Notifications = new NotificationClient(RestClient, ApiKey);
            Profiles = new ClientBase<ProfileResource>(RestClient, ApiKey);
            Releases = new ReleaseClient(RestClient, ApiKey);
            RootFolders = new ClientBase<RootFolderResource>(RestClient, ApiKey);
            Series = new SeriesClient(RestClient, ApiKey);
            Tags = new ClientBase<TagResource>(RestClient, ApiKey);
            WantedMissing = new ClientBase<EpisodeResource>(RestClient, ApiKey, "wanted/missing");
            WantedCutoffUnmet = new ClientBase<EpisodeResource>(RestClient, ApiKey, "wanted/cutoff");
        }
Example #24
0
        public BlockAdapter()
        {
            var configuration = IndexerConfiguration.FromConfiguration();

            _client = new IndexerClient(configuration);
        }
 public MainChainService(IndexerClient indexerClient)
 {
     _indexerClient = indexerClient;
 }
Example #26
0
        private void InitRestClients()
        {
            RestClient = new RestClient(RootUrl + "api/");
            RestClient.AddDefaultHeader("Authentication", _runner.ApiKey);
            RestClient.AddDefaultHeader("X-Api-Key", _runner.ApiKey);

            Series = new SeriesClient(RestClient, _runner.ApiKey);
            Releases = new ReleaseClient(RestClient, _runner.ApiKey);
            RootFolders = new ClientBase<RootFolderResource>(RestClient, _runner.ApiKey);
            Commands = new ClientBase<CommandResource>(RestClient, _runner.ApiKey);
            History = new ClientBase<HistoryResource>(RestClient, _runner.ApiKey);
            Indexers = new IndexerClient(RestClient, _runner.ApiKey);
            Episodes = new EpisodeClient(RestClient, _runner.ApiKey);
            NamingConfig = new ClientBase<NamingConfigResource>(RestClient, _runner.ApiKey, "config/naming");
            Notifications = new NotificationClient(RestClient, _runner.ApiKey);
        }