@@ -95,7 +95,7 @@ public async Task<GoogleCalendarListRoot> GetCalendars(int maxResults = 250, boo
9595 }
9696
9797 AccessToken = await AuthService . RefreshAccessToken ( _refreshToken ) ;
98- return await GetCalendars ( ) ;
98+ return model ;
9999 }
100100
101101 /// <summary>
@@ -118,7 +118,7 @@ public async Task<GoogleCalendarListModel> GetCalendarById(string calendarId, bo
118118 }
119119
120120 AccessToken = await AuthService . RefreshAccessToken ( _refreshToken ) ;
121- return await GetCalendarById ( calendarId ) ;
121+ return model ;
122122 }
123123
124124 /// <summary>
@@ -180,7 +180,7 @@ public async Task<GoogleCalendarModel> AddCalendar(GoogleCalendarListModel googl
180180 }
181181
182182 AccessToken = await AuthService . RefreshAccessToken ( _refreshToken ) ;
183- return await AddCalendar ( googleCalendarListModel ) ;
183+ return model ;
184184 }
185185
186186 /// <summary>
@@ -210,7 +210,7 @@ public async Task<GoogleCalendarModel> UpdateCalendar(string calendarId, GoogleC
210210 }
211211
212212 AccessToken = await AuthService . RefreshAccessToken ( _refreshToken ) ;
213- return await UpdateCalendar ( calendarId , googleCalendarListModel ) ;
213+ return model ;
214214 }
215215
216216 /// <summary>
@@ -235,7 +235,6 @@ public async Task DeleteCalendar(string calendarId, bool forceAccessToken = fals
235235 }
236236
237237 AccessToken = await AuthService . RefreshAccessToken ( _refreshToken ) ;
238- await DeleteCalendar ( calendarId ) ;
239238 }
240239
241240 /// <summary>
@@ -261,7 +260,6 @@ public async Task ClearCalendar(string calendarId, bool forceAccessToken = false
261260 }
262261
263262 AccessToken = await AuthService . RefreshAccessToken ( _refreshToken ) ;
264- await ClearCalendar ( calendarId ) ;
265263 }
266264
267265 #endregion
@@ -299,7 +297,7 @@ public async Task<GoogleCalendarEventRoot> GetEvents(DateTime timeMin, DateTime
299297 }
300298
301299 AccessToken = await AuthService . RefreshAccessToken ( _refreshToken ) ;
302- return await GetEvents ( timeMin , timeMax , calendarId , maxResults ) ;
300+ return model ;
303301 }
304302
305303 /// <summary>
@@ -315,15 +313,15 @@ public async Task<GoogleCalendarEventModel> GetEventById(string eventId, string
315313 var result = await client . GetAsync ( $ "https://www.googleapis.com/calendar/v3/calendars/{ calendarId } /events/{ eventId } ?access_token=" + _accessToken ) ;
316314
317315 string contentResult = await result . Content . ReadAsStringAsync ( ) ;
318- var json = JsonSerializer . Deserialize < GoogleCalendarEventModel > ( contentResult ) ;
316+ var model = JsonSerializer . Deserialize < GoogleCalendarEventModel > ( contentResult ) ;
319317
320318 if ( forceAccessToken == false || ! AuthService . IsAccessTokenExpired ( contentResult ) )
321319 {
322- return json ;
320+ return model ;
323321 }
324322
325323 AccessToken = await AuthService . RefreshAccessToken ( _refreshToken ) ;
326- return await GetEventById ( eventId , calendarId ) ;
324+ return model ;
327325 }
328326
329327 /// <summary>
@@ -343,16 +341,15 @@ public async Task<string> AddEvent(GoogleCalendarEventModel calendarEvent, strin
343341 var content = new StringContent ( requestBody , Encoding . UTF8 , "application/json" ) ;
344342 var result = await client . PostAsync ( $ "https://www.googleapis.com/calendar/v3/calendars/{ calendarId } /events", content ) ;
345343
346- string contentResult = await result . Content . ReadAsStringAsync ( ) ;
344+ string model = await result . Content . ReadAsStringAsync ( ) ;
347345
348- if ( forceAccessToken == false || ! AuthService . IsAccessTokenExpired ( contentResult ) )
346+ if ( forceAccessToken == false || ! AuthService . IsAccessTokenExpired ( model ) )
349347 {
350- return contentResult ;
348+ return model ;
351349 }
352350
353351 AccessToken = await AuthService . RefreshAccessToken ( _refreshToken ) ;
354- await AddEvent ( calendarEvent , calendarId ) ;
355- return "" ;
352+ return model ;
356353 }
357354
358355 /// <summary>
@@ -393,7 +390,6 @@ public async Task<string> UpdateEvent(GoogleCalendarEventModel newCalendarEvent,
393390 }
394391
395392 AccessToken = await AuthService . RefreshAccessToken ( _refreshToken ) ;
396- await UpdateEvent ( newCalendarEvent , eventId , calendarId ) ;
397393 return "" ;
398394 }
399395
@@ -561,7 +557,6 @@ public async Task DeleteEvent(string eventId, string calendarId, bool forceAcces
561557 }
562558
563559 AccessToken = await AuthService . RefreshAccessToken ( _refreshToken ) ;
564- await DeleteEvent ( eventId , calendarId ) ;
565560 }
566561
567562 #endregion
0 commit comments