@@ -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;
|
||||
}
|
||||
|
||||
@@ -13,5 +13,6 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
export * from './client';
|
||||
export * from './types';
|
||||
|
||||
@@ -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',
|
||||
|
||||
@@ -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';
|
||||
|
||||
@@ -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',
|
||||
|
||||
Reference in New Issue
Block a user