Ejemplo n.º 1
0
        /// <summary>
        /// List license assignments for given product of the customer.
        /// Documentation https://developers.google.com/licensing/v1/reference/licenseAssignments/listForProduct
        /// 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 licensing service.</param>
        /// <param name="productId">Name for product</param>
        /// <param name="customerId">CustomerId represents the customer for whom licenseassignments are queried</param>
        /// <param name="optional">Optional paramaters.</param>        /// <returns>LicenseAssignmentListResponse</returns>
        public static LicenseAssignmentList ListForProduct(licensingService service, string productId, string customerId, LicenseAssignmentsListForProductOptionalParms optional = null)
        {
            try
            {
                // Initial validation.
                if (service == null)
                {
                    throw new ArgumentNullException("service");
                }
                if (productId == null)
                {
                    throw new ArgumentNullException(productId);
                }
                if (customerId == null)
                {
                    throw new ArgumentNullException(customerId);
                }

                // Building the initial request.
                var request = service.LicenseAssignments.ListForProduct(productId, customerId);

                // Applying optional parameters to the request.
                request = (LicenseAssignmentsResource.ListForProductRequest)SampleHelpers.ApplyOptionalParms(request, optional);

                // Requesting data.
                return(request.Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request LicenseAssignments.ListForProduct failed.", ex);
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Revoke License.
        /// Documentation https://developers.google.com/licensing/v1/reference/licenseAssignments/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 licensing service.</param>
        /// <param name="productId">Name for product</param>
        /// <param name="skuId">Name for sku</param>
        /// <param name="userId">email id or unique Id of the user</param>
        public static void Delete(licensingService service, string productId, string skuId, string userId)
        {
            try
            {
                // Initial validation.
                if (service == null)
                {
                    throw new ArgumentNullException("service");
                }
                if (productId == null)
                {
                    throw new ArgumentNullException(productId);
                }
                if (skuId == null)
                {
                    throw new ArgumentNullException(skuId);
                }
                if (userId == null)
                {
                    throw new ArgumentNullException(userId);
                }

                // Make the request.
                return(service.LicenseAssignments.Delete(productId, skuId, userId).Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request LicenseAssignments.Delete failed.", ex);
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Assign License.
        /// Documentation https://developers.google.com/licensing/v1/reference/licenseAssignments/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 licensing service.</param>
        /// <param name="productId">Name for product</param>
        /// <param name="skuId">Name for sku</param>
        /// <param name="body">A valid licensing v1 body.</param>
        /// <returns>LicenseAssignmentResponse</returns>
        public static LicenseAssignment Insert(licensingService service, string productId, string skuId, LicenseAssignmentInsert body)
        {
            try
            {
                // Initial validation.
                if (service == null)
                {
                    throw new ArgumentNullException("service");
                }
                if (body == null)
                {
                    throw new ArgumentNullException("body");
                }
                if (productId == null)
                {
                    throw new ArgumentNullException(productId);
                }
                if (skuId == null)
                {
                    throw new ArgumentNullException(skuId);
                }

                // Make the request.
                return(service.LicenseAssignments.Insert(body, productId, skuId).Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request LicenseAssignments.Insert failed.", ex);
            }
        }