Exemple #1
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="navigationManager">NavigationManager (Injected)</param>
 /// <param name="apiConnector">ApiConnector (Injected)</param>
 public DeckSearchViewModel(NavigationManager navigationManager, IApiConnector apiConnector)
     : base(navigationManager, apiConnector)
 {
     PracticeDeckCommand = new NavigationCommand(navigationManager)
     {
         CommandText       = Messages.Practice,
         IsRelative        = true,
         IsEnabledFunction = (parameter) => (parameter as Deck).CardCount > 0,
         ToolTip           = Messages.PracticeCommandToolTip.FormatWith(EntityNameHelper.GetName <Deck>()),
         TargetUriFactory  = (param) => $"/{(param as Deck).DeckId}/Practice"
     };
     AddCardCommand = new NavigationCommand(navigationManager)
     {
         CommandText      = Messages.NewCard,
         IsRelative       = true,
         ToolTip          = Components.Messages.NewCommandToolTip.FormatWith(EntityNameHelper.GetName <Card>()),
         TargetUriFactory = (param) => $"/{(param as Deck).DeckId}/Cards/New"
     };
     ShowStatisticsCommand = new NavigationCommand(navigationManager)
     {
         CommandText      = Messages.PracticeStatistics,
         IsRelative       = true,
         ToolTip          = Messages.ShowStatisticsCommandToolTip.FormatWith(EntityNameHelper.GetName <Deck>()),
         TargetUriFactory = (param) => $"/{(param as Deck).DeckId}/Statistics"
     };
 }
 /// <summary>
 /// Class constructor
 /// </summary>
 /// <param name="login">user login</param>
 /// <param name="apiKey">user API key</param>
 /// <param name="apiHost">API address</param>
 /// <param name="apiConnector">API data connector</param>
 public IntisClient(string login, string apiKey, string apiHost, IApiConnector apiConnector)
     : base(apiConnector)
 {
     Login = login;
     ApiKey = apiKey;
     ApiHost = apiHost;
 }
 public ControllerList(IApiConnector connector, string baseUrl)
 {
     _baseUrl     = baseUrl;
     _connector   = connector;
     _controllers = new Hashtable();
     _services    = new Services().Services;
 }
Exemple #4
0
 public TrackerManager(IApiConnector apiConnector, IApiMapper apiMapper, ITrackerParser trackerParser, ILogger <TrackerManager> logger)
 {
     this.trackerParser = trackerParser;
     this.logger        = logger;
     this.apiConnector  = apiConnector;
     this.apiMapper     = apiMapper;
 }
Exemple #5
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="navigationManager">NavigationManager (Injected)</param>
 /// <param name="authenticationStateProvider">AuthenticationStateProvider (Injected)</param>
 /// <param name="apiConnector">API Connector (Injected)</param>
 /// <param name="changeValidator">EntityChangeValdiator (Injected)</param>
 public IdentityViewModelBase(NavigationManager navigationManager, AuthenticationStateProvider authenticationStateProvider,
                              IApiConnector apiConnector, EntityChangeValidator <User> changeValidator)
     : base(navigationManager)
 {
     this.changeValidator        = changeValidator;
     ApiConnector                = apiConnector;
     AuthenticationStateProvider = authenticationStateProvider as CustomAuthenticationStateProvider;
 }
 public InstallationPresenter(IApiConnector api, IFileSystem fs, RevisionManager revisionMgr, List <int> ids)
 {
     _api         = api;
     _fs          = fs;
     _revisionMgr = revisionMgr;
     _ids         = ids;
     _progress    = 0;
     _progresses.Add(ProgressState.Download, 0);
     _progresses.Add(ProgressState.Extraction, 0);
     _progresses.Add(ProgressState.Installation, 0);
 }
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="navigationManager">NavigationManager (Injected)</param>
 /// <param name="authenticationStateProvider">AuthenticationStateProvider (Injected)</param>
 /// <param name="apiConnector">API Connector (Injected)</param>
 /// <param name="changeValidator">EntityChangeValdiator (Injected)</param>
 public LoginViewModel(NavigationManager navigationManager, AuthenticationStateProvider authenticationStateProvider,
                       IApiConnector apiConnector, EntityChangeValidator <User> changeValidator)
     : base(navigationManager, authenticationStateProvider, apiConnector, changeValidator)
 {
     LoginAsGuestUserCommand = new Command()
     {
         ToolTip       = Messages.LoginAsGuestUserCommandToolTip,
         CommandText   = Messages.LoginAsGuestUser,
         ExecuteAction = async(parameter) => await LoginAsGuestUser()
     };
 }
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="navigationManager">NavigationManager (Injected)</param>
        /// <param name="apiConnector">ApiConnetcor (Injected)</param>
        public HomeViewModel(NavigationManager navigationManager, IApiConnector apiConnector) : base(navigationManager)
        {
            this.apiConnector = apiConnector;

            PracticeDeckCommand = new NavigationCommand(navigationManager)
            {
                IsEnabledFunction = (parameter) => (parameter as Deck).CardCount > 0,
                TargetUriFactory  = (param) => $"/Decks/{(param as Deck).DeckId}/Practice",
                CommandText       = Messages.Practice,
                ToolTip           = Messages.PracticeCommandToolTip.FormatWith(EntityNameHelper.GetName <Deck>())
            };
            AddCardCommand = new NavigationCommand(navigationManager)
            {
                TargetUriFactory = (param) => $"/Decks/{(long)param}/Cards/New",
                CommandText      = Messages.NewCard,
                ToolTip          = Components.Messages.NewCommandToolTip.FormatWith(EntityNameHelper.GetName <Card>())
            };
            ShowStatisticsCommand = new NavigationCommand(navigationManager)
            {
                TargetUriFactory = (param) => $"/Decks/{(long)param}/Statistics",
                CommandText      = Messages.PracticeStatistics,
                ToolTip          = Messages.ShowStatisticsCommandToolTip.FormatWith(EntityNameHelper.GetName <Deck>())
            };
            NewDeckCommand = new NavigationCommand(navigationManager)
            {
                CommandText = Messages.NewDeck,
                TargetUri   = "/Decks/New",
                ToolTip     = Components.Messages.NewCommandToolTip.FormatWith(EntityNameHelper.GetName <Deck>())
            };
            NewTemplateCommand = new NavigationCommand(navigationManager)
            {
                CommandText = Messages.NewTemplate,
                TargetUri   = "/Templates/New",
                ToolTip     = Components.Messages.NewCommandToolTip.FormatWith(EntityNameHelper.GetName <CardTemplate>())
            };
            SearchDecksCommand = new NavigationCommand(navigationManager)
            {
                CommandText = Messages.SearchDecks,
                TargetUri   = "/Decks",
                ToolTip     = Messages.SearchCommandToolTip.FormatWith(EntityNameHelper.GetPluralName <Deck>())
            };
            SearchTemplatesCommand = new NavigationCommand(navigationManager)
            {
                CommandText = Messages.SearchTemplates,
                TargetUri   = "/Templates",
                ToolTip     = Messages.SearchCommandToolTip.FormatWith(EntityNameHelper.GetPluralName <CardTemplate>())
            };
            SearchCardsCommand = new NavigationCommand(navigationManager)
            {
                CommandText = Messages.SearchCards,
                TargetUri   = "/Cards",
                ToolTip     = Messages.SearchCommandToolTip.FormatWith(EntityNameHelper.GetPluralName <Card>())
            };
        }
		public string EndPoint { get; set; } // private before. Changed for $extend= functionality
		//private string _extend;

		/// <summary>
		/// Creates a new instance of APIConnection
		/// </summary>
		/// <param name="conn">Instance of APIConnector</param>
		/// <param name="endPoint">Specific endpoint of API</param>
		public ApiConnection(IApiConnector conn, string endPoint)
		{
			if (conn != null && endPoint != string.Empty)
			{
				_conn = conn;
				EndPoint = endPoint;
			}
			else
			{
				throw new ArgumentException("APIConnector and/or endPoint are required");
			}
		}
        /// <summary>
        /// Initialize the connection to Penneo.
        /// </summary>
        public PenneoConnector(string key, string secret, string endpoint = null, string user = null, Dictionary <string, string> headers = null, AuthType authType = AuthType.WSSE)
        {
            _serviceLocator = new ServiceLocator();
            _setup          = new PenneoSetup(_serviceLocator);
            _setup.InitializeRestResources();
            _setup.InitializeMappings();
            _setup.InitializePostProcessors();

            _api = new ApiConnector(this, _setup.GetRestResources(), endpoint, headers, user, key, secret, authType);

            IsInitialized = true;
        }
Exemple #11
0
 /// <summary>
 /// Creates a new instance of APIConnection
 /// </summary>
 /// <param name="conn">Instance of APIConnector</param>
 /// <param name="endPoint">Specific endpoint of API</param>
 public ApiConnection(IApiConnector conn, string endPoint)
 {
     if (conn != null && endPoint != string.Empty)
     {
         _conn    = conn;
         EndPoint = endPoint;
     }
     else
     {
         throw new ArgumentException("APIConnector and/or endPoint are required");
     }
 }
Exemple #12
0
        static void Main(string[] args)
        {
            using (TikSession session = new TikSession(TikConnectorType.Api))
            {
                session.Open(HOST, USER, PASS);

                Tik4Net.Objects.System.SystemResource resource = Tik4Net.Objects.System.SystemResource.LoadInstance();


                IApiConnector apiConnector = (IApiConnector)session.Connector;

                //ip-scan example
                List <ITikEntityRow> ipScanList = apiConnector.ApiExecuteReader("/tool/ip-scan", new Dictionary <string, string>
                {
                    { "address-range", "192.168.0.0/16" },
                    { "interface", "ether1" },
                    { "duration", "120" }
                });
                foreach (ITikEntityRow row in ipScanList)
                {
                    Console.WriteLine("Address: {0}, MAC: {1}, DNS: {2}",
                                      row.GetStringValueOrNull("address", true),
                                      row.GetStringValueOrNull("mac-address", false),
                                      row.GetStringValueOrNull("dns", false));
                }

                //mac-scan sample
                List <ITikEntityRow> macScanList = apiConnector.ApiExecuteReader("/tool/mac-scan", new Dictionary <string, string>
                {
                    { "interface", "ether1" },
                    { "duration", "120" }
                });
                foreach (ITikEntityRow row in macScanList)
                {
                    Console.WriteLine("Address: {0}, MAC: {1}",
                                      row.GetStringValueOrNull("address", true),
                                      row.GetStringValueOrNull("mac-address", true));
                }

                //logging example
                apiConnector.Log("Test", Tik4Net.Objects.LogLevel.Info); //REMARKS - you should use LogList.LogDebug for this case.

                //execute scalar - select for single value
                string result = apiConnector.ApiExecuteScalar("/ip/firewall/connection/print", new Dictionary <string, string> {
                    { "count-only", "" }
                });
                Console.WriteLine(result);
            }
        }
 public void MyTestInitialize()
 {
     _connector = new ApiConnectorMock();
     _conn      = new ApiConnection(_connector, Uri + CurrentDivision + "/crm/Accounts");
 }
 public void MyTestInitialize()
 {
     _connector = new ApiConnectorMock();
     _conn = new ApiConnection(_connector, Uri + CurrentDivision + "/crm/Accounts");
 }
Exemple #15
0
 public IApiConnector ApiConnector()
 {
     return(_connector ?? (_connector = new ApiConnector(GetOAuthAuthenticationToken, GetClient())));
 }
 public AuthService(IApiConnector apiConnector)
 {
     this.apiConnector = apiConnector;
 }
Exemple #17
0
 public AnalysisService(IApiConnector apiConnector) => _apiConnector = apiConnector;
 public ControllerList(IApiConnector connector, string apiEndpoint)
 {
     _apiEndpoint = apiEndpoint;
     _connector   = connector;
     _controllers = new Hashtable();
 }
Exemple #19
0
 public static void ResetInstance()
 {
     _instance = null;
 }
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="navigationManager">NavigationManager (Injected)</param>
 /// <param name="apiConnector">ApiConnetcor (Injected)</param>
 public EntityViewModelBase(NavigationManager navigationManager, IApiConnector apiConnector)
     : base(navigationManager)
 {
     ApiConnector = apiConnector;
 }
Exemple #21
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="apiConnector">ApiConnector</param>
 public EntityCommandBase(IApiConnector apiConnector)
 {
     ApiConnector = apiConnector;
 }
Exemple #22
0
 /// <summary>
 /// Use this empty constructor for demonstration/UI design purposes
 /// </summary>
 public SynoCommand()
 {
     _connector = new DemoApiConnector(); 
 }
 public IApiConnector ApiConnector()
 {
     return _connector ?? (_connector = new ApiConnector(GetOAuthAuthenticationToken));
 }
Exemple #24
0
 /// <summary>
 /// Use this constructor to create a real connection to a Synology API
 /// </summary>
 public SynoCommand(string url, string username, string password)
 {
     _connector = new ApiConnector(url, username, password);
 }
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="navigationManager">NavigationManager (Injected)</param>
        /// <param name="authenticationStateProvider">AuthenticationStateProvider (Injected)</param>
        /// <param name="apiConnector">API Connector (Injected)</param>
        /// <param name="changeValidator">EntityChangeValdiator (Injected)</param>

        public SignupViewModel(NavigationManager navigationManager, AuthenticationStateProvider authenticationStateProvider,
                               IApiConnector apiConnector, EntityChangeValidator <User> changeValidator)
            : base(navigationManager, authenticationStateProvider, apiConnector, changeValidator)
        {
        }
 protected AClient(IApiConnector apiConnector)
 {
     ApiConnector = apiConnector ?? new HttpApiConnector();
 }
Exemple #27
0
 public TestViewModel(NavigationManager navigationManager, IApiConnector apiConnector, EntityChangeValidator <Card> changeValidator)
     : base(navigationManager, apiConnector, changeValidator)
 {
 }
Exemple #28
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="navigationManager">NavigationManager (Injected)</param>
 /// <param name="apiConnector">ApiConnector (Injected)</param>
 public CardTemplateSearchViewModel(NavigationManager navigationManager, IApiConnector apiConnector)
     : base(navigationManager, apiConnector)
 {
 }
 public ProjectService(IApiConnector apiConnector)
 {
     _apiConnector = apiConnector;
 }
Exemple #30
0
 public TestViewModel(NavigationManager navigationManager, IApiConnector apiConnector) : base(navigationManager, apiConnector)
 {
 }
Exemple #31
0
 public UserManger(IApiConnector connector)
 {
     _connector = connector;
 }
Exemple #32
0
 public BooksController(IApiConnector apiConnector, IUnitOfWork unitOfWork, IMapper mapper)
 {
     _apiConnector = apiConnector;
     _unitOfWork   = unitOfWork;
     _mapper       = mapper;
 }
 public void Setup()
 {
     _connector = new ApiConnector(GetAccessToken);
 }
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="navigationManager">NavigationManager (Injected)</param>
 /// <param name="apiConnector">ApiConnetcor (Injected)</param>
 public DeckStatisticsViewModel(NavigationManager navigationManager, IApiConnector apiConnector)
     : base(navigationManager, apiConnector)
 {
 }
Exemple #35
0
 public void Setup()
 {
     _connector = new ApiConnector(GetAccessToken, null);
 }
 public void Setup()
 {
     _toc             = new TestObjectsCreator();
     _currentDivision = _toc.GetCurrentDivision();
     _conn            = _toc.ApiConnector();
 }
Exemple #37
0
 public ApiDataConnector(IApiConnector apiConnector)
 {
     this.apiConnector = apiConnector;
 }
Exemple #38
0
 public EmployeeService(IApiConnector apiConnector) => _apiConnector = apiConnector;