Retrieves detailed information about a specific calendar connection using its unique identifier.
Method Signature
await client.calendar.retrieve(params: BaseCalendarParams): Promise<CalendarResponse>
Parameters
The unique identifier of the calendar connection to retrieve.
Response
Returns the calendar object with all connection details including platform, OAuth credentials, email, and status.
Examples
Basic Retrieval
import { RecallClient } from '@recall-ai/sdk';
const client = new RecallClient({
apiKey: 'your-api-key'
});
const calendar = await client.calendar.retrieve({
id: 'cal_1234567890abcdef'
});
console.log('Calendar platform:', calendar.platform);
console.log('Calendar email:', calendar.oauth_email);
console.log('Calendar status:', calendar.status);
Check Connection Status
import { RecallClient } from '@recall-ai/sdk';
const client = new RecallClient({
apiKey: 'your-api-key'
});
const calendarId = 'cal_1234567890abcdef';
const calendar = await client.calendar.retrieve({ id: calendarId });
if (calendar.status === 'connected') {
console.log('Calendar is connected and syncing');
} else if (calendar.status === 'connecting') {
console.log('Calendar is still establishing connection');
} else if (calendar.status === 'disconnected') {
console.log('Calendar is disconnected');
}
Retrieve and Update
import { RecallClient } from '@recall-ai/sdk';
const client = new RecallClient({
apiKey: 'your-api-key'
});
const calendarId = 'cal_1234567890abcdef';
// First retrieve the current details
const calendar = await client.calendar.retrieve({ id: calendarId });
console.log('Current email:', calendar.oauth_email);
// Then update if needed
if (calendar.status === 'disconnected') {
await client.calendar.update({
id: calendarId,
oauth_refresh_token: 'new-refresh-token'
});
console.log('Calendar reconnected');
}
Display Calendar Info
import { RecallClient } from '@recall-ai/sdk';
const client = new RecallClient({
apiKey: 'your-api-key'
});
const calendarId = 'cal_1234567890abcdef';
const calendar = await client.calendar.retrieve({ id: calendarId });
const platformName = calendar.platform === 'google_calendar'
? 'Google Calendar'
: 'Microsoft Outlook';
console.log(`
Calendar Details:
----------------
Platform: ${platformName}
Email: ${calendar.oauth_email}
Status: ${calendar.status}
ID: ${calendarId}
`);
Error Handling
import { RecallClient } from '@recall-ai/sdk';
const client = new RecallClient({
apiKey: 'your-api-key'
});
const calendarId = 'cal_1234567890abcdef';
try {
const calendar = await client.calendar.retrieve({ id: calendarId });
console.log('Calendar found:', calendar);
} catch (error) {
if (error.status === 404) {
console.error('Calendar not found');
} else {
console.error('Failed to retrieve calendar:', error.message);
}
}
Batch Retrieval
import { RecallClient } from '@recall-ai/sdk';
const client = new RecallClient({
apiKey: 'your-api-key'
});
const calendarIds = [
'cal_1234567890abcdef',
'cal_abcdef1234567890',
'cal_fedcba0987654321'
];
// Retrieve multiple calendars in parallel
const calendars = await Promise.all(
calendarIds.map(id => client.calendar.retrieve({ id }))
);
calendars.forEach((calendar, index) => {
console.log(`Calendar ${index + 1}:`, calendar.oauth_email);
});
Notes
- The calendar ID is returned when you create a calendar connection
- Returns a 404 error if the calendar ID doesn’t exist
- Use this method to check the current status of a calendar connection
- OAuth credentials may be partially masked in the response for security