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,614 lines • 248 kB
JavaScript
var __defProp = Object.defineProperty;
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
/**
* 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
*/
const _Scriptable = class _Scriptable {
/**
* Creates a new instance of a Scriptable class
* @param initialState Initial state for the instance
*/
constructor(initialState = {}) {
// Cache frozen state
__publicField(this, "frozenState");
this.setState(initialState);
const classInitializer = _Scriptable.classInitializers.get(this.constructor);
if (classInitializer) {
classInitializer(this);
}
}
/**
* 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(targetClass, initializer) {
if (this.classInitializers.has(targetClass)) {
throw new Error(`Class initializer already registered for ${targetClass.name}. Use replaceInitializer() if you need to override the existing initializer.`);
}
this.classInitializers.set(targetClass, initializer);
}
/**
* 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(targetClass, initializer) {
this.classInitializers.set(targetClass, initializer);
}
/**
* 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) {
return this.classInitializers.delete(targetClass);
}
// Public API
get state() {
if (!this.frozenState) {
this.frozenState = Object.freeze({
...this.internalState
});
}
return this.frozenState;
}
setState(state) {
const updates = typeof state === "function" ? state(this.state) : state;
if (Object.keys(updates).length === 0) {
return this;
}
this.updateState(updates);
return this;
}
// Protected internal methods
get internalState() {
return _Scriptable.states.get(this) ?? {};
}
set internalState(value) {
this.frozenState = void 0;
_Scriptable.states.set(this, value);
}
updateState(updates) {
const newState = {
...this.internalState
};
let hasChanges = false;
for (const key in updates) {
const value = updates[key];
if (value !== void 0 && value !== this.internalState[key]) {
newState[key] = value;
hasChanges = true;
}
}
if (hasChanges) {
this.internalState = newState;
}
}
// Method invocation
invokeMethod(method, _args) {
throw new Error(`Method '${String(method)}' not implemented in ${this.constructor.name}`);
}
static invokeStaticMethod(method, _args) {
throw new Error(`Static method '${method}' not implemented in ${this.name}`);
}
asOriginal() {
return this;
}
};
__name(_Scriptable, "Scriptable");
/**
* The type of the scriptable implementation.
*/
__publicField(_Scriptable, "type");
/**
* The identifier name in the target system.
*/
__publicField(_Scriptable, "identifier");
// Use WeakMap for private state storage to prevent direct access
__publicField(_Scriptable, "states", /* @__PURE__ */ new WeakMap());
/**
* Store class-level initializers
* Using WeakMap to allow garbage collection of unused class references
*/
__publicField(_Scriptable, "classInitializers", /* @__PURE__ */ new WeakMap());
let Scriptable = _Scriptable;
const _ScriptableClass = class _ScriptableClass extends Scriptable {
};
__name(_ScriptableClass, "ScriptableClass");
__publicField(_ScriptableClass, "type", "class");
let ScriptableClass = _ScriptableClass;
const _ScriptableVariable = class _ScriptableVariable extends Scriptable {
constructor(initialState = {}) {
super(initialState);
if (this.constructor._instance) {
throw new Error(`${this.constructor.name} is a singleton`);
}
}
static get instance() {
if (!this._instance) {
this._instance = new this();
}
return this._instance;
}
};
__name(_ScriptableVariable, "ScriptableVariable");
__publicField(_ScriptableVariable, "type", "variable");
__publicField(_ScriptableVariable, "_instance");
let ScriptableVariable = _ScriptableVariable;
const _AbsAlert = class _AbsAlert extends ScriptableClass {
get asAlert() {
return this.asOriginal();
}
get title() {
if (!("title" in this.state)) {
return "";
}
return this.state.title;
}
set title(value) {
this.setState({
title: value
});
}
get message() {
if (!("message" in this.state)) {
return "";
}
return this.state.message;
}
set message(value) {
this.setState({
message: value
});
}
/**
* _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) {
return this.invokeMethod("addAction", Array.from(arguments));
}
/**
* _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) {
return this.invokeMethod("addDestructiveAction", Array.from(arguments));
}
/**
* _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) {
return this.invokeMethod("addCancelAction", Array.from(arguments));
}
/**
* _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, text) {
return this.invokeMethod("addTextField", Array.from(arguments));
}
/**
* _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, text) {
return this.invokeMethod("addSecureTextField", Array.from(arguments));
}
/**
* _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) {
return this.invokeMethod("textFieldValue", Array.from(arguments));
}
/**
* _Presents the alert modally._
*
* This is a shorthand for presentAlert().
* @see https://docs.scriptable.app/alert/#-present
*/
present() {
return this.invokeMethod("present", Array.from(arguments));
}
/**
* _Presents the alert modally._
* @see https://docs.scriptable.app/alert/#-presentalert
*/
presentAlert() {
return this.invokeMethod("presentAlert", Array.from(arguments));
}
/**
* _Presents the alert as a sheet._
* @see https://docs.scriptable.app/alert/#-presentsheet
*/
presentSheet() {
return this.invokeMethod("presentSheet", Array.from(arguments));
}
};
__name(_AbsAlert, "AbsAlert");
__publicField(_AbsAlert, "identifier", "Alert");
let AbsAlert = _AbsAlert;
const _AbsCalendar = class _AbsCalendar extends ScriptableClass {
get asCalendar() {
return this.asOriginal();
}
/**
* _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() {
return this.invokeStaticMethod("forReminders", Array.from(arguments));
}
/**
* _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() {
return this.invokeStaticMethod("forEvents", Array.from(arguments));
}
/**
* _Fetches a calendar that holds reminders._
* @param title - Title of calendar.
* @see https://docs.scriptable.app/calendar/#forremindersbytitle
*/
static forRemindersByTitle(title) {
return this.invokeStaticMethod("forRemindersByTitle", Array.from(arguments));
}
/**
* _Fetches a calendar that holds events._
* @param title - Title of calendar.
* @see https://docs.scriptable.app/calendar/#foreventsbytitle
*/
static forEventsByTitle(title) {
return this.invokeStaticMethod("forEventsByTitle", Array.from(arguments));
}
/**
* _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) {
return this.invokeStaticMethod("createForReminders", Array.from(arguments));
}
/**
* _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) {
return this.invokeStaticMethod("findOrCreateForReminders", Array.from(arguments));
}
/**
* _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() {
return this.invokeStaticMethod("defaultForReminders", Array.from(arguments));
}
/**
* _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() {
return this.invokeStaticMethod("defaultForEvents", Array.from(arguments));
}
/**
* _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) {
return this.invokeStaticMethod("presentPicker", Array.from(arguments));
}
get identifier() {
if (!("identifier" in this.state)) {
return "";
}
return this.state.identifier;
}
set identifier(value) {
this.setState({
identifier: value
});
}
get title() {
if (!("title" in this.state)) {
return "";
}
return this.state.title;
}
set title(value) {
this.setState({
title: value
});
}
get isSubscribed() {
if (!("isSubscribed" in this.state)) {
return false;
}
return this.state.isSubscribed;
}
set isSubscribed(value) {
this.setState({
isSubscribed: value
});
}
get allowsContentModifications() {
if (!("allowsContentModifications" in this.state)) {
return false;
}
return this.state.allowsContentModifications;
}
set allowsContentModifications(value) {
this.setState({
allowsContentModifications: value
});
}
get color() {
if (!("color" in this.state)) {
throw new Error('Required property "color" of type "Color" is not set');
}
return this.state.color;
}
set color(value) {
this.setState({
color: value
});
}
/**
* _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) {
return this.invokeMethod("supportsAvailability", Array.from(arguments));
}
/**
* _Saves calendar._
*
* Saves changes to the calendar.
* @see https://docs.scriptable.app/calendar/#-save
*/
save() {
return this.invokeMethod("save", Array.from(arguments));
}
/**
* _Removes calendar._
*
* The calendar is removed immediately. This cannot be undone.
* @see https://docs.scriptable.app/calendar/#-remove
*/
remove() {
return this.invokeMethod("remove", Array.from(arguments));
}
};
__name(_AbsCalendar, "AbsCalendar");
__publicField(_AbsCalendar, "identifier", "Calendar");
let AbsCalendar = _AbsCalendar;
const _AbsCalendarEvent = class _AbsCalendarEvent extends ScriptableClass {
get asCalendarEvent() {
return this.asOriginal();
}
/**
* _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() {
return this.invokeStaticMethod("presentCreate", Array.from(arguments));
}
/**
* _Events occurring today._
* @param calendars - Calendars to fetch events for. Defaults to all calendars.
* @see https://docs.scriptable.app/calendarevent/#today
*/
static today(calendars) {
return this.invokeStaticMethod("today", Array.from(arguments));
}
/**
* _Events occurring tomorrow._
* @param calendars - Calendars to fetch events for. Defaults to all calendars.
* @see https://docs.scriptable.app/calendarevent/#tomorrow
*/
static tomorrow(calendars) {
return this.invokeStaticMethod("tomorrow", Array.from(arguments));
}
/**
* _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) {
return this.invokeStaticMethod("yesterday", Array.from(arguments));
}
/**
* _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) {
return this.invokeStaticMethod("thisWeek", Array.from(arguments));
}
/**
* _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) {
return this.invokeStaticMethod("nextWeek", Array.from(arguments));
}
/**
* _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) {
return this.invokeStaticMethod("lastWeek", Array.from(arguments));
}
/**
* _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, endDate, calendars) {
return this.invokeStaticMethod("between", Array.from(arguments));
}
get identifier() {
if (!("identifier" in this.state)) {
return "";
}
return this.state.identifier;
}
set identifier(value) {
this.setState({
identifier: value
});
}
get title() {
if (!("title" in this.state)) {
return "";
}
return this.state.title;
}
set title(value) {
this.setState({
title: value
});
}
get location() {
if (!("location" in this.state)) {
return "";
}
return this.state.location;
}
set location(value) {
this.setState({
location: value
});
}
get notes() {
if (!("notes" in this.state)) {
return "";
}
return this.state.notes;
}
set notes(value) {
this.setState({
notes: value
});
}
get startDate() {
if (!("startDate" in this.state)) {
throw new Error('Required property "startDate" of type "Date" is not set');
}
return this.state.startDate;
}
set startDate(value) {
this.setState({
startDate: value
});
}
get endDate() {
if (!("endDate" in this.state)) {
throw new Error('Required property "endDate" of type "Date" is not set');
}
return this.state.endDate;
}
set endDate(value) {
this.setState({
endDate: value
});
}
get isAllDay() {
if (!("isAllDay" in this.state)) {
return false;
}
return this.state.isAllDay;
}
set isAllDay(value) {
this.setState({
isAllDay: value
});
}
get attendees() {
if (!("attendees" in this.state)) {
return [];
}
return this.state.attendees;
}
set attendees(value) {
this.setState({
attendees: value
});
}
get availability() {
if (!("availability" in this.state)) {
throw new Error('Required property "availability" of type ""busy" | "free" | "tentative" | "unavailable"" is not set');
}
return this.state.availability;
}
set availability(value) {
this.setState({
availability: value
});
}
get timeZone() {
if (!("timeZone" in this.state)) {
return "";
}
return this.state.timeZone;
}
set timeZone(value) {
this.setState({
timeZone: value
});
}
get calendar() {
if (!("calendar" in this.state)) {
throw new Error('Required property "calendar" of type "Calendar" is not set');
}
return this.state.calendar;
}
set calendar(value) {
this.setState({
calendar: value
});
}
/**
* _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) {
return this.invokeMethod("addRecurrenceRule", Array.from(arguments));
}
/**
* _Removes all recurrence rules._
* @see https://docs.scriptable.app/calendarevent/#-removeallrecurrencerules
*/
removeAllRecurrenceRules() {
return this.invokeMethod("removeAllRecurrenceRules", Array.from(arguments));
}
/**
* _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() {
return this.invokeMethod("save", Array.from(arguments));
}
/**
* _Removes event from calendar._
* @see https://docs.scriptable.app/calendarevent/#-remove
*/
remove() {
return this.invokeMethod("remove", Array.from(arguments));
}
/**
* _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() {
return this.invokeMethod("presentEdit", Array.from(arguments));
}
};
__name(_AbsCalendarEvent, "AbsCalendarEvent");
__publicField(_AbsCalendarEvent, "identifier", "CalendarEvent");
let AbsCalendarEvent = _AbsCalendarEvent;
const _AbsCallbackURL = class _AbsCallbackURL extends ScriptableClass {
get asCallbackURL() {
return this.asOriginal();
}
/**
* _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, value) {
return this.invokeMethod("addParameter", Array.from(arguments));
}
/**
* _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() {
return this.invokeMethod("open", Array.from(arguments));
}
/**
* _Creates the callback URL._
*
* Creates a callback URL with the specified base URL and query parameters.
* @see https://docs.scriptable.app/callbackurl/#-geturl
*/
getURL() {
return this.invokeMethod("getURL", Array.from(arguments));
}
};
__name(_AbsCallbackURL, "AbsCallbackURL");
__publicField(_AbsCallbackURL, "identifier", "CallbackURL");
let AbsCallbackURL = _AbsCallbackURL;
const _AbsColor = class _AbsColor extends ScriptableClass {
get asColor() {
return this.asOriginal();
}
/**
* _Constructs a black color._
* @see https://docs.scriptable.app/color/#black
*/
static black() {
return this.invokeStaticMethod("black", Array.from(arguments));
}
/**
* _Constructs a dark gray color._
* @see https://docs.scriptable.app/color/#darkgray
*/
static darkGray() {
return this.invokeStaticMethod("darkGray", Array.from(arguments));
}
/**
* _Constructs a light gray color._
* @see https://docs.scriptable.app/color/#lightgray
*/
static lightGray() {
return this.invokeStaticMethod("lightGray", Array.from(arguments));
}
/**
* _Constructs a white color._
* @see https://docs.scriptable.app/color/#white
*/
static white() {
return this.invokeStaticMethod("white", Array.from(arguments));
}
/**
* _Constructs a gray color._
* @see https://docs.scriptable.app/color/#gray
*/
static gray() {
return this.invokeStaticMethod("gray", Array.from(arguments));
}
/**
* _Constructs a red color._
* @see https://docs.scriptable.app/color/#red
*/
static red() {
return this.invokeStaticMethod("red", Array.from(arguments));
}
/**
* _Constructs a green color._
* @see https://docs.scriptable.app/color/#green
*/
static green() {
return this.invokeStaticMethod("green", Array.from(arguments));
}
/**
* _Constructs a blue color._
* @see https://docs.scriptable.app/color/#blue
*/
static blue() {
return this.invokeStaticMethod("blue", Array.from(arguments));
}
/**
* _Constructs a cyan color._
* @see https://docs.scriptable.app/color/#cyan
*/
static cyan() {
return this.invokeStaticMethod("cyan", Array.from(arguments));
}
/**
* _Constructs a yellow color._
* @see https://docs.scriptable.app/color/#yellow
*/
static yellow() {
return this.invokeStaticMethod("yellow", Array.from(arguments));
}
/**
* _Constructs a magenta color._
* @see https://docs.scriptable.app/color/#magenta
*/
static magenta() {
return this.invokeStaticMethod("magenta", Array.from(arguments));
}
/**
* _Constructs a orange color._
* @see https://docs.scriptable.app/color/#orange
*/
static orange() {
return this.invokeStaticMethod("orange", Array.from(arguments));
}
/**
* _Constructs a purple color._
* @see https://docs.scriptable.app/color/#purple
*/
static purple() {
return this.invokeStaticMethod("purple", Array.from(arguments));
}
/**
* _Constructs a brown color._
* @see https://docs.scriptable.app/color/#brown
*/
static brown() {
return this.invokeStaticMethod("brown", Array.from(arguments));
}
/**
* _Constructs a transparent color._
* @see https://docs.scriptable.app/color/#clear
*/
static clear() {
return this.invokeStaticMethod("clear", Array.from(arguments));
}
/**
* _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, darkColor) {
return this.invokeStaticMethod("dynamic", Array.from(arguments));
}
get hex() {
if (!("hex" in this.state)) {
return "";
}
return this.state.hex;
}
set hex(value) {
this.setState({
hex: value
});
}
get red() {
if (!("red" in this.state)) {
return 0;
}
return this.state.red;
}
set red(value) {
this.setState({
red: value
});
}
get green() {
if (!("green" in this.state)) {
return 0;
}
return this.state.green;
}
set green(value) {
this.setState({
green: value
});
}
get blue() {
if (!("blue" in this.state)) {
return 0;
}
return this.state.blue;
}
set blue(value) {
this.setState({
blue: value
});
}
get alpha() {
if (!("alpha" in this.state)) {
return 0;
}
return this.state.alpha;
}
set alpha(value) {
this.setState({
alpha: value
});
}
};
__name(_AbsColor, "AbsColor");
__publicField(_AbsColor, "identifier", "Color");
let AbsColor = _AbsColor;
const _AbsContact = class _AbsContact extends ScriptableClass {
get asContact() {
return this.asOriginal();
}
/**
* _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) {
return this.invokeStaticMethod("all", Array.from(arguments));
}
/**
* _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) {
return this.invokeStaticMethod("inGroups", Array.from(arguments));
}
/**
* _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, containerIdentifier) {
return this.invokeStaticMethod("add", Array.from(arguments));
}
/**
* _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) {
return this.invokeStaticMethod("update", Array.from(arguments));
}
/**
* _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) {
return this.invokeStaticMethod("delete", Array.from(arguments));
}
/**
* _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() {
return this.invokeStaticMethod("persistChanges", Array.from(arguments));
}
get identifier() {
if (!("identifier" in this.state)) {
return "";
}
return this.state.identifier;
}
set identifier(value) {
this.setState({
identifier: value
});
}
get namePrefix() {
if (!("namePrefix" in this.state)) {
return "";
}
return this.state.namePrefix;
}
set namePrefix(value) {
this.setState({
namePrefix: value
});
}
get givenName() {
if (!("givenName" in this.state)) {
return "";
}
return this.state.givenName;
}
set givenName(value) {
this.setState({
givenName: value
});
}
get middleName() {
if (!("middleName" in this.state)) {
return "";
}
return this.state.middleName;
}
set middleName(value) {
this.setState({
middleName: value
});
}
get familyName() {
if (!("familyName" in this.state)) {
return "";
}
return this.state.familyName;
}
set familyName(value) {
this.setState({
familyName: value
});
}
get nickname() {
if (!("nickname" in this.state)) {
return "";
}
return this.state.nickname;
}
set nickname(value) {
this.setState({
nickname: value
});
}
get birthday() {
if (!("birthday" in this.state)) {
throw new Error('Required property "birthday" of type "Date" is not set');
}
return this.state.birthday;
}
set birthday(value) {
this.setState({
birthday: value
});
}
get image() {
if (!("image" in this.state)) {
throw new Error('Required property "image" of type "Image" is not set');
}
return this.state.image;
}
set image(value) {
this.setState({
image: value
});
}
get emailAddresses() {
if (!("emailAddresses" in this.state)) {
return [];
}
return this.state.emailAddresses;
}
set emailAddresses(value) {
this.setState({
emailAddresses: value
});
}
get phoneNumbers() {
if (!("phoneNumbers" in this.state)) {
return [];
}
return this.state.phoneNumbers;
}
set phoneNumbers(value) {
this.setState({
phoneNumbers: value
});
}
get postalAddresses() {
if (!("postalAddresses" in this.state)) {
return [];
}
return this.state.postalAddresses;
}
set postalAddresses(value) {
this.setState({
postalAddresses: value
});
}
get socialProfiles() {
if (!("socialProfiles" in this.state)) {
return [];
}
return this.state.socialProfiles;
}
set socialProfiles(value) {
this.setState({
socialProfiles: value
});
}
get note() {
if (!("note" in this.state)) {
return "";
}
return this.state.note;
}
set note(value) {
this.setState({
note: value
});
}
get urlAddresses() {
if (!("urlAddresses" in this.state)) {
return [];
}
return this.state.urlAddresses;
}
set urlAddresses(value) {
this.setState({
urlAddresses: value
});
}
get dates() {
if (!("dates" in this.state)) {
return [];
}
return this.state.dates;
}
set dates(value) {
this.setState({
dates: value
});
}
get organizationName() {
if (!("organizationName" in this.state)) {
return "";
}
return this.state.organizationName;
}
set organizationName(value) {
this.setState({
organizationName: value
});
}
get departmentName() {
if (!("departmentName" in this.state)) {
return "";
}
return this.state.departmentName;
}
set departmentName(value) {
this.setState({
departmentName: value
});
}
get jobTitle() {
if (!("jobTitle" in this.state)) {
return "";
}
return this.state.jobTitle;
}
set jobTitle(value) {
this.setState({
jobTitle: value
});
}
get isNamePrefixAvailable() {
if (!("isNamePrefixAvailable" in this.state)) {
return false;
}
return this.state.isNamePrefixAvailable;
}
set isNamePrefixAvailable(value) {
this.setState({
isNamePrefixAvailable: value
});
}
get isGiveNameAvailable() {
if (!("isGiveNameAvailable" in this.state)) {
return false;
}
return this.state.isGiveNameAvailable;
}
set isGiveNameAvailable(value) {
this.setState({
isGiveNameAvailable: value
});
}
get isMiddleNameAvailable() {
if (!("isMiddleNameAvailable" in this.state)) {
return false;
}
return this.state.isMiddleNameAvailable;
}
set isMiddleNameAvailable(value) {
this.setState({
isMiddleNameAvailable: value
});
}
get isFamilyNameAvailable() {
if (!("isFamilyNameAvailable" in this.state)) {
return false;
}
return this.state.isFamilyNameAvailable;
}
set isFamilyNameAvailable(value) {
this.setState({
isFamilyNameAvailable: value
});
}
get isNicknameAvailable() {
if (!("isNicknameAvailable" in this.state)) {
return false;
}
return this.state.isNicknameAvailable;
}
set isNicknameAvailable(value) {
this.setState({
isNicknameAvailable: value
});
}
get isBirthdayAvailable() {
if (!("isBirthdayAvailable" in this.state)) {
return false;
}
return this.state.isBirthdayAvailable;
}
set isBirthdayAvailable(value) {
this.setState({
isBirthdayAvailable: value
});
}
get isEmailAddressesAvailable() {
if (!("isEmailAddressesAvailable" in this.state)) {
return false;
}
return this.state.isEmailAddressesAvailable;
}
set isEmailAddressesAvailable(value) {
this.setState({
isEmailAddressesAvailable: value
});
}
get isPhoneNumbersAvailable() {
if (!("isPhoneNumbersAvailable" in this.state)) {
return false;
}
return this.state.isPhoneNumbersAvailable;
}
set isPhoneNumbersAvailable(value) {
this.setState({
isPhoneNumbersAvailable: value
});
}
get isPostalAddressesAvailable() {
if (!("isPostalAddressesAvailable" in this.state)) {
return false;
}
return this.state.isPostalAddressesAvailable;
}
set isPostalAddressesAvailable(value) {
this.setState({
isPostalAddressesAvailable: value
});
}
get isSocialProfilesAvailable() {
if (!("isSocialProfilesAvailable" in this.state)) {
return false;
}
return this.state.isSocialProfilesAvailable;
}
set isSocialProfilesAvailable(value) {
this.setState({
isSocialProfilesAvailable: value
});
}
get isImageAvailable() {
if (!("isImageAvailable" in this.state)) {
return false;
}
return this.state.isImageAvailable;
}
set isImageAvailable(value) {
this.setState({
isImageAvailable: value
});
}
get isNoteAvailable() {
if (!("isNoteAvailable" in this.state)) {
return false;
}
return this.state.isNoteAvailable;
}
set isNoteAvailable(value) {
this.setState({
isNoteAvailable: value
});
}
get isURLAddressesAvailable() {
if (!("isURLAddressesAvailable" in this.state)) {
return false;
}
return this.state.isURLAddressesAvailable;
}
set isURLAddressesAvailable(value) {
this.setState({
isURLAddressesAvailable: value
});
}
get isOrganizationNameAvailable() {
if (!("isOrganizationNameAvailable" in this.state)) {
return false;
}
return this.state.isOrganizationNameAvailable;
}
set isOrganizationNameAvailable(value) {
this.setState({
isOrganizationNameAvailable: value
});
}
get isDepartmentNameAvailable() {
if (!("isDepartmentNameAvailable" in this.state)) {
return false;
}
return this.state.isDepartmentNameAvailable;
}
set isDepartmentNameAvailable(value) {
this.setState({
isDepartmentNameAvailable: value
});
}
get isJobTitleAvailable() {
if (!("isJobTitleAvailable" in this.state)) {
return false;
}
return this.state.isJobTitleAvailable;
}
set isJobTitleAvailable(value) {
this.setState({
isJobTitleAvailable: value
});
}
get isDatesAvailable() {
if (!("isDatesAvailable" in this.state)) {
return false;
}
return this.state.isDatesAvailable;
}
set isDatesAvailable(value) {
this.setState({
isDatesAvailable: value
});
}
};
__name(_AbsContact, "AbsContact");
__publicField(_AbsContact, "identifier", "Contact");
let AbsContact = _AbsContact;
const _AbsContactsContainer = class _AbsContactsContainer extends ScriptableClass {
get asContactsContainer() {
return this.asOriginal();
}
/**
* _Fetches default contacts container._
* @see https://docs.scriptable.app/contactscontainer/#default
*/
static default() {
return this.invokeStaticMethod("default", Array.from(arguments));
}
/**
* _Fetches all contacts containers._
* @see https://docs.scriptable.app/contactscontainer/#all
*/
static all() {
return this.invokeStaticMethod("all", Array.from(arguments));
}
/**
* _Fetches a contacts container._
* @param identifier - Identifier of the contacts container to fetch.
* @see https://docs.scriptable.app/contactscontainer/#withidentifier
*/
static withIdentifier(identifier) {
return this.invokeStaticMethod("withIdentifier", Array.from(arguments));
}
get identifier() {
if (!("identifier" in this.state)) {
return "";
}
return this.state.identifier;
}
set identifier(value) {
this.setState({
identifier: value
});
}
get name() {
if (!("name" in this.state)) {
return "";
}
return this.state.name;
}
set name(value) {
this.setState({
name: value
});
}
};
__name(_AbsContactsContainer, "AbsContactsContainer");
__publicField(_AbsContactsContainer, "identifier", "ContactsContainer");
let AbsContactsContainer = _AbsContactsContainer;
const _AbsContactsGroup = class _AbsContactsGroup extends ScriptableClass {
get asContactsGroup() {
return this.asOriginal();
}
/**
* _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) {
return this.invokeStaticMethod("all", Array.from(arguments));
}
/**
* _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, containerIdentifier) {
return this.invokeStaticMethod("add", Array.from(arguments));
}
/**
* _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) {
return this.invokeStaticMethod("update", Array.from(arguments));
}
/**
* _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) {
return this.invokeStaticMethod("delete", Array.from(arguments));
}
get identifier() {
if (!("identifier" in this.state)) {
return "";
}
return this.state.identifier;
}
set identifier(value) {
this.setState({
identifier: value
});
}
get name() {
if (!("name" in this.state)) {
return "";
}
return this.state.name;
}
set name(value) {
this.setState({
name: value
});
}
/**
* _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) {
return this.invokeMethod("addMember", Array.from(arguments));
}
/**
* _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) {
return this.invokeMethod("removeMember", Array.from(arguments));
}
};
__name(_AbsContactsGroup, "AbsContactsGroup");
__publicField(_AbsContactsGroup, "identifier", "ContactsGroup");
let AbsContactsGroup = _AbsContactsGroup;
const _AbsData = class _AbsData extends ScriptableClass {
get asData() {
return this.asOriginal();
}
/**
* _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) {
return this.invokeStaticMethod("fromString", Array.from(arguments));
}
/**
* _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) {
return this.invokeStaticMethod("fromFile", Array.from(arguments));
}
/**
* _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) {
return this.invokeStaticMethod("fromBase64String", Array.from(arguments));
}
/**
* _Creates data from JPEG image._
* @param image - JPEG image to convert to data.
* @see https://docs.scriptable.app/data/#fromjpeg
*/
static fromJPEG(image) {
return this.invokeStaticMethod("fromJPEG", Array.from(arguments));
}
/**
* _Creates data from PNG image._
* @param image - PNG image to convert to data.
* @see https://docs.scriptable.app/data/#frompng
*/
static fromPNG(image) {
return this.invokeStaticMethod("fromPNG", Array.from(arguments));
}
/**
* _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) {
return this.invokeStaticMethod("fromBytes", Array.from(arguments));
}
/**
* _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() {
return this.invokeMethod("toRawString", Array.from(arguments));
}
/**
* _Creates a base64 encoded string._
*
* Creates a base64 enco