API Integration Blueprint¶
Audience
Use this page when another plugin needs controlled access to Full Calendar. The API is permissioned and must not bypass EventCache.
Integration Steps¶
- Detect the plugin and obtain the
PublicAPIinstance. - Request access with your plugin ID, a clear reason, and the scopes you need.
- Store the returned token in your own plugin settings.
- Use
withToken()on startup to obtain anAuthorizedAPIinstance.
Minimal Example (TypeScript)¶
const fcPlugin = app.plugins?.plugins?.['full-calendar'] as { api?: { requestAccess: Function; withToken: Function } } | undefined;
const publicApi = fcPlugin?.api;
if (!publicApi) {
return; // Full Calendar not installed or not loaded.
}
let token = await publicApi.requestAccess(
'your-plugin-id',
'Explain what you need from Full Calendar.',
['events:read', 'ui:open-calendar']
);
if (!token) {
return; // User denied.
}
const api = publicApi.withToken(token);
if (!api) {
return; // Token invalid or revoked.
}
await api.openCalendar();
const events = api.getAllEvents();
Expected Behaviors¶
requestAccess()always shows a user-facing authorization modal.- Tokens are stored by Full Calendar in
authorizedTokens, but the caller must persist the token too. withToken()returnsnullwhen the token is missing, invalid, or revoked.
Best Practices¶
- Request the minimum access necessary and keep the reason explicit.
- Avoid re-prompting on every load; reuse stored tokens when possible.
- Handle
nullresults and runtime errors without blocking your plugin. - Do not cache or mutate event objects outside
EventCacheor the authorized API.
Supported Operations¶
Authorized plugins can open views, change view mode, open the create modal, and read cached events. Direct data writes are intentionally not exposed.