Exemple #1
0
        public async Task <IEnumerable <IntrospectionResponse> > ExecuteAsync(PostIntrospection parameter, string url)
        {
            if (parameter == null)
            {
                throw new ArgumentNullException(nameof(parameter));
            }

            if (string.IsNullOrWhiteSpace(url))
            {
                throw new ArgumentNullException(nameof(url));
            }

            if (url.EndsWith("/"))
            {
                url = url.Remove(0, url.Length - 1);
            }

            url = url + "/bulk";
            var serializedParameter = JsonConvert.SerializeObject(parameter);
            var body    = new StringContent(serializedParameter, Encoding.UTF8, "application/json");
            var request = new HttpRequestMessage
            {
                Method     = HttpMethod.Post,
                RequestUri = new Uri(url),
                Content    = body
            };
            var httpClient = _httpClientFactory.GetHttpClient();
            var httpResult = await httpClient.SendAsync(request);

            httpResult.EnsureSuccessStatusCode();
            var content = await httpResult.Content.ReadAsStringAsync().ConfigureAwait(false);

            return(JsonConvert.DeserializeObject <IEnumerable <IntrospectionResponse> >(content));
        }
        public async Task <ActionResult> PostBulk([FromBody] PostIntrospection parameter)
        {
            if (parameter == null)
            {
                throw new ArgumentNullException(nameof(parameter));
            }

            var result = await _introspectionActions.GetIntrospection(parameter.Rpts);

            return(new OkObjectResult(result));
        }
Exemple #3
0
        public async Task <IEnumerable <IntrospectionResponse> > GetByResolution(PostIntrospection parameter, string url)
        {
            var introspectionEndPoint = await GetIntrospectionEndpoint(UriHelpers.GetUri(url));

            return(await Get(parameter, introspectionEndPoint));
        }
Exemple #4
0
 public Task <IEnumerable <IntrospectionResponse> > Get(PostIntrospection parameter, string url)
 {
     return(_getIntrospectionsAction.ExecuteAsync(parameter, url));
 }