1import { UnavailabilityError } from 'expo-modules-core';
2
3import NotificationScheduler from './NotificationScheduler';
4import { NotificationRequest } from './Notifications.types';
5
6/**
7 * Fetches information about all scheduled notifications.
8 * @return Returns a Promise resolving to an array of objects conforming to the [`Notification`](#notification) interface.
9 * @header schedule
10 */
11export default async function getAllScheduledNotificationsAsync(): Promise<NotificationRequest[]> {
12  if (!NotificationScheduler.getAllScheduledNotificationsAsync) {
13    throw new UnavailabilityError('Notifications', 'getAllScheduledNotificationsAsync');
14  }
15
16  return await NotificationScheduler.getAllScheduledNotificationsAsync();
17}
18