Пример #1
0
        /// <summary>
        /// Returns a single review.
        /// Documentation https://developers.google.com/androidpublisher/v2/reference/reviews/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 Androidpublisher service.</param>
        /// <param name="packageName">Unique identifier for the Android app for which we want reviews; for example, "com.spiffygame".</param>
        /// <param name="reviewId">NA</param>
        /// <param name="optional">Optional paramaters.</param>
        /// <returns>ReviewResponse</returns>
        public static Review Get(AndroidpublisherService service, string packageName, string reviewId, ReviewsGetOptionalParms optional = null)
        {
            try
            {
                // Initial validation.
                if (service == null)
                {
                    throw new ArgumentNullException("service");
                }
                if (packageName == null)
                {
                    throw new ArgumentNullException(packageName);
                }
                if (reviewId == null)
                {
                    throw new ArgumentNullException(reviewId);
                }

                // Building the initial request.
                var request = service.Reviews.Get(packageName, reviewId);

                // Applying optional parameters to the request.
                request = (ReviewsResource.GetRequest)SampleHelpers.ApplyOptionalParms(request, optional);

                // Requesting data.
                return(request.Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request Reviews.Get failed.", ex);
            }
        }
Пример #2
0
        /// <summary>
        /// Cancels a user's subscription purchase. The subscription remains valid until its expiration time.
        /// Documentation https://developers.google.com/androidpublisher/v1.1/reference/purchases/cancel
        /// 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 Androidpublisher service.</param>
        /// <param name="packageName">The package name of the application for which this subscription was purchased (for example, 'com.some.thing').</param>
        /// <param name="subscriptionId">The purchased subscription ID (for example, 'monthly001').</param>
        /// <param name="token">The token provided to the user's device when the subscription was purchased.</param>
        public static void Cancel(AndroidpublisherService service, string packageName, string subscriptionId, string token)
        {
            try
            {
                // Initial validation.
                if (service == null)
                {
                    throw new ArgumentNullException("service");
                }
                if (packageName == null)
                {
                    throw new ArgumentNullException(packageName);
                }
                if (subscriptionId == null)
                {
                    throw new ArgumentNullException(subscriptionId);
                }
                if (token == null)
                {
                    throw new ArgumentNullException(token);
                }

                // Make the request.
                service.Purchases.Cancel(packageName, subscriptionId, token).Execute();
            }
            catch (Exception ex)
            {
                throw new Exception("Request Purchases.Cancel failed.", ex);
            }
        }
Пример #3
0
        /// <summary>
        /// Reply to a single review, or update an existing reply.
        /// Documentation https://developers.google.com/androidpublisher/v2/reference/reviews/reply
        /// 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 Androidpublisher service.</param>
        /// <param name="packageName">Unique identifier for the Android app for which we want reviews; for example, "com.spiffygame".</param>
        /// <param name="reviewId">NA</param>
        /// <param name="body">A valid Androidpublisher v2 body.</param>
        /// <returns>ReviewsReplyResponseResponse</returns>
        public static ReviewsReplyResponse Reply(AndroidpublisherService service, string packageName, string reviewId, ReviewsReplyRequest body)
        {
            try
            {
                // Initial validation.
                if (service == null)
                {
                    throw new ArgumentNullException("service");
                }
                if (body == null)
                {
                    throw new ArgumentNullException("body");
                }
                if (packageName == null)
                {
                    throw new ArgumentNullException(packageName);
                }
                if (reviewId == null)
                {
                    throw new ArgumentNullException(reviewId);
                }

                // Make the request.
                return(service.Reviews.Reply(body, packageName, reviewId).Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request Reviews.Reply failed.", ex);
            }
        }
Пример #4
0
        /// <summary>
        /// Checks the purchase and consumption status of an inapp item.
        /// Documentation https://developers.google.com/androidpublisher/v1.1/reference/inapppurchases/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 Androidpublisher service.</param>
        /// <param name="packageName">The package name of the application the inapp product was sold in (for example, 'com.some.thing').</param>
        /// <param name="productId">The inapp product SKU (for example, 'com.some.thing.inapp1').</param>
        /// <param name="token">The token provided to the user's device when the inapp product was purchased.</param>
        /// <returns>InappPurchaseResponse</returns>
        public static InappPurchase Get(AndroidpublisherService service, string packageName, string productId, string token)
        {
            try
            {
                // Initial validation.
                if (service == null)
                {
                    throw new ArgumentNullException("service");
                }
                if (packageName == null)
                {
                    throw new ArgumentNullException(packageName);
                }
                if (productId == null)
                {
                    throw new ArgumentNullException(productId);
                }
                if (token == null)
                {
                    throw new ArgumentNullException(token);
                }

                // Make the request.
                return(service.Inapppurchases.Get(packageName, productId, token).Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request Inapppurchases.Get failed.", ex);
            }
        }
        /// <summary>
        /// Delete an in-app product for an app.
        /// Documentation https://developers.google.com/androidpublisher/v2/reference/inappproducts/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 Androidpublisher service.</param>
        /// <param name="packageName">Unique identifier for the Android app with the in-app product; for example, "com.spiffygame".</param>
        /// <param name="sku">Unique identifier for the in-app product.</param>
        public static void Delete(AndroidpublisherService service, string packageName, string sku)
        {
            try
            {
                // Initial validation.
                if (service == null)
                {
                    throw new ArgumentNullException("service");
                }
                if (packageName == null)
                {
                    throw new ArgumentNullException(packageName);
                }
                if (sku == null)
                {
                    throw new ArgumentNullException(sku);
                }

                // Make the request.
                service.Inappproducts.Delete(packageName, sku).Execute();
            }
            catch (Exception ex)
            {
                throw new Exception("Request Inappproducts.Delete failed.", ex);
            }
        }
        /// <summary>
        /// List all the in-app products for an Android app, both subscriptions and managed in-app products..
        /// Documentation https://developers.google.com/androidpublisher/v2/reference/inappproducts/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 Androidpublisher service.</param>
        /// <param name="packageName">Unique identifier for the Android app with in-app products; for example, "com.spiffygame".</param>
        /// <param name="optional">Optional paramaters.</param>
        /// <returns>InappproductsListResponseResponse</returns>
        public static InappproductsListResponse List(AndroidpublisherService service, string packageName, InappproductsListOptionalParms optional = null)
        {
            try
            {
                // Initial validation.
                if (service == null)
                {
                    throw new ArgumentNullException("service");
                }
                if (packageName == null)
                {
                    throw new ArgumentNullException(packageName);
                }

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

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

                // Requesting data.
                return(request.Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request Inappproducts.List failed.", ex);
            }
        }
        /// <summary>
        /// NA
        /// Documentation https://developers.google.com/androidpublisher/v2/reference/inappproducts/batch
        /// 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 Androidpublisher service.</param>
        /// <param name="body">A valid Androidpublisher v2 body.</param>
        /// <returns>InappproductsBatchResponseResponse</returns>
        public static InappproductsBatchResponse Batch(AndroidpublisherService service, InappproductsBatchRequest body)
        {
            try
            {
                // Initial validation.
                if (service == null)
                {
                    throw new ArgumentNullException("service");
                }
                if (body == null)
                {
                    throw new ArgumentNullException("body");
                }

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