/// <summary>
        ///
        /// </summary>
        /// <param name="campaignId"></param>
        /// <param name="contactId"></param>
        /// <returns></returns>
        public async Task <List <SurveyResult> > GetForContactAsync(string campaignId, string contactId)
        {
            var request = await VoiqClient.GetRestRequest($"campaigns/{campaignId}/contacts/{contactId}/survey-results", HttpMethod.Get);

            var response = await VoiqClient.SendAsync <List <SurveyResult> >(request);

            return(await VoiqClient.ProcessResponse(response));
        }
Exemplo n.º 2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="campaignId"></param>
        /// <param name="contactId"></param>
        /// <returns></returns>
        public async Task <Question> GetAsync(string campaignId, string surveyId, string questionId)
        {
            var request = await VoiqClient.GetRestRequest($"campaigns/{campaignId}/surveys/{surveyId}/questions/{questionId}", HttpMethod.Get);

            var response = await VoiqClient.SendAsync <Question>(request);

            return(await VoiqClient.ProcessResponse(response));
        }
Exemplo n.º 3
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="campaignId"></param>
        /// <returns></returns>
        public async Task <List <Survey> > GetAllForCampaignAsync(string campaignId)
        {
            var request = await VoiqClient.GetRestRequest($"campaigns/{campaignId}/surveys", HttpMethod.Get);

            var response = await VoiqClient.SendAsync <List <Survey> >(request);

            return(await VoiqClient.ProcessResponse(response));
        }
Exemplo n.º 4
0
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        public async Task <List <CampaignSummary> > GetAllAsync()
        {
            var request = await VoiqClient.GetRestRequest($"campaigns", HttpMethod.Get);

            var response = await VoiqClient.SendAsync <List <CampaignSummary> >(request);

            return(await VoiqClient.ProcessResponse(response));
        }
        /// <summary>
        ///
        /// </summary>
        /// <param name="campaignId"></param>
        /// <param name="leadId"></param>
        /// <returns></returns>
        public async Task <List <PhoneCall> > GetForCampaignContactAsync(string campaignId, string leadId)
        {
            var callsRequest = await VoiqClient.GetRestRequest($"campaigns/{campaignId}/leads/{leadId}/calls", HttpMethod.Get);

            var callsResponse = await VoiqClient.SendAsync <List <PhoneCall> >(callsRequest);

            return(await VoiqClient.ProcessResponse(callsResponse));
        }
Exemplo n.º 6
0
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        public async Task <Lead> DeleteAsync(string campaignId, string contactId)
        {
            var request = await VoiqClient.GetRestRequest($"campaigns/{campaignId}/contacts/{contactId}", HttpMethod.Delete);

            var response = await VoiqClient.SendAsync <Lead>(request);

            return(await VoiqClient.ProcessResponse(response));
        }
        /// <summary>
        ///
        /// </summary>
        /// <param name="resultsRequest"></param>
        /// <returns></returns>
        public async Task <List <SurveyResult> > GetAllForCampaignAsync(string campaignId, DateTime?since = null, DateTime?until = null)
        {
            var request = await VoiqClient.GetRestRequest($"campaigns/{campaignId}/survey-results", HttpMethod.Get);

            if (since != null)
            {
                request.AddQueryString("since", since.Value.ToString("s") + "+00:00");
            }
            if (until != null)
            {
                request.AddQueryString("until", until.Value.ToString("s") + "+00:00");
            }

            var response = await VoiqClient.SendAsync <List <SurveyResult> >(request);

            return(await VoiqClient.ProcessResponse(response));
        }
Exemplo n.º 8
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="campaignId"></param>
        /// <param name="surveyId"></param>
        /// <param name="getQuestions"></param>
        /// <param name="getSurveyResults"
        /// <returns></returns>
        public async Task <Survey> GetAsync(string campaignId, string surveyId, bool getQuestions = true, bool getSurveyResults = false)
        {
            var request = await VoiqClient.GetRestRequest($"campaigns/{campaignId}/surveys/{surveyId}", HttpMethod.Get);

            var response = await VoiqClient.SendAsync <Survey>(request);

            var survey = await VoiqClient.ProcessResponse(response);

            if (getQuestions)
            {
                survey.Questions = await VoiqClient.Questions.GetAllForSurveyAsync(campaignId, surveyId);
            }

            if (getSurveyResults)
            {
                survey.Results = await VoiqClient.SurveyResults.GetAllForCampaignAsync(campaignId);
            }
            return(survey);
        }
        /// <summary>
        ///
        /// </summary>
        /// <param name="campaignId"></param>
        /// <returns></returns>
        private async Task <List <CallsListResponse> > GetAllInternalAsync(string campaignId, DateTime?since = null, DateTime?until = null)
        {
            var callsRequest = await VoiqClient.GetRestRequest($"campaigns/{campaignId}/calls", HttpMethod.Get);

            if (since != null)
            {
                callsRequest.AddQueryString("since", since.Value.ToString("s") + "+00:00");
            }
            if (until != null)
            {
                callsRequest.AddQueryString("until", until.Value.ToString("s") + "+00:00");
            }

            var callsResponse = await VoiqClient.SendAsync <List <CallsListResponse> >(callsRequest);

            var response = await VoiqClient.ProcessResponse(callsResponse);

            return(response);
        }
Exemplo n.º 10
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="campaignId"></param>
        /// <param name="leadId"></param>
        /// <param name="getCalls"></param>
        /// <param name="getSurveyResults"></param>
        /// <returns></returns>
        public async Task <Lead> GetAsync(string campaignId, string leadId, bool getCalls = true, bool getSurveyResults = true)
        {
            var request = await VoiqClient.GetRestRequest($"campaigns/{campaignId}/leads/{leadId}", HttpMethod.Get);

            var response = await VoiqClient.SendAsync <Lead>(request);

            var lead = await VoiqClient.ProcessResponse(response);

            if (getCalls)
            {
                lead.Calls = await VoiqClient.Calls.GetForCampaignContactAsync(campaignId, leadId);
            }

            if (getSurveyResults)
            {
                lead.SurveyResults = await VoiqClient.SurveyResults.GetForContactAsync(campaignId, leadId);
            }
            return(lead);
        }
Exemplo n.º 11
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="campaignId"></param>
        /// <param name="getCalls"></param>
        /// <param name="getLeads"></param>
        /// <param name="getSurveys"></param>
        /// <param name="getSurveyResults"></param>
        /// <param name="since"></param>
        /// <param name="until"></param>
        /// <returns></returns>
        public async Task <Campaign> GetAsync(string campaignId, bool getCalls = false, bool getLeads = true, bool getSurveys = true, bool getSurveyResults = false, DateTime?since = null, DateTime?until = null)
        {
            var request = await VoiqClient.GetRestRequest($"campaigns/{campaignId}", HttpMethod.Get);

            var response = await VoiqClient.SendAsync <Campaign>(request);

            var campaign = await VoiqClient.ProcessResponse(response);

            if (getLeads)
            {
                var leads = await VoiqClient.Leads.GetAllAsync(campaignId);

                if (getCalls)
                {
                    // RWM: This version associates the retrieved calls with the existing leads.
                    leads = await VoiqClient.Calls.GetAllAsync(campaignId, leads, since, until);
                }
                campaign.Leads = leads;
            }

            // RWM: This is if they didn't ask for the Leads but they still want the Calls.
            if (getCalls && campaign.Leads == null)
            {
                campaign.Leads = await VoiqClient.Calls.GetAllAsync(campaignId, since, until);
            }

            if (getSurveys)
            {
                campaign.Surveys = await VoiqClient.Surveys.GetAllForCampaignAsync(campaignId);
            }

            if (getSurveyResults)
            {
                campaign.SurveyResults = await VoiqClient.SurveyResults.GetAllForCampaignAsync(campaignId, since, until);
            }

            return(campaign);
        }