Example #1
0
        private async Task <IEnumerable <GetTask> > GetUserTasksInternalAsync(GetUserTasksRequest request)
        {
            const string endpoint = "/api/v3/tasks/user";

            NameValueCollection queryParameters = new NameValueCollection();

            if (request.TaskType.HasValue)
            {
                queryParameters.Add("type", request.TaskType.Value.ToString("G"));
            }
            if (request.DueDate.HasValue)
            {
                queryParameters.Add("dueDate", request.DueDate.Value.ToString("o", DateTimeFormatInfo.InvariantInfo));
            }

            string path = endpoint + queryParameters.ToQueryString();
            Uri    uri  = path.ToUri();
            var    res  = await client.GetAsync(uri).Safe();

            return(res.UnwrapHabiticaResponse <IEnumerable <GetTask> >());
        }