Beispiel #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="TodoistClient" /> class.
        /// </summary>
        /// <param name="token">The token.</param>
        /// <param name="restClient">The rest client.</param>
        /// <exception cref="System.ArgumentException">Value cannot be null or empty - token</exception>
        public TodoistClient(string token, ITodoistRestClient restClient)
        {
            if (string.IsNullOrEmpty(token))
            {
                throw new ArgumentException("Value cannot be null or empty.", nameof(token));
            }

            _token      = token;
            _restClient = restClient;

            Projects      = new ProjectsService(this);
            Templates     = new TemplateService(this);
            Items         = new ItemsService(this);
            Labels        = new LabelsService(this);
            Notes         = new NotesService(this);
            Uploads       = new UploadService(this);
            Filters       = new FiltersService(this);
            Activity      = new ActivityService(this);
            Notifications = new NotificationsService(this);
            Backups       = new BackupService(this);
            Reminders     = new RemindersService(this);
            Users         = new UsersService(this);
            Sharing       = new SharingService(this);
            Emails        = new EmailService(this);
            Sections      = new SectionService(this);
        }
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="apiKey">The api key credential</param>
        public WistiaDataClient(string apiKey)
        {
            if (string.IsNullOrWhiteSpace(apiKey)) throw new ArgumentNullException(apiKey);

            Account = new AccountService(apiKey);
            Projects = new ProjectService(apiKey);
            Sharings = new SharingService(apiKey);
            Media = new MediaService(apiKey);
        }
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="apiKey">The api key credential</param>
        public WistiaDataClient(string apiKey)
        {
            if (string.IsNullOrWhiteSpace(apiKey))
            {
                throw new ArgumentNullException(apiKey);
            }

            Account  = new AccountService(apiKey);
            Projects = new ProjectService(apiKey);
            Sharings = new SharingService(apiKey);
            Media    = new MediaService(apiKey);
        }
Beispiel #4
0
        public ISharingService RegisterSharingService()
        {
            if (GetBindings(typeof(ISharingService)).Any())
            {
                return(this.Get <ISharingService>());
            }

            var sharingService = new SharingService();

            Bind <ISharingService>().ToConstant(sharingService).InSingletonScope();

            return(sharingService);
        }
Beispiel #5
0
        private async void GetDataAction(object deviceId)
        {
            var device  = GlobalDataModel.Instance.Devices.Select(x => x).Where(x => x.Id == (int)deviceId).FirstOrDefault();
            var newData = await RestService.GetDataAsync(device.Address);

            if (newData != null)
            {
                DataModel      model = JsonConvert.DeserializeObject <DataModel>(newData);
                SharingService ss    = new SharingService();
                ss.ReceiveStructureData(model, device.Name);
            }
            else
            {
                await Application.Current.Dispatcher.BeginInvoke(DispatcherPriority.Background, new Action(() => MessageBox.Show("Getting data from device " + device.Name + " failed.", "Connection failed", MessageBoxButton.OK, MessageBoxImage.Stop)));
            }
        }
Beispiel #6
0
        public HttpResponseMessage Post(DataModel model)
        {
            //Application.Current.Dispatcher.BeginInvoke(DispatcherPriority.Background,
            //    new Action(() => GlobalDataModel.Instance.LoadModel(model)));

            string deviceName = string.Empty;

            if (Request.Headers.Contains(Headers.REST_HEADER_NAME))
            {
                deviceName = Request.Headers.GetValues(Headers.REST_HEADER_NAME).First();
            }

            SharingService ss = new SharingService();

            ss.ReceiveStructureData(model, deviceName);

            var response = Request.CreateResponse(System.Net.HttpStatusCode.OK);

            AddResponseHeaders(response);
            return(response);
        }
 public ShareController(SharingService sharingService, DocumentService documentService, EmailSender emailSender)
 {
     _sharingService  = sharingService;
     _documentService = documentService;
     _emailSender     = emailSender;
 }