public async Task <DC_ListTaskForAnAppResponse> GetAllTaskForAnApp(DC_ListTaskForAnAppRequest listTaskforAppRequest) { UriBuilder uriBuilder = new UriBuilder(this.Client.CloudTarget); var queryParams = ((listTaskforAppRequest != null) && (listTaskforAppRequest.BuildQueryParams().Length > 0)) ? listTaskforAppRequest.BuildQueryParams() : string.Empty; uriBuilder.Path = $"/v3/apps/{listTaskforAppRequest.AppGuid}/tasks"; if (!string.IsNullOrWhiteSpace(queryParams)) { uriBuilder.Query = queryParams; } var client = this.GetHttpClient(); client.Uri = uriBuilder.Uri; client.Method = HttpMethod.Get; var authHeader = await BuildAuthenticationHeader(); if (!string.IsNullOrWhiteSpace(authHeader.Key)) { if (client.Headers.ContainsKey(authHeader.Key)) { client.Headers[authHeader.Key] = authHeader.Value; } else { client.Headers.Add(authHeader); } } var expectedReturnStatus = 200; var response = await this.SendAsync(client, expectedReturnStatus); return(Utilities.DeserializeJson <DC_ListTaskForAnAppResponse>(await response.ReadContentAsStringAsync())); }
public async Task <DC_ListTaskForAnAppResponse> GetAllTaskForAnApp(DC_ListTaskForAnAppRequest listTaskforAppRequest) { UriBuilder uriBuilder = new UriBuilder(this.Client.CloudTarget); var queryParams = ((listTaskforAppRequest != null) && (listTaskforAppRequest.BuildQueryParams().Length > 0)) ? "?" + listTaskforAppRequest.BuildQueryParams() : string.Empty; uriBuilder.Path = $"/v3/apps/{listTaskforAppRequest.AppGuid}/tasks{queryParams}"; var client = this.GetHttpClient(); client.Uri = uriBuilder.Uri; client.Method = HttpMethod.Get; var expectedReturnStatus = 200; var response = await this.SendAsync(client, expectedReturnStatus); return(Utilities.DeserializeJson <DC_ListTaskForAnAppResponse>(await response.Content.ReadAsStringAsync())); }
public async Task <DC_ListTaskForAnAppResponse> ListAppTaskAsync(Guid appGuid, string statesCsv) { var request = new DC_ListTaskForAnAppRequest { AppGuid = appGuid.ToString(), TaskStates = statesCsv }; try { var response = await _cfV3Client.TaskResource.GetAllTaskForAnApp(request); return(response); } catch (Exception ex) { _logger.LogError($"Error {ex.Message} and Stack trace {ex.StackTrace}"); throw; } }