Ejemplo n.º 1
0
        /// <summary>
        /// Adds labels to the AdGroupAd or removes labels from the AdGroupAd.
        /// <p>Add - Apply an existing label to an existing {@linkplain AdGroupAd ad group ad}. The
        /// {@code adGroupId} and {@code adId} must reference an existing
        /// {@linkplain AdGroupAd ad group ad}. The {@code labelId} must reference an existing
        /// {@linkplain Label label}.
        /// <p>Remove - Removes the link between the specified {@linkplain AdGroupAd ad group ad} and
        /// {@linkplain Label label}.
        /// @param operations The operations to apply.
        /// @return A list of AdGroupAdLabel 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 AdGroupAdLabel contains the AdGroupId, AdId and the LabelId.
        /// In the case of a remove operation, the returned AdGroupAdLabel will only have AdGroupId and
        /// AdId.
        /// @throws ApiException when there are one or more errors with the request.
        /// </summary>
        public async Task <AdGroupAdLabelReturnValue> MutateLabelAsync(IEnumerable <AdGroupAdLabelOperation> operations)
        {
            var binding = new AdGroupAdServiceSoapBinding("https://adwords.google.com/api/adwords/cm/v201609/AdGroupAdService", _config.AccessToken, _config.Timeout, _config.EnableGzipCompression, _netUtil, _logger);
            var inData  = new SoapData <AdGroupAdServiceRequestHeader, AdGroupAdServiceMutateLabel>();

            inData.Header = new AdGroupAdServiceRequestHeader();
            AssignHeaderValues(inData.Header);
            inData.Body            = new AdGroupAdServiceMutateLabel();
            inData.Body.Operations = new List <AdGroupAdLabelOperation>(operations);
            var outData = await binding.MutateLabelAsync(inData).ConfigureAwait(false);

            return(outData.Body.Rval);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Returns a list of AdGroupAds.
        /// AdGroupAds that had been removed are not returned by default.
        ///
        /// @param serviceSelector The selector specifying the {@link AdGroupAd}s to return.
        /// @return The page containing the AdGroupAds that meet the criteria specified by the selector.
        /// @throws ApiException when there is at least one error with the request.
        /// </summary>
        public async Task <AdGroupAdPage> GetAsync(Selector serviceSelector)
        {
            var binding = new AdGroupAdServiceSoapBinding("https://adwords.google.com/api/adwords/cm/v201609/AdGroupAdService", _config.AccessToken, _config.Timeout, _config.EnableGzipCompression, _netUtil, _logger);
            var inData  = new SoapData <AdGroupAdServiceRequestHeader, AdGroupAdServiceGet>();

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

            return(outData.Body.Rval);
        }