コード例 #1
0
        private static string GenQueryData(ListCampaignNegativeKeywordsParameter parameter)
        {
            var queryData = new List <string>();

            if (parameter.StartIndex.HasValue)
            {
                queryData.Add($"startIndex={parameter.StartIndex.Value}");
            }
            if (parameter.Count.HasValue)
            {
                queryData.Add($"count={parameter.Count}");
            }
            if (!string.IsNullOrWhiteSpace(parameter.CampaignType))
            {
                queryData.Add($"campaignType={parameter.CampaignType}");
            }
            if (!string.IsNullOrWhiteSpace(parameter.MatchTypeFilter))
            {
                queryData.Add($"matchTypeFilter={parameter.MatchTypeFilter}");
            }
            if (!string.IsNullOrWhiteSpace(parameter.KeywordText))
            {
                queryData.Add($"keywordText={parameter.KeywordText}");
            }
            if (!string.IsNullOrWhiteSpace(parameter.CampaignIdFilter))
            {
                queryData.Add($"campaignIdFilter={parameter.CampaignIdFilter}");
            }

            return(string.Join("&", queryData));
        }
コード例 #2
0
        /// <summary>
        /// Retrieves a list of negative keywords satisfying optional criteria.
        /// </summary>
        /// <param name="parameter"></param>
        /// <returns></returns>
        public List <CampaignNegativeKeywordInfo> ListCampaignNegativeKeywords(
            ListCampaignNegativeKeywordsParameter parameter)
        {
            var queryData = string.Empty;

            if (parameter != null)
            {
                queryData = GenQueryData(parameter);
            }

            var url = $"{APIEndpoint.GetUrl(this.Marketplace)}/{this.ApiVersion}/campaignNegativeKeywords?{queryData}";

            return(this.HttpRequest <List <CampaignNegativeKeywordInfo> >(url));
        }