UNPKG

scriptable-abstract

Version:

Abstract class definitions and type structures for Scriptable-iOS, providing the foundation for building mock implementations and type-safe Scriptable development tools.

1,178 lines 205 kB
/** * Scriptable iOS Type Definitions * * @file Auto-generated abstract class definitions for Scriptable iOS * @source @types/scriptable-ios@1.7.7 * @module scriptable-abstract * @generated 2025-02-13T08:51:18.588Z * @license MIT */ /** * Base abstract class with shared core functionality. * Provides common methods for property access and method invocation. */ type ScriptableConstructor<T extends object = object, Instance extends Scriptable<T> = Scriptable<T>> = { new (...args: any[]): Instance; readonly type: 'class' | 'variable'; readonly identifier: string; }; /** * Initializer function type for scriptable instances. * Defines initialization behavior for a scriptable class. * @template T The state type of the scriptable instance * @param instance The scriptable instance to initialize */ type ScriptableInitializer<T extends object> = (instance: Scriptable<T>) => void; declare abstract class Scriptable<T extends object> { /** * The type of the scriptable implementation. */ static readonly type: 'class' | 'variable'; /** * The identifier name in the target system. */ static readonly identifier: string; private static readonly states; /** * Store class-level initializers * Using WeakMap to allow garbage collection of unused class references */ private static readonly classInitializers; private frozenState?; /** * Creates a new instance of a Scriptable class * @param initialState Initial state for the instance */ constructor(initialState?: Partial<T>); /** * Registers a class-level initializer that will be applied to all instances during construction. * This is useful for setting up default behaviors and states for all instances of a class. * * @template T The state type of the target class * @param targetClass The class to register the initializer for * @param initializer The initialization function * @throws {Error} If an initializer is already registered for the target class * @example * ```typescript * Scriptable.initialize(MyClass, instance => { * instance.setState({ defaultValue: 'some value' }); * }); * ``` */ static initialize<T extends object>(targetClass: ScriptableConstructor<T>, initializer: ScriptableInitializer<T>): void; /** * Replaces an existing class-level initializer or sets a new one. * Use this method with caution as it can affect all future instances of the class. * * @template T The state type of the target class * @param targetClass The class to set the initializer for * @param initializer The new initialization function */ static replaceInitializer<T extends object>(targetClass: ScriptableConstructor<T>, initializer: ScriptableInitializer<T>): void; /** * Removes the class-level initializer for the specified class. * * @param targetClass The class to remove the initializer from * @returns true if an initializer was removed, false otherwise */ static clearInitializer(targetClass: ScriptableConstructor<any>): boolean; get state(): Readonly<T>; setState<K extends keyof T>(state: Pick<T, K> | Partial<T> | ((prevState: Readonly<T>) => Pick<T, K>)): this; protected get internalState(): T; protected set internalState(value: T); protected updateState(updates: Partial<T>): void; protected invokeMethod<R>(method: string, _args: unknown[]): R; protected static invokeStaticMethod<R>(method: string, _args: unknown[]): R; protected asOriginal<O>(): O; } /** * Base class for objects. * Provides implementation for class-based scriptable objects. */ declare abstract class ScriptableClass<T extends object> extends Scriptable<T> { static readonly type = "class"; } /** * Base class for global variables. * Provides implementation for global variable access and manipulation. */ declare abstract class ScriptableVariable<T extends object> extends Scriptable<T> { static readonly type = "variable"; protected static _instance?: ScriptableVariable<any>; constructor(initialState?: Partial<T>); static get instance(): ScriptableVariable<any>; } interface AlertState { title: string; message: string; } declare class AbsAlert<S extends AlertState = AlertState> extends ScriptableClass<S> implements Alert { static readonly identifier = "Alert"; get asAlert(): Alert; get title(): string; set title(value: string); get message(): string; set message(value: string); /** * _Adds an action to the alert._ * * Adds an action button to the alert. To check if an action was selected, you should use the first parameter provided when the promise returned by presentAlert() and presentSheet() * is resolved. * @param title - Title of the action. * @see https://docs.scriptable.app/alert/#-addaction */ addAction(title: string): void; /** * _Adds a destructive action to the alert._ * * Destructive action titles have a red text color, signaling that the action may modify or delete data. * @param title - Title of the action. * @see https://docs.scriptable.app/alert/#-adddestructiveaction */ addDestructiveAction(title: string): void; /** * _Adds a cancel action to the alert._ * * Adds a cancel action to the alert. When a cancel action is selected, the index provided by presentAlert() or presentSheet() will always be -1. Please note that when running on the * iPad and presenting using presentSheet(), the action will not be shown in the list of actions. The operation is cancelled by tapping outside the sheet. * * An alert can only contain a single cancel action. Attempting to add more cancel actions will remove any previously added cancel actions. * @param title - Title of the action. * @see https://docs.scriptable.app/alert/#-addcancelaction */ addCancelAction(title: string): void; /** * _Adds a text field prompting for user input._ * * Adds a text field to the alert controller prompting for user input. Retrieve the value for the text field using textFieldValue() and supply the index of the text field. Indices for * text fields are assigned in the same order as they are added to the alert starting at 0. * * Text fields are not supported when using the sheet presentation. * @param placeholder - Optional placeholder that will be displayed when the text field is empty. * @param text - Optional default value for the text field. * @see https://docs.scriptable.app/alert/#-addtextfield */ addTextField(placeholder?: string, text?: string): TextField; /** * _Adds a secure text field prompting for user input._ * * Adds a secure text field to the alert controller prompting for user input. Values entered into a secure text field will be hidden behind dots. Retrieve the value for the text field * using textFieldValue() and supply the index of the text field. Indices for text fields are assigned in the same order as they are added to the alert starting at 0. * @param placeholder - Optional placeholder that will be displayed when the text field is empty. * @param text - Optional default value for the text field. * @see https://docs.scriptable.app/alert/#-addsecuretextfield */ addSecureTextField(placeholder?: string, text?: string): TextField; /** * _Retrieves value of a text field._ * * Retrieves the value of a text field added using addTextField() or addSecureTextField(). Indices for text fields are assigned in the same order as they are added to the alert * starting at 0. * @param index - Index of text field to retrieve for value. * @see https://docs.scriptable.app/alert/#-textfieldvalue */ textFieldValue(index: number): string; /** * _Presents the alert modally._ * * This is a shorthand for presentAlert(). * @see https://docs.scriptable.app/alert/#-present */ present(): Promise<number>; /** * _Presents the alert modally._ * @see https://docs.scriptable.app/alert/#-presentalert */ presentAlert(): Promise<number>; /** * _Presents the alert as a sheet._ * @see https://docs.scriptable.app/alert/#-presentsheet */ presentSheet(): Promise<number>; } interface CalendarState { identifier: string; title: string; isSubscribed: boolean; allowsContentModifications: boolean; color: Color; } declare class AbsCalendar<S extends CalendarState = CalendarState> extends ScriptableClass<S> implements Calendar { static readonly identifier = "Calendar"; get asCalendar(): Calendar; /** * _Fetches calendars for reminders._ * * A calendar can only hold either reminders or events. Call this function to fetch all calendars that can hold reminders. * @see https://docs.scriptable.app/calendar/#forreminders */ static forReminders(): Promise<Calendar[]>; /** * _Fetches calendars for events._ * * A calendar can only hold either reminders or events. Call this function to fetch all calendars that can hold events. * @see https://docs.scriptable.app/calendar/#forevents */ static forEvents(): Promise<Calendar[]>; /** * _Fetches a calendar that holds reminders._ * @param title - Title of calendar. * @see https://docs.scriptable.app/calendar/#forremindersbytitle */ static forRemindersByTitle(title: string): Promise<Calendar>; /** * _Fetches a calendar that holds events._ * @param title - Title of calendar. * @see https://docs.scriptable.app/calendar/#foreventsbytitle */ static forEventsByTitle(title: string): Promise<Calendar>; /** * _Create a new calendar that holds reminders._ * * This will create a new list for reminders in the Reminders app. The list is automatically saved so there is no need to call `save()` after creating the list. * @see https://docs.scriptable.app/calendar/#createforreminders */ static createForReminders(title: string): Promise<Calendar>; /** * _Find or create a new calendar that holds reminders._ * * This will attempt to find a calendar for reminders with the specified name. If no calendar is found, a new calendar is created and the calendar will appear as a reminder list in * the Reminders app. If multiple calendars are found for the specified name, the first one will be returned. The list is automatically saved so there is no need to call `save()` in * the case the list was created. * @see https://docs.scriptable.app/calendar/#findorcreateforreminders */ static findOrCreateForReminders(title: string): Promise<Calendar>; /** * _Default calendar for reminders._ * * A calendar can only hold either reminders or events. Call this function to get the default calendar that can hold reminders. * @see https://docs.scriptable.app/calendar/#defaultforreminders */ static defaultForReminders(): Promise<Calendar>; /** * _Default calendar for events._ * * A calendar can only hold either reminders or events. Call this function to get the default calendar that can hold events. * @see https://docs.scriptable.app/calendar/#defaultforevents */ static defaultForEvents(): Promise<Calendar>; /** * _Presents a view for picking calendars._ * @param allowMultiple - Whether to allow picking multiple calenders. Defaults to false. * @see https://docs.scriptable.app/calendar/#presentpicker */ static presentPicker(allowMultiple?: boolean): Promise<Calendar[]>; get identifier(): string; set identifier(value: string); get title(): string; set title(value: string); get isSubscribed(): boolean; set isSubscribed(value: boolean); get allowsContentModifications(): boolean; set allowsContentModifications(value: boolean); get color(): Color; set color(value: Color); /** * _Checks if the calendar supports availability._ * * The following values are supported: * * * busy * * free * * tentative * * unavailable * * Not all calendars support all of these availabilities and some calendars may not support availability at all. Use this function to check if the calendar supports a specific * availability. * @param availability - Availability to check against. * @see https://docs.scriptable.app/calendar/#-supportsavailability */ supportsAvailability(availability: "busy" | "free" | "tentative" | "unavailable"): boolean; /** * _Saves calendar._ * * Saves changes to the calendar. * @see https://docs.scriptable.app/calendar/#-save */ save(): void; /** * _Removes calendar._ * * The calendar is removed immediately. This cannot be undone. * @see https://docs.scriptable.app/calendar/#-remove */ remove(): void; } interface CalendarEventState { identifier: string; title: string; location: string; notes: string; startDate: Date; endDate: Date; isAllDay: boolean; attendees: CalendarEvent.Attendees[]; availability: "busy" | "free" | "tentative" | "unavailable"; timeZone: string; calendar: Calendar; } declare class AbsCalendarEvent<S extends CalendarEventState = CalendarEventState> extends ScriptableClass<S> implements CalendarEvent { static readonly identifier = "CalendarEvent"; get asCalendarEvent(): CalendarEvent; /** * _Presents a view for creating a calendar event._ * * The presented view supports editing various attributes of the event, including title, location, dates, recurrence and alerts. * @see https://docs.scriptable.app/calendarevent/#presentcreate */ static presentCreate(): Promise<CalendarEvent>; /** * _Events occurring today._ * @param calendars - Calendars to fetch events for. Defaults to all calendars. * @see https://docs.scriptable.app/calendarevent/#today */ static today(calendars?: readonly Calendar[]): Promise<CalendarEvent[]>; /** * _Events occurring tomorrow._ * @param calendars - Calendars to fetch events for. Defaults to all calendars. * @see https://docs.scriptable.app/calendarevent/#tomorrow */ static tomorrow(calendars?: readonly Calendar[]): Promise<CalendarEvent[]>; /** * _Events that occurred yesterday._ * @param calendars - Calendars to fetch events for. Defaults to all calendars. * @see https://docs.scriptable.app/calendarevent/#yesterday */ static yesterday(calendars?: readonly Calendar[]): Promise<CalendarEvent[]>; /** * _Events that occur this week._ * @param calendars - Calendars to fetch events for. Defaults to all calendars. * @see https://docs.scriptable.app/calendarevent/#thisweek */ static thisWeek(calendars?: readonly Calendar[]): Promise<CalendarEvent[]>; /** * _Events that occur next week._ * @param calendars - Calendars to fetch events for. Defaults to all calendars. * @see https://docs.scriptable.app/calendarevent/#nextweek */ static nextWeek(calendars?: readonly Calendar[]): Promise<CalendarEvent[]>; /** * _Events that occurred last week._ * @param calendars - Calendars to fetch events for. Defaults to all calendars. * @see https://docs.scriptable.app/calendarevent/#lastweek */ static lastWeek(calendars?: readonly Calendar[]): Promise<CalendarEvent[]>; /** * _Events that occurs between two dates._ * @param startDate - Start date to fetch events for. * @param endDate - End date to fetch events for. * @param calendars - Calendars to fetch events for. Defaults to all calendars. * @see https://docs.scriptable.app/calendarevent/#between */ static between(startDate: Date, endDate: Date, calendars?: readonly Calendar[]): Promise<CalendarEvent[]>; get identifier(): string; set identifier(value: string); get title(): string; set title(value: string); get location(): string; set location(value: string); get notes(): string; set notes(value: string); get startDate(): Date; set startDate(value: Date); get endDate(): Date; set endDate(value: Date); get isAllDay(): boolean; set isAllDay(value: boolean); get attendees(): CalendarEvent.Attendees[]; set attendees(value: CalendarEvent.Attendees[]); get availability(): "busy" | "free" | "tentative" | "unavailable"; set availability(value: "busy" | "free" | "tentative" | "unavailable"); get timeZone(): string; set timeZone(value: string); get calendar(): Calendar; set calendar(value: Calendar); /** * _Adds a recurrence rule._ * * Recurrence rules specify when the event or reminder should be repeated. See the documentation of RecurrenceRule for more information on creating rules. * @param recurrenceRule - Recurrence rule to add to the reminder. * @see https://docs.scriptable.app/calendarevent/#-addrecurrencerule */ addRecurrenceRule(recurrenceRule: RecurrenceRule): void; /** * _Removes all recurrence rules._ * @see https://docs.scriptable.app/calendarevent/#-removeallrecurrencerules */ removeAllRecurrenceRules(): void; /** * _Saves event._ * * Saves changes to an event, inserting it into the calendar if it is newly created. * @see https://docs.scriptable.app/calendarevent/#-save */ save(): void; /** * _Removes event from calendar._ * @see https://docs.scriptable.app/calendarevent/#-remove */ remove(): void; /** * _Presents a view for editing the calendar event._ * * The presented view supports editing various attributes of the event, including title, location, dates, recurrence and alerts. * @see https://docs.scriptable.app/calendarevent/#-presentedit */ presentEdit(): Promise<CalendarEvent>; } interface CallbackURLState { } declare class AbsCallbackURL<T extends string, S extends CallbackURLState = CallbackURLState> extends ScriptableClass<S> implements CallbackURL<T> { static readonly identifier = "CallbackURL"; get asCallbackURL(): CallbackURL<T>; /** * _Construct CallbackURL._ * * Appends a key/value pair to the base URL as a query parameter. The name and value are automatically encoded. Do not add the x-callback-url paramters, i.e. x-source, x-success, * x-error and x-cancel as Scriptable will add those. * @param name - Name of the query parameter to add. * @param value - Value of the query parameter to add. * @see https://docs.scriptable.app/callbackurl/#-addparameter */ addParameter(name: string, value: string): void; /** * _Opens the callback URL._ * * Opens the target app and waits for the target app to perform the action. The returned promise contains the query parameters supplied by the target app when it invokes the callback. * If the action failed in the target app or the action was cancelled, the promise will be rejected. The promise is also rejected if the action times out because the target app did * not invoke the callback. * @see https://docs.scriptable.app/callbackurl/#-open */ open(): Promise<T extends `shortcuts://x-callback-url/${string}` ? { result: string | number | boolean | null; } : Record<string, string | number | boolean | null>>; /** * _Creates the callback URL._ * * Creates a callback URL with the specified base URL and query parameters. * @see https://docs.scriptable.app/callbackurl/#-geturl */ getURL(): string; } interface ColorState { hex: string; red: number; green: number; blue: number; alpha: number; } declare class AbsColor<S extends ColorState = ColorState> extends ScriptableClass<S> implements Color { static readonly identifier = "Color"; get asColor(): Color; /** * _Constructs a black color._ * @see https://docs.scriptable.app/color/#black */ static black(): Color; /** * _Constructs a dark gray color._ * @see https://docs.scriptable.app/color/#darkgray */ static darkGray(): Color; /** * _Constructs a light gray color._ * @see https://docs.scriptable.app/color/#lightgray */ static lightGray(): Color; /** * _Constructs a white color._ * @see https://docs.scriptable.app/color/#white */ static white(): Color; /** * _Constructs a gray color._ * @see https://docs.scriptable.app/color/#gray */ static gray(): Color; /** * _Constructs a red color._ * @see https://docs.scriptable.app/color/#red */ static red(): Color; /** * _Constructs a green color._ * @see https://docs.scriptable.app/color/#green */ static green(): Color; /** * _Constructs a blue color._ * @see https://docs.scriptable.app/color/#blue */ static blue(): Color; /** * _Constructs a cyan color._ * @see https://docs.scriptable.app/color/#cyan */ static cyan(): Color; /** * _Constructs a yellow color._ * @see https://docs.scriptable.app/color/#yellow */ static yellow(): Color; /** * _Constructs a magenta color._ * @see https://docs.scriptable.app/color/#magenta */ static magenta(): Color; /** * _Constructs a orange color._ * @see https://docs.scriptable.app/color/#orange */ static orange(): Color; /** * _Constructs a purple color._ * @see https://docs.scriptable.app/color/#purple */ static purple(): Color; /** * _Constructs a brown color._ * @see https://docs.scriptable.app/color/#brown */ static brown(): Color; /** * _Constructs a transparent color._ * @see https://docs.scriptable.app/color/#clear */ static clear(): Color; /** * _Creates a dynamic color._ * * The dynamic color will use either its light or dark variant depending on the appearance of the system. * * Dynamic colors are not supported when used with `DrawContext`. * @param lightColor - Color used in light appearance. * @param darkColor - Color used in dark appearance. * @see https://docs.scriptable.app/color/#dynamic */ static dynamic(lightColor: Color, darkColor: Color): Color; get hex(): string; set hex(value: string); get red(): number; set red(value: number); get green(): number; set green(value: number); get blue(): number; set blue(value: number); get alpha(): number; set alpha(value: number); } interface ContactState { identifier: string; namePrefix: string; givenName: string; middleName: string; familyName: string; nickname: string; birthday: Date; image: Image; emailAddresses: Contact.EmailAddresses[]; phoneNumbers: Contact.PhoneNumbers[]; postalAddresses: Contact.PostalAddresses[]; socialProfiles: Contact.SocialProfiles[]; note: string; urlAddresses: { [key: string]: string; }[]; dates: { [key: string]: any; }[]; organizationName: string; departmentName: string; jobTitle: string; isNamePrefixAvailable: boolean; isGiveNameAvailable: boolean; isMiddleNameAvailable: boolean; isFamilyNameAvailable: boolean; isNicknameAvailable: boolean; isBirthdayAvailable: boolean; isEmailAddressesAvailable: boolean; isPhoneNumbersAvailable: boolean; isPostalAddressesAvailable: boolean; isSocialProfilesAvailable: boolean; isImageAvailable: boolean; isNoteAvailable: boolean; isURLAddressesAvailable: boolean; isOrganizationNameAvailable: boolean; isDepartmentNameAvailable: boolean; isJobTitleAvailable: boolean; isDatesAvailable: boolean; } declare class AbsContact<S extends ContactState = ContactState> extends ScriptableClass<S> implements Contact { static readonly identifier = "Contact"; get asContact(): Contact; /** * _Fetches contacts._ * * Fetches the contacts in the specified containers. A contact can be in only one container. * @param containers - Containers to fetch contacts from. * @see https://docs.scriptable.app/contact/#all */ static all(containers: readonly ContactsContainer[]): Promise<Contact[]>; /** * _Fetches contacts in groups._ * * Fetches the contacts in the specified contacts groups. A contact may belong to many groups. * @param groups - Groups to fetch contacts from. * @see https://docs.scriptable.app/contact/#ingroups */ static inGroups(groups: readonly ContactsGroup[]): Promise<Contact[]>; /** * _Queues a contact to be added._ * * After you have created a contact, you must queue the contact to be added to the address book and invoke `Contact.persistChanges()` to persist the changes to the address book. * * For performance reasons, it is best to batch changes to the address book. Therefore you should queue all updates, insertions and removals of contacts and contacts groups to as * large batches as possible and then call `Contact.persistChanges()` when you want to persist the changes to the address book. * @param contact - Contact to queue to be added. * @param containerIdentifier - Optional. Identifier of container to add the contact to. If null is specified, the contact will be added to the default container. * @see https://docs.scriptable.app/contact/#add */ static add(contact: Contact, containerIdentifier?: string): void; /** * _Queues an update to a contact._ * * After you have updated one or more properties on a contact, you must queue the contact to be updated and invoke `Contact.persistChanges()` to persist the changes to the address * book. * * For performance reasons, it is best to batch changes to the address book. Therefore you should queue all updates, insertions and removals of contacts and contacts groups to as * large batches as possible and then call `Contact.persistChanges()` when you want to persist the changes to the address book. * @param contact - Contact to queue to be updated. * @see https://docs.scriptable.app/contact/#update */ static update(contact: Contact): void; /** * _Queues a contact to be deleted._ * * To delete a contact, you must queue the contact for deletion and invoke `Contact.persistChanges()` to persist the changes to the address book. * * For performance reasons, it is best to batch changes to the address book. Therefore you should queue all updates, insertions and removals of contacts and contacts groups to as * large batches as possible and then call `Contact.persistChanges()` when you want to persist the changes to the address book. * @param contact - Contact to queue to be deleted. * @see https://docs.scriptable.app/contact/#delete */ static delete(contact: Contact): void; /** * _Persist queued changes to the address book._ * * Call this function to persist changes queued with `Contact.add()`, `Contact.update()` and `Contact.delete()`. * * For performance reasons, it is best to batch changes to the address book. Therefore you should queue all updates, insertions and removals of contacts and contacts groups to as * large batches as possible and then call `Contact.persistChanges()` when you want to persist the changes to the address book. * @see https://docs.scriptable.app/contact/#persistchanges */ static persistChanges(): Promise<void>; get identifier(): string; set identifier(value: string); get namePrefix(): string; set namePrefix(value: string); get givenName(): string; set givenName(value: string); get middleName(): string; set middleName(value: string); get familyName(): string; set familyName(value: string); get nickname(): string; set nickname(value: string); get birthday(): Date; set birthday(value: Date); get image(): Image; set image(value: Image); get emailAddresses(): Contact.EmailAddresses[]; set emailAddresses(value: Contact.EmailAddresses[]); get phoneNumbers(): Contact.PhoneNumbers[]; set phoneNumbers(value: Contact.PhoneNumbers[]); get postalAddresses(): Contact.PostalAddresses[]; set postalAddresses(value: Contact.PostalAddresses[]); get socialProfiles(): Contact.SocialProfiles[]; set socialProfiles(value: Contact.SocialProfiles[]); get note(): string; set note(value: string); get urlAddresses(): { [key: string]: string; }[]; set urlAddresses(value: { [key: string]: string; }[]); get dates(): { [key: string]: any; }[]; set dates(value: { [key: string]: any; }[]); get organizationName(): string; set organizationName(value: string); get departmentName(): string; set departmentName(value: string); get jobTitle(): string; set jobTitle(value: string); get isNamePrefixAvailable(): boolean; set isNamePrefixAvailable(value: boolean); get isGiveNameAvailable(): boolean; set isGiveNameAvailable(value: boolean); get isMiddleNameAvailable(): boolean; set isMiddleNameAvailable(value: boolean); get isFamilyNameAvailable(): boolean; set isFamilyNameAvailable(value: boolean); get isNicknameAvailable(): boolean; set isNicknameAvailable(value: boolean); get isBirthdayAvailable(): boolean; set isBirthdayAvailable(value: boolean); get isEmailAddressesAvailable(): boolean; set isEmailAddressesAvailable(value: boolean); get isPhoneNumbersAvailable(): boolean; set isPhoneNumbersAvailable(value: boolean); get isPostalAddressesAvailable(): boolean; set isPostalAddressesAvailable(value: boolean); get isSocialProfilesAvailable(): boolean; set isSocialProfilesAvailable(value: boolean); get isImageAvailable(): boolean; set isImageAvailable(value: boolean); get isNoteAvailable(): boolean; set isNoteAvailable(value: boolean); get isURLAddressesAvailable(): boolean; set isURLAddressesAvailable(value: boolean); get isOrganizationNameAvailable(): boolean; set isOrganizationNameAvailable(value: boolean); get isDepartmentNameAvailable(): boolean; set isDepartmentNameAvailable(value: boolean); get isJobTitleAvailable(): boolean; set isJobTitleAvailable(value: boolean); get isDatesAvailable(): boolean; set isDatesAvailable(value: boolean); } interface ContactsContainerState { identifier: string; name: string; } declare class AbsContactsContainer<S extends ContactsContainerState = ContactsContainerState> extends ScriptableClass<S> implements ContactsContainer { static readonly identifier = "ContactsContainer"; get asContactsContainer(): ContactsContainer; /** * _Fetches default contacts container._ * @see https://docs.scriptable.app/contactscontainer/#default */ static default(): Promise<ContactsContainer>; /** * _Fetches all contacts containers._ * @see https://docs.scriptable.app/contactscontainer/#all */ static all(): Promise<ContactsContainer[]>; /** * _Fetches a contacts container._ * @param identifier - Identifier of the contacts container to fetch. * @see https://docs.scriptable.app/contactscontainer/#withidentifier */ static withIdentifier(identifier: string): Promise<ContactsContainer>; get identifier(): string; set identifier(value: string); get name(): string; set name(value: string); } interface ContactsGroupState { identifier: string; name: string; } declare class AbsContactsGroup<S extends ContactsGroupState = ContactsGroupState> extends ScriptableClass<S> implements ContactsGroup { static readonly identifier = "ContactsGroup"; get asContactsGroup(): ContactsGroup; /** * _Fetches contacts groups._ * * Fetches the contacts groups in the specified containers. A group can be in only one container. * @param containers - Container to fetch contacts groups from. * @see https://docs.scriptable.app/contactsgroup/#all */ static all(containers: readonly ContactsContainer[]): Promise<ContactsGroup[]>; /** * _Queues a contacts group to be added._ * * After you have created a group, you must queue the group to be added to the address book and invoke `Contact.persistChanges()` to persist the changes to the address book. * * For performance reasons, it is best to batch changes to the address book. Therefore you should queue all updates, insertions and removals of contacts and contacts groups to as * large batches as possible and then call `Contact.persistChanges()` when you want to persist the changes to the address book. * @param group - Contacts group to queue to be added. * @param containerIdentifier - Optional. Identifier of container to add the contacts group to. If null is specified, the group will be added to the default container. * @see https://docs.scriptable.app/contactsgroup/#add */ static add(group: ContactsGroup, containerIdentifier?: string): void; /** * _Queues an update to a contacts group._ * * After you have updated one or more properties on a contacts group, you must queue the group to be updated and invoke `Contact.persistChanges()` to persist the changes to the * address book. * * For performance reasons, it is best to batch changes to the address book. Therefore you should queue all updates, insertions and removals of contacts and contacts groups to as * large batches as possible and then call `Contact.persistChanges()` when you want to persist the changes to the address book. * @param group - Contacts group to queue to be updated. * @see https://docs.scriptable.app/contactsgroup/#update */ static update(group: ContactsGroup): void; /** * _Queues a contacts group to be deleted._ * * To delete a contacts group, you must queue the group for deletion and invoke `Contact.persistChanges()` to persist the changes to the address book. * * For performance reasons, it is best to batch changes to the address book. Therefore you should queue all updates, insertions and removals of contacts and contacts groups to as * large batches as possible and then call `Contact.persistChanges()` when you want to persist the changes to the address book. * @param group - Contacts group to queue to be deleted. * @see https://docs.scriptable.app/contactsgroup/#delete */ static delete(group: ContactsGroup): void; get identifier(): string; set identifier(value: string); get name(): string; set name(value: string); /** * _Adds a contact to the group._ * * In order to persist the change, you should call `Contact.persistChanges()`. It is important that the contact is added to the address book. To add the contact to the address book, * you should queue it for insertion using `Contact.add()` before persisting the changes. * @param contact - Contact to add to the group. * @see https://docs.scriptable.app/contactsgroup/#-addmember */ addMember(contact: Contact): void; /** * _Removes a contact from the group._ * * In order to persist the change, you should call `Contact.persistChanges()`. It is important that the contact is added to the address book. To add the contact to the address book, * you should queue it for insertion using `Contact.add()` before persisting the changes. * @param contact - Contact to add to the group. * @see https://docs.scriptable.app/contactsgroup/#-removemember */ removeMember(contact: Contact): void; } interface DataState { } declare class AbsData<S extends DataState = DataState> extends ScriptableClass<S> implements Data { static readonly identifier = "Data"; get asData(): Data; /** * _Creates data from string._ * * The provided string is assumed to be UTF8 encoded. If the string is not UTF8 encoded, the function will return null. * @param string - String to create data from. * @see https://docs.scriptable.app/data/#fromstring */ static fromString(string: string): Data; /** * _Reads data from file path._ * * Reads the raw data of the file at the specified file path. * @param filePath - Path of file to read data from. * @see https://docs.scriptable.app/data/#fromfile */ static fromFile(filePath: string): Data; /** * _Creates data from base64 encoded string._ * * The supplied string must be base64 encoded otherwise the function will return null. * @param base64String - Base64 encoded string to create data from. * @see https://docs.scriptable.app/data/#frombase64string */ static fromBase64String(base64String: string): Data; /** * _Creates data from JPEG image._ * @param image - JPEG image to convert to data. * @see https://docs.scriptable.app/data/#fromjpeg */ static fromJPEG(image: Image): Data; /** * _Creates data from PNG image._ * @param image - PNG image to convert to data. * @see https://docs.scriptable.app/data/#frompng */ static fromPNG(image: Image): Data; /** * _Creates data from an array of bytes._ * @param bytes - Array of bytes to convert to data. * @see https://docs.scriptable.app/data/#frombytes */ static fromBytes(bytes: readonly number[]): Data; /** * _Creates a string from the data._ * * The data is assumed to represent a UTF8 encoded string. If the string is not UTF8 encoded string, the function will return null. * @see https://docs.scriptable.app/data/#-torawstring */ toRawString(): string; /** * _Creates a base64 encoded string._ * * Creates a base64 encoded string from the data. * @see https://docs.scriptable.app/data/#-tobase64string */ toBase64String(): string; /** * _Gets bytes from data._ * @see https://docs.scriptable.app/data/#-getbytes */ getBytes(): number[]; } interface DateFormatterState { dateFormat: string; locale: string; } declare class AbsDateFormatter<S extends DateFormatterState = DateFormatterState> extends ScriptableClass<S> implements DateFormatter { static readonly identifier = "DateFormatter"; get asDateFormatter(): DateFormatter; get dateFormat(): string; set dateFormat(value: string); get locale(): string; set locale(value: string); /** * _Creates a string from a date._ * @param date - The date to convert to a string. * @see https://docs.scriptable.app/dateformatter/#-string */ string(date: Date): string; /** * _Creates a date from a string._ * * Uses the date formatters configuration to parse the string into a date. If the string cannot be parsed with the date foramtters configuration, the function will return null. * @param str - The string to parse into a date. * @see https://docs.scriptable.app/dateformatter/#-date */ date(str: string): Date; /** * _Use no style for the date._ * * This will remove the date from the formatted string. * @see https://docs.scriptable.app/dateformatter/#-usenodatestyle */ useNoDateStyle(): void; /** * _Use a short style for the date._ * * Dates with a short style are typically numeric only e.g. "08/23/19". * @see https://docs.scriptable.app/dateformatter/#-useshortdatestyle */ useShortDateStyle(): void; /** * _Use a medium style for the date._ * * Dates with a medium style usually includes abbreviations, e.g. "Aug 23, 2019". * @see https://docs.scriptable.app/dateformatter/#-usemediumdatestyle */ useMediumDateStyle(): void; /** * _Use a long style for the date._ * * Dates with a long style usually includes a full text, e.g. "August 23, 2019". * @see https://docs.scriptable.app/dateformatter/#-uselongdatestyle */ useLongDateStyle(): void; /** * _Use a full style for the date._ * * Dates with a full style includes all details, e.g. "Friday, August 23, 2019 AD". * @see https://docs.scriptable.app/dateformatter/#-usefulldatestyle */ useFullDateStyle(): void; /** * _Use no style for the time._ * * This will remove the time from the formatted string. * @see https://docs.scriptable.app/dateformatter/#-usenotimestyle */ useNoTimeStyle(): void; /** * _Use a short style for the time._ * * Times with a short style are typically numeric only but also includes the period for 12-hour clocks, e.g. "7:17 PM". * @see https://docs.scriptable.app/dateformatter/#-useshorttimestyle */ useShortTimeStyle(): void; /** * _Use a short style for the time._ * * Times with a medium style usually includes abbreviations, e.g. "7:16:42 PM". * @see https://docs.scriptable.app/dateformatter/#-usemediumtimestyle */ useMediumTimeStyle(): void; /** * _Use a long style for the time._ * * Times with a long style usually includes a full text, e.g. "7:16:42 PM PST". * @see https://docs.scriptable.app/dateformatter/#-uselongtimestyle */ useLongTimeStyle(): void; /** * _Use a full style for the time._ * * Times with a full style includes all details, e.g. "7:16:42 PM Pacific Standard Time". * @see https://docs.scriptable.app/dateformatter/#-usefulltimestyle */ useFullTimeStyle(): void; } interface DatePickerState { minimumDate: Date; maximumDate: Date; countdownDuration: number; minuteInterval: number; initialDate: Date; } declare class AbsDatePicker<S extends DatePickerState = DatePickerState> extends ScriptableClass<S> implements DatePicker { static readonly identifier = "DatePicker"; get asDatePicker(): DatePicker; get minimumDate(): Date; set minimumDate(value: Date); get maximumDate(): Date; set maximumDate(value: Date); get countdownDuration(): number; set countdownDuration(value: number); get minuteInterval(): number; set minuteInterval(value: number); get initialDate(): Date; set initialDate(value: Date); /** * _Presents the date picker displaying hours and minutes._ * * Use the method to pick a time. The date picker will display hours and minutes and, depending on the locale of the device, an AM/PM designation. * * The returned date will be the current date with the hour and minute set to the selected values. Use the `initialDate` property to set the initially selected date. * @see https://docs.scriptable.app/datepicker/#-picktime */ pickTime(): Promise<Date>; /** * _Presents the date picker displaying day, month and year._ * * Use the method to pick a date. The date picker will display the day, month and year. Use the `initialDate` property to set the initially selected date. * @see https://docs.scriptable.app/datepicker/#-pickdate */ pickDate(): Promise<Date>; /** * _Presents the date picker displaying date and time._ * * Use the method to pick a date and a time. The date picker will display the day, month, year, hour, minutes and, depending on the locale of the device, an AM/PM designation. Use the * `initialDate` property to set the initially selected date. * @see https://docs.scriptable.app/datepicker/#-pickdateandtime */ pickDateAndTime(): Promise<Date>; /** * _Presents the date picker for selecting the duration of a countdown._ * * Use the method to pick the duration of a countdown, e.g. a timer. The date picker will display hours and minutes. Use the `countdownDuration` property to set the initially selected * duration. * @see https://docs.scriptable.app/datepicker/#-pickcountdownduration */ pickCountdownDuration(): Promise<number>; } interface DrawContextState { size: Size; respectScreenScale: boolean; opaque: boolean; } declare class AbsDrawContext<S extends DrawContextState = DrawContextState> extends ScriptableClass<S> implements DrawContext { static readonly identifier = "DrawContext"; get asDrawContext(): DrawContext; get size(): Size; set size(value: Size); get respectScreenScale(): boolean; set respectScreenScale(value: boolean); get opaque(): boolean; set opaque(value: boolean); /** * _Retrieves the image._ * * Call this to retrieve the image you have drawn to the context. * @see https://docs.scriptable.app/drawcontext/#-getimage */ getImage(): Image; /** * _Draws an image in the specified rect._ * * Draws the image in the rectangle. The image will be scaled to fit within the rectangle. * @param image - Image to draw. * @param rect - Rectangle to draw the image in. * @see https://docs.scriptable.app/drawcontext/#-drawimageinrect */ drawImageInRect(image: Image, rect: Rect): void; /** * _Draws an image at the specified point._ * * Draws the image at the point. The top-left corner of the image will be drawn at the specified point. * @param image - Image to draw. * @param point - Point at which to draw top-left corner of the image. * @see https://docs.scriptable.app/drawcontext/#-drawimageatpoint */ drawImageAtPoint(image: Image, point: Point): void; /** * _Sets the fill color._ * * Sets the fill color to be used when performing a fill operation. Any fill operation performed afterwards will fill with the specified color until another call to setFillColor is * made. * @param color - Color to set for filling. * @see https://docs.scriptable.app/drawcontext/#-setfillcolor */ setFillColor(color: Color): void; /** * _Sets the stroke color._ * * Sets the stroke color to be used when performing a stroke operation. Any stroke operation performed afterwards will stroke with the specified color until another call to * setStrokeColor is made. * @param color - Color to set for stroking. * @see https://docs.scriptable.app/drawcontext/#-setstrokecolor */ setStrokeColor(color: Color): void; /** * _Sets the line width for stroking._ * * Sets the line width to be used when performing a stroke operation. * @param width - Line width to use for stroking. * @see https://docs.scriptable.app/drawcontext/#-setlinewidth */ setLineWidth(width: number): void; /** * _Fills a rectangle._ * * Fills the rectangle with the color set when calling setFillColor. * @param rect - Rectangle to fill. * @see https://docs.scriptable.app/drawcontext/#-fill */ fill(rect: Rect): void; /** * _Fills a rectangle._ * * Fills the rectangle with the color set when calling setFillColor. * @param rect - Rectangle to fill. * @see https://docs.scriptable.app/drawcontext/#-fillrect */ fillRect(rect: Rect): void; /** * _Fills an ellipse._ * * Fills the ellipse that fits within the supplied rectangle with the color set when calling setFillColor. * @param rect - Rectangle incapsulating the ellipse to fill. * @see https://docs.scriptable.app/drawcontext/#-fillellipse */ fillEllipse(rect: Rect): void; /** * _Strokes a rectangle._ * * Draws a line around the rectangle using the color set when calling setStrokeColor. The line will have the width set when calling setLineWidth. * @param rect - Rectangle to stroke. * @see https://docs.scriptable.app/drawcontext/#-stroke */ stroke(rect: Rect): void; /** * _Strokes a rectangle._ * * Draws a line around the rectangle using the color set when calling setStrokeColor. The line will have the width set when calling setLineWidth. * @param rect - Rectangle to stroke. * @see https://docs.scriptable.app/drawcontext/#-strokerect */ strokeRect(rect: Rect): void; /** * _Strokes an ellipse._ * * D