コード例 #1
0
        /// <summary>
        /// Retrieves the details of a single subscription.
        /// </summary>
        /// <param name="identity">Unique identifier, beginning with "SB".</param>
        /// <param name="request">An optional `SubscriptionGetRequest` representing the query parameters for this get request.</param>
        /// <param name="customiseRequestMessage">An optional `RequestSettings` allowing you to configure the request</param>
        /// <returns>A single subscription resource</returns>
        public Task <SubscriptionResponse> GetAsync(string identity, SubscriptionGetRequest request = null, RequestSettings customiseRequestMessage = null)
        {
            request = request ?? new SubscriptionGetRequest();
            if (identity == null)
            {
                throw new ArgumentException(nameof(identity));
            }

            var urlParams = new List <KeyValuePair <string, object> >
            {
                new KeyValuePair <string, object>("identity", identity),
            };

            return(_goCardlessClient.ExecuteAsync <SubscriptionResponse>("GET", "/subscriptions/:identity", urlParams, request, null, null, customiseRequestMessage));
        }
コード例 #2
0
        public async Task <SubscriptionGetResponse> Subscribe(SubscriptionGetRequest request)
        {
            using (var client = new HttpClient())
            {
                client.BaseAddress = new Uri(_config.Value.URI_SNS);
                var response = await client.GetAsync($"subscription/{request.email}");

                response.EnsureSuccessStatusCode();

                var stringResult = await response.Content.ReadAsStringAsync();

                var result = JsonConvert.DeserializeObject <SubscriptionGetResponse>(stringResult);
                return(result);
            }
        }
コード例 #3
0
        public async Task <SubscriptionGetResponse> Subscribe(SubscriptionGetRequest request)
        {
            var result = await _messageRepository.Subscribe(request);

            return(result);
        }
コード例 #4
0
        public async Task <IActionResult> Get([FromRoute] SubscriptionGetRequest request)
        {
            var result = await _service.Subscribe(request);

            return(Json(new { result }));
        }