コード例 #1
0
        /// <summary>
        /// Static async version send event to TriggMine API
        /// </summary>
        /// <typeparam name="T">Type of event</typeparam>
        /// <param name="eventDto">Event data</param>
        /// <param name="apiKey">Client API key</param>
        /// <param name="apiUrl">Client Url</param>
        /// <returns>Task<HttpResponseMessage/></returns>
        public static HttpResponseMessage SendEvent <T>(T eventDto, string apiKey, Uri apiUrl)
        {
            using (var httpClient = HttpClientBase.CreateHttpClient(apiKey, apiUrl))
            {
                var content = JsonConvert.SerializeObject(eventDto);
                var url     = EventsRepository.GetEventUrl(typeof(T));

                return(httpClient.PostAsync(url, new StringContent(content, Encoding.UTF8, "application/json")).Result);
            }
        }
コード例 #2
0
 public TriggmineApi(string apiKey, Uri apiUrl)
     : base(apiKey, HttpClientBase.CreateHttpClient(apiKey, apiUrl))
 {
 }