Exemple #1
0
        /// <summary>
        /// Creates a GTM Trigger.
        /// Documentation https://developers.google.com/tagmanager/v1/reference/triggers/create
        /// 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="body">A valid TagManager v1 body.</param>
        /// <returns>TriggerResponse</returns>
        public static Trigger Create(TagManagerService service, string accountId, string containerId, Trigger body)
        {
            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);
                }

                // Make the request.
                return(service.Triggers.Create(body, accountId, containerId).Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request Triggers.Create failed.", ex);
            }
        }
        /// <summary>
        /// Deletes a GTM Tag.
        /// Documentation https://developers.google.com/tagmanager/v1/reference/tags/delete
        /// 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="tagId">The GTM Tag ID.</param>
        public static void Delete(TagManagerService service, string accountId, string containerId, string tagId)
        {
            try
            {
                // Initial validation.
                if (service == null)
                {
                    throw new ArgumentNullException("service");
                }
                if (accountId == null)
                {
                    throw new ArgumentNullException(accountId);
                }
                if (containerId == null)
                {
                    throw new ArgumentNullException(containerId);
                }
                if (tagId == null)
                {
                    throw new ArgumentNullException(tagId);
                }

                // Make the request.
                return(service.Tags.Delete(accountId, containerId, tagId).Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request Tags.Delete failed.", ex);
            }
        }
Exemple #3
0
        /// <summary>
        /// Lists all GTM Triggers of a Container.
        /// Documentation https://developers.google.com/tagmanager/v1/reference/triggers/list
        /// 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>
        /// <returns>ListTriggersResponseResponse</returns>
        public static ListTriggersResponse List(TagManagerService service, string accountId, string containerId)
        {
            try
            {
                // Initial validation.
                if (service == null)
                {
                    throw new ArgumentNullException("service");
                }
                if (accountId == null)
                {
                    throw new ArgumentNullException(accountId);
                }
                if (containerId == null)
                {
                    throw new ArgumentNullException(containerId);
                }

                // Make the request.
                return(service.Triggers.List(accountId, containerId).Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request Triggers.List failed.", ex);
            }
        }
        /// <summary>
        /// Removes a user from the account, revoking access to it and all of its containers.
        /// Documentation https://developers.google.com/tagmanager/v1/reference/permissions/delete
        /// 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="permissionId">The GTM User ID.</param>
        public static void Delete(TagManagerService service, string accountId, string permissionId)
        {
            try
            {
                // Initial validation.
                if (service == null)
                {
                    throw new ArgumentNullException("service");
                }
                if (accountId == null)
                {
                    throw new ArgumentNullException(accountId);
                }
                if (permissionId == null)
                {
                    throw new ArgumentNullException(permissionId);
                }

                // Make the request.
                return(service.Permissions.Delete(accountId, permissionId).Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request Permissions.Delete failed.", ex);
            }
        }
        /// <summary>
        /// Creates a user's Account & Container Permissions.
        /// Documentation https://developers.google.com/tagmanager/v1/reference/permissions/create
        /// 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="body">A valid TagManager v1 body.</param>
        /// <returns>UserAccessResponse</returns>
        public static UserAccess Create(TagManagerService service, string accountId, UserAccess body)
        {
            try
            {
                // Initial validation.
                if (service == null)
                {
                    throw new ArgumentNullException("service");
                }
                if (body == null)
                {
                    throw new ArgumentNullException("body");
                }
                if (accountId == null)
                {
                    throw new ArgumentNullException(accountId);
                }

                // Make the request.
                return(service.Permissions.Create(body, accountId).Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request Permissions.Create failed.", ex);
            }
        }
Exemple #6
0
        /// <summary>
        /// Gets a GTM Environment.
        /// Documentation https://developers.google.com/tagmanager/v1/reference/environments/get
        /// 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="environmentId">The GTM Environment ID.</param>
        /// <returns>EnvironmentResponse</returns>
        public static Environment Get(TagManagerService service, string accountId, string containerId, string environmentId)
        {
            try
            {
                // Initial validation.
                if (service == null)
                {
                    throw new ArgumentNullException("service");
                }
                if (accountId == null)
                {
                    throw new ArgumentNullException(accountId);
                }
                if (containerId == null)
                {
                    throw new ArgumentNullException(containerId);
                }
                if (environmentId == null)
                {
                    throw new ArgumentNullException(environmentId);
                }

                // Make the request.
                return(service.Environments.Get(accountId, containerId, environmentId).Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request Environments.Get failed.", ex);
            }
        }
        /// <summary>
        /// Updates a GTM Variable.
        /// Documentation https://developers.google.com/tagmanager/v1/reference/variables/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="variableId">The GTM Variable ID.</param>
        /// <param name="body">A valid TagManager v1 body.</param>
        /// <param name="optional">Optional paramaters.</param>        /// <returns>VariableResponse</returns>
        public static Variable Update(TagManagerService service, string accountId, string containerId, string variableId, Variable body, VariablesUpdateOptionalParms 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 (variableId == null)
                {
                    throw new ArgumentNullException(variableId);
                }

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

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

                // Requesting data.
                return(request.Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request Variables.Update failed.", ex);
            }
        }
Exemple #8
0
        /// <summary>
        /// Updates a GTM Environment. This method supports patch semantics.
        /// Documentation https://developers.google.com/tagmanager/v1/reference/environments/patch
        /// 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="environmentId">The GTM Environment ID.</param>
        /// <param name="body">A valid TagManager v1 body.</param>
        /// <param name="optional">Optional paramaters.</param>        /// <returns>EnvironmentResponse</returns>
        public static Environment Patch(TagManagerService service, string accountId, string containerId, string environmentId, Environment body, EnvironmentsPatchOptionalParms 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 (environmentId == null)
                {
                    throw new ArgumentNullException(environmentId);
                }

                // Building the initial request.
                var request = service.Environments.Patch(body, accountId, containerId, environmentId);

                // Applying optional parameters to the request.
                request = (EnvironmentsResource.PatchRequest)SampleHelpers.ApplyOptionalParms(request, optional);

                // Requesting data.
                return(request.Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request Environments.Patch failed.", ex);
            }
        }
        /// <summary>
        /// Publishes a Container Version.
        /// Documentation https://developers.google.com/tagmanager/v1/reference/versions/publish
        /// 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="optional">Optional paramaters.</param>        /// <returns>PublishContainerVersionResponseResponse</returns>
        public static PublishContainerVersionResponse Publish(TagManagerService service, string accountId, string containerId, string containerVersionId, VersionsPublishOptionalParms optional = null)
        {
            try
            {
                // Initial validation.
                if (service == null)
                {
                    throw new ArgumentNullException("service");
                }
                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.Publish(accountId, containerId, containerVersionId);

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

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