示例#1
0
        public async Task <ProcessingResponse?> SendPostRequest(RequestParams requestParams)
        {
            requestParams.ThrowIfNull(nameof(requestParams));

            _logger.Info($"Service method '{nameof(SendPostRequest)}' is called.");

            using HttpResponseMessage response = await _client.PostAsJsonAsync(
                      _apiUrl, requestParams
                      );

            if (response.IsSuccessStatusCode)
            {
                var result = await response.Content.ReadAsAsync <ProcessingResponse>();

                return(result);
            }

            return(null);
        }
示例#2
0
        public bool TryAddUser(long id, RequestParams requestParams)
        {
            requestParams.ThrowIfNull(nameof(requestParams));

            return(_cache.TryAdd(id, requestParams));
        }