/// <summary> /// Change task mode /// </summary> /// <param name="apiSession">api session</param> /// <param name="taskId">task guid</param> /// <param name="taskChangeModeRequest"></param> /// <param name="cancellationToken">cancellation token</param> /// <returns>Returns task status</returns> public Task <SpaceTask> TaskChangeModeAsync(ApiSession apiSession, Guid taskId, TaskChangeModeRequest taskChangeModeRequest, CancellationToken cancellationToken) { if (apiSession == null) { throw new ArgumentNullException(nameof(apiSession)); } if (taskChangeModeRequest is null) { throw new ArgumentNullException(nameof(taskChangeModeRequest)); } return(Wrapped(async(token) => { var request = new SpaceTaskChangeModeRequestDto { TaskEnabled = taskChangeModeRequest.TaskEnabled }; var apiResult = await _lowLevelApiClient.TaskChangeModeAsync(apiSession, taskId, request, token); return MapOrFail(apiResult, (dto) => SpaceTaskMapper.MapFull(dto)); }, cancellationToken, OperationType.ShortOperation)); }
public Task <ApiResult <TaskFullDto> > TaskChangeModeAsync(ApiSession apiSession, Guid taskId, SpaceTaskChangeModeRequestDto requestDto, CancellationToken cancellationToken) { if (apiSession == null) { throw new ArgumentNullException(nameof(apiSession)); } var spaceName = apiSession.SpaceName; var url = UrlHelper.JoinUrl("space", spaceName, "tasks", taskId.ToString("D"), "changeMode"); return(apiClient.PostAsync <SpaceTaskChangeModeRequestDto, TaskFullDto>(url, requestDto, null, apiSession.ToHeadersCollection(), cancellationToken)); }