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()));
        }
Ejemplo n.º 2
0
        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()));
        }