public async Task <DC_GetTaskResponse> GetTaskByGuid(DC_GetTaskRequest getTaskRequest)
        {
            UriBuilder uriBuilder = new UriBuilder(this.Client.CloudTarget);

            uriBuilder.Path = $"/v3/tasks/{getTaskRequest.TaskGuid}";
            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_GetTaskResponse>(await response.ReadContentAsStringAsync()));
        }
示例#2
0
        public async Task <DC_GetTaskResponse> GetTaskByGuid(DC_GetTaskRequest getTaskRequest)
        {
            UriBuilder uriBuilder = new UriBuilder(this.Client.CloudTarget);

            uriBuilder.Path = $"/v3/tasks/{getTaskRequest.TaskGuid}";
            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_GetTaskResponse>(await response.Content.ReadAsStringAsync()));
        }
示例#3
0
        public async Task <DC_GetTaskResponse> GetTaskAsync(Guid taskGuid)
        {
            try
            {
                var request = new DC_GetTaskRequest
                {
                    TaskGuid = taskGuid.ToString()
                };
                var response = await _cfV3Client.TaskResource.GetTaskByGuid(request);

                return(response);
            }
            catch (Exception ex)
            {
                _logger.LogError($"Error {ex.Message} and Stack trace {ex.StackTrace}");
                throw;
            }
        }