public override Data.IMarketData Execute(IRestConnection connection)
        {
            this._connection = connection;
            //Add headers for private request

            //RequestHeaders.Add( )

            
            return base.Execute(connection);
        }
예제 #2
0
        public MyPlexConnection(IRestConnection restConnection)
        {
            _restConnection = restConnection;
            _devices        = new ObservableCollectionEx <Device>();
            _servers        = new ObservableCollectionEx <Device>();
            _players        = new ObservableCollectionEx <Device>();

            Devices = new ReadOnlyObservableCollection <Device>(_devices);
            Servers = new ReadOnlyObservableCollection <Device>(_servers);
            Players = new ReadOnlyObservableCollection <Device>(_players);
        }
예제 #3
0
        private ManagementClient(string baseUrl, IRestConnection restConnection)
        {
            restConnection.Setup(baseUrl, null);

            User    = new UserManagementClient(baseUrl, restConnection);
            Company = new CompanyManagementClient(restConnection);
            Service = new ServiceManagementClient(restConnection);
            Network = new NetworkManagementClient(restConnection);
            Device  = new DeviceManagementClient(restConnection);
            TelemetryDataSinksMetadata = new TelemetryDataSinksMetadataClient(restConnection);
        }
        public MyPlexConnection(IRestConnection restConnection)
        {
            _restConnection = restConnection;
            _devices = new ObservableCollectionEx<Device>();
            _servers = new ObservableCollectionEx<Device>();
            _players = new ObservableCollectionEx<Device>();

            Devices = new ReadOnlyObservableCollection<Device>(_devices);
            Servers = new ReadOnlyObservableCollection<Device>(_servers);
            Players = new ReadOnlyObservableCollection<Device>(_players);
        }
예제 #5
0
 public ClassAndGradeViewModel(IRestConnection restConnection)
 {
     this.restConnection = restConnection;
     this.editorFactory  = new DataFormEditorFactory <ClassAndGradeEditor>();
     Items         = new ObservableCollection <ClassAndGradeModel>();
     QueryCommand  = new DelegateCommand(QueryOp);
     AddCommand    = new DelegateCommand(AddOp);
     EditCommand   = new DelegateCommand(EditOp);
     DeleteCommand = new DelegateCommand(DeleteOp);
     GetAllFaculties();
 }
예제 #6
0
        /// <summary>
        /// Executes the specified request.
        /// </summary>
        /// <param name="request">The request.</param>
        /// <param name="restConnection">The rest connection.</param>
        /// <returns>Task&lt;RestResponse&gt;.</returns>
        /// <summary>
        /// Executes the specified request.
        /// </summary>
        /// <param name="request">The request.</param>
        /// <param name="restConnection">The rest connection.</param>
        /// <returns>Task&lt;RestResponse&gt;.</returns>
        public async Task <RestResponse> Execute(RestRequest request, IRestConnection restConnection)
        {
            var client = await BuildRestClient(restConnection);

            var restRequest  = _mapper.Map <RestSharpRestRequest>(request);
            var restResponse = await client.ExecuteTaskAsync(restRequest);

            var response = _mapper.Map <Rest.RestResponse>(restResponse);

            NormalizeErrorsToExceptions(restResponse, response);
            return(response);
        }
예제 #7
0
 public IcCardViewModel(IRestConnection restConnection)
 {
     this.restConnection = restConnection;
     this.editorFactory  = new DataFormEditorFactory <IcCardEditor>();
     Items         = new ObservableCollection <IcCardModel>();
     QueryCommand  = new DelegateCommand(QueryOp);
     AddCommand    = new DelegateCommand(AddOp);
     EditCommand   = new DelegateCommand(EditOp);
     DeleteCommand = new DelegateCommand(DeleteOp);
     GetAllFaculties();
     InitIcCardTypes();
     InitSexTypes();
 }
        public override IMarketData Execute(IRestConnection connection)
        {
            this._connection = connection;
            string pair = Pair.ToString();

            RestParameters.Add("pair", pair);
            if (SinceTimeUTC_Epoch_e9 != 0)
                RestParameters.Add("since", Convert.ToString(SinceTimeUTC_Epoch_e9));

            TradesResponse tr = restRequest<TradesResponse>();

            return tr.ToMarketData();
        }
        public ConnectionManager(ITimer timer, ILocalServerDiscovery localServerDiscovery,
                                 IRestConnection restConnection, IMyPlexConnection myPlexConnection, ITvdbCache tvdbCache,
                                 ITmdbCache tmdbCache, INowPlaying nowPlaying)
        {
            _timer            = timer;
            _restConnection   = restConnection;
            _myPlexConnection = myPlexConnection;
            _tvdbCache        = tvdbCache;
            _tmdbCache        = tmdbCache;

            _localServerDiscovery = localServerDiscovery;
            _localServerDiscovery.ServerDiscovered += LocalServerDiscoveryOnServerDiscovered;

            ServerConnections = new ReadOnlyObservableCollection <ServerConnection>(_allServerConnections);

            NowPlaying = nowPlaying;
        }
        public ConnectionManager(ITimer timer, ILocalServerDiscovery localServerDiscovery,
            IRestConnection restConnection, IMyPlexConnection myPlexConnection, ITvdbCache tvdbCache, 
            ITmdbCache tmdbCache, INowPlaying nowPlaying)
        {
            _timer = timer;
            _restConnection = restConnection;
            _myPlexConnection = myPlexConnection;
            _tvdbCache = tvdbCache;
            _tmdbCache = tmdbCache;

            _localServerDiscovery = localServerDiscovery;
            _localServerDiscovery.ServerDiscovered += LocalServerDiscoveryOnServerDiscovered;

            ServerConnections = new ReadOnlyObservableCollection<ServerConnection>(_allServerConnections);

            NowPlaying = nowPlaying;
        }
예제 #11
0
        /// <summary>
        /// Executes the specified request.
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="request">The request.</param>
        /// <param name="restConnection">The rest connection.</param>
        /// <returns>Task&lt;RestResponse&lt;T&gt;&gt;.</returns>
        /// <summary>
        /// Executes the specified request.
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="request">The request.</param>
        /// <param name="restConnection">The rest connection.</param>
        /// <returns>Task&lt;RestResponse&lt;T&gt;&gt;.</returns>
        public Rest.RestResponse <T> ExecuteSync <T>(RestRequest request, IRestConnection restConnection)
            where T : class, new()
        {
            var client      = BuildRestClientSync(restConnection);
            var restRequest = _mapper.Map <RestSharpRestRequest>(request);


            //
            // make the REST request and wait for the response
            //
            var restResponse = client.Execute <T>(restRequest, (Method)Enum.Parse(typeof(Method), request.Method.ToString()));


            var response = _mapper.Map <Rest.RestResponse <T> >(restResponse);

            NormalizeErrorsToExceptions(restResponse, response);
            return(response);
        }
예제 #12
0
        private static RestSharpRestClient BuildRestClientSync(IRestConnection restConnection)
        {
            var client = new RestSharpRestClient
            {
                BaseUrl       = restConnection.BaseUrl,
                Timeout       = restConnection.Timeout,
                Authenticator = restConnection.AuthenticateSync <IAuthenticator>()
            };

            // use Newtonsoft's for a) proper handling of DateTimeOffset types, b) performance and c) extensability
            client.AddHandler("application/json", NewtonsoftJsonSerializer.Default);
            client.AddHandler("text/json", NewtonsoftJsonSerializer.Default);
            client.AddHandler("text/x-json", NewtonsoftJsonSerializer.Default);
            client.AddHandler("text/javascript", NewtonsoftJsonSerializer.Default);
            client.AddHandler("*+json", NewtonsoftJsonSerializer.Default);

            return(client);
        }
예제 #13
0
        /// <summary>
        /// Executes the specified request.
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="request">The request.</param>
        /// <param name="restConnection">The rest connection.</param>
        /// <returns>Task&lt;RestResponse&lt;T&gt;&gt;.</returns>
        /// <summary>
        /// Executes the specified request.
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="request">The request.</param>
        /// <param name="restConnection">The rest connection.</param>
        /// <returns>Task&lt;RestResponse&lt;T&gt;&gt;.</returns>
        public async Task <Rest.RestResponse <T> > Execute <T>(RestRequest request, IRestConnection restConnection)
        {
            var client = await BuildRestClient(restConnection);

            var restRequest = _mapper.Map <RestSharpRestRequest>(request);


            //
            // make the REST request and wait for the response
            //
            var restResponse = await client.ExecuteTaskAsync <T>(restRequest);


            var response = _mapper.Map <Rest.RestResponse <T> >(restResponse);

            NormalizeErrorsToExceptions(restResponse, response);
            return(response);
        }
예제 #14
0
        public void LoginOp(object o)
        {
            string          msg;
            IRestConnection restCon = container.Resolve <IRestConnection>(new ParameterOverride("baseUrl", Config.GetConfig <string>("ServiceAddress")));
            //new RestConnection(Config.GetConfig<string>("ServiceAddress"));
            string password = (o as RadPasswordBox)?.Password;

            if (restCon.Login(@"/Account/Login", "LoginName", username, "Password", password, out msg))
            {
                RaiseLoginCompleted();
            }
            else
            {
                RadWindow.Alert(new DialogParameters
                {
                    OkButtonContent = "确定",
                    Content         = msg,
                    Owner           = App.Current.MainWindow,
                    Header          = "错误"
                });
            }
        }
예제 #15
0
 public PlexServerConnection(IRestConnection restConnection, Device device, PlexUser user = null)
     : this(restConnection)
 {
     User   = user;
     Device = device;
 }
예제 #16
0
 private PlexServerConnection(IRestConnection restConnection)
 {
     _restConnection = restConnection;
     NowPlaying      = new ReadOnlyObservableCollection <Video>(_nowPlaying);
     Clients         = new ReadOnlyObservableCollection <Server>(_clients);
 }
예제 #17
0
 internal NetworkClient(string baseUrl, IRestConnection restConnection)
 {
     _baseUrl        = baseUrl;
     _restConnection = restConnection;
 }
예제 #18
0
 public TmdbConnection(IRestConnection restConnection, string apiKey)
 {
     _restConnection = restConnection;
     _apiKey         = apiKey;
 }
예제 #19
0
 public CategoriesDataService(IRestConnection restConnection, ILocalDatabase localDb)
 {
     _restConnection = restConnection;
     _localDb        = localDb;
 }
예제 #20
0
 public TvdbConnection(IRestConnection restConnection)
 {
     _restConnection = restConnection;
 }
예제 #21
0
 public ImageHelper(IRestConnection restConnection)
 {
     _restConnection = restConnection;
 }
예제 #22
0
 internal DeviceClient(string baseUrl, IRestConnection restConnection)
 {
     _baseUrl        = baseUrl;
     _restConnection = restConnection;
 }
예제 #23
0
 public TvdbConnection(IRestConnection restConnection)
 {
     _restConnection = restConnection;
 }
예제 #24
0
 public TmdbConnection(IRestConnection restConnection, string apiKey)
 {
     _restConnection = restConnection;
     _apiKey = apiKey;
 }
예제 #25
0
 public PlexServerConnection(IRestConnection restConnection, string uri, PlexUser user = null)
     : this(restConnection)
 {
     User          = user;
     ConnectionUri = TidyUrl(uri);
 }
예제 #26
0
 internal TelemetryDataSinksMetadataClient(IRestConnection restConnection)
     : base(restConnection)
 {
 }
예제 #27
0
 private OccasionallyConnectionClient(string baseUrl, string deviceId, string apiKey, IRestConnection restConnection)
 {
     _restConnection = restConnection;
     _restConnection.Setup(baseUrl, new Dictionary <string, string>
     {
         { "X-DeviceId", deviceId },
         { "X-ApiKey", apiKey }
     });
 }
예제 #28
0
 /// <summary>
 /// Initializes a new instance of the <see cref="RestContext"/> class.
 /// </summary>
 /// <param name="restConnection">The rest connection.</param>
 /// <param name="restClient">The rest client.</param>
 public RestContext(IRestConnection restConnection, IRestClient restClient)
 {
     _restConnection = restConnection;
     _restClient     = restClient;
 }
예제 #29
0
 internal NetworkManagementClient(IRestConnection restConnection) : base(restConnection)
 {
 }
예제 #30
0
 internal UserManagementClient(string baseUrl, IRestConnection restConnection) : base(restConnection)
 {
     _baseUrl    = baseUrl;
     _isLoggedIn = false;
 }
예제 #31
0
 internal DeviceManagementClient(IRestConnection restConnection) : base(restConnection)
 {
 }
예제 #32
0
 protected SpecificManagementClient(IRestConnection restConnection)
 {
     RestConnection = restConnection;
 }
예제 #33
0
 internal CompanyManagementClient(IRestConnection restConnection) : base(restConnection)
 {
 }