Beispiel #1
0
 public WebhookQueueMessage(WebhookEndpoint end, string body, IEnumerable <KeyValuePair <string, IEnumerable <string> > > headers)
 {
     Endpoint = end;
     if (String.IsNullOrWhiteSpace(body))
     {
         throw new ArgumentNullException("body");
     }
     Body    = body;
     Headers = headers.ToDictionary(x => x.Key, x => x.Value.ToList());
 }
Beispiel #2
0
        public void WebhookQueuePublish(WebhookEndpoint end, string message, string accessKey)
        {
            var          client    = Client;
            const string urlFormat = "Api/WebhookQueue/{0}?accessKey={1}";
            var          url       = string.Format(urlFormat, end, accessKey);
            var          resp      = client.PostAsync(url, new StringContent(message)).Result;

            if (!resp.IsSuccessStatusCode)
            {
                var content = resp.Content.ReadAsStringAsync().Result;
                throw new ApiClientException("UsersFromUsername bad status code {resp.StatusCode}\n{content}");
            }
        }