コード例 #1
0
        /// <summary>
        /// Updates a calendar resource.
        /// Documentation https://developers.google.com/directory/directory_v1/reference/calendars/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 directory service.</param>
        /// <param name="customer">The unique ID for the customer's Google account. As an account administrator, you can also use the my_customer alias to represent your account's customer ID.</param>
        /// <param name="calendarResourceId">The unique ID of the calendar resource to update.</param>
        /// <param name="body">A valid directory directory_v1 body.</param>
        /// <returns>CalendarResourceResponse</returns>
        public static CalendarResource Update(directoryService service, string customer, string calendarResourceId, CalendarResource body)
        {
            try
            {
                // Initial validation.
                if (service == null)
                {
                    throw new ArgumentNullException("service");
                }
                if (body == null)
                {
                    throw new ArgumentNullException("body");
                }
                if (customer == null)
                {
                    throw new ArgumentNullException(customer);
                }
                if (calendarResourceId == null)
                {
                    throw new ArgumentNullException(calendarResourceId);
                }

                // Make the request.
                return(service.Calendars.Update(body, customer, calendarResourceId).Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request Calendars.Update failed.", ex);
            }
        }
コード例 #2
0
        /// <summary>
        /// Get information about an access token issued by a user.
        /// Documentation https://developers.google.com/directory/directory_v1/reference/tokens/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 directory service.</param>
        /// <param name="userKey">Identifies the user in the API request. The value can be the user's primary email address, alias email address, or unique user ID.</param>
        /// <param name="clientId">The Client ID of the application the token is issued to.</param>
        /// <returns>TokenResponse</returns>
        public static Token Get(directoryService service, string userKey, string clientId)
        {
            try
            {
                // Initial validation.
                if (service == null)
                {
                    throw new ArgumentNullException("service");
                }
                if (userKey == null)
                {
                    throw new ArgumentNullException(userKey);
                }
                if (clientId == null)
                {
                    throw new ArgumentNullException(clientId);
                }

                // Make the request.
                return(service.Tokens.Get(userKey, clientId).Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request Tokens.Get failed.", ex);
            }
        }
コード例 #3
0
        /// <summary>
        /// Retrieve Group Member
        /// Documentation https://developers.google.com/directory/directory_v1/reference/members/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 directory service.</param>
        /// <param name="groupKey">Email or immutable Id of the group</param>
        /// <param name="memberKey">Email or immutable Id of the member</param>
        /// <returns>MemberResponse</returns>
        public static Member Get(directoryService service, string groupKey, string memberKey)
        {
            try
            {
                // Initial validation.
                if (service == null)
                {
                    throw new ArgumentNullException("service");
                }
                if (groupKey == null)
                {
                    throw new ArgumentNullException(groupKey);
                }
                if (memberKey == null)
                {
                    throw new ArgumentNullException(memberKey);
                }

                // Make the request.
                return(service.Members.Get(groupKey, memberKey).Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request Members.Get failed.", ex);
            }
        }
コード例 #4
0
        /// <summary>
        /// Add a alias for the user
        /// Documentation https://developers.google.com/directory/directory_v1/reference/aliases/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 directory service.</param>
        /// <param name="userKey">Email or immutable Id of the user</param>
        /// <param name="body">A valid directory directory_v1 body.</param>
        /// <returns>AliasResponse</returns>
        public static Alias Insert(directoryService service, string userKey, Alias body)
        {
            try
            {
                // Initial validation.
                if (service == null)
                {
                    throw new ArgumentNullException("service");
                }
                if (body == null)
                {
                    throw new ArgumentNullException("body");
                }
                if (userKey == null)
                {
                    throw new ArgumentNullException(userKey);
                }

                // Make the request.
                return(service.Aliases.Insert(body, userKey).Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request Aliases.Insert failed.", ex);
            }
        }
コード例 #5
0
        /// <summary>
        /// Watch for changes in user aliases list
        /// Documentation https://developers.google.com/directory/directory_v1/reference/aliases/watch
        /// 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 directory service.</param>
        /// <param name="userKey">Email or immutable Id of the user</param>
        /// <param name="body">A valid directory directory_v1 body.</param>
        /// <param name="optional">Optional paramaters.</param>        /// <returns>ChannelResponse</returns>
        public static Channel Watch(directoryService service, string userKey, Channel body, AliasesWatchOptionalParms optional = null)
        {
            try
            {
                // Initial validation.
                if (service == null)
                {
                    throw new ArgumentNullException("service");
                }
                if (body == null)
                {
                    throw new ArgumentNullException("body");
                }
                if (userKey == null)
                {
                    throw new ArgumentNullException(userKey);
                }

                // Building the initial request.
                var request = service.Aliases.Watch(body, userKey);

                // Applying optional parameters to the request.
                request = (AliasesResource.WatchRequest)SampleHelpers.ApplyOptionalParms(request, optional);

                // Requesting data.
                return(request.Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request Aliases.Watch failed.", ex);
            }
        }
コード例 #6
0
        /// <summary>
        /// Delete Mobile Device
        /// Documentation https://developers.google.com/directory/directory_v1/reference/mobiledevices/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 directory service.</param>
        /// <param name="customerId">Immutable id of the Google Apps account</param>
        /// <param name="resourceId">Immutable id of Mobile Device</param>
        public static void Delete(directoryService service, string customerId, string resourceId)
        {
            try
            {
                // Initial validation.
                if (service == null)
                {
                    throw new ArgumentNullException("service");
                }
                if (customerId == null)
                {
                    throw new ArgumentNullException(customerId);
                }
                if (resourceId == null)
                {
                    throw new ArgumentNullException(resourceId);
                }

                // Make the request.
                return(service.Mobiledevices.Delete(customerId, resourceId).Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request Mobiledevices.Delete failed.", ex);
            }
        }
コード例 #7
0
        /// <summary>
        /// Deletes a notification
        /// Documentation https://developers.google.com/directory/directory_v1/reference/notifications/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 directory service.</param>
        /// <param name="customer">The unique ID for the customer's Google account. The customerId is also returned as part of the Users resource.</param>
        /// <param name="notificationId">The unique ID of the notification.</param>
        public static void Delete(directoryService service, string customer, string notificationId)
        {
            try
            {
                // Initial validation.
                if (service == null)
                {
                    throw new ArgumentNullException("service");
                }
                if (customer == null)
                {
                    throw new ArgumentNullException(customer);
                }
                if (notificationId == null)
                {
                    throw new ArgumentNullException(notificationId);
                }

                // Make the request.
                return(service.Notifications.Delete(customer, notificationId).Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request Notifications.Delete failed.", ex);
            }
        }
コード例 #8
0
        /// <summary>
        /// Retrieve all Mobile Devices of a customer (paginated)
        /// Documentation https://developers.google.com/directory/directory_v1/reference/mobiledevices/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 directory service.</param>
        /// <param name="customerId">Immutable id of the Google Apps account</param>
        /// <param name="optional">Optional paramaters.</param>        /// <returns>MobileDevicesResponse</returns>
        public static MobileDevices List(directoryService service, string customerId, MobiledevicesListOptionalParms optional = null)
        {
            try
            {
                // Initial validation.
                if (service == null)
                {
                    throw new ArgumentNullException("service");
                }
                if (customerId == null)
                {
                    throw new ArgumentNullException(customerId);
                }

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

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

                // Requesting data.
                return(request.Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request Mobiledevices.List failed.", ex);
            }
        }
コード例 #9
0
        /// <summary>
        /// Take action on Chrome OS Device
        /// Documentation https://developers.google.com/directory/directory_v1/reference/chromeosdevices/action
        /// 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 directory service.</param>
        /// <param name="customerId">Immutable id of the Google Apps account</param>
        /// <param name="resourceId">Immutable id of Chrome OS Device</param>
        /// <param name="body">A valid directory directory_v1 body.</param>
        public static void Action(directoryService service, string customerId, string resourceId, ChromeOsDeviceAction 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 (resourceId == null)
                {
                    throw new ArgumentNullException(resourceId);
                }

                // Make the request.
                return(service.Chromeosdevices.Action(body, customerId, resourceId).Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request Chromeosdevices.Action failed.", ex);
            }
        }
コード例 #10
0
        /// <summary>
        /// Retrieves a domain alias of the customer.
        /// Documentation https://developers.google.com/directory/directory_v1/reference/domainAliases/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 directory service.</param>
        /// <param name="customer">Immutable id of the Google Apps account.</param>
        /// <param name="domainAliasName">Name of domain alias to be retrieved.</param>
        /// <returns>DomainAliasResponse</returns>
        public static DomainAlias Get(directoryService service, string customer, string domainAliasName)
        {
            try
            {
                // Initial validation.
                if (service == null)
                {
                    throw new ArgumentNullException("service");
                }
                if (customer == null)
                {
                    throw new ArgumentNullException(customer);
                }
                if (domainAliasName == null)
                {
                    throw new ArgumentNullException(domainAliasName);
                }

                // Make the request.
                return(service.DomainAliases.Get(customer, domainAliasName).Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request DomainAliases.Get failed.", ex);
            }
        }
コード例 #11
0
        /// <summary>
        /// Creates a role.
        /// Documentation https://developers.google.com/directory/directory_v1/reference/roles/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 directory service.</param>
        /// <param name="customer">Immutable ID of the Google Apps account.</param>
        /// <param name="body">A valid directory directory_v1 body.</param>
        /// <returns>RoleResponse</returns>
        public static Role Insert(directoryService service, string customer, Role body)
        {
            try
            {
                // Initial validation.
                if (service == null)
                {
                    throw new ArgumentNullException("service");
                }
                if (body == null)
                {
                    throw new ArgumentNullException("body");
                }
                if (customer == null)
                {
                    throw new ArgumentNullException(customer);
                }

                // Make the request.
                return(service.Roles.Insert(body, customer).Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request Roles.Insert failed.", ex);
            }
        }
コード例 #12
0
        /// <summary>
        /// Retrieves a role.
        /// Documentation https://developers.google.com/directory/directory_v1/reference/roles/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 directory service.</param>
        /// <param name="customer">Immutable ID of the Google Apps account.</param>
        /// <param name="roleId">Immutable ID of the role.</param>
        /// <returns>RoleResponse</returns>
        public static Role Get(directoryService service, string customer, string roleId)
        {
            try
            {
                // Initial validation.
                if (service == null)
                {
                    throw new ArgumentNullException("service");
                }
                if (customer == null)
                {
                    throw new ArgumentNullException(customer);
                }
                if (roleId == null)
                {
                    throw new ArgumentNullException(roleId);
                }

                // Make the request.
                return(service.Roles.Get(customer, roleId).Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request Roles.Get failed.", ex);
            }
        }
コード例 #13
0
        /// <summary>
        /// Retrieve schema
        /// Documentation https://developers.google.com/directory/directory_v1/reference/schemas/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 directory service.</param>
        /// <param name="customerId">Immutable id of the Google Apps account</param>
        /// <param name="schemaKey">Name or immutable Id of the schema</param>
        /// <returns>SchemaResponse</returns>
        public static Schema Get(directoryService service, string customerId, string schemaKey)
        {
            try
            {
                // Initial validation.
                if (service == null)
                {
                    throw new ArgumentNullException("service");
                }
                if (customerId == null)
                {
                    throw new ArgumentNullException(customerId);
                }
                if (schemaKey == null)
                {
                    throw new ArgumentNullException(schemaKey);
                }

                // Make the request.
                return(service.Schemas.Get(customerId, schemaKey).Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request Schemas.Get failed.", ex);
            }
        }
コード例 #14
0
        /// <summary>
        /// Retrieve Organization Unit
        /// Documentation https://developers.google.com/directory/directory_v1/reference/orgunits/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 directory service.</param>
        /// <param name="customerId">Immutable id of the Google Apps account</param>
        /// <param name="orgUnitPath">Full path of the organization unit or its Id</param>
        /// <returns>OrgUnitResponse</returns>
        public static OrgUnit Get(directoryService service, string customerId, string orgUnitPath)
        {
            try
            {
                // Initial validation.
                if (service == null)
                {
                    throw new ArgumentNullException("service");
                }
                if (customerId == null)
                {
                    throw new ArgumentNullException(customerId);
                }
                if (orgUnitPath == null)
                {
                    throw new ArgumentNullException(orgUnitPath);
                }

                // Make the request.
                return(service.Orgunits.Get(customerId, orgUnitPath).Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request Orgunits.Get failed.", ex);
            }
        }
コード例 #15
0
        /// <summary>
        /// Updates a customer. This method supports patch semantics.
        /// Documentation https://developers.google.com/directory/directory_v1/reference/customers/patch
        /// 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 directory service.</param>
        /// <param name="customerKey">Id of the customer to be updated</param>
        /// <param name="body">A valid directory directory_v1 body.</param>
        /// <returns>CustomerResponse</returns>
        public static Customer Patch(directoryService service, string customerKey, Customer body)
        {
            try
            {
                // Initial validation.
                if (service == null)
                {
                    throw new ArgumentNullException("service");
                }
                if (body == null)
                {
                    throw new ArgumentNullException("body");
                }
                if (customerKey == null)
                {
                    throw new ArgumentNullException(customerKey);
                }

                // Make the request.
                return(service.Customers.Patch(body, customerKey).Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request Customers.Patch failed.", ex);
            }
        }
コード例 #16
0
        /// <summary>
        /// Remove a alias for the user
        /// Documentation https://developers.google.com/directory/directory_v1/reference/aliases/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 directory service.</param>
        /// <param name="userKey">Email or immutable Id of the user</param>
        /// <param name="alias">The alias to be removed</param>
        public static void Delete(directoryService service, string userKey, string alias)
        {
            try
            {
                // Initial validation.
                if (service == null)
                {
                    throw new ArgumentNullException("service");
                }
                if (userKey == null)
                {
                    throw new ArgumentNullException(userKey);
                }
                if (alias == null)
                {
                    throw new ArgumentNullException(alias);
                }

                // Make the request.
                return(service.Aliases.Delete(userKey, alias).Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request Aliases.Delete failed.", ex);
            }
        }
コード例 #17
0
        /// <summary>
        /// Add a photo for the user
        /// Documentation https://developers.google.com/directory/directory_v1/reference/photos/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 directory service.</param>
        /// <param name="userKey">Email or immutable Id of the user</param>
        /// <param name="body">A valid directory directory_v1 body.</param>
        /// <returns>UserPhotoResponse</returns>
        public static UserPhoto Update(directoryService service, string userKey, UserPhoto body)
        {
            try
            {
                // Initial validation.
                if (service == null)
                {
                    throw new ArgumentNullException("service");
                }
                if (body == null)
                {
                    throw new ArgumentNullException("body");
                }
                if (userKey == null)
                {
                    throw new ArgumentNullException(userKey);
                }

                // Make the request.
                return(service.Photos.Update(body, userKey).Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request Photos.Update failed.", ex);
            }
        }
コード例 #18
0
        /// <summary>
        /// Retrieves a paginated list of all privileges for a customer.
        /// Documentation https://developers.google.com/directory/directory_v1/reference/privileges/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 directory service.</param>
        /// <param name="customer">Immutable ID of the Google Apps account.</param>
        /// <returns>PrivilegesResponse</returns>
        public static Privileges List(directoryService service, string customer)
        {
            try
            {
                // Initial validation.
                if (service == null)
                {
                    throw new ArgumentNullException("service");
                }
                if (customer == null)
                {
                    throw new ArgumentNullException(customer);
                }

                // Make the request.
                return(service.Privileges.List(customer).Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request Privileges.List failed.", ex);
            }
        }
コード例 #19
0
        /// <summary>
        /// Stop watching resources through this channel
        /// Documentation https://developers.google.com/directory/directory_v1/reference/channels/stop
        /// 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 directory service.</param>
        /// <param name="body">A valid directory directory_v1 body.</param>
        public static void Stop(directoryService service, Channel body)
        {
            try
            {
                // Initial validation.
                if (service == null)
                {
                    throw new ArgumentNullException("service");
                }
                if (body == null)
                {
                    throw new ArgumentNullException("body");
                }

                // Make the request.
                return(service.Channels.Stop(body).Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request Channels.Stop failed.", ex);
            }
        }
コード例 #20
0
        /// <summary>
        /// Invalidate the current backup verification codes for the user.
        /// Documentation https://developers.google.com/directory/directory_v1/reference/verificationCodes/invalidate
        /// 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 directory service.</param>
        /// <param name="userKey">Email or immutable Id of the user</param>
        public static void Invalidate(directoryService service, string userKey)
        {
            try
            {
                // Initial validation.
                if (service == null)
                {
                    throw new ArgumentNullException("service");
                }
                if (userKey == null)
                {
                    throw new ArgumentNullException(userKey);
                }

                // Make the request.
                return(service.VerificationCodes.Invalidate(userKey).Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request VerificationCodes.Invalidate failed.", ex);
            }
        }
コード例 #21
0
        /// <summary>
        /// List the ASPs issued by a user.
        /// Documentation https://developers.google.com/directory/directory_v1/reference/asps/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 directory service.</param>
        /// <param name="userKey">Identifies the user in the API request. The value can be the user's primary email address, alias email address, or unique user ID.</param>
        /// <returns>AspsResponse</returns>
        public static Asps List(directoryService service, string userKey)
        {
            try
            {
                // Initial validation.
                if (service == null)
                {
                    throw new ArgumentNullException("service");
                }
                if (userKey == null)
                {
                    throw new ArgumentNullException(userKey);
                }

                // Make the request.
                return(service.Asps.List(userKey).Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request Asps.List failed.", ex);
            }
        }
コード例 #22
0
        /// <summary>
        /// Update Chrome OS Device
        /// Documentation https://developers.google.com/directory/directory_v1/reference/chromeosdevices/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 directory service.</param>
        /// <param name="customerId">Immutable id of the Google Apps account</param>
        /// <param name="deviceId">Immutable id of Chrome OS Device</param>
        /// <param name="body">A valid directory directory_v1 body.</param>
        /// <param name="optional">Optional paramaters.</param>        /// <returns>ChromeOsDeviceResponse</returns>
        public static ChromeOsDevice Update(directoryService service, string customerId, string deviceId, ChromeOsDevice body, ChromeosdevicesUpdateOptionalParms optional = null)
        {
            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 (deviceId == null)
                {
                    throw new ArgumentNullException(deviceId);
                }

                // Building the initial request.
                var request = service.Chromeosdevices.Update(body, customerId, deviceId);

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

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