/// <summary>
        /// Retrieves details of an enterprise's group license for a product.
        /// Documentation https://developers.google.com/androidenterprise/v1/reference/grouplicenses/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 AndroidEnterprise service.</param>
        /// <param name="enterpriseId">The ID of the enterprise.</param>
        /// <param name="groupLicenseId">The ID of the product the group license is for, e.g. "app:com.google.android.gm".</param>
        /// <returns>GroupLicenseResponse</returns>
        public static GroupLicense Get(AndroidEnterpriseService service, string enterpriseId, string groupLicenseId)
        {
            try
            {
                // Initial validation.
                if (service == null)
                {
                    throw new ArgumentNullException("service");
                }
                if (enterpriseId == null)
                {
                    throw new ArgumentNullException(enterpriseId);
                }
                if (groupLicenseId == null)
                {
                    throw new ArgumentNullException(groupLicenseId);
                }

                // Make the request.
                return(service.Grouplicenses.Get(enterpriseId, groupLicenseId).Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request Grouplicenses.Get failed.", ex);
            }
        }
        /// Documentation https://developers.google.com/androidenterprise/v1/reference/serviceaccountkeys/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 AndroidEnterprise service.</param>
        /// <param name="enterpriseId">The ID of the enterprise.</param>
        /// <param name="body">A valid AndroidEnterprise v1 body.</param>
        /// <returns>ServiceAccountKeyResponse</returns>
        public static ServiceAccountKey Insert(AndroidEnterpriseService service, string enterpriseId, ServiceAccountKey body)
        {
            try
            {
                // Initial validation.
                if (service == null)
                {
                    throw new ArgumentNullException("service");
                }
                if (body == null)
                {
                    throw new ArgumentNullException("body");
                }
                if (enterpriseId == null)
                {
                    throw new ArgumentNullException(enterpriseId);
                }

                // Make the request.
                return(service.Serviceaccountkeys.Insert(body, enterpriseId).Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request Serviceaccountkeys.Insert failed.", ex);
            }
        }
Example #3
0
        /// <summary>
        /// Updates a cluster.
        /// Documentation https://developers.google.com/androidenterprise/v1/reference/storelayoutclusters/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 AndroidEnterprise service.</param>
        /// <param name="enterpriseId">The ID of the enterprise.</param>
        /// <param name="pageId">The ID of the page.</param>
        /// <param name="clusterId">The ID of the cluster.</param>
        /// <param name="body">A valid AndroidEnterprise v1 body.</param>
        /// <returns>StoreClusterResponse</returns>
        public static StoreCluster Update(AndroidEnterpriseService service, string enterpriseId, string pageId, string clusterId, StoreCluster body)
        {
            try
            {
                // Initial validation.
                if (service == null)
                {
                    throw new ArgumentNullException("service");
                }
                if (body == null)
                {
                    throw new ArgumentNullException("body");
                }
                if (enterpriseId == null)
                {
                    throw new ArgumentNullException(enterpriseId);
                }
                if (pageId == null)
                {
                    throw new ArgumentNullException(pageId);
                }
                if (clusterId == null)
                {
                    throw new ArgumentNullException(clusterId);
                }

                // Make the request.
                return(service.Storelayoutclusters.Update(body, enterpriseId, pageId, clusterId).Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request Storelayoutclusters.Update failed.", ex);
            }
        }
        /// <summary>
        /// Removes and invalidates the specified credentials for the service account associated with this enterprise. The calling service account must have been retrieved by calling Enterprises.GetServiceAccount and must have been set as the enterprise service account by calling Enterprises.SetAccount.
        /// Documentation https://developers.google.com/androidenterprise/v1/reference/serviceaccountkeys/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 AndroidEnterprise service.</param>
        /// <param name="enterpriseId">The ID of the enterprise.</param>
        /// <param name="keyId">The ID of the key.</param>
        public static void Delete(AndroidEnterpriseService service, string enterpriseId, string keyId)
        {
            try
            {
                // Initial validation.
                if (service == null)
                {
                    throw new ArgumentNullException("service");
                }
                if (enterpriseId == null)
                {
                    throw new ArgumentNullException(enterpriseId);
                }
                if (keyId == null)
                {
                    throw new ArgumentNullException(keyId);
                }

                // Make the request.
                return(service.Serviceaccountkeys.Delete(enterpriseId, keyId).Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request Serviceaccountkeys.Delete failed.", ex);
            }
        }
Example #5
0
        /// <summary>
        /// Retrieves the set of products a user is entitled to access.
        /// Documentation https://developers.google.com/androidenterprise/v1/reference/users/getAvailableProductSet
        /// 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 AndroidEnterprise service.</param>
        /// <param name="enterpriseId">The ID of the enterprise.</param>
        /// <param name="userId">The ID of the user.</param>
        /// <returns>ProductSetResponse</returns>
        public static ProductSet GetAvailableProductSet(AndroidEnterpriseService service, string enterpriseId, string userId)
        {
            try
            {
                // Initial validation.
                if (service == null)
                {
                    throw new ArgumentNullException("service");
                }
                if (enterpriseId == null)
                {
                    throw new ArgumentNullException(enterpriseId);
                }
                if (userId == null)
                {
                    throw new ArgumentNullException(userId);
                }

                // Make the request.
                return(service.Users.GetAvailableProductSet(enterpriseId, userId).Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request Users.GetAvailableProductSet failed.", ex);
            }
        }
        /// <summary>
        /// Removes a per-device managed configuration for an app for the specified device.
        /// Documentation https://developers.google.com/androidenterprise/v1/reference/managedconfigurationsfordevice/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 AndroidEnterprise service.</param>
        /// <param name="enterpriseId">The ID of the enterprise.</param>
        /// <param name="userId">The ID of the user.</param>
        /// <param name="deviceId">The Android ID of the device.</param>
        /// <param name="managedConfigurationForDeviceId">The ID of the managed configuration (a product ID), e.g. "app:com.google.android.gm".</param>
        public static void Delete(AndroidEnterpriseService service, string enterpriseId, string userId, string deviceId, string managedConfigurationForDeviceId)
        {
            try
            {
                // Initial validation.
                if (service == null)
                {
                    throw new ArgumentNullException("service");
                }
                if (enterpriseId == null)
                {
                    throw new ArgumentNullException(enterpriseId);
                }
                if (userId == null)
                {
                    throw new ArgumentNullException(userId);
                }
                if (deviceId == null)
                {
                    throw new ArgumentNullException(deviceId);
                }
                if (managedConfigurationForDeviceId == null)
                {
                    throw new ArgumentNullException(managedConfigurationForDeviceId);
                }

                // Make the request.
                return(service.Managedconfigurationsfordevice.Delete(enterpriseId, userId, deviceId, managedConfigurationForDeviceId).Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request Managedconfigurationsfordevice.Delete failed.", ex);
            }
        }
Example #7
0
        /// <summary>
        /// Requests to remove an app from a device. A call to get or list will still show the app as installed on the device until it is actually removed.
        /// Documentation https://developers.google.com/androidenterprise/v1/reference/installs/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 AndroidEnterprise service.</param>
        /// <param name="enterpriseId">The ID of the enterprise.</param>
        /// <param name="userId">The ID of the user.</param>
        /// <param name="deviceId">The Android ID of the device.</param>
        /// <param name="installId">The ID of the product represented by the install, e.g. "app:com.google.android.gm".</param>
        public static void Delete(AndroidEnterpriseService service, string enterpriseId, string userId, string deviceId, string installId)
        {
            try
            {
                // Initial validation.
                if (service == null)
                {
                    throw new ArgumentNullException("service");
                }
                if (enterpriseId == null)
                {
                    throw new ArgumentNullException(enterpriseId);
                }
                if (userId == null)
                {
                    throw new ArgumentNullException(userId);
                }
                if (deviceId == null)
                {
                    throw new ArgumentNullException(deviceId);
                }
                if (installId == null)
                {
                    throw new ArgumentNullException(installId);
                }

                // Make the request.
                return(service.Installs.Delete(enterpriseId, userId, deviceId, installId).Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request Installs.Delete failed.", ex);
            }
        }
        /// <summary>
        /// Lists all the per-user managed configurations for the specified user. Only the ID is set.
        /// Documentation https://developers.google.com/androidenterprise/v1/reference/managedconfigurationsforuser/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 AndroidEnterprise service.</param>
        /// <param name="enterpriseId">The ID of the enterprise.</param>
        /// <param name="userId">The ID of the user.</param>
        /// <returns>ManagedConfigurationsForUserListResponseResponse</returns>
        public static ManagedConfigurationsForUserListResponse List(AndroidEnterpriseService service, string enterpriseId, string userId)
        {
            try
            {
                // Initial validation.
                if (service == null)
                {
                    throw new ArgumentNullException("service");
                }
                if (enterpriseId == null)
                {
                    throw new ArgumentNullException(enterpriseId);
                }
                if (userId == null)
                {
                    throw new ArgumentNullException(userId);
                }

                // Make the request.
                return(service.Managedconfigurationsforuser.List(enterpriseId, userId).Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request Managedconfigurationsforuser.List failed.", ex);
            }
        }
        /// <summary>
        /// Finds approved products that match a query, or all approved products if there is no query.
        /// Documentation https://developers.google.com/androidenterprise/v1/reference/products/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 AndroidEnterprise service.</param>
        /// <param name="enterpriseId">The ID of the enterprise.</param>
        /// <param name="optional">Optional paramaters.</param>        /// <returns>ProductsListResponseResponse</returns>
        public static ProductsListResponse List(AndroidEnterpriseService service, string enterpriseId, ProductsListOptionalParms optional = null)
        {
            try
            {
                // Initial validation.
                if (service == null)
                {
                    throw new ArgumentNullException("service");
                }
                if (enterpriseId == null)
                {
                    throw new ArgumentNullException(enterpriseId);
                }

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

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

                // Requesting data.
                return(request.Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request Products.List failed.", ex);
            }
        }
        /// Documentation https://developers.google.com/androidenterprise/v1/reference/products/approve
        /// 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 AndroidEnterprise service.</param>
        /// <param name="enterpriseId">The ID of the enterprise.</param>
        /// <param name="productId">The ID of the product.</param>
        /// <param name="body">A valid AndroidEnterprise v1 body.</param>
        public static void Approve(AndroidEnterpriseService service, string enterpriseId, string productId, ProductsApproveRequest body)
        {
            try
            {
                // Initial validation.
                if (service == null)
                {
                    throw new ArgumentNullException("service");
                }
                if (body == null)
                {
                    throw new ArgumentNullException("body");
                }
                if (enterpriseId == null)
                {
                    throw new ArgumentNullException(enterpriseId);
                }
                if (productId == null)
                {
                    throw new ArgumentNullException(productId);
                }

                // Make the request.
                return(service.Products.Approve(body, enterpriseId, productId).Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request Products.Approve failed.", ex);
            }
        }
Example #11
0
        /// <summary>
        /// Retrieves details of a store page.
        /// Documentation https://developers.google.com/androidenterprise/v1/reference/storelayoutpages/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 AndroidEnterprise service.</param>
        /// <param name="enterpriseId">The ID of the enterprise.</param>
        /// <param name="pageId">The ID of the page.</param>
        /// <returns>StorePageResponse</returns>
        public static StorePage Get(AndroidEnterpriseService service, string enterpriseId, string pageId)
        {
            try
            {
                // Initial validation.
                if (service == null)
                {
                    throw new ArgumentNullException("service");
                }
                if (enterpriseId == null)
                {
                    throw new ArgumentNullException(enterpriseId);
                }
                if (pageId == null)
                {
                    throw new ArgumentNullException(pageId);
                }

                // Make the request.
                return(service.Storelayoutpages.Get(enterpriseId, pageId).Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request Storelayoutpages.Get failed.", ex);
            }
        }
        /// <summary>
        /// Retrieves the Android app permissions required by this app.
        /// Documentation https://developers.google.com/androidenterprise/v1/reference/products/getPermissions
        /// 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 AndroidEnterprise service.</param>
        /// <param name="enterpriseId">The ID of the enterprise.</param>
        /// <param name="productId">The ID of the product.</param>
        /// <returns>ProductPermissionsResponse</returns>
        public static ProductPermissions GetPermissions(AndroidEnterpriseService service, string enterpriseId, string productId)
        {
            try
            {
                // Initial validation.
                if (service == null)
                {
                    throw new ArgumentNullException("service");
                }
                if (enterpriseId == null)
                {
                    throw new ArgumentNullException(enterpriseId);
                }
                if (productId == null)
                {
                    throw new ArgumentNullException(productId);
                }

                // Make the request.
                return(service.Products.GetPermissions(enterpriseId, productId).Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request Products.GetPermissions failed.", ex);
            }
        }
Example #13
0
        /// Documentation https://developers.google.com/androidenterprise/v1/reference/users/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 AndroidEnterprise service.</param>
        /// <param name="enterpriseId">The ID of the enterprise.</param>
        /// <param name="userId">The ID of the user.</param>
        /// <param name="body">A valid AndroidEnterprise v1 body.</param>
        /// <returns>UserResponse</returns>
        public static User Update(AndroidEnterpriseService service, string enterpriseId, string userId, User body)
        {
            try
            {
                // Initial validation.
                if (service == null)
                {
                    throw new ArgumentNullException("service");
                }
                if (body == null)
                {
                    throw new ArgumentNullException("body");
                }
                if (enterpriseId == null)
                {
                    throw new ArgumentNullException(enterpriseId);
                }
                if (userId == null)
                {
                    throw new ArgumentNullException(userId);
                }

                // Make the request.
                return(service.Users.Update(body, enterpriseId, userId).Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request Users.Update failed.", ex);
            }
        }
Example #14
0
        /// Documentation https://developers.google.com/androidenterprise/v1/reference/users/generateAuthenticationToken
        /// 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 AndroidEnterprise service.</param>
        /// <param name="enterpriseId">The ID of the enterprise.</param>
        /// <param name="userId">The ID of the user.</param>
        /// <returns>AuthenticationTokenResponse</returns>
        public static AuthenticationToken GenerateAuthenticationToken(AndroidEnterpriseService service, string enterpriseId, string userId)
        {
            try
            {
                // Initial validation.
                if (service == null)
                {
                    throw new ArgumentNullException("service");
                }
                if (enterpriseId == null)
                {
                    throw new ArgumentNullException(enterpriseId);
                }
                if (userId == null)
                {
                    throw new ArgumentNullException(userId);
                }

                // Make the request.
                return(service.Users.GenerateAuthenticationToken(enterpriseId, userId).Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request Users.GenerateAuthenticationToken failed.", ex);
            }
        }
Example #15
0
        /// <summary>
        /// Looks up a user by primary email address. This is only supported for Google-managed users. Lookup of the id is not needed for EMM-managed users because the id is already returned in the result of the Users.insert call.
        /// Documentation https://developers.google.com/androidenterprise/v1/reference/users/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 AndroidEnterprise service.</param>
        /// <param name="enterpriseId">The ID of the enterprise.</param>
        /// <param name="email">The exact primary email address of the user to look up.</param>
        /// <returns>UsersListResponseResponse</returns>
        public static UsersListResponse List(AndroidEnterpriseService service, string enterpriseId, string email)
        {
            try
            {
                // Initial validation.
                if (service == null)
                {
                    throw new ArgumentNullException("service");
                }
                if (enterpriseId == null)
                {
                    throw new ArgumentNullException(enterpriseId);
                }
                if (email == null)
                {
                    throw new ArgumentNullException(email);
                }

                // Make the request.
                return(service.Users.List(enterpriseId, email).Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request Users.List failed.", ex);
            }
        }
        /// <summary>
        /// Adds or updates a per-user managed configuration for an app for the specified user.
        /// Documentation https://developers.google.com/androidenterprise/v1/reference/managedconfigurationsforuser/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 AndroidEnterprise service.</param>
        /// <param name="enterpriseId">The ID of the enterprise.</param>
        /// <param name="userId">The ID of the user.</param>
        /// <param name="managedConfigurationForUserId">The ID of the managed configuration (a product ID), e.g. "app:com.google.android.gm".</param>
        /// <param name="body">A valid AndroidEnterprise v1 body.</param>
        /// <returns>ManagedConfigurationResponse</returns>
        public static ManagedConfiguration Update(AndroidEnterpriseService service, string enterpriseId, string userId, string managedConfigurationForUserId, ManagedConfiguration body)
        {
            try
            {
                // Initial validation.
                if (service == null)
                {
                    throw new ArgumentNullException("service");
                }
                if (body == null)
                {
                    throw new ArgumentNullException("body");
                }
                if (enterpriseId == null)
                {
                    throw new ArgumentNullException(enterpriseId);
                }
                if (userId == null)
                {
                    throw new ArgumentNullException(userId);
                }
                if (managedConfigurationForUserId == null)
                {
                    throw new ArgumentNullException(managedConfigurationForUserId);
                }

                // Make the request.
                return(service.Managedconfigurationsforuser.Update(body, enterpriseId, userId, managedConfigurationForUserId).Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request Managedconfigurationsforuser.Update failed.", ex);
            }
        }
        /// <summary>
        /// Removes the user from the list of those specifically allowed to see the collection. If the collection's visibility is set to viewersOnly then only such users will see the collection.
        /// Documentation https://developers.google.com/androidenterprise/v1/reference/collectionviewers/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 AndroidEnterprise service.</param>
        /// <param name="enterpriseId">The ID of the enterprise.</param>
        /// <param name="collectionId">The ID of the collection.</param>
        /// <param name="userId">The ID of the user.</param>
        public static void Delete(AndroidEnterpriseService service, string enterpriseId, string collectionId, string userId)
        {
            try
            {
                // Initial validation.
                if (service == null)
                {
                    throw new ArgumentNullException("service");
                }
                if (enterpriseId == null)
                {
                    throw new ArgumentNullException(enterpriseId);
                }
                if (collectionId == null)
                {
                    throw new ArgumentNullException(collectionId);
                }
                if (userId == null)
                {
                    throw new ArgumentNullException(userId);
                }

                // Make the request.
                return(service.Collectionviewers.Delete(enterpriseId, collectionId, userId).Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request Collectionviewers.Delete failed.", ex);
            }
        }
        /// <summary>
        /// Updates a collection.
        /// Documentation https://developers.google.com/androidenterprise/v1/reference/collections/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 AndroidEnterprise service.</param>
        /// <param name="enterpriseId">The ID of the enterprise.</param>
        /// <param name="collectionId">The ID of the collection.</param>
        /// <param name="body">A valid AndroidEnterprise v1 body.</param>
        /// <returns>CollectionResponse</returns>
        public static Collection Update(AndroidEnterpriseService service, string enterpriseId, string collectionId, Collection body)
        {
            try
            {
                // Initial validation.
                if (service == null)
                {
                    throw new ArgumentNullException("service");
                }
                if (body == null)
                {
                    throw new ArgumentNullException("body");
                }
                if (enterpriseId == null)
                {
                    throw new ArgumentNullException(enterpriseId);
                }
                if (collectionId == null)
                {
                    throw new ArgumentNullException(collectionId);
                }

                // Make the request.
                return(service.Collections.Update(body, enterpriseId, collectionId).Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request Collections.Update failed.", ex);
            }
        }
Example #19
0
        /// <summary>
        /// Adds or updates an entitlement to an app for a user.
        /// Documentation https://developers.google.com/androidenterprise/v1/reference/entitlements/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 AndroidEnterprise service.</param>
        /// <param name="enterpriseId">The ID of the enterprise.</param>
        /// <param name="userId">The ID of the user.</param>
        /// <param name="entitlementId">The ID of the entitlement (a product ID), e.g. "app:com.google.android.gm".</param>
        /// <param name="body">A valid AndroidEnterprise v1 body.</param>
        /// <param name="optional">Optional paramaters.</param>        /// <returns>EntitlementResponse</returns>
        public static Entitlement Update(AndroidEnterpriseService service, string enterpriseId, string userId, string entitlementId, Entitlement body, EntitlementsUpdateOptionalParms optional = null)
        {
            try
            {
                // Initial validation.
                if (service == null)
                {
                    throw new ArgumentNullException("service");
                }
                if (body == null)
                {
                    throw new ArgumentNullException("body");
                }
                if (enterpriseId == null)
                {
                    throw new ArgumentNullException(enterpriseId);
                }
                if (userId == null)
                {
                    throw new ArgumentNullException(userId);
                }
                if (entitlementId == null)
                {
                    throw new ArgumentNullException(entitlementId);
                }

                // Building the initial request.
                var request = service.Entitlements.Update(body, enterpriseId, userId, entitlementId);

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

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