API
July 12, 2022 ยท View on GitHub
Auth Service
AuthorizeCredential
Get credentials with given authorizationCode. Returns string content.
Parameters
AuthorizationCode: The code which you have with RequestAuthorizationCode
GetAccessTokenDetails
Get information with given accesstoken like scope, expires in etc. Returns a json format.
GetClientId, GetClientSecret, GetRedirectUrl
Only works when the value stored in appsettings.json.
Parameters
RootValue: Allows customization. By default it searches from GoogleClient root.
GetUserMail
Returns user email with given access token.
GetValueFromCredential
Brings a value into a given credential string. The credential string can be obtain with result of AuthorizeCredential method.
Enum: CredentialValueType -> AccessToken, RefreshToken, Scope, TokenType, ExpiresIn
IsAccessTokenExpired
Returns a bool value that access token expired.
RefreshAccessToken
Refresh and create new access token with given refresh token. Returns the new access token as a string.
Note
If you placed your clientid, clientsecret and redirecturl in your appsettings.json, you can use the method only with refreshtoken. (No need to define them again)
RequestAuthorizationCode
Opens Google "select account" page in a new tab.
Parameters
ClientId: Your project's client id. Can be obtanied on google developer console.
RedirectUrl: The page which the authorization code will send. The page opens immediately after user selects their google account.
Calendar Service
Fields
AccessToken: It must be set before the call of other methods. All methods use this access token value.
RefreshToken: It is used for automatic renewal of access token. All methods have forceAccessTokenparameter, and it only works if refresh token is not null or empty.
EventCallbacks
AccessTokenChanged: Fires when access token changed.
RefreshTokenChanged: Fires when refresh token changed.
AddCalendar
Creates a new secondary calendar into user's CalendarList with given GoogleCalendarListModel.
AddEvent
Creates a new event in a specific calendar with given GoogleCalendarEventModel.
ClearCalendar
Deletes all events in a primary calendar. If it's a secondary calendar, it has no effect. Use DeleteCalendar method for secondary ones.
DeleteCalendar
Deletes the specified calendar. Only deletes the secondary calendars. Use ClearCalendar method for primary calendar.
DeleteEvent
Deletes the event in a specific calendar.
GetCalendarById
Get calendar with given id that authenticated user has. Returns GoogleCalendarListModel.
GetCalendarBySummary
Get calendar with given summary (title) that authenticated user has. Returns GoogleCalendarListModel.
GetCalendars
Get all calendars that authenticated user has. Returns max of 250 calendars (Google limitation). Returns GoogleCalendarListRoot.
GetEventById
Get event in a specific calendar with a given id. Returns GoogleCalendarEventModel.
GetEventByDescription
Get event in a specific calendar with a given description. Returns GoogleCalendarEventModel.
GetEventBySummary
Get event in a specific calendar with a given summary (title). Returns GoogleCalendarEventModel.
GetEvents
Get event list within a specific calendar between the specified dates. Returns a max of 2500 events (Google limitation). Returns GoogleCalendarEventRoot.
GetProperDateTimeFormat
Format datetime (ISO standarts) to make proper Google api calls.
FindCalendarId
Finds and returns the calendar id which matches with the given value (Summary, description or location). Returns calendar id as string.
FindEventId
Finds and returns the event id which matches with the given value and type (Summary, description or location). Returns event id as string.
FindPrimaryCalendar
Get the primary calendar in calendar list. Returns null if not found or GoogleCalendarListModel if found.
UpdateCalendar
Updates the specified calendar with given model. Returns GoogleCalendarModel.
UpdateEvent
Updates the event.