示例#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);
        }
示例#2
0
 private TodoistClient()
 {
     _restClient = new TodoistRestClient();
 }
示例#3
0
 internal TodoistClient(ITodoistRestClient restClient)
 {
     _restClient = restClient ?? throw new ArgumentNullException(nameof(restClient));
 }
示例#4
0
 /// <summary>
 /// Initializes a new instance of the <see cref="TodoistTokenlessClient" /> class.
 /// </summary>
 /// <param name="restClient">The rest client.</param>
 public TodoistTokenlessClient(ITodoistRestClient restClient)
 {
     _todoistClient = new TodoistClient(restClient);
 }