public async Task <string> CampaignPostSave(CampaignPostDTO campaignInfo) { CampaignSetting settingObj = await GetCampaignSetting(); Dictionary <string, string> headers = new Dictionary <string, string>(); headers.Add("secret", settingObj.APISecret); headers.Add("domainsecret", settingObj.DomainSecret); var data = new { campaignID = campaignInfo.CampaignID, campaignPostID = campaignInfo.CampaignPostID, campaignType = campaignInfo.PostContent, appID = campaignInfo.AppID, postContent = campaignInfo.PostContent, targetID = campaignInfo.TargetID, images = campaignInfo.Images.ToArray() }; var jsonData = JsonConvert.SerializeObject(data); Invoker invoker = new Invoker(); ResponseInfo info = await invoker.PostAsync <ResponseInfo>("POST", APIEndPoint.CampaignPostSave, headers, jsonData); return(JsonConvert.SerializeObject(info)); }
public async Task <string> GetCampaignList(int offset, int limit, int campaignType, int statusID, string searchText) { CampaignSetting settingObj = await GetCampaignSetting(); Dictionary <string, string> headers = new Dictionary <string, string>(); headers.Add("secret", settingObj.APISecret); headers.Add("domainsecret", settingObj.DomainSecret); var data = new { offset = offset, limit = limit, searchText = searchText, campaignType = campaignType, statusID = statusID }; var jsonData = JsonConvert.SerializeObject(data); Invoker invoker = new Invoker(); string result = await invoker.PostAsync("POST", APIEndPoint.CampaignList, headers, jsonData); return(result); }
public async Task <ResponseInfo> UnSubscribeService(string username) { CampaignSetting settingObj = await GetCampaignSetting(); Dictionary <string, string> headers = new Dictionary <string, string>(); headers.Add("secret", settingObj.APISecret); var data = new { DomainType = settingObj.DomainType, DomainSecret = settingObj.DomainSecret }; var jsonData = JsonConvert.SerializeObject(data); Invoker invoker = new Invoker(); ResponseInfo info = await invoker.PostAsync <ResponseInfo>("POST", APIEndPoint.UnSubscribe, headers, jsonData); if (info.StatusCode == StatusCode.Created) { CampaignProvider provider = new CampaignProvider(); await provider.UpdateCampaignSetting(subscribe : false, username); } return(info); }
public async Task <string> ConnectTwitter(string redirectUrl) { CampaignSetting settingObj = await GetCampaignSetting(); string url = APIEndPoint.ConnectTwitter + $"?ret_url={redirectUrl}&appsecret={settingObj.APISecret}&domainsecret={settingObj.DomainSecret}"; return(url); }
public async Task <string> GetCampaignApps() { CampaignSetting settingObj = await GetCampaignSetting(); Dictionary <string, string> headers = new Dictionary <string, string>(); headers.Add("secret", settingObj.APISecret); headers.Add("domainsecret", settingObj.DomainSecret); Invoker invoker = new Invoker(); ResponseInfo info = await invoker.PostAsync <ResponseInfo>("GET", APIEndPoint.CampaignApps, headers); return(JsonConvert.SerializeObject(info)); }
public async Task <string> ProcessCampaignPost(string campaignID) { CampaignSetting settingObj = await GetCampaignSetting(); Dictionary <string, string> headers = new Dictionary <string, string>(); headers.Add("secret", settingObj.APISecret); headers.Add("domainsecret", settingObj.DomainSecret); var data = new { campaignid = campaignID }; var jsonData = JsonConvert.SerializeObject(data); Invoker invoker = new Invoker(); string info = await invoker.PostAsync("POST", APIEndPoint.CampaignProcess, headers, jsonData); return(info); }
public async Task <string> GetCampaignType(string searchText) { CampaignSetting settingObj = await GetCampaignSetting(); Dictionary <string, string> headers = new Dictionary <string, string>(); headers.Add("secret", settingObj.APISecret); headers.Add("domainsecret", settingObj.DomainSecret); var data = new { searchText = searchText }; var jsonData = JsonConvert.SerializeObject(data); Invoker invoker = new Invoker(); ResponseInfo info = await invoker.PostAsync <ResponseInfo>("POST", APIEndPoint.CampaignType, headers, jsonData); return(JsonConvert.SerializeObject(info)); }