/// <summary>
        /// Lists the name of the subscriptions for this topic.
        /// Documentation https://developers.google.com/pubsub/v1beta2/reference/subscriptions/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 pubsub service.</param>
        /// <param name="topic">The name of the topic that subscriptions are attached to.</param>
        /// <param name="optional">Optional paramaters.</param>        /// <returns>ListTopicSubscriptionsResponseResponse</returns>
        public static ListTopicSubscriptionsResponse List(pubsubService service, string topic, SubscriptionsListOptionalParms optional = null)
        {
            try
            {
                // Initial validation.
                if (service == null)
                {
                    throw new ArgumentNullException("service");
                }
                if (topic == null)
                {
                    throw new ArgumentNullException(topic);
                }

                // Building the initial request.
                var request = service.Subscriptions.List(topic);

                // Applying optional parameters to the request.
                request = (SubscriptionsResource.ListRequest)SampleHelpers.ApplyOptionalParms(request, optional);

                // Requesting data.
                return(request.Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request Subscriptions.List failed.", ex);
            }
        }
        /// Documentation https://developers.google.com/pubsub/v1beta1a/reference/subscriptions/pull
        /// 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 pubsub service.</param>  
        /// <param name="body">A valid pubsub v1beta1a body.</param>
        /// <returns>PullResponseResponse</returns>
        public static PullResponse Pull(pubsubService service, PullRequest body)
        {
            try
            {
                // Initial validation.
                if (service == null)
                    throw new ArgumentNullException("service");
                if (body == null)
                    throw new ArgumentNullException("body");

                // Make the request.
                return service.Subscriptions.Pull(body).Execute();
            }
            catch (Exception ex)
            {
                throw new Exception("Request Subscriptions.Pull failed.", ex);
            }
        }
        /// Documentation https://developers.google.com/pubsub/v1beta1a/reference/subscriptions/modifyPushConfig
        /// 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 pubsub service.</param>  
        /// <param name="body">A valid pubsub v1beta1a body.</param>
        /// <returns>EmptyResponse</returns>
        public static Empty ModifyPushConfig(pubsubService service, ModifyPushConfigRequest body)
        {
            try
            {
                // Initial validation.
                if (service == null)
                    throw new ArgumentNullException("service");
                if (body == null)
                    throw new ArgumentNullException("body");

                // Make the request.
                return service.Subscriptions.ModifyPushConfig(body).Execute();
            }
            catch (Exception ex)
            {
                throw new Exception("Request Subscriptions.ModifyPushConfig failed.", ex);
            }
        }
Exemplo n.º 4
0
        /// Documentation https://developers.google.com/pubsub/v1beta1a/reference/topics/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 pubsub service.</param>
        /// <param name="body">A valid pubsub v1beta1a body.</param>
        /// <returns>EmptyResponse</returns>
        public static Empty Publish(pubsubService service, PublishRequest body)
        {
            try
            {
                // Initial validation.
                if (service == null)
                {
                    throw new ArgumentNullException("service");
                }
                if (body == null)
                {
                    throw new ArgumentNullException("body");
                }

                // Make the request.
                return(service.Topics.Publish(body).Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request Topics.Publish failed.", ex);
            }
        }