contacts
const contacts: { get: Promise<UserContact>; getPage: Promise<Page<UserContact>>; eachPage: Promise<void>;};Defined in: domains/contacts.ts:10
Type Declaration
Section titled “Type Declaration”get(contactID): Promise<UserContact>;Get a specific contact by ID.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
contactID |
number |
The ID of the contact to fetch. |
Returns
Section titled “Returns”Promise<UserContact>
A UserContact object.
Throws
Section titled “Throws”MobileLockerError on network failure or server error.
getPage()
Section titled “getPage()”getPage(limit, cursor?): Promise<Page<UserContact>>;Get one page of contacts (cursor envelope).
Requires Mobile Locker iOS 5.5.0+. Prefer contacts.eachPage when walking the whole book. Production users can have 100k+ contacts (MLJS-24 / MLJS-27); do not reassemble every page into one array.
Host: GET /mobilelocker/api/user-contacts?limit=&cursor=
→ { data, meta: { cursor: { next, count } } } (MLI-1718).
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
limit |
number |
Page size (1…5000). |
cursor? |
string |
From previous meta.cursor.next. Omit for the first page. |
Returns
Section titled “Returns”Promise<Page<UserContact>>
Page of UserContact records.
Throws
Section titled “Throws”MobileLockerError with code InvalidArgument when limit is out of range.
Throws
Section titled “Throws”MobileLockerError on network failure or server error.
Example
Section titled “Example”const page = await mobilelocker.contacts.getPage(500)const next = page.meta.cursor.next ? await mobilelocker.contacts.getPage(500, page.meta.cursor.next) : nulleachPage()
Section titled “eachPage()”eachPage(pageSize, handler): Promise<void>;Walk the address book page by page without loading everything into memory.
Replaces the removed getAll() (MLJS-24) and intermediate getChunked(min, limit)
(MLJS-27). Advances only via meta.cursor.next; stops when next === null.
Process each chunk in handler. Do not push chunks into a growing array
unless the book is known to be small. Requires iOS 5.5.0+.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
pageSize |
number |
Page size passed to contacts.getPage (1…5000). |
handler |
(chunk) => void | Promise<void> |
Called once per non-empty page; may be async. |
Returns
Section titled “Returns”Promise<void>
Throws
Section titled “Throws”MobileLockerError when pageSize is out of range, or on network/server error.
Example
Section titled “Example”await mobilelocker.contacts.eachPage(500, (chunk) => { for (const contact of chunk) { // handle one contact — never accumulate the full book }})