Exemplo n.º 1
0
        /// <summary>
        /// Adds labels to the {@linkplain Campaign campaign} or removes {@linkplain Label label}s from the
        /// {@linkplain Campaign campaign}.
        /// <p>Add - Apply an existing label to an existing {@linkplain Campaign campaign}. The
        /// {@code campaignId} must reference an existing {@linkplain Campaign}. The {@code labelId} must
        /// reference an existing {@linkplain Label label}.
        /// <p>Remove - Removes the link between the specified {@linkplain Campaign campaign} and
        /// {@linkplain Label label}.
        ///
        /// @param operations the operations to apply.
        /// @return a list of {@linkplain CampaignLabel}s where each entry in the list is the result of
        /// applying the operation in the input list with the same index. For an
        /// add operation, the returned CampaignLabel contains the CampaignId and the LabelId.
        /// In the case of a remove operation, the returned CampaignLabel will only have CampaignId.
        /// @throws ApiException when there are one or more errors with the request.
        /// </summary>
        public async Task <CampaignLabelReturnValue> MutateLabelAsync(IEnumerable <CampaignLabelOperation> operations)
        {
            var binding = new CampaignServiceSoapBinding("https://adwords.google.com/api/adwords/cm/v201609/CampaignService", _config.AccessToken, _config.Timeout, _config.EnableGzipCompression, _netUtil, _logger);
            var inData  = new SoapData <CampaignServiceRequestHeader, CampaignServiceMutateLabel>();

            inData.Header = new CampaignServiceRequestHeader();
            AssignHeaderValues(inData.Header);
            inData.Body            = new CampaignServiceMutateLabel();
            inData.Body.Operations = new List <CampaignLabelOperation>(operations);
            var outData = await binding.MutateLabelAsync(inData).ConfigureAwait(false);

            return(outData.Body.Rval);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Returns the list of campaigns that meet the selector criteria.
        ///
        /// @param serviceSelector the selector specifying the {@link Campaign}s to return.
        /// @return A list of campaigns.
        /// @throws ApiException if problems occurred while fetching campaign information.
        /// </summary>
        public async Task <CampaignPage> GetAsync(Selector serviceSelector)
        {
            var binding = new CampaignServiceSoapBinding("https://adwords.google.com/api/adwords/cm/v201609/CampaignService", _config.AccessToken, _config.Timeout, _config.EnableGzipCompression, _netUtil, _logger);
            var inData  = new SoapData <CampaignServiceRequestHeader, CampaignServiceGet>();

            inData.Header = new CampaignServiceRequestHeader();
            AssignHeaderValues(inData.Header);
            inData.Body = new CampaignServiceGet();
            inData.Body.ServiceSelector = serviceSelector;
            var outData = await binding.GetAsync(inData).ConfigureAwait(false);

            return(outData.Body.Rval);
        }