/// <summary>
 /// Edits a calendar.
 /// </summary>
 /// <remarks>
 /// Client Credentials Flow required permissions: Settings or Settings.Write.
 ///
 /// Required permissions: (Settings.Edit).
 /// </remarks>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='id'>
 /// key: Id
 /// </param>
 /// <param name='extendedCalendarDto'>
 /// The entity to put
 /// </param>
 /// <param name='cancellationToken'>
 /// The cancellation token.
 /// </param>
 public static async Task <ExtendedCalendarDto> PutByIdAsync(this ICalendars operations, long id, ExtendedCalendarDto extendedCalendarDto, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
 {
     using (var _result = await operations.PutByIdWithHttpMessagesAsync(id, extendedCalendarDto, null, cancellationToken).ConfigureAwait(false))
     {
         return(_result.Body);
     }
 }
Example #2
0
 /// <summary>
 /// Edits a calendar.
 /// </summary>
 /// <remarks>
 /// Client Credentials Flow required permissions: Settings or Settings.Write.
 ///
 /// Required permissions: (Settings.Edit).
 /// </remarks>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='key'>
 /// </param>
 /// <param name='body'>
 /// </param>
 /// <param name='cancellationToken'>
 /// The cancellation token.
 /// </param>
 public static async Task <ExtendedCalendarDto> PutByIdAsync(this ICalendars operations, long key, ExtendedCalendarDto body = default(ExtendedCalendarDto), CancellationToken cancellationToken = default(CancellationToken))
 {
     using (var _result = await operations.PutByIdWithHttpMessagesAsync(key, body, null, cancellationToken).ConfigureAwait(false))
     {
         return(_result.Body);
     }
 }
 /// <summary>
 /// Validate calendar name, and check if it already exists.
 /// </summary>
 /// <remarks>
 /// Client Credentials Flow required permissions: Settings or Settings.Write.
 ///
 /// Required permissions: (Settings.Edit).
 /// </remarks>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='calendarExistsParameters'>
 /// </param>
 /// <param name='cancellationToken'>
 /// The cancellation token.
 /// </param>
 public static async Task <ODataValueBoolean> CalendarExistsAsync(this ICalendars operations, CalendarExistsParameters calendarExistsParameters = default(CalendarExistsParameters), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
 {
     using (var _result = await operations.CalendarExistsWithHttpMessagesAsync(calendarExistsParameters, null, cancellationToken).ConfigureAwait(false))
     {
         return(_result.Body);
     }
 }
Example #4
0
 /// <summary>
 /// Gets calendar based on its id.
 /// </summary>
 /// <remarks>
 /// Client Credentials Flow required permissions: Settings or Settings.Read.
 ///
 /// Requires authentication.
 /// </remarks>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='key'>
 /// </param>
 /// <param name='expand'>
 /// Indicates the related entities to be represented inline. The maximum depth
 /// is 2.
 /// </param>
 /// <param name='select'>
 /// Limits the properties returned in the result.
 /// </param>
 /// <param name='cancellationToken'>
 /// The cancellation token.
 /// </param>
 public static async Task <ExtendedCalendarDto> GetByIdAsync(this ICalendars operations, long key, string expand = default(string), string select = default(string), CancellationToken cancellationToken = default(CancellationToken))
 {
     using (var _result = await operations.GetByIdWithHttpMessagesAsync(key, expand, select, null, cancellationToken).ConfigureAwait(false))
     {
         return(_result.Body);
     }
 }
Example #5
0
 /// <summary>
 /// Validate calendar name, and check if it already exists.
 /// </summary>
 /// <remarks>
 /// Client Credentials Flow required permissions: Settings or Settings.Write.
 ///
 /// Required permissions: (Settings.Edit).
 /// </remarks>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='body'>
 /// </param>
 /// <param name='expand'>
 /// Indicates the related entities to be represented inline. The maximum depth
 /// is 2.
 /// </param>
 /// <param name='select'>
 /// Limits the properties returned in the result.
 /// </param>
 /// <param name='cancellationToken'>
 /// The cancellation token.
 /// </param>
 public static async Task <ODataValueOfBoolean> CalendarExistsAsync(this ICalendars operations, CalendarsCalendarExistsParameters body = default(CalendarsCalendarExistsParameters), string expand = default(string), string select = default(string), CancellationToken cancellationToken = default(CancellationToken))
 {
     using (var _result = await operations.CalendarExistsWithHttpMessagesAsync(body, expand, select, null, cancellationToken).ConfigureAwait(false))
     {
         return(_result.Body);
     }
 }
 /// <summary>
 /// Gets calendars for current tenant.
 /// </summary>
 /// <remarks>
 /// Client Credentials Flow required permissions: Settings or Settings.Read.
 ///
 /// Requires authentication.
 /// </remarks>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='expand'>
 /// Expands related entities inline.
 /// </param>
 /// <param name='filter'>
 /// Filters the results, based on a Boolean condition.
 /// </param>
 /// <param name='select'>
 /// Selects which properties to include in the response.
 /// </param>
 /// <param name='orderby'>
 /// Sorts the results.
 /// </param>
 /// <param name='top'>
 /// Returns only the first n results.
 /// </param>
 /// <param name='skip'>
 /// Skips the first n results.
 /// </param>
 /// <param name='count'>
 /// Includes a count of the matching results in the response.
 /// </param>
 /// <param name='cancellationToken'>
 /// The cancellation token.
 /// </param>
 public static async Task <ODataValueIEnumerableExtendedCalendarDto> GetAsync(this ICalendars operations, string expand = default(string), string filter = default(string), string select = default(string), string orderby = default(string), int?top = default(int?), int?skip = default(int?), bool?count = default(bool?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
 {
     using (var _result = await operations.GetWithHttpMessagesAsync(expand, filter, select, orderby, top, skip, count, null, cancellationToken).ConfigureAwait(false))
     {
         return(_result.Body);
     }
 }
Example #7
0
        public void Setup()
        {
            _service = new CalendarsImplementation();

            // Android supports milliseconds, iOS supports seconds
#if __IOS__
            _eventComparer    = new EventComparer(Rounding.Seconds);
            _dateTimeComparer = new DateTimeComparer(Rounding.Seconds);
#else
            _eventComparer    = new EventComparer(Rounding.Milliseconds);
            _dateTimeComparer = new DateTimeComparer(Rounding.Milliseconds);
#endif
        }
        /// <summary>
        /// Creates a new calendar with the specified name and optional color.
        /// (just a convenience wrapper around AddOrUpdateCalendarAsync)
        /// </summary>
        /// <param name="api">ICalendars instance to extend</param>
        /// <param name="calendarName">Calendar name</param>
        /// <param name="color">Preferred color, or null to accept default</param>
        /// <returns>The created calendar</returns>
        public static async Task <Calendar> CreateCalendarAsync(this ICalendars api, string calendarName, string color = null)
        {
            var calendar = new Calendar
            {
                Name            = calendarName,
                Color           = color,
                CanEditCalendar = true,
                CanEditEvents   = true
            };

            await api.AddOrUpdateCalendarAsync(calendar).ConfigureAwait(false);

            return(calendar);
        }
Example #9
0
        public void Setup()
        {
            // iOS won't let us keep recreating the event store
            // (gives the error
            //  "[EventKit] Client tried to open too many connections to calaccessd. Refusing to open another")
#if __IOS__
            _service ??= new CalendarsImplementation();
#else
            _service = new CalendarsImplementation();
#endif

            // Android supports milliseconds, iOS supports seconds
#if __IOS__
            _eventComparer    = new EventComparer(Rounding.Seconds);
            _dateTimeComparer = new DateTimeComparer(Rounding.Seconds);
#else
            _eventComparer    = new EventComparer(Rounding.Milliseconds);
            _dateTimeComparer = new DateTimeComparer(Rounding.Milliseconds);
#endif
        }
 /// <summary>
 /// Creates a new calendar.
 /// </summary>
 /// <remarks>
 /// Client Credentials Flow required permissions: Settings or Settings.Write.
 ///
 /// Required permissions: (Settings.Create).
 /// </remarks>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='extendedCalendarDto'>
 /// The entity to post
 /// </param>
 public static ExtendedCalendarDto Post(this ICalendars operations, ExtendedCalendarDto extendedCalendarDto)
 {
     return(operations.PostAsync(extendedCalendarDto).GetAwaiter().GetResult());
 }
Example #11
0
 /// <summary>
 /// Edits a calendar.
 /// </summary>
 /// <remarks>
 /// Client Credentials Flow required permissions: Settings or Settings.Write.
 ///
 /// Required permissions: (Settings.Edit).
 /// </remarks>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='key'>
 /// </param>
 /// <param name='body'>
 /// </param>
 public static ExtendedCalendarDto PutById(this ICalendars operations, long key, ExtendedCalendarDto body = default(ExtendedCalendarDto))
 {
     return(operations.PutByIdAsync(key, body).GetAwaiter().GetResult());
 }
 /// <summary>
 /// Gets calendars for current tenant.
 /// </summary>
 /// <remarks>
 /// Client Credentials Flow required permissions: Settings or Settings.Read.
 ///
 /// Requires authentication.
 /// </remarks>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='expand'>
 /// Expands related entities inline.
 /// </param>
 /// <param name='filter'>
 /// Filters the results, based on a Boolean condition.
 /// </param>
 /// <param name='select'>
 /// Selects which properties to include in the response.
 /// </param>
 /// <param name='orderby'>
 /// Sorts the results.
 /// </param>
 /// <param name='top'>
 /// Returns only the first n results.
 /// </param>
 /// <param name='skip'>
 /// Skips the first n results.
 /// </param>
 /// <param name='count'>
 /// Includes a count of the matching results in the response.
 /// </param>
 public static ODataValueIEnumerableExtendedCalendarDto Get(this ICalendars operations, string expand = default(string), string filter = default(string), string select = default(string), string orderby = default(string), int?top = default(int?), int?skip = default(int?), bool?count = default(bool?))
 {
     return(operations.GetAsync(expand, filter, select, orderby, top, skip, count).GetAwaiter().GetResult());
 }
 /// <summary>
 /// Deletes a calendar.
 /// </summary>
 /// <remarks>
 /// Client Credentials Flow required permissions: Settings or Settings.Write.
 ///
 /// Required permissions: (Settings.Delete).
 /// </remarks>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='id'>
 /// key: Id
 /// </param>
 /// <param name='ifMatch'>
 /// If-Match header
 /// </param>
 /// <param name='cancellationToken'>
 /// The cancellation token.
 /// </param>
 public static async Task DeleteByIdAsync(this ICalendars operations, long id, string ifMatch = default(string), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
 {
     (await operations.DeleteByIdWithHttpMessagesAsync(id, ifMatch, null, cancellationToken).ConfigureAwait(false)).Dispose();
 }
 /// <summary>
 /// Validate calendar name, and check if it already exists.
 /// </summary>
 /// <remarks>
 /// Client Credentials Flow required permissions: Settings or Settings.Write.
 ///
 /// Required permissions: (Settings.Edit).
 /// </remarks>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='calendarExistsParameters'>
 /// </param>
 public static ODataValueBoolean CalendarExists(this ICalendars operations, CalendarExistsParameters calendarExistsParameters = default(CalendarExistsParameters))
 {
     return(operations.CalendarExistsAsync(calendarExistsParameters).GetAwaiter().GetResult());
 }
 /// <summary>
 /// Deletes a calendar.
 /// </summary>
 /// <remarks>
 /// Client Credentials Flow required permissions: Settings or Settings.Write.
 ///
 /// Required permissions: (Settings.Delete).
 /// </remarks>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='id'>
 /// key: Id
 /// </param>
 /// <param name='ifMatch'>
 /// If-Match header
 /// </param>
 public static void DeleteById(this ICalendars operations, long id, string ifMatch = default(string))
 {
     operations.DeleteByIdAsync(id, ifMatch).GetAwaiter().GetResult();
 }
Example #16
0
 /// <summary>
 /// Deletes a calendar.
 /// </summary>
 /// <remarks>
 /// Client Credentials Flow required permissions: Settings or Settings.Write.
 ///
 /// Required permissions: (Settings.Delete).
 /// </remarks>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='key'>
 /// </param>
 public static void DeleteById(this ICalendars operations, long key)
 {
     operations.DeleteByIdAsync(key).GetAwaiter().GetResult();
 }
Example #17
0
 /// <summary>
 /// Creates a new calendar.
 /// </summary>
 /// <remarks>
 /// Client Credentials Flow required permissions: Settings or Settings.Write.
 ///
 /// Required permissions: (Settings.Create).
 /// </remarks>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='body'>
 /// </param>
 public static ExtendedCalendarDto Post(this ICalendars operations, ExtendedCalendarDto body = default(ExtendedCalendarDto))
 {
     return(operations.PostAsync(body).GetAwaiter().GetResult());
 }
Example #18
0
 /// <summary>
 /// Deletes a calendar.
 /// </summary>
 /// <remarks>
 /// Client Credentials Flow required permissions: Settings or Settings.Write.
 ///
 /// Required permissions: (Settings.Delete).
 /// </remarks>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='key'>
 /// </param>
 /// <param name='cancellationToken'>
 /// The cancellation token.
 /// </param>
 public static async Task DeleteByIdAsync(this ICalendars operations, long key, CancellationToken cancellationToken = default(CancellationToken))
 {
     (await operations.DeleteByIdWithHttpMessagesAsync(key, null, cancellationToken).ConfigureAwait(false)).Dispose();
 }
Example #19
0
 /// <summary>
 /// Validate calendar name, and check if it already exists.
 /// </summary>
 /// <remarks>
 /// Client Credentials Flow required permissions: Settings or Settings.Write.
 ///
 /// Required permissions: (Settings.Edit).
 /// </remarks>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='body'>
 /// </param>
 /// <param name='expand'>
 /// Indicates the related entities to be represented inline. The maximum depth
 /// is 2.
 /// </param>
 /// <param name='select'>
 /// Limits the properties returned in the result.
 /// </param>
 public static ODataValueOfBoolean CalendarExists(this ICalendars operations, CalendarsCalendarExistsParameters body = default(CalendarsCalendarExistsParameters), string expand = default(string), string select = default(string))
 {
     return(operations.CalendarExistsAsync(body, expand, select).GetAwaiter().GetResult());
 }
Example #20
0
 public void Setup()
 {
     _service = new CalendarsImplementation();
     _eventComparer = new EventComparer();
 }
 /// <summary>
 /// Gets calendar based on its id.
 /// </summary>
 /// <remarks>
 /// Client Credentials Flow required permissions: Settings or Settings.Read.
 ///
 /// Requires authentication.
 /// </remarks>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='id'>
 /// key: Id
 /// </param>
 /// <param name='expand'>
 /// Expands related entities inline.
 /// </param>
 /// <param name='select'>
 /// Selects which properties to include in the response.
 /// </param>
 public static ExtendedCalendarDto GetById(this ICalendars operations, long id, string expand = default(string), string select = default(string))
 {
     return(operations.GetByIdAsync(id, expand, select).GetAwaiter().GetResult());
 }
 /// <summary>
 /// Edits a calendar.
 /// </summary>
 /// <remarks>
 /// Client Credentials Flow required permissions: Settings or Settings.Write.
 ///
 /// Required permissions: (Settings.Edit).
 /// </remarks>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='id'>
 /// key: Id
 /// </param>
 /// <param name='extendedCalendarDto'>
 /// The entity to put
 /// </param>
 public static ExtendedCalendarDto PutById(this ICalendars operations, long id, ExtendedCalendarDto extendedCalendarDto)
 {
     return(operations.PutByIdAsync(id, extendedCalendarDto).GetAwaiter().GetResult());
 }
Example #23
0
 public void Setup()
 {
     _service       = new CalendarsImplementation();
     _eventComparer = new EventComparer();
 }