public string GetContactLink(ApiUriService apiService, string actimoApikey, int messageId, int sourceId)
        {
            var response = restClientService.ExecuteAsync(apiService.BaseUri,
                                                          string.Format(apiService.ContactLinkApiUri, messageId, sourceId), actimoApikey,
                                                          Method.GET)
                           .GetAwaiter()
                           .GetResult();

            if (response.StatusCode != HttpStatusCode.OK)
            {
                throw new Exception("Request issue -> HTTP code:" + response.StatusCode);
            }

            return(ObjectConversionService.ToObject <ContactLinkModel>(response.Content)?.link);
        }
示例#2
0
        public List <ContactModel> GetContacts(ApiUriService apiService, string actimoApikey)
        {
            var response = restClientService.ExecuteAsync(apiService.BaseUri,
                                                          apiService.ContactApiUri, actimoApikey,
                                                          Method.GET)
                           .GetAwaiter()
                           .GetResult();

            if (response.StatusCode != HttpStatusCode.OK)
            {
                throw new Exception("Request issue -> HTTP code:" + response.StatusCode);
            }

            return(ObjectConversionService.ToObject <ContactRoot>(response.Content)?.data
                   ?? new List <ContactModel>());
        }
        public List <EnagementModel> GetEngagementData(ApiUriService apiService, string actimoApikey, int targetId, int sourceId, string authCode)
        {
            var response = restClientService.ExecuteAsync(apiService.BaseUri,
                                                          string.Format(apiService.EnagementApiUri, targetId, sourceId, authCode), actimoApikey,
                                                          Method.GET)
                           .GetAwaiter()
                           .GetResult();

            if (response.StatusCode != HttpStatusCode.OK)
            {
                throw new Exception("Request issue -> HTTP code:" + response.StatusCode);
            }

            var data = ObjectConversionService.ToObject <RootObject>(response.Content);

            return(GetEngagementList(data));
        }
        public string GetContactAuthContact(ApiUriService apiService, string actimoApikey, string keyCode)
        {
            var response = restClientService.ExecuteAsync(apiService.BaseUri,
                                                          string.Format(apiService.ContactAuthApiUri, keyCode), actimoApikey,
                                                          Method.GET)
                           .GetAwaiter()
                           .GetResult();

            if (response.StatusCode != HttpStatusCode.OK)
            {
                throw new Exception("Request issue -> HTTP code:" + response.StatusCode);
            }

            var data = ObjectConversionService.ToObject <JObject>(response.Content);

            return(data["contactAuthCode"].Value <string>());
        }