/// <summary> /// Creates a new task under the authenticated account. Makes a POST and a GET request to the Tasks resource. /// </summary> /// <param name="options">The options for the new task to be created</param> public Task CreateTask(TaskOptions options) { var request = Request("tasks", RestSharp.Method.POST); request.AddBody(options); return Execute<Task>(request); }
/// <summary> /// Creates a new task under the authenticated account. Makes both a POST and a GET request to the Tasks resource. /// </summary> /// <param name="name">The name of the task</param> /// <param name="billableByDefault">Whether the task should be billable when added to a project</param> /// <param name="isDefault">Whether the task should be added to new projects</param> /// <param name="defaultHourlyRate">The default hourly rate</param> public Task CreateTask(string name, bool billableByDefault = false, bool isDefault = false, decimal? defaultHourlyRate = null) { if (name == null) throw new ArgumentNullException("name"); var options = new TaskOptions() { Name = name, BillableByDefault = billableByDefault, IsDefault = isDefault, DefaultHourlyRate = defaultHourlyRate }; return CreateTask(options); }
/// <summary> /// Updates a task on the authenticated account. Makes a PUT and a GET request to the Tasks resource. /// </summary> /// <param name="taskId">The ID for the task to update</param> /// <param name="options">The options to be updated</param> public Task UpdateTask(long taskId, TaskOptions options) { var request = Request("tasks/" + taskId, RestSharp.Method.PUT); request.AddBody(options); return Execute<Task>(request); }
/// <summary> /// Update a task on the authenticated account. Makes a PUT and a GET request to the Tasks resource. /// </summary> /// <param name="name">The name of the task</param> /// <param name="billableByDefault">Whether the task should be billable when added to a project</param> /// <param name="isDefault">Whether the task should be added to new projects</param> /// <param name="defaultHourlyRate">The default hourly rate</param> public Task UpdateTask(long taskId, string name = null, bool? billableByDefault = null, bool? isDefault = null, decimal? defaultHourlyRate = null) { var options = new TaskOptions() { Name = name, BillableByDefault = billableByDefault, IsDefault = isDefault, DefaultHourlyRate = defaultHourlyRate }; return UpdateTask(taskId, options); }