API Reference: Data Types
Below are the data type references in TypeScript format.
You can import types in a TypeScript project as below:
import type {
BinaryFile,
Condition,
Connection,
ConnectionInfo,
DatabaseResponse,
DelRecordQuery,
FetchOptions,
FileInfo,
Form,
GetRecordQuery,
Index,
Newsletter,
PostRecordConfig,
ProgressCallback,
RealtimeCallback,
RecordData,
RequestHistory,
RTCConnector,
RTCConnectorParams,
RTCEvent,
RTCReceiverParams,
RTCResolved,
Subscription,
Table,
Tag,
UniqueId,
UserAttributes,
UserProfile,
UserPublic,
WebSocketMessage,
} from "skapi-js";BinaryFile
type BinaryFile = {
access_group: number | 'private' | 'public' | 'authorized' | 'admin';
filename: string;
/** For an ENCRYPTED file this url serves CIPHERTEXT. Use getFile() below, which decrypts;
* an <img src> or a plain <a href> on it will not work. */
url: string;
path: string;
/** The PLAINTEXT byte length. For an encrypted file the object on storage is larger:
* see stored_size. */
size: number;
uploaded: number;
/** Present and true only on an encrypted attachment. Set on the plain data, not just
* on the getFile closure, so it survives being structured-cloned or JSON round-tripped. */
encrypted?: boolean;
/** Byte length of the encrypted object as stored. Present only when encrypted is true. */
stored_size?: number;
getFile: (dataType?: 'base64' | 'download' | 'endpoint' | 'blob' | 'text' | 'info', progress?: ProgressCallback) => Promise<Blob | string | void | FileInfo>;
}ClientSecretStreamOptions
type ClientSecretStreamOptions = {
/** The URL the request was sent to. Required unless the request ID is an already-composed full ID. */
url?: string;
/** The method it was sent with. Required unless the request ID is an already-composed full ID. */
method?: 'GET' | 'POST' | 'DELETE' | 'PUT';
/** Called with each relayed piece, in order, with the sequence number it was stored under
* and which transport carried it ('socket' when skapi's websocket got there first,
* 'poll' when the poll did). Raw text: skapi relays bytes and parses none of them. */
onStream?: (chunk: string, seq: number, via?: 'socket' | 'poll') => void;
/** The `realtime_group` the dispatching clientSecretRequest() handed back. With it, this
* read ALSO listens on skapi's websocket while the request is still running, so text
* arrives as it is relayed instead of on each poll tick. The group cannot be rebuilt
* from a request ID, so keep it beside the ID. Without it the read works exactly as it
* always has, at poll speed. */
realtimeGroup?: string;
/** Start after this sequence number instead of from the beginning, so a reader that already
* holds part of a turn does not receive it twice. Default 0. */
since?: number;
/** Polling interval in milliseconds while the request is still running. Default 1000.
* Must be a finite, non-negative number. */
poll?: number;
/** Called once with whatever the read resolves with. Not called when the read is stopped.
* `meta` carries facts about the REQUEST rather than the response: a settled poll resolves
* with the destination's own answer, and that answer is the destination's, not a place to
* attach skapi's fields. `meta.executed` is when the worker BEGAN running the request, in
* milliseconds (the same value clientSecretRequestHistory() reports as `executed`), so
* `updated - executed` times the call while `updated - created` also counts the queue wait.
* Present only when this request was QUEUED and therefore polled, and absent even then for a
* request that began and ended between two ticks, so treat it as optional and show nothing
* rather than substituting `created`. A one-argument callback is unaffected. */
onResponse?: (res: any, meta?: { executed?: number }) => void;
/** Called if the read itself fails. */
onError?: (err: any) => void;
service?: string;
owner?: string;
}The second argument of clientSecretRequestStream(). It is written inline in that method's signature, so it is not importable from skapi-js under this name.
Condition
type Condition = 'gt' | 'gte' | 'lt' | 'lte' | 'eq' | '>' | '>=' | '<' | '<=' | '=';In a record index query (getRecords() and deleteRecords()), a string index value gives >= and <= a search meaning: >= matches values that start with the given value, and <= matches values that end with it. > and < remain lexicographic, and number / boolean values compare normally. See Indexing.
The 'ends with' behavior is specific to the record index query. On the other methods that accept a Condition (getTables(), getTags(), getIndexes(), and getUniqueId()), <= is never an 'ends with' search: on a string value it falls back to an exact match, and on a number value it is a plain 'lesser or equal' comparison.
condition is optional, and the SDK never fills in a value for it: an omitted condition is simply absent from the request and the backend decides what it means. The default is not the same on every method:
| Method | condition omitted |
|---|---|
getTables() | Exact match on table. With table omitted as well, every table. |
getTags() | Exact match on tag when both table and tag are given. With only table given, >= (prefix), so every tag in the table. With neither, every tag in the project, ordered by record count, descending. |
getIndexes() | No top level condition exists. order.condition omitted is an exact match against order.value, and order.condition requires order.value. |
Omit the key, do not blank it out. Passing condition explicitly as undefined or null is rejected with INVALID_PARAMETER, while leaving the key out works. When you assemble a query object programmatically, delete the key rather than setting it to undefined.
A condition also needs something to compare against, and it is the value key that supplies it. Sending a condition with that key left out is an error, not a listing: getTables() with no table is rejected with "table" is required for condition., getTags() with neither table nor tag with "table" or "tag" is required for condition., and getIndexes() rejects order.condition without order.value. To list everything instead, leave the condition out as well.
While you are exploring and do not know the exact spelling, pass gte: it is a prefix search, so it also surfaces related entries. An entity whose name is recorded two ways, such as Asian Spice House and Asian Spice House (alias), is only found by the prefix. When you already know the exact name, omitting condition is the exact match you want.
Connection
type Connection = {
/** User's locale */
locale: string;
user_agent: string;
/** Connected user's IP address */
ip: string;
/** Project group */
group: number;
/** Project name */
service_name: string;
/** Project description */
service_description: string;
/** Project options */
opt: {
freeze_database: boolean;
prevent_inquiry: boolean;
prevent_signup: boolean;
prevent_anonymous: boolean;
}
/* AI agent info */
ai_agent?: string;
}ConnectionInfo
type ConnectionInfo = {
project_id: string; // Public project ID of the connected project (single token composed from the project and its owner). Also available directly as skapi.project_id.
user_ip: string;
user_agent: string;
user_location: string;
service_name: string;
service_description: string;
version: string;
ai_agent: string;
conf: {
freeze_database: boolean;
prevent_signup: boolean;
prevent_inquiry: boolean;
prevent_anonymous: boolean;
// When true, the SDK refuses database READS from a signed-out visitor
// (getRecords, getTables, getTags, getIndexes, getUniqueId) with
// code 'REQUIRE_LOGIN'. Defaults to true.
require_login?: boolean;
}
};DatabaseResponse
type DatabaseResponse<T> = {
list: T[];
startKey: { [key: string]: any; } | 'end';
endOfList: boolean;
startKeyHistory: string[];
}DelRecordQuery
type DelRecordQuery = GetRecordQuery & {
unique_id?: string;
record_id?: string;
};FetchOptions
type FetchOptions = {
limit?: number;
fetchMore?: boolean;
ascending?: boolean;
startKey?: { [key: string]: any; };
progress?: ProgressCallback;
}FileInfo
type FileInfo = {
url: string;
filename: string;
access_group: number | 'private' | 'public' | 'authorized';
filesize: number;
record_id: string;
uploader: string;
uploaded: number;
fileKey: string;
}Form
type Form<T> = HTMLFormElement | FormData | SubmitEvent | T;GetRecordQuery
type GetRecordQuery = {
unique_id?: string; // When unique_id is given, it will fetch the record with the given unique_id.
record_id?: string; // When record_id is given, it will fetch the record with the given record_id. This overrides all other parameters.
/** Table name not required when "record_id" is given. A bare string is shorthand for { name: <string> }. */
table?: string | {
/** Max 256 characters, where / ! * # % each count as 3. Blocks control chars and sentinel . */
name: string;
/** Number range: 0 ~ 99. 'public' = 0, 'authorized' = 1, 'admin' = 99. '*' is shorthand for 'private'. Default: 'public' */
access_group?: number | 'private' | '*' | 'public' | 'authorized' | 'admin';
/** User ID of subscription */
subscription?: string;
};
reference?: string | { record_id?: string; unique_id?: string; user_id?: string }; // Referenced record ID or unique ID. If user_id is given (object form), it will fetch records that are uploaded by the user.
/** Index condition and range cannot be used simultaneously.*/
index?: {
/** Custom names: max 256 characters, where / ! * # % each count as 3. Cannot start with "$". Blocks control chars and sentinel . Reserved names: $uploaded, $updated, $referenced_count, $user_id. */
name: string | '$updated' | '$uploaded' | '$referenced_count' | '$user_id';
/** String value max 256 characters. Any punctuation is allowed and counts as one character, and values compare exactly as written. Blocks control chars and sentinel . */
value: string | number | boolean;
/** For a string value: '>=' = 'starts with', '<=' = 'ends with'. When the name is a compound name ending in '.', '>=' / '<=' match the child name segment (starts / ends with). '>' / '<' are lexicographic; numbers/booleans compare normally. */
condition?: Condition;
range?: string | number | boolean;
};
tag?: string;
}Index
type Index = {
table: string;
index: string;
number_of_records: number;
string_count: number;
number_count: number;
boolean_count: number;
total_number: number;
total_bool: number;
average_number: number;
average_bool: number;
}Newsletter
type Newsletter = {
/** Newsletter id */
message_id: string;
/** Time sent out */
timestamp: number;
/** Number of complaints */
complaint: number;
/** Number of read */
read: number;
/** Subject */
subject: string;
/**
* Number of bounced.<br>
* When e-mail address is bounced, skapi no longer sends e-mail to the bounced address.
*/
bounced: string;
/**
* Url of the message html.
*/
url: string;
/** Number users delivered */
delivered: number;
/**
* Newsletter group the message was sent to.<br>
* A number for the 0 ~ 99 groups, the group name for a named newsletter group.
*/
group: number | string;
}PostRecordConfig
type PostRecordConfig = {
record_id?: string; // when record_id is given, it will update the record with the given record_id. If record_id is not given, it will create a new record.
unique_id?: string | null; // You can set unique_id to the record with the given unique_id. null removes unique_id from the record.
readonly?: boolean; // When true, record cannot be updated or deleted.
/** Table name not required when "record_id" is given.*/
table?: {
/** Max 256 characters, where / ! * # % each count as 3. Blocks control chars and sentinel . */
name?: string;
/** Number range: 0 ~ 99. 'public' = 0, 'authorized' = 1, 'admin' = 99. '*' is shorthand for 'private'. Default: 'public' */
access_group?: number | 'private' | '*' | 'public' | 'authorized' | 'admin';
/** When true, Record will be only accessible for subscribed users. null removes all subscription settings from the record. */
subscription?: {
is_subscription_record?: boolean; // When true, this record is a subscription record.
upload_to_feed?: boolean; // When true, record will be uploaded to the feed of the subscribers.
notify_subscribers?: boolean; // When true, subscribers will receive notification when the record is uploaded.
feed_referencing_records?: boolean; // When true, records referencing this record will be included to the subscribers feed.
notify_referencing_records?: boolean; // When true, records referencing this record will be notified to subscribers.
} | null;
};
source?: {
referencing_limit?: number; // Default: null (Infinite)
prevent_multiple_referencing?: boolean; // If true, a single user can reference this record only once.
can_remove_referencing_records?: boolean; // When true, owner of the record can remove any record that are referencing this record. Also when this record is deleted, all the record referencing this record will be deleted.
only_granted_can_reference?: boolean; // When true, only the user who has granted private access to the record can reference this record.
/** Index restrictions for referencing records. null removes all restrictions. */
referencing_index_restrictions?: {
name: string; // Allowed index name
value?: string | number | boolean; // Allowed index value
range?: string | number | boolean; // Allowed index range
condition?: 'gt' | 'gte' | 'lt' | 'lte' | 'eq' | 'ne' | '>' | '>=' | '<' | '<=' | '=' | '!='; // Allowed index value condition. Checked when a referencing record is posted: on a string value '>=' is a 'starts with' check, while '<=' is a plain 'lesser or equal' comparison and is not 'ends with'.
}[] | null;
allow_granted_to_grant_others?: boolean; // When true, the user who has granted private access to the record can grant access to other users.
};
/** Can be record ID or unique ID */
reference?: string | null; // null removes reference from the record.
/** null removes index */
index?: {
/** Max 256 characters, where / ! * # % each count as 3. Cannot start with "$". Blocks control chars and sentinel . */
name: string;
/** String value max 256 characters. Any punctuation is allowed and counts as one character, and values compare exactly as written. Blocks control chars and sentinel . */
value: string | number | boolean;
} | null;
tags?: string[] | null; // null removes all tags. each tag 1..256 characters, where / ! * # % each count as 3. Blocks control chars and sentinel .
remove_bin?: BinaryFile[] | string[] | null; // Removes bin data from the record. When null, it will remove all bin data.
progress?: ProgressCallback; // Callback for database request progress. Useful when building progress bar.
reference_private_key?: string; // When referencing a record that has private access, you can provide the private key of the referenced record to pass the access check. This is only required when the referenced record has private access and the user does not have access to the record through subscription or granted access.
}ProgressCallback
type ProgressCallback = (e: {
status: 'upload' | 'download';
progress: number; // 0 ~ 100, number of percent completed.
loaded: number; // Number of bytes loaded.
total: number; // Total number of bytes to be loaded.
currentFile?: File, // Only for uploadFiles()
completed?: File[]; // Only for uploadFiles()
failed?: File[]; // Only for uploadFiles()
abort: () => void;
}) => void;RealtimeCallback
type RealtimeCallback = (rt: WebSocketMessage) => void;RecordData
type RecordData = {
record_id: string;
unique_id?: string;
user_id: string;
updated: number;
uploaded: number;
referenced_count: number;
table: {
name: string;
/** Number range: 0 ~ 99 */
access_group: number | 'private' | 'public' | 'authorized' | 'admin';
/** User ID of subscription */
subscription?: {
upload_to_feed: boolean; // When true, record will be uploaded to the feed of the subscribers.
notify_subscribers: boolean; // When true, subscribers will receive notification when the record is uploaded.
feed_referencing_records: boolean; // When true, records referencing this record will be included to the subscribers feed.
notify_referencing_records: boolean; // When true, records referencing this record will be notified to subscribers.
};
};
source: {
referencing_limit: number; // Default: null (Infinite)
prevent_multiple_referencing: boolean; // If true, a single user can reference this record only once.
can_remove_referencing_records: boolean; // When true, owner of the record can remove any record that are referencing this record. Also when this record is deleted, all the record referencing this record will be deleted.
only_granted_can_reference: boolean; // When true, only the user who has granted private access to the record can reference this record.
referencing_index_restrictions?: {
name: string; // Allowed index name
value?: string | number | boolean; // Allowed index value
range?: string | number | boolean; // Allowed index range
condition?: 'gt' | 'gte' | 'lt' | 'lte' | 'eq' | 'ne' | '>' | '>=' | '<' | '<=' | '=' | '!='; // Allowed index value condition. Checked when a referencing record is posted: on a string value '>=' is a 'starts with' check, while '<=' is a plain 'lesser or equal' comparison and is not 'ends with'.
}[];
};
reference?: string; // record id of the referenced record.
index?: {
name: string;
value: string | number | boolean;
};
/** null (or the withheld placeholder) when this session could not decrypt it: see `encrypted`. */
data?: Record<string, any>;
/** Present ONLY when the record's data passed through the client-side encryption layer.
* Its ABSENCE means the record was stored in the clear, which is how existing plaintext
* records keep working after the feature is enabled.
*
* status 'encrypted' means `data` above is the decrypted value.
* status 'failed' means `data` is null (or the sentinel) and `reason` says why:
* NOT_A_RECIPIENT this user has no key wrap on the record (a MASTER reading
* another user's private record lands here; unlocking cannot help)
* NO_SESSION_KEY this user IS a recipient but encryption is locked; unlock and retry
* BAD_KEY the key wrap did not open (usually a rolled key)
* BINDING_MISMATCH the stored envelope does not belong to this record
* CORRUPT the payload failed its authentication tag
* DATA_UNAVAILABLE the payload is offloaded to storage and could not be fetched
* UNSUPPORTED_VERSION written by a newer SDK than this one
* ENCRYPTION_DISABLED the record is encrypted but this instance has the flag off */
encrypted?: {
status: 'encrypted' | 'failed';
reason?: string;
/** user_ids that hold a key wrap on this record. Metadata, not content. */
recipients?: string[];
};
tags?: string[];
bin: { [key: string]: BinaryFile[] };
ip: string;
readonly: boolean;
/** Present ONLY on an element of a bulkPostRecords() result that the API refused.
* Such an element is an empty record (record_id is ""), and this carries the reason,
* e.g. { code: 'NOT_EXISTS', message: 'Record of "reference.unique_id": "src::report.xlsx" does not exists.' }.
* A saved record never has it, so record_id stays the test for "did this save". */
error?: { code?: string; message?: string; [key: string]: any };
}RequestHistory
type RequestHistory = {
id: string; // request id. Format: {stamp}:{entropy}
status_code: number; // http status code of the request
response_body: any; // null on a STREAMED request until it is finalized: its text lives in the relayed chunks, not on the request. clientSecretRequestFinalize() is what stores a body here.
error?: any;
created: number; // timestamp of when the request was created, in milliseconds. Set once and never changes.
updated: number; // timestamp of the last update of the request status (e.g. when the response arrived), in milliseconds.
executed?: number; // timestamp of when the worker actually BEGAN executing the request, in milliseconds. Distinct from created, which is when it was enqueued: a request can wait in the queue first, so updated - executed is the execution time while updated - created also includes the wait. Absent on a request that has not started yet, and on rows written before the worker recorded it.
request_body: any;
expires?: number; // timestamp of when the request history will be deleted in epoch time (seconds).
status: 'pending' | 'running' | 'resolved' | 'failed';
queue_name?: string; // queue name if the request is in queue, empty string if the request is not in queue.
// Compact-listing stubs. Present ONLY when the history was fetched with compact: true,
// in which case request_body/response_body are omitted (the full bodies never leave the
// server). Re-fetch without compact, or poll the item, when a full body is needed.
request_text?: string; // stub: first text of the request's LAST user message, truncated. Missing when the request body's shape was unrecognisable.
response_text?: string; // stub: the head of the response text, truncated.
response_complete_marker?: boolean; // stub: whether the response carried the indexing completion marker.
compact?: boolean; // true on items returned by a compact: true listing, so consumers can tell "bodies omitted" from "bodies empty".
poll?: (arg?: {
latency?: number;
onResponse?: (res:any, meta?: { executed?: number })=>void; // called when the request settles. `meta` carries request-level facts, which cannot ride on `res`: a settled poll resolves with the DESTINATION's own answer. `meta.executed` is when the worker BEGAN running this request, in milliseconds, matching the `executed` on a RequestHistory item -- `updated - executed` is the call, `updated - created` is the call plus the queue wait. A poll built from a clientSecretRequestHistory() item starts out already knowing it, taken from that listing, so it is delivered even when the request settles on the poll's first read; otherwise it is learned from a running tick, and a request that began and ended between two ticks has none. Optional either way: show nothing rather than falling back to `created`.
onError?: (err:any)=>void;
onStream?: (chunk: string, seq: number, via?: 'socket' | 'poll')=>void; // reads a STREAMED item's text as it arrives, same as on the dispatch path. "via" names the transport that carried the piece: 'socket' when skapi's websocket got there first, 'poll' when the poll did. Supplying it is what makes the poll fetch chunks. An item that already settled has nothing left to poll: read that one back with clientSecretRequestStream().
}) => Promise<any>; // function to poll the request status until it settles. The promise resolves with the final result of the request: the third-party API response body when it resolves, or the error payload when it fails. It does not resolve with a RequestHistory item, so "created" and "updated" are not on the polled value. A poll stopped by stopClientSecretPolling() resolves with { id, status: 'stopped' }. Optional argument "latency" can be used to set the latency of the polling in milliseconds. Default latency is 1000ms. A STREAMED request has no body to resolve with until it is finalized, so it resolves with a StreamPollResult instead: the text arrived through onStream.
}RTCConnector
type RTCConnector = {
hangup: () => void;
connection: Promise<RTCResolved>;
}RTCConnectorParams
type RTCConnectorParams = {
cid: string;
ice?: string;
media?: {
video: boolean;
audio: boolean;
} | MediaStream | MediaStreamConstraints;
channels?: Array<RTCDataChannelInit | 'text-chat' | 'file-transfer' | 'video-chat' | 'voice-chat' | 'gaming'>;
}RTCEvent
type RTCEvent = {
type: 'track' | 'connectionstatechange' | 'close' | 'message' | 'open' | 'bufferedamountlow' | 'error' | 'icecandidate' | 'icecandidateend' | 'icegatheringstatechange' | 'negotiationneeded' | 'signalingstatechange';
[key: string]: any;
}RTCReceiverParams
type RTCReceiverParams = {
ice?: string;
media?: {
video: boolean;
audio: boolean;
} | MediaStream | MediaStreamConstraints;
}RTCResolved
type RTCResolved = {
target: RTCPeerConnection;
channels: {
[protocol: string]: RTCDataChannel
};
hangup: () => void;
media: MediaStream;
}StreamChunk
type StreamChunk = {
/** Sequence number this piece was stored under. Ascending within one request, and the
* value a reader sends back as its cursor. */
seq: number;
/** Raw relayed text, exactly as the destination wrote it and in whatever format the
* destination chose. Skapi parses none of it. Empty string when the chunk was written
* without text, which still advances seq. */
txt: string;
}One piece of a streamed request's relayed response, as a poll hands it back. onStream(chunk, seq, via) receives the txt and seq of each of these, in order, and never fires for an empty txt.
This shape is written inline in the SDK, so it is not importable from skapi-js under this name.
StreamPollResult
type StreamPollResult = {
id: string; // Request ID in "stamp:entropy" format.
status: 'pending' | 'running' | 'resolved' | 'failed' | 'cancelled'; // Everything but 'pending' and 'running' is terminal: nothing further is written to the request or to its chunks.
queue_name: string; // The plain queue name, or an empty string when the request is not queued.
in_queue: number; // Unresolved requests in this queue.
// The fields below are present ONLY when the poll asked for chunks by sending a cursor:
// clientSecretRequest()'s poll() does that when an onStream callback was supplied, and
// clientSecretRequestStream() always does. Without a cursor you get exactly the four fields
// above, the same response polling returned before streaming existed.
stream: boolean; // Whether the request was made with stream: true. false means there are no chunks to read, ever.
chunks: StreamChunk[]; // The pieces with seq greater than the cursor that was sent, oldest first.
last_seq: number; // The sequence number to send as the next cursor. Stays at the requested value when nothing new arrived.
more: boolean; // This read was CAPPED, not the end of the data. See below.
error?: any; // Present only on a failed streamed request: what the server recorded about the failure, alongside the chunks that did arrive before the stream died.
}What a poll of a streamed request resolves with while it has not been finalized. A buffered request, and a streamed one that was finalized, resolve with the stored body itself instead: a response with no status field is a body, not this envelope. Like StreamChunk, this is a response shape rather than an exported type name, so there is nothing to import under it.
more: true means one read was capped by a size budget, not that the request is unfinished. Ask again immediately with last_seq rather than waiting out the polling interval. The one exception is more: true with no new chunks and an unchanged last_seq: that is the server saying the chunk read itself failed, and re-asking immediately hammers a store that is already in trouble. The SDK's own readers tell the two apart by whether the cursor moved, and back off on the second.
See clientSecretRequest and clientSecretRequestStream.
Subscription
type Subscription = {
subscriber: string;
subscription: string;
timestamp: number;
blocked: boolean;
get_feed: boolean;
get_notified: boolean;
get_email: boolean;
}Table
type Table = {
table: string;
number_of_records: string;
size: number;
number_of_records_in_access_group_public?: number;
number_of_records_in_access_group_private?: number;
number_of_records_in_access_group_authorized?: number;
number_of_records_in_access_group_admin?: number;
[number_of_records_in_access_group_xx: string]: number | string | undefined; // for other access groups
}Tag
type Tag = {
table: string;
tag: string;
number_of_records: number;
}UniqueId
type UniqueId = {
unique_id: string;
record_id: string;
}UserAttributes
type UserAttributes = {
/** User's name */
name?: string;
/**
* User's E-Mail for signin.<br>
* 64 character max.<br>
* When E-Mail is changed, E-Mail verified state will be changed to false.
* E-Mail is only visible to others when set to public.
* E-Mail should be verified to set to public.
* */
email?: string;
/**
* User's phone number. Format: "+0012341234"<br>
* When phone number is changed, phone number verified state will be changed to false.
* Phone number is only visible to others when set to public.
* Phone number should be verified to set to public.
*/
phone_number?: string;
/** User's address, only visible to others when set to public. */
address?: string | {
/**
* Full mailing address, formatted for display or use on a mailing label. This field MAY contain multiple lines, separated by newlines. Newlines can be represented either as a carriage return/line feed pair ("\r\n") or as a single line feed character ("\n").
* street_address
* Full street address component, which MAY include house number, street name, Post Office Box, and multi-line extended street address information. This field MAY contain multiple lines, separated by newlines. Newlines can be represented either as a carriage return/line feed pair ("\r\n") or as a single line feed character ("\n").
*/
formatted: string;
// City or locality component.
locality: string;
// State, province, prefecture, or region component.
region: string;
// Zip code or postal code component.
postal_code: string;
// Country name component.
country: string;
};
/**
* User's gender. Can be "female" and "male".
* Other values may be used when neither of the defined values are applicable.
* Only visible to others when set to public.
*/
gender?: string;
/** User's birthdate. String format: "1969-07-16", only visible to others when set to public.*/
birthdate?: string;
/** Additional string value that can be used freely. This is only accessible to the owner of the account and the admins. */
misc?: string;
picture?: string;
profile?: string;
website?: string;
nickname?: string;
/** User's E-Mail is public when true. E-Mail should be verified. */
email_public?: boolean;
/** User's phone number is public when true. Phone number should be verified. */
phone_number_public?: boolean;
/** User's address is public when true. */
address_public?: boolean;
/** User's gender is public when true. */
gender_public?: boolean;
/** User's birthdate is public when true. */
birthdate_public?: boolean;
}UserProfile
type UserProfile = {
/** Project id of the user account. */
service: string;
/** User ID of the project owner. */
owner: string;
/** Access level of the user's account. */
access_group: number;
/** User's ID. */
user_id: string;
/** Country code of where user first signed up from. */
locale: string;
/**
Account approval info and timestamp.
Comes with string with the following format: "{approver}:{approved | suspended}:{approved_timestamp}"
{approver} is who approved the account:
[by_master] is when account approval is done manually from skapi admin panel,
[by_admin] is when approval is done by the admin account with api call within your project.
[by_skapi] is when account approval is automatically done.
Open ID logger ID will be the value if the user is logged with openIdLogin()
This timestamp is generated when the user confirms their signup, or recovers their disabled account.
{approved | suspended}
[approved] is when the account is approved.
[suspended] is when the account is blocked by the admin or the master.
{approved_timestamp} is the timestamp when the account is approved or suspended.
*/
approved: string;
/** Last login timestamp(Seconds). */
log: number;
/** Shows true when user has verified their E-Mail. */
email_verified?: boolean;
/** Shows true when user has verified their phone number. */
phone_number_verified?: boolean;
/** User's E-Mail is public when true. E-Mail should be verified. */
email_public?: boolean;
/** User's phone number is public when true. Phone number should be verified. */
phone_number_public?: boolean;
/** User's address is public when true. */
address_public?: boolean;
/** User's gender is public when true. */
gender_public?: boolean;
/** User's birthdate is public when true. */
birthdate_public?: boolean;
/** User's name */
name?: string;
/**
* User's E-Mail for signin.<br>
* 64 character max.<br>
* When E-Mail is changed, E-Mail verified state will be changed to false.
* E-Mail is only visible to others when set to public.
* E-Mail should be verified to set to public.
* */
email?: string;
/**
* User's phone number. Format: "+0012341234"<br>
* When phone number is changed, phone number verified state will be changed to false.
* Phone number is only visible to others when set to public.
* Phone number should be verified to set to public.
*/
phone_number?: string;
/** User's address, only visible to others when set to public. */
address?: string | {
/**
* Full mailing address, formatted for display or use on a mailing label. This field MAY contain multiple lines, separated by newlines. Newlines can be represented either as a carriage return/line feed pair ("\r\n") or as a single line feed character ("\n").
* street_address
* Full street address component, which MAY include house number, street name, Post Office Box, and multi-line extended street address information. This field MAY contain multiple lines, separated by newlines. Newlines can be represented either as a carriage return/line feed pair ("\r\n") or as a single line feed character ("\n").
*/
formatted: string;
// City or locality component.
locality: string;
// State, province, prefecture, or region component.
region: string;
// Zip code or postal code component.
postal_code: string;
// Country name component.
country: string;
};
/**
* User's gender. Can be "female" and "male".
* Other values may be used when neither of the defined values are applicable.
* Only visible to others when set to public.
*/
gender?: string;
/** User's birthdate. String format: "1969-07-16", only visible to others when set to public.*/
birthdate?: string;
/** Additional string value that can be used freely. This is only accessible to the owner of the account and the admins. */
misc?: string;
picture?: string;
profile?: string;
website?: string;
nickname?: string;
};UserPublic
type UserPublic = {
/** Access level of the user's account. */
access_group: number;
/** User's ID. */
user_id: string;
/** Country code of where user first signed up from. */
locale: string;
/**
Account approval info and timestamp.
Comes with string with the following format: "{approver}:{approved | suspended}:{approved_timestamp}"
{approver} is who approved the account:
[by_master] is when account approval is done manually from skapi admin panel,
[by_admin] is when approval is done by the admin account with api call within your project.
[by_skapi] is when account approval is automatically done.
Open ID logger ID will be the value if the user is logged with openIdLogin()
This timestamp is generated when the user confirms their signup, or recovers their disabled account.
{approved | suspended}
[approved] is when the account is approved.
[suspended] is when the account is blocked by the admin or the master.
{approved_timestamp} is the timestamp when the account is approved or suspended.
*/
approved: string;
/** Account created timestamp(13 digit milliseconds). */
timestamp: number;
/** Last login timestamp(Seconds). */
log: number;
/** Number of the user's subscribers. */
subscribers: number;
/** Number of subscription the user has made */
subscribed: number;
/** Number of the records the user have created. */
records: number;
/** User's name */
name?: string;
/**
* User's E-Mail for signin.<br>
* 64 character max.<br>
* When E-Mail is changed, E-Mail verified state will be changed to false.
* E-Mail is only visible to others when set to public.
* E-Mail should be verified to set to public.
* */
email?: string;
/**
* User's phone number. Format: "+0012341234"<br>
* When phone number is changed, phone number verified state will be changed to false.
* Phone number is only visible to others when set to public.
* Phone number should be verified to set to public.
*/
phone_number?: string;
/** User's address, only visible to others when set to public. */
address?: string | {
/**
* Full mailing address, formatted for display or use on a mailing label. This field MAY contain multiple lines, separated by newlines. Newlines can be represented either as a carriage return/line feed pair ("\r\n") or as a single line feed character ("\n").
* street_address
* Full street address component, which MAY include house number, street name, Post Office Box, and multi-line extended street address information. This field MAY contain multiple lines, separated by newlines. Newlines can be represented either as a carriage return/line feed pair ("\r\n") or as a single line feed character ("\n").
*/
formatted: string;
// City or locality component.
locality: string;
// State, province, prefecture, or region component.
region: string;
// Zip code or postal code component.
postal_code: string;
// Country name component.
country: string;
};
/**
* User's gender. Can be "female" and "male".
* Other values may be used when neither of the defined values are applicable.
* Only visible to others when set to public.
*/
gender?: string;
/** User's birthdate. String format: "1969-07-16", only visible to others when set to public.*/
birthdate?: string;
picture?: string;
profile?: string;
website?: string;
nickname?: string;
};WebSocketMessage
type WebSocketMessage = {
type: 'message' | 'error' | 'success' | 'close' | 'notice' | 'private' | 'reconnect' | 'rtc:incoming' | 'rtc:closed';
message?: any;
connectRTC?: (params: RTCReceiverParams, callback: (e: RTCEvent) => void) => Promise<RTCResolved>;
hangup?: () => void; // Reject incoming RTC connection.
sender?: string; // user_id of the sender
sender_cid?: string; // scid of the sender
sender_rid?: string; // group of the sender
code?: 'USER_LEFT' | 'USER_DISCONNECTED' | 'USER_JOINED' | null; // code for notice messeges
}