-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(types): breakdown definitions file (#164)
Refactor permission handling definitions in separate interface.
- Loading branch information
Showing
3 changed files
with
95 additions
and
110 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
import { PermissionState } from "@capacitor/core"; | ||
import { PluginPermission } from "../schemas/enums/plugin-permission"; | ||
|
||
export interface CalendarAccess { | ||
/** | ||
* Retrieves the current permission status for a given permission alias. | ||
* | ||
* @since 0.1.0 | ||
* @platform Android, iOS | ||
* | ||
* @example | ||
* CapacitorCalendar.checkPermission({ alias: 'readCalendar' }); | ||
*/ | ||
checkPermission(options: { | ||
alias: PluginPermission; | ||
}): Promise<{ result: PermissionState }>; | ||
|
||
/** | ||
* Retrieves the current status of all permissions. | ||
* | ||
* @since 0.1.0 | ||
* @platform Android, iOS | ||
*/ | ||
checkAllPermissions(): Promise<{ result: CheckAllPermissionsResult }>; | ||
|
||
/** | ||
* Requests permission for a given permission alias. | ||
* | ||
* @since 0.1.0 | ||
* @platform Android, iOS | ||
* | ||
* @example | ||
* this.requestPermission({ alias: 'readCalendar' }); | ||
*/ | ||
requestPermission(options: { | ||
alias: PluginPermission; | ||
}): Promise<{ result: PermissionState }>; | ||
|
||
/** | ||
* Requests permission for all permissions. | ||
* | ||
* @since 0.1.0 | ||
* @platform Android, iOS | ||
*/ | ||
requestAllPermissions(): Promise<{ result: RequestAllPermissionsResult }>; | ||
|
||
/** | ||
* Requests write access to the calendar. | ||
* | ||
* @since 5.4.0 | ||
* @platform Android, iOS | ||
*/ | ||
requestWriteOnlyCalendarAccess(): Promise<{ result: PermissionState }>; | ||
|
||
/** | ||
* Requests read access to the calendar. | ||
* | ||
* @since 5.4.0 | ||
* @platform Android | ||
*/ | ||
requestReadOnlyCalendarAccess(): Promise<{ result: PermissionState }>; | ||
|
||
/** | ||
* Requests read and write access to the calendar. | ||
* | ||
* @since 5.4.0 | ||
* @platform Android, iOS | ||
*/ | ||
requestFullCalendarAccess(): Promise<{ result: PermissionState }>; | ||
|
||
/** | ||
* Requests read and write access to the reminders. | ||
* | ||
* @since 5.4.0 | ||
* @platform iOS | ||
*/ | ||
requestFullRemindersAccess(): Promise<{ result: PermissionState }>; | ||
} | ||
|
||
/** | ||
* @since 7.1.0 | ||
* @platform Android, iOS | ||
*/ | ||
export type CheckAllPermissionsResult = Record< | ||
PluginPermission, | ||
PermissionState | ||
>; | ||
|
||
/** | ||
* @since 7.1.0 | ||
* @platform Android, iOS | ||
*/ | ||
export type RequestAllPermissionsResult = CheckAllPermissionsResult; |