/// <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); } }
public TriggmineApi(string apiKey, Uri apiUrl) : base(apiKey, HttpClientBase.CreateHttpClient(apiKey, apiUrl)) { }