/// <summary>
        /// Creates a customer resource if one does not already exist.
        /// Documentation https://developers.google.com/reseller/v1/reference/customers/insert
        /// 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 reseller service.</param>
        /// <param name="body">A valid reseller v1 body.</param>
        /// <param name="optional">Optional paramaters.</param>        /// <returns>CustomerResponse</returns>
        public static Customer Insert(resellerService service, Customer body, CustomersInsertOptionalParms optional = null)
        {
            try
            {
                // Initial validation.
                if (service == null)
                {
                    throw new ArgumentNullException("service");
                }
                if (body == null)
                {
                    throw new ArgumentNullException("body");
                }

                // Building the initial request.
                var request = service.Customers.Insert(body);

                // Applying optional parameters to the request.
                request = (CustomersResource.InsertRequest)SampleHelpers.ApplyOptionalParms(request, optional);

                // Requesting data.
                return(request.Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request Customers.Insert failed.", ex);
            }
        }
        /// <summary>
        /// Update a customer resource if one it exists and is owned by the reseller.
        /// Documentation https://developers.google.com/reseller/v1/reference/customers/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 reseller service.</param>
        /// <param name="customerId">Id of the Customer</param>
        /// <param name="body">A valid reseller v1 body.</param>
        /// <returns>CustomerResponse</returns>
        public static Customer Update(resellerService service, string customerId, Customer body)
        {
            try
            {
                // Initial validation.
                if (service == null)
                {
                    throw new ArgumentNullException("service");
                }
                if (body == null)
                {
                    throw new ArgumentNullException("body");
                }
                if (customerId == null)
                {
                    throw new ArgumentNullException(customerId);
                }

                // Make the request.
                return(service.Customers.Update(body, customerId).Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request Customers.Update failed.", ex);
            }
        }
示例#3
0
        /// <summary>
        /// Activates a subscription previously suspended by the reseller
        /// Documentation https://developers.google.com/reseller/v1/reference/subscriptions/activate
        /// 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 reseller service.</param>
        /// <param name="customerId">Id of the Customer</param>
        /// <param name="subscriptionId">Id of the subscription, which is unique for a customer</param>
        /// <returns>SubscriptionResponse</returns>
        public static Subscription Activate(resellerService service, string customerId, string subscriptionId)
        {
            try
            {
                // Initial validation.
                if (service == null)
                {
                    throw new ArgumentNullException("service");
                }
                if (customerId == null)
                {
                    throw new ArgumentNullException(customerId);
                }
                if (subscriptionId == null)
                {
                    throw new ArgumentNullException(subscriptionId);
                }

                // Make the request.
                return(service.Subscriptions.Activate(customerId, subscriptionId).Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request Subscriptions.Activate failed.", ex);
            }
        }
示例#4
0
        /// <summary>
        /// Changes the plan of a subscription
        /// Documentation https://developers.google.com/reseller/v1/reference/subscriptions/changePlan
        /// 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 reseller service.</param>
        /// <param name="customerId">Id of the Customer</param>
        /// <param name="subscriptionId">Id of the subscription, which is unique for a customer</param>
        /// <param name="body">A valid reseller v1 body.</param>
        /// <returns>SubscriptionResponse</returns>
        public static Subscription ChangePlan(resellerService service, string customerId, string subscriptionId, ChangePlanRequest body)
        {
            try
            {
                // Initial validation.
                if (service == null)
                {
                    throw new ArgumentNullException("service");
                }
                if (body == null)
                {
                    throw new ArgumentNullException("body");
                }
                if (customerId == null)
                {
                    throw new ArgumentNullException(customerId);
                }
                if (subscriptionId == null)
                {
                    throw new ArgumentNullException(subscriptionId);
                }

                // Make the request.
                return(service.Subscriptions.ChangePlan(body, customerId, subscriptionId).Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request Subscriptions.ChangePlan failed.", ex);
            }
        }
示例#5
0
        /// <summary>
        /// Lists subscriptions of a reseller, optionally filtered by a customer name prefix.
        /// Documentation https://developers.google.com/reseller/v1/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 reseller service.</param>
        /// <param name="optional">Optional paramaters.</param>        /// <returns>SubscriptionsResponse</returns>
        public static Subscriptions List(resellerService service, SubscriptionsListOptionalParms optional = null)
        {
            try
            {
                // Initial validation.
                if (service == null)
                {
                    throw new ArgumentNullException("service");
                }

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

                // 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);
            }
        }