gcalendar

Signed-off-by: Fredrik Adelöw <freben@gmail.com>
This commit is contained in:
Fredrik Adelöw
2022-08-19 12:13:09 +02:00
parent d467b7e332
commit 680b8baebd
7 changed files with 15 additions and 29 deletions
+4 -7
View File
@@ -13,25 +13,22 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { OAuthApi, createApiRef, FetchApi } from '@backstage/core-plugin-api';
import { OAuthApi, createApiRef, FetchApi } from '@backstage/core-plugin-api';
import { GCalendarEvent, GCalendarList } from './types';
import { ResponseError } from '@backstage/errors';
type Options = {
authApi: OAuthApi;
fetchApi: FetchApi;
};
/** @public */
export const gcalendarApiRef = createApiRef<GCalendarApiClient>({
id: 'plugin.gcalendar.service',
});
/** @public */
export class GCalendarApiClient {
private readonly authApi: OAuthApi;
private readonly fetchApi: FetchApi;
constructor(options: Options) {
constructor(options: { authApi: OAuthApi; fetchApi: FetchApi }) {
this.authApi = options.authApi;
this.fetchApi = options.fetchApi;
}
+1
View File
@@ -13,5 +13,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export * from './client';
export * from './types';
+5
View File
@@ -16,18 +16,23 @@
/// <reference types="@maxim_mazurok/gapi.client.calendar" />
/** @public */
export type GCalendarList = gapi.client.calendar.CalendarList;
/** @public */
export type GCalendar = gapi.client.calendar.CalendarListEntry;
/** @public */
export type EventAttendee = gapi.client.calendar.EventAttendee;
/** @public */
export type GCalendarEvent = gapi.client.calendar.Event &
Pick<GCalendar, 'backgroundColor' | 'primary'> &
Pick<EventAttendee, 'responseStatus'> & {
calendarId?: string;
};
/** @public */
export enum ResponseStatus {
needsAction = 'needsAction',
accepted = 'accepted',
+1
View File
@@ -13,5 +13,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export { gcalendarPlugin, HomePageCalendar } from './plugin';
export * from './api';
+3 -1
View File
@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import {
createApiFactory,
createComponentExtension,
@@ -20,10 +21,10 @@ import {
fetchApiRef,
googleAuthApiRef,
} from '@backstage/core-plugin-api';
import { GCalendarApiClient, gcalendarApiRef } from './api';
import { rootRouteRef } from './routes';
/** @public */
export const gcalendarPlugin = createPlugin({
id: 'gcalendar',
routes: {
@@ -40,6 +41,7 @@ export const gcalendarPlugin = createPlugin({
],
});
/** @public */
export const HomePageCalendar = gcalendarPlugin.provide(
createComponentExtension({
name: 'HomePageCalendar',