Ejemplo n.º 1
0
        /// <summary>
        /// Uploads new media. Currently, you can upload {@link Image} files and {@link MediaBundle}s.
        ///
        /// @param media A list of {@code Media} objects, each containing the data to
        /// be uploaded.
        /// @return A list of uploaded media in the same order as the argument list.
        /// </summary>
        public async Task <IEnumerable <Media> > UploadAsync(IEnumerable <Media> media)
        {
            var binding = new MediaServiceSoapBinding("https://adwords.google.com/api/adwords/cm/v201609/MediaService", _config.AccessToken, _config.Timeout, _config.EnableGzipCompression, _netUtil, _logger);
            var inData  = new SoapData <MediaServiceRequestHeader, MediaServiceUpload>();

            inData.Header = new MediaServiceRequestHeader();
            AssignHeaderValues(inData.Header);
            inData.Body       = new MediaServiceUpload();
            inData.Body.Media = new List <Media>(media);
            var outData = await binding.UploadAsync(inData).ConfigureAwait(false);

            return(outData.Body.Rval);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Returns the list of {@link Media} objects that match the query.
        ///
        /// @param query The SQL-like AWQL query string
        /// @returns A list of {@code Media} objects.
        /// @throws ApiException when the query is invalid or there are errors processing the request.
        /// </summary>
        public async Task <MediaPage> QueryAsync(string query)
        {
            var binding = new MediaServiceSoapBinding("https://adwords.google.com/api/adwords/cm/v201609/MediaService", _config.AccessToken, _config.Timeout, _config.EnableGzipCompression, _netUtil, _logger);
            var inData  = new SoapData <MediaServiceRequestHeader, MediaServiceQuery>();

            inData.Header = new MediaServiceRequestHeader();
            AssignHeaderValues(inData.Header);
            inData.Body       = new MediaServiceQuery();
            inData.Body.Query = query;
            var outData = await binding.QueryAsync(inData).ConfigureAwait(false);

            return(outData.Body.Rval);
        }