private List <T> GetBannersInternal <T>(int[] campaingIds, int[] bannerIds, PhraseInfoType phraseDetails, BannersFilterInfo filter)
            where T : BannerInfo
        {
            var request = new { CampaignIDS = campaingIds, BannerIDS = bannerIds, GetPhrases = phraseDetails, Filter = filter };

            return(YandexApiClient.Invoke <List <T> >(ApiMethod.GetBanners, request));
        }
Esempio n. 2
0
        public ClientUnitInfo[] GetClientsUnits(params string[] logins)
        {
            if (logins == null || logins.Length == 0)
            {
                throw new ArgumentNullException("logins");
            }

            return(YandexApiClient.Invoke <ClientUnitInfo[]>(ApiMethod.GetClientsUnits, logins));
        }
        public void DeleteForecastReport(int forecastReportId)
        {
            var result = YandexApiClient.Invoke <int>(ApiMethod.DeleteForecastReport, forecastReportId);

            if (result != 1)
            {
                throw new YandexDirectException("Method DeleteForecastReport failed.");
            }
        }
        /*
         * Not implemented:
         * - CreateOrUpdateCampaign
         * - GetBalance
         * - GetCampaignParams
         * - GetCampaignsList
         * - GetCampaignsListFilter
         * - GetCampaignsParams
         */

        public List <ShortCampaignInfo> GetClientCampaigns(params string[] logins)
        {
            if (logins == null || logins.Length == 0)
            {
                throw new ArgumentNullException("logins");
            }

            return(YandexApiClient.Invoke <List <ShortCampaignInfo> >(ApiMethod.GetCampaignsList, logins));
        }
        public int CreateNewForecast(string[] phrases, int[] geoIds = null, int[] categoryIds = null)
        {
            if (phrases == null || phrases.Length == 0)
            {
                throw new ArgumentNullException("phrases");
            }

            var request = new { Categories = categoryIds, GeoID = geoIds, Phrases = phrases };

            return(YandexApiClient.Invoke <int>(ApiMethod.CreateNewForecast, request));
        }
Esempio n. 6
0
        public bool UnArchiveBanners(int campaignId, int[] bannerIds)
        {
            if (bannerIds == null || bannerIds.Length == 0)
            {
                throw new ArgumentNullException("bannerIds");
            }

            var request = new { CampaignID = campaignId, BannerIDS = bannerIds };

            return(YandexApiClient.Invoke <int>(ApiMethod.UnArchiveBanners, request) == 1);
        }
Esempio n. 7
0
        public int CreateNewReport(NewReportInfo reportInfo)
        {
            if (reportInfo == null)
            {
                throw new ArgumentNullException("reportInfo");
            }

            if (reportInfo.Limit != null && reportInfo.Offset != null)
            {
                throw new ArgumentException("Only one of \"Limit\" and \"Offset\" should be set");
            }

            return(YandexApiClient.Invoke <int>(ApiMethod.CreateNewReport, reportInfo));
        }
        public List <int> CreateOrUpdateBanners(IEnumerable <EditableBannerInfo> banners)
        {
            if (banners == null)
            {
                throw new ArgumentNullException("banners");
            }

            var bannersArray = banners.ToArray();

            if (bannersArray.Contains(null))
            {
                throw new ArgumentNullException("banners", "One of the items is null.");
            }

            return(YandexApiClient.Invoke <List <int> >(ApiMethod.CreateOrUpdateBanners, bannersArray));
        }
        public List <BannerPhraseInfoWithStats> GetBannerPhrasesWithStats(int[] bannerIds, bool considerTimeTarget = false)
        {
            if (bannerIds == null || bannerIds.Length == 0)
            {
                throw new ArgumentNullException("bannerIds");
            }

            if (bannerIds.Length > 1000)
            {
                throw new ArgumentOutOfRangeException("bannerIds", "Maximum allowed number of banner identifiers per call is 1000.");
            }

            var request = new { BannerIDS = bannerIds, RequestPrices = YesNo.Yes, ConsiderTimeTarget = (YesNo)considerTimeTarget };

            return(YandexApiClient.Invoke <List <BannerPhraseInfoWithStats> >(ApiMethod.GetBannerPhrasesFilter, request));
        }
Esempio n. 10
0
 //TODO: Should be renamed to GetClientsList
 public List <ShortClientInfo> GetClientLogins()
 {
     return(YandexApiClient.Invoke <List <ShortClientInfo> >(ApiMethod.GetClientsList));
 }
 public List <ForecastStatus> GetForecastList()
 {
     return(YandexApiClient.Invoke <List <ForecastStatus> >(ApiMethod.GetForecastList));
 }
 public ForecastInfo GetForecast(int forecastId)
 {
     return(YandexApiClient.Invoke <ForecastInfo>(ApiMethod.GetForecast, forecastId));
 }
Esempio n. 13
0
 public int PingApi()
 {
     return(YandexApiClient.Invoke <int>(ApiMethod.PingAPI));
 }
Esempio n. 14
0
        public void TransferMoney(TransferInfo[] from, TransferInfo[] to)
        {
            var request = new { FromCampaigns = from, ToCampaigns = to };

            YandexApiClient.Invoke <int>(ApiMethod.TransferMoney, request, true);
        }
Esempio n. 15
0
 public List <GoalInfo> GetStatGoals(int campaignId)
 {
     return(YandexApiClient.Invoke <List <GoalInfo> >(ApiMethod.GetStatGoals, new { CampaignID = campaignId }));
 }
Esempio n. 16
0
 public List <ReportInfo> GetReportList()
 {
     return(YandexApiClient.Invoke <List <ReportInfo> >(ApiMethod.GetReportList));
 }