Ejemplo n.º 1
0
        /// <summary>
        /// Returns an access control rule.
        /// Documentation https://developers.google.com/calendar/v3/reference/acl/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 calendar service.</param>
        /// <param name="calendarId">Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you want to access the primary calendar of the currently logged in user, use the "primary" keyword.</param>
        /// <param name="ruleId">ACL rule identifier.</param>
        /// <returns>AclRuleResponse</returns>
        public static AclRule Get(calendarService service, string calendarId, string ruleId)
        {
            try
            {
                // Initial validation.
                if (service == null)
                {
                    throw new ArgumentNullException("service");
                }
                if (calendarId == null)
                {
                    throw new ArgumentNullException(calendarId);
                }
                if (ruleId == null)
                {
                    throw new ArgumentNullException(ruleId);
                }

                // Make the request.
                return(service.Acl.Get(calendarId, ruleId).Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request Acl.Get failed.", ex);
            }
        }
        /// <summary>
        /// Updates metadata for a calendar.
        /// Documentation https://developers.google.com/calendar/v3/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 calendar service.</param>
        /// <param name="calendarId">Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you want to access the primary calendar of the currently logged in user, use the "primary" keyword.</param>
        /// <param name="body">A valid calendar v3 body.</param>
        /// <returns>CalendarResponse</returns>
        public static Calendar Update(calendarService service, string calendarId, Calendar body)
        {
            try
            {
                // Initial validation.
                if (service == null)
                {
                    throw new ArgumentNullException("service");
                }
                if (body == null)
                {
                    throw new ArgumentNullException("body");
                }
                if (calendarId == null)
                {
                    throw new ArgumentNullException(calendarId);
                }

                // Make the request.
                return(service.Calendars.Update(body, calendarId).Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request Calendars.Update failed.", ex);
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Watch for changes to ACL resources.
        /// Documentation https://developers.google.com/calendar/v3/reference/acl/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 calendar service.</param>
        /// <param name="calendarId">Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you want to access the primary calendar of the currently logged in user, use the "primary" keyword.</param>
        /// <param name="body">A valid calendar v3 body.</param>
        /// <param name="optional">Optional paramaters.</param>        /// <returns>ChannelResponse</returns>
        public static Channel Watch(calendarService service, string calendarId, Channel body, AclWatchOptionalParms optional = null)
        {
            try
            {
                // Initial validation.
                if (service == null)
                {
                    throw new ArgumentNullException("service");
                }
                if (body == null)
                {
                    throw new ArgumentNullException("body");
                }
                if (calendarId == null)
                {
                    throw new ArgumentNullException(calendarId);
                }

                // Building the initial request.
                var request = service.Acl.Watch(body, calendarId);

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

                // Requesting data.
                return(request.Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request Acl.Watch failed.", ex);
            }
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Updates an entry on the user's calendar list.
        /// Documentation https://developers.google.com/calendar/v3/reference/calendarList/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 calendar service.</param>
        /// <param name="calendarId">Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you want to access the primary calendar of the currently logged in user, use the "primary" keyword.</param>
        /// <param name="body">A valid calendar v3 body.</param>
        /// <param name="optional">Optional paramaters.</param>        /// <returns>CalendarListEntryResponse</returns>
        public static CalendarListEntry Update(calendarService service, string calendarId, CalendarListEntry body, CalendarListUpdateOptionalParms optional = null)
        {
            try
            {
                // Initial validation.
                if (service == null)
                {
                    throw new ArgumentNullException("service");
                }
                if (body == null)
                {
                    throw new ArgumentNullException("body");
                }
                if (calendarId == null)
                {
                    throw new ArgumentNullException(calendarId);
                }

                // Building the initial request.
                var request = service.CalendarList.Update(body, calendarId);

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

                // Requesting data.
                return(request.Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request CalendarList.Update failed.", ex);
            }
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Returns the color definitions for calendars and events.
        /// Documentation https://developers.google.com/calendar/v3/reference/colors/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 calendar service.</param>
        /// <returns>ColorsResponse</returns>
        public static Colors Get(calendarService service)
        {
            try
            {
                // Initial validation.
                if (service == null)
                {
                    throw new ArgumentNullException("service");
                }

                // Make the request.
                return(service.Colors.Get().Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request Colors.Get failed.", ex);
            }
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Stop watching resources through this channel
        /// Documentation https://developers.google.com/calendar/v3/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 calendar service.</param>
        /// <param name="body">A valid calendar v3 body.</param>
        public static void Stop(calendarService 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);
            }
        }
        /// <summary>
        /// Clears a primary calendar. This operation deletes all events associated with the primary calendar of an account.
        /// Documentation https://developers.google.com/calendar/v3/reference/calendars/clear
        /// 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 calendar service.</param>
        /// <param name="calendarId">Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you want to access the primary calendar of the currently logged in user, use the "primary" keyword.</param>
        public static void Clear(calendarService service, string calendarId)
        {
            try
            {
                // Initial validation.
                if (service == null)
                {
                    throw new ArgumentNullException("service");
                }
                if (calendarId == null)
                {
                    throw new ArgumentNullException(calendarId);
                }

                // Make the request.
                return(service.Calendars.Clear(calendarId).Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request Calendars.Clear failed.", ex);
            }
        }
Ejemplo n.º 8
0
        /// <summary>
        /// Returns a single user setting.
        /// Documentation https://developers.google.com/calendar/v3/reference/settings/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 calendar service.</param>
        /// <param name="setting">The id of the user setting.</param>
        /// <returns>SettingResponse</returns>
        public static Setting Get(calendarService service, string setting)
        {
            try
            {
                // Initial validation.
                if (service == null)
                {
                    throw new ArgumentNullException("service");
                }
                if (setting == null)
                {
                    throw new ArgumentNullException(setting);
                }

                // Make the request.
                return(service.Settings.Get(setting).Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request Settings.Get failed.", ex);
            }
        }
        /// <summary>
        /// Returns free/busy information for a set of calendars.
        /// Documentation https://developers.google.com/calendar/v3/reference/freebusy/query
        /// 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 calendar service.</param>
        /// <param name="body">A valid calendar v3 body.</param>
        /// <returns>FreeBusyResponseResponse</returns>
        public static FreeBusyResponse Query(calendarService service, FreeBusyRequest body)
        {
            try
            {
                // Initial validation.
                if (service == null)
                {
                    throw new ArgumentNullException("service");
                }
                if (body == null)
                {
                    throw new ArgumentNullException("body");
                }

                // Make the request.
                return(service.Freebusy.Query(body).Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request Freebusy.Query failed.", ex);
            }
        }
Ejemplo n.º 10
0
        /// <summary>
        /// Returns all user settings for the authenticated user.
        /// Documentation https://developers.google.com/calendar/v3/reference/settings/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 calendar service.</param>
        /// <param name="optional">Optional paramaters.</param>        /// <returns>SettingsResponse</returns>
        public static Settings List(calendarService service, SettingsListOptionalParms optional = null)
        {
            try
            {
                // Initial validation.
                if (service == null)
                {
                    throw new ArgumentNullException("service");
                }

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

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

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