scriptable-testlab
Version:
A lightweight, efficient tool designed to manage and update scripts for Scriptable.
196 lines (193 loc) • 5.81 kB
TypeScript
import { AbsContact } from 'scriptable-abstract';
/**
* Interface for contact's email addresses
*/
interface ContactEmailAddress {
identifier?: string;
label?: string;
localizedLabel?: string;
value: string;
}
/**
* Interface for contact's phone numbers
*/
interface ContactPhoneNumber {
identifier?: string;
label?: string;
localizedLabel?: string;
value: string;
}
/**
* Interface for contact's postal addresses
*/
interface ContactPostalAddress {
identifier?: string;
label: string;
localizedLabel: string;
street: string;
city: string;
state: string;
postalCode: string;
country: string;
}
/**
* Interface for contact's social profiles
*/
interface ContactSocialProfile {
identifier?: string;
label: string;
localizedLabel: string;
service: string;
url: string;
userIdentifier: string;
username: string;
}
/**
* State interface for Contact mock
*/
interface ContactState {
identifier: string;
namePrefix: string;
givenName: string;
middleName: string;
familyName: string;
nickname: string;
birthday: Date | null;
image: any | null;
emailAddresses: ContactEmailAddress[];
phoneNumbers: ContactPhoneNumber[];
postalAddresses: ContactPostalAddress[];
socialProfiles: ContactSocialProfile[];
note: string;
urlAddresses: Array<{
[key: string]: string;
}>;
dates: Array<{
[key: string]: any;
}>;
organizationName: string;
departmentName: string;
jobTitle: string;
isNamePrefixAvailable: boolean;
isGiveNameAvailable: boolean;
isGivenNameAvailable: 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;
}
/**
* Mock implementation of Scriptable's Contact.
* Represents a contact in the user's address book.
*/
declare class MockContact extends AbsContact<ContactState> {
constructor();
/**
* _Creates a new contact._
* @see https://docs.scriptable.app/contact/#new-contact
*/
static create(): MockContact;
/**
* _All contacts in the address book._
* @see https://docs.scriptable.app/contact/#all
*/
static all(): Promise<MockContact[]>;
/**
* _Contacts matching the specified name._
* @param name - Name to search for.
* @see https://docs.scriptable.app/contact/#contactsnamed
*/
static contactsNamed(_name: string): Promise<MockContact[]>;
/**
* _Picks a contact._
* @see https://docs.scriptable.app/contact/#pickcontact
*/
static pickContact(): Promise<MockContact | null>;
/**
* _Picks multiple contacts._
* @see https://docs.scriptable.app/contact/#pickcontacts
*/
static pickContacts(): Promise<MockContact[]>;
/**
* _Saves the contact._
* @see https://docs.scriptable.app/contact/#-save
*/
save(): Promise<void>;
/**
* _Removes the contact._
* @see https://docs.scriptable.app/contact/#-remove
*/
remove(): Promise<void>;
get identifier(): 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 | null;
set birthday(value: Date | null);
get image(): any | null;
set image(value: any | null);
get emailAddresses(): ContactEmailAddress[];
set emailAddresses(value: ContactEmailAddress[]);
get phoneNumbers(): ContactPhoneNumber[];
set phoneNumbers(value: ContactPhoneNumber[]);
get postalAddresses(): ContactPostalAddress[];
set postalAddresses(value: ContactPostalAddress[]);
get socialProfiles(): ContactSocialProfile[];
set socialProfiles(value: ContactSocialProfile[]);
get note(): string;
set note(value: string);
get urlAddresses(): Array<{
[key: string]: string;
}>;
set urlAddresses(value: Array<{
[key: string]: string;
}>);
get dates(): Array<{
[key: string]: any;
}>;
set dates(value: Array<{
[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;
get isGivenNameAvailable(): boolean;
get isMiddleNameAvailable(): boolean;
get isFamilyNameAvailable(): boolean;
get isNicknameAvailable(): boolean;
get isBirthdayAvailable(): boolean;
get isEmailAddressesAvailable(): boolean;
get isPhoneNumbersAvailable(): boolean;
get isPostalAddressesAvailable(): boolean;
get isSocialProfilesAvailable(): boolean;
get isImageAvailable(): boolean;
get isNoteAvailable(): boolean;
get isURLAddressesAvailable(): boolean;
get isOrganizationNameAvailable(): boolean;
get isDepartmentNameAvailable(): boolean;
get isJobTitleAvailable(): boolean;
get isDatesAvailable(): boolean;
}
export { type ContactEmailAddress, type ContactPhoneNumber, type ContactPostalAddress, type ContactSocialProfile, type ContactState, MockContact };