Exemplo n.º 1
0
        public Tag2Csv(Tag original, ContainerVersion container, bool flatten)
        {
            Id       = Convert.ToInt32(original.tagId);
            Triggers = original.firingTriggerId.Select(t => Convert.ToInt32(t)).ToArray();

            _container = container;
            _original  = original;
            Flatten    = flatten;
        }
        /// <summary>
        /// Updates a Container Version.
        /// Documentation https://developers.google.com/tagmanager/v1/reference/versions/update
        /// Generation Note: This does not always build corectly.  Google needs to standardise things I need to figuer out which ones are wrong.
        /// </summary>
        /// <param name="service">Authenticated TagManager service.</param>
        /// <param name="accountId">The GTM Account ID.</param>
        /// <param name="containerId">The GTM Container ID.</param>
        /// <param name="containerVersionId">The GTM Container Version ID.</param>
        /// <param name="body">A valid TagManager v1 body.</param>
        /// <param name="optional">Optional paramaters.</param>        /// <returns>ContainerVersionResponse</returns>
        public static ContainerVersion Update(TagManagerService service, string accountId, string containerId, string containerVersionId, ContainerVersion body, VersionsUpdateOptionalParms optional = null)
        {
            try
            {
                // Initial validation.
                if (service == null)
                {
                    throw new ArgumentNullException("service");
                }
                if (body == null)
                {
                    throw new ArgumentNullException("body");
                }
                if (accountId == null)
                {
                    throw new ArgumentNullException(accountId);
                }
                if (containerId == null)
                {
                    throw new ArgumentNullException(containerId);
                }
                if (containerVersionId == null)
                {
                    throw new ArgumentNullException(containerVersionId);
                }

                // Building the initial request.
                var request = service.Versions.Update(body, accountId, containerId, containerVersionId);

                // Applying optional parameters to the request.
                request = (VersionsResource.UpdateRequest)SampleHelpers.ApplyOptionalParms(request, optional);

                // Requesting data.
                return(request.Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request Versions.Update failed.", ex);
            }
        }