public static RetrieveWebhookResponse CreateFromResponse(Response response)
        {
            var result = new RetrieveWebhookResponse();

            LeftRight.SetValuesToMatch(result, response);

            var results = Jsonification.DeserializeObject <dynamic>(response.Content).results;

            result.Webhook = ListWebhookResponse.ConvertToAWebhook(results);

            return(result);
        }
        public static ListWebhookResponse CreateFromResponse(Response response)
        {
            var result = new ListWebhookResponse();
            LeftRight.SetValuesToMatch(result, response);

            var results = Jsonification.DeserializeObject<dynamic>(result.Content).results;
            var webhooks = new List<Webhook>();
            foreach(var r in results)
                webhooks.Add(ConvertToAWebhook(r));

            result.Webhooks = webhooks;
            return result;
        }
        public static ListWebhookResponse CreateFromResponse(Response response)
        {
            var result = new ListWebhookResponse();

            LeftRight.SetValuesToMatch(result, response);

            var results  = Jsonification.DeserializeObject <dynamic>(result.Content).results;
            var webhooks = new List <Webhook>();

            foreach (var r in results)
            {
                webhooks.Add(ConvertToAWebhook(r));
            }

            result.Webhooks = webhooks;
            return(result);
        }
Ejemplo n.º 4
0
        public async Task <ListWebhookResponse> List(object query = null)
        {
            if (query == null)
            {
                query = new {}
            }
            ;
            var request = new Request
            {
                Url    = $"/api/{client.Version}/webhooks",
                Method = "GET",
                Data   = query
            };

            var response = await requestSender.Send(request);

            if (response.StatusCode != HttpStatusCode.OK)
            {
                throw new ResponseException(response);
            }

            return(ListWebhookResponse.CreateFromResponse(response));
        }