Пример #1
0
        /// <summary>
        ///Add a task
        /// https://www.toggl.com/public/api#post_tasks
        /// </summary>
        /// <param name="t"></param>
        public async Task <Task> CreateAsync(Task t)
        {
            var response = await TogglSrv.PostAsync(_togglTasksUrl, t.ToJson()).ConfigureAwait(false);

            var data = response.GetData <Task>();

            return(data);
        }
Пример #2
0
        /// <summary>
        /// Edit a task
        /// https://www.toggl.com/public/api#put_tasks
        /// </summary>
        /// <param name="t"></param>
        public async Task <Task> UpdateAsync(Task t)
        {
            var url      = string.Format(ApiRoutes.Task.TogglTasksGet, t.Id);
            var response = await TogglSrv.PutAsync(url, t.ToJson()).ConfigureAwait(false);

            var data = response.GetData <Task>();

            return(data);
        }
Пример #3
0
        public async void MergeAsync(Task masterTask, Task slaveTask, long workspaceId, string userAgent = TogglClient.UserAgent)
        {
            if (!masterTask.Id.HasValue)
            {
                throw new InvalidOperationException("Master task Id not set");
            }

            if (!slaveTask.Id.HasValue)
            {
                throw new InvalidOperationException("Slave task Id not set");
            }

            await MergeAsync(masterTask.Id.Value, slaveTask.Id.Value, workspaceId, userAgent).ConfigureAwait(false);
        }