type Condition = 'gt' | 'gte' | 'lt' | 'lte' | 'eq' | '>' | '>=' | '<' | '<=' | '='; type RTCReceiverParams = { ice?: string; media?: { video: boolean; audio: boolean; } | MediaStream | MediaStreamConstraints; }; type RTCConnectorParams = { cid: string; ice?: string; media?: { video: boolean; audio: boolean; } | MediaStream | MediaStreamConstraints; channels?: Array; }; type RTCConnector = { hangup: () => void; connection: Promise; }; type RTCResolved = { target: RTCPeerConnection; channels: { [protocol: string]: RTCDataChannel; }; hangup: () => void; media: MediaStream; }; type RTCEvent = { type: 'track' | 'connectionstatechange' | 'close' | 'message' | 'open' | 'bufferedamountlow' | 'error' | 'icecandidate' | 'icecandidateend' | 'icegatheringstatechange' | 'negotiationneeded' | 'signalingstatechange'; [key: string]: any; }; type WebSocketMessage = { type: 'message' | 'error' | 'success' | 'close' | 'notice' | 'private' | 'reconnect' | 'rtc:incoming' | 'rtc:closed'; message?: any; connectRTC?: (params: RTCReceiverParams, callback: (e: RTCEvent) => void) => Promise; hangup?: () => void; sender?: string; sender_cid?: string; sender_rid?: string; code?: 'USER_LEFT' | 'USER_DISCONNECTED' | 'USER_JOINED' | null; }; type RealtimeCallback = (rt: WebSocketMessage) => void; type DelRecordQuery = GetRecordQuery & { unique_id?: string | string[]; record_id?: string | string[]; }; type GetRecordQuery = { unique_id?: string; record_id?: string; /** Table name not required when "record_id" is given.*/ table?: { /** Max 128 chars. Blocks: / ! * #, control chars, and sentinel 􏿿. */ name: string; /** Number range: 0 ~ 99. Default: 'public' */ access_group?: number | 'private' | 'public' | 'authorized' | 'admin'; /** User ID of subscription */ subscription?: string; }; reference?: string; /** Index condition and range cannot be used simultaneously.*/ index?: { /** Custom names: max 128 chars, 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 chars. Allows punctuation (including / ! * #). Blocks control chars and sentinel 􏿿. */ value: string | number | boolean; condition?: Condition; range?: string | number | boolean; }; tag?: string; }; type PostRecordConfig = { record_id?: string; unique_id?: string | null; readonly?: boolean; /** Table name not required when "record_id" is given.*/ table?: { /** Max 128 chars. Blocks: / ! * #, control chars, and sentinel 􏿿. */ name?: string; /** Number range: 0 ~ 99. Default: 'public' */ access_group?: number | 'private' | 'public' | 'authorized' | 'admin'; /** When true, Record will be only accessible for subscribed users. */ subscription?: { is_subscription_record?: boolean; upload_to_feed?: boolean; notify_subscribers?: boolean; feed_referencing_records?: boolean; notify_referencing_records?: boolean; } | null; }; source?: { referencing_limit?: number; prevent_multiple_referencing?: boolean; can_remove_referencing_records?: boolean; only_granted_can_reference?: boolean; /** Index restrictions for referencing records. null removes all restrictions. */ referencing_index_restrictions?: { /** Not allowed: White space, special characters. Allowed: Alphanumeric, Periods. */ name: string; /** Not allowed: Periods, special characters. Allowed: Alphanumeric, White space. */ value?: string | number | boolean; range?: string | number | boolean; condition?: 'gt' | 'gte' | 'lt' | 'lte' | 'eq' | 'ne' | '>' | '>=' | '<' | '<=' | '=' | '!='; }[] | null; allow_granted_to_grant_others?: boolean; }; /** Can be record ID or unique ID */ reference?: string | null; /** null removes index */ index?: { /** Max 128 chars, cannot start with "$", blocks / ! * #, control chars, and sentinel 􏿿. */ name: string; /** String value max 256 chars. Allows punctuation (including / ! * #). Blocks control chars and sentinel 􏿿. */ value: string | number | boolean; } | null; tags?: string[] | null; remove_bin?: BinaryFile[] | string[] | null; progress?: ProgressCallback; reference_private_key?: string; }; type BinaryFile = { access_group: number | 'private' | 'public' | 'authorized' | 'admin'; filename: string; url: string; path: string; size: number; uploaded: number; getFile: (dataType?: 'base64' | 'download' | 'endpoint' | 'blob' | 'text' | 'info', progress?: ProgressCallback) => Promise; }; 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; notify_subscribers: boolean; feed_referencing_records: boolean; notify_referencing_records: boolean; }; }; source: { referencing_limit: number; prevent_multiple_referencing: boolean; can_remove_referencing_records: boolean; only_granted_can_reference: boolean; referencing_index_restrictions?: { name: string; value?: string | number | boolean; range?: string | number | boolean; condition?: 'gt' | 'gte' | 'lt' | 'lte' | 'eq' | 'ne' | '>' | '>=' | '<' | '<=' | '=' | '!='; }[]; }; reference?: string; index?: { name: string; value: string | number | boolean; }; data?: Record; tags?: string[]; bin: { [key: string]: BinaryFile[]; }; ip: string; readonly: boolean; }; type Connection = { /** User's locale */ locale: string; user_agent: string; /** Connected user's IP address */ ip: string; /** Service group */ group: number; /** Service name */ service_name: string; /** Service options */ opt: { freeze_database: boolean; prevent_inquiry: boolean; prevent_signup: boolean; }; }; type Form = HTMLFormElement | FormData | SubmitEvent | T; 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.
* 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; }; type UserAttributes = { /** User's name */ name?: string; /** * User's E-Mail for signin.
* 64 character max.
* 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"
* 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; locality: string; region: string; postal_code: string; 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; }; type UserProfile = { /** Service id of the user account. */ service: string; /** User ID of the service 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 service. [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.
* 64 character max.
* 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"
* 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; locality: string; region: string; postal_code: string; 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; }; 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 service. [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.
* 64 character max.
* 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"
* 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; locality: string; region: string; postal_code: string; 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; }; type ProgressCallback = (e: { status: 'upload' | 'download'; progress: number; loaded: number; total: number; currentFile?: File; completed?: File[]; failed?: File[]; abort: () => void; }) => void; type FetchOptions = { /** Maximum number of records to fetch per call */ limit?: number; /** Fetch next batch of data. Will return empty list if there is nothing more to fetch. */ fetchMore?: boolean; /** Result in ascending order if true, decending when false. */ ascending?: boolean; /** Start key to be used to query from the certain batch of fetch. */ startKey?: { [key: string]: any; }; /** Callback for database request progress. Useful when building progress bar. */ progress?: ProgressCallback; }; type DatabaseResponse = { list: T[]; startKey: { [key: string]: any; } | 'end'; endOfList: boolean; startKeyHistory: string[]; }; type FileInfo = { url: string; filename: string; access_group: number | 'private' | 'public' | 'authorized'; filesize: number; record_id: string; uploader: string; uploaded: number; fileKey: string; }; type ConnectionInfo = { user_ip: string; user_agent: string; user_location: string; service_name: string; version: string; }; type Table = { table: string; number_of_records: string; size: number; }; 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; }; type Tag = { table: string; tag: string; number_of_records: number; }; type UniqueId = { unique_id: string; record_id: string; }; type Subscription = { subscriber: string; subscription: string; timestamp: number; blocked: boolean; get_feed: boolean; get_notified: boolean; get_email: boolean; }; type Types_BinaryFile = BinaryFile; type Types_Condition = Condition; type Types_Connection = Connection; type Types_ConnectionInfo = ConnectionInfo; type Types_DatabaseResponse = DatabaseResponse; type Types_DelRecordQuery = DelRecordQuery; type Types_FetchOptions = FetchOptions; type Types_FileInfo = FileInfo; type Types_Form = Form; type Types_GetRecordQuery = GetRecordQuery; type Types_Index = Index; type Types_Newsletter = Newsletter; type Types_PostRecordConfig = PostRecordConfig; type Types_ProgressCallback = ProgressCallback; type Types_RTCConnector = RTCConnector; type Types_RTCConnectorParams = RTCConnectorParams; type Types_RTCEvent = RTCEvent; type Types_RTCReceiverParams = RTCReceiverParams; type Types_RTCResolved = RTCResolved; type Types_RealtimeCallback = RealtimeCallback; type Types_RecordData = RecordData; type Types_Subscription = Subscription; type Types_Table = Table; type Types_Tag = Tag; type Types_UniqueId = UniqueId; type Types_UserAttributes = UserAttributes; type Types_UserProfile = UserProfile; type Types_UserPublic = UserPublic; type Types_WebSocketMessage = WebSocketMessage; declare namespace Types { export type { Types_BinaryFile as BinaryFile, Types_Condition as Condition, Types_Connection as Connection, Types_ConnectionInfo as ConnectionInfo, Types_DatabaseResponse as DatabaseResponse, Types_DelRecordQuery as DelRecordQuery, Types_FetchOptions as FetchOptions, Types_FileInfo as FileInfo, Types_Form as Form, Types_GetRecordQuery as GetRecordQuery, Types_Index as Index, Types_Newsletter as Newsletter, Types_PostRecordConfig as PostRecordConfig, Types_ProgressCallback as ProgressCallback, Types_RTCConnector as RTCConnector, Types_RTCConnectorParams as RTCConnectorParams, Types_RTCEvent as RTCEvent, Types_RTCReceiverParams as RTCReceiverParams, Types_RTCResolved as RTCResolved, Types_RealtimeCallback as RealtimeCallback, Types_RecordData as RecordData, Types_Subscription as Subscription, Types_Table as Table, Types_Tag as Tag, Types_UniqueId as UniqueId, Types_UserAttributes as UserAttributes, Types_UserProfile as UserProfile, Types_UserPublic as UserPublic, Types_WebSocketMessage as WebSocketMessage }; } declare function terminatePendingRequests(): void; declare class MD5 { private static readonly alphabet; static hash(str?: string): string; private static rh; private static ad; private static rl; private static cm; private static ff; private static gg; private static hh; private static ii; private static sb; } declare function toBase62(num: number): string; declare function fromBase62(chars: string): number; declare function generateRandom(length?: number): string; declare function extractFormData(form: FormData | HTMLFormElement | SubmitEvent | { [key: string]: any; } | number | string | boolean | null, options?: { nullIfEmpty?: boolean; ignoreEmpty?: boolean; }, callback?: (name: string, value: any) => any): { data: any; files: { name: string; file: File; }[]; }; declare function decodeServiceId(service: any): { service: any; owner: any; }; declare function formatServiceId(serviceId: any, ownerId: any): string; type Options = { autoLogin: boolean; requestBatchSize?: number; eventListener?: { onLogin?: (user: UserProfile | null) => void; onUserUpdate?: (user: UserProfile | null) => void; onBatchProcess?: (process: { batchToProcess: number; itemsToProcess: number; completed: any[]; }) => void; }; }; declare class Skapi { private __version; service: string; owner: string; session: Record | null; connection: Connection | null; private __my_unique_ids; private userPool; private __socket; private __mediaStream; private host; private hostDomain; private target_cdn; private customApiDomain; private requestBatchSize; private __disabledAccount; private __cached_requests; private __startKeyHistory; private __request_signup_confirmation; private __private_access_key; private __class_properties_has_been_cached; /** Current logged in user object. null if not logged. */ private __user; get user(): UserProfile | null; set user(value: UserProfile | null); private _userProfileListeners; private _onLoginListeners; get onLogin(): Function[]; set onLogin(listener: (user: UserProfile | null) => void); get onUserUpdate(): Function[]; set onUserUpdate(listener: (user: UserProfile | null) => void); private _runOnUserUpdateListeners; private _runOnLoginListeners; private admin_endpoint; private record_endpoint; private _onBatchProcessListeners; get onBatchProcess(): ((process: { batchToProcess: number; itemsToProcess: number; completed: any[]; }) => void)[]; set onBatchProcess(listener: (process: { batchToProcess: number; itemsToProcess: number; completed: any[]; }) => void); validate: { userId(val: string): boolean; url(val: string | string[]): boolean; phoneNumber(val: string): boolean; birthdate(val: string): boolean; email(val: string): boolean; params(val: any, schema: Record, required?: string[]): any; }; util: { MD5: typeof MD5; generateRandom: typeof generateRandom; toBase62: typeof toBase62; fromBase62: typeof fromBase62; decodeServiceId: typeof decodeServiceId; formatServiceId: typeof formatServiceId; extractFormData: typeof extractFormData; terminatePendingRequests: typeof terminatePendingRequests; request: (url: string, data?: Form, options?: { fetchOptions?: FetchOptions; auth?: boolean; method?: string; bypassAwaitConnection?: boolean; responseType?: "json" | "blob" | "text" | "arrayBuffer" | "formData" | "document"; contentType?: string; }) => any; }; private __connection; private __authConnection; private __network_logs; private __endpoint_version; private __public_identifier; private bearerToken; private _alert; constructor(service: string, owner?: string | Options, options?: Options | any, __etc?: any); /** * Returns current connection metadata such as service name, client IP, user agent, locale, and SDK version. * @returns A promise that resolves to Promise. */ getConnectionInfo(): Promise; private _updateConnection; private registerTicket; private unregisterTicket; /** * Returns the current SDK version and prints runtime version details in browser environments. * @returns A promise that resolves to Promise. */ version(): Promise; private log; /** * Fetches feed records visible to the current user with optional access-group filtering and pagination. * @param params Request parameters. * @param fetchOptions Pagination and fetch behavior options. * @returns A promise that resolves to Promise>. */ getFeed(params?: { access_group?: number; }, fetchOptions?: FetchOptions): Promise>; /** * Closes an active WebRTC connection by cid or closes all active RTC connections. * @param params Request parameters. * @returns A promise that resolves to Promise. */ closeRTC(params: { cid?: string; close_all?: boolean; }): Promise; /** * Creates or joins a WebRTC session and returns an RTC connector for streaming events and controls. * @param params Request parameters. * @param callback Callback invoked for events or updates. * @returns A promise that resolves to Promise. */ connectRTC(params: RTCConnectorParams, callback?: (e: RTCEvent) => void): Promise; /** * Opens a realtime WebSocket connection and registers a callback for incoming realtime messages. * @param callback Callback invoked for events or updates. * @returns A promise that resolves to Promise. */ connectRealtime(callback: RealtimeCallback): Promise; /** * Runs a spellcast operation and stores or returns generated spell data. * @param params Request parameters. * @returns A promise that resolves to Promise. */ spellcast(params: { spell: string; name: string; magic?: any; }): Promise; /** * Searches previously stored spell records by spell text or name. Defaults to 'spell' search if no search type is specified. * @param params Request parameters. * @returns A promise that resolves to Promise>. */ getspell(params?: { search?: 'spell' | 'name'; value?: string; }): Promise>; /** * Sends a dopamine message payload and returns the previous message. * @param params Request parameters. * @returns A promise that resolves to Promise. */ dopamine(params: { message: string; name: string; }): Promise; /** * Queries unique ID records by unique_id or condition filters. * @param params Request parameters. * @param fetchOptions Pagination and fetch behavior options. * @returns A promise that resolves to Promise>. */ getUniqueId(params: Form<{ /** Unique ID */ unique_id?: string; /** String query condition for tag name. */ condition?: Condition; }>, fetchOptions?: FetchOptions): Promise>; /** * Resends an existing user invitation email to the target address. * @param params Request parameters. * @returns A promise that resolves to Promise<"SUCCESS: Invitation has been re-sent. (User ID: xxx...)">. */ resendInvitation(params: Form<{ email: string; confirmation_url?: string; }>): Promise<"SUCCESS: Invitation has been re-sent. (User ID: xxx...)">; /** * Cancels a pending invitation for the target email address. * @param params Request parameters. * @returns A promise that resolves to Promise<"SUCCESS: Invitation has been canceled.">. */ cancelInvitation(params: Form<{ email: string; }>): Promise<"SUCCESS: Invitation has been canceled.">; /** * Lists invitation records with optional email filtering and pagination. * @param params Request parameters. * @param fetchOptions Pagination and fetch behavior options. * @returns A promise that resolves to Promise>. */ getInvitations(params: Form<{ email?: string; }>, fetchOptions: FetchOptions): Promise>; /** * Completes OpenID login and optionally merges the OpenID identity with an existing account. * @param params Request parameters. * @returns A promise that resolves to Promise<{ userProfile: UserProfile; openid: { [attribute: string]: string } }>. */ openIdLogin(params: { token: string; id: string; merge?: boolean | string[]; }): Promise<{ userProfile: UserProfile; openid: { [attribute: string]: string; }; }>; /** * Logs in a user with externally issued id/access/refresh tokens. * @param params Request parameters. * @returns A promise that resolves to Promise. */ loginWithToken(params: { idToken: string; accessToken?: string; refreshToken?: string; }): Promise; /** * Sends a secure outbound request using a Skapi client secret key. * @param params Request parameters. * @returns A promise that resolves to Promise. */ clientSecretRequest(params: { url: string; clientSecretName: string; method: 'GET' | 'POST' | 'DELETE' | 'PUT'; headers?: { [key: string]: string; }; data?: { [key: string]: any; }; params?: { [key: string]: string; }; }): Promise; /** * Consumes a one-time ticket and executes the ticketed request payload. * @param params Request parameters. * @returns A promise that resolves to Promise. */ consumeTicket(params: { ticket_id: string; method: string; auth?: boolean; data?: { [key: string]: any; }; }): Promise; /** * Lists consumed tickets with optional filters and pagination. * @param params Request parameters. * @param fetchOptions Pagination and fetch behavior options. * @returns A promise that resolves to Promise>. */ getConsumedTickets(params: { ticket_id?: string; }, fetchOptions: FetchOptions): Promise>; /** * Lists issued tickets with optional filters and pagination. * @param params Request parameters. * @param fetchOptions Pagination and fetch behavior options. * @returns A promise that resolves to Promise>. */ getTickets(params: { ticket_id?: string; }, fetchOptions: FetchOptions): Promise>; /** * Closes the active realtime WebSocket connection. * @returns A promise that resolves to Promise. */ closeRealtime(): Promise; /** * Fetches currently connected users in a realtime group. * @param params Request parameters. * @param fetchOptions Pagination and fetch behavior options. * @returns A promise that resolves to Promise>. */ getRealtimeUsers(params: { group: string; user_id?: string; }, fetchOptions?: FetchOptions): Promise>; /** * Sends an inquiry email payload to the service contact channel. * @param params Payload for the request. * @returns A promise that resolves to Promise<"SUCCESS: Inquiry has been sent.">. */ sendInquiry(params: Form<{ name: string; email: string; subject: string; message: string; }>): Promise<"SUCCESS: Inquiry has been sent.">; /** * Blocks a user account by user_id. * @param params Payload for the request. * @returns A promise that resolves to Promise<"SUCCESS: The user has been blocked.">. */ blockAccount(params: { user_id: string; }): Promise<"SUCCESS: The user has been blocked.">; /** * Unblocks a previously blocked user account by user_id. * @param params Payload for the request. * @returns A promise that resolves to Promise<"SUCCESS: The user has been unblocked.">. */ unblockAccount(params: { user_id: string; }): Promise<"SUCCESS: The user has been unblocked.">; /** * Deletes a user account by user_id. * @param params Payload for the request. * @returns A promise that resolves to Promise<"SUCCESS: Account has been deleted.">. */ deleteAccount(params: { user_id: string; }): Promise<"SUCCESS: Account has been deleted.">; /** * Invites a user by email with optional attributes and invitation email options. * @param params Payload for the request. * @param options Optional behavior configuration. * @returns A promise that resolves to Promise<'SUCCESS: Invitation has been sent.'>. */ inviteUser(params: UserAttributes & { openid_id: string; access_group: number; }, options?: { confirmation_url?: string; email_subscription?: boolean; template?: { url: string; subject: string; }; }): Promise<'SUCCESS: Invitation has been sent.'>; /** * Creates a user account directly from admin context. * @param params Payload for the request. * @returns A promise that resolves to Promise. */ createAccount(params: UserAttributes & { password: string; access_group: number; }): Promise; /** * Updates a user's access_group level. * @param params Request parameters. * @returns A promise that resolves to Promise<'SUCCESS: Access has been granted to the user.'>. */ grantAccess(params: { user_id: string; access_group: number; }): Promise<'SUCCESS: Access has been granted to the user.'>; /** * Lists realtime groups with optional search conditions and pagination. * @param params Request parameters. * @param fetchOptions Pagination and fetch behavior options. * @returns A promise that resolves to Promise>. */ getRealtimeGroups(params?: { /** Index name to search. */ searchFor: 'group' | 'number_of_users'; /** Index value to search. */ value: string | number; /** Search condition. */ condition?: '>' | '>=' | '=' | '<' | '<=' | '!=' | 'gt' | 'gte' | 'eq' | 'lt' | 'lte' | 'ne'; /** Range of search. */ range?: string | number; } | null, fetchOptions?: FetchOptions): Promise>; /** * Sends realtime data to a user or group with optional push notification metadata. * @param message Message payload to send. * @param recipient Recipient user or group target. * @param notification Optional notification payload. * @returns A promise that resolves to Promise<{ type: 'success', message: 'Message sent.' }>. */ postRealtime(message: any, recipient: string, notification?: { config?: { always: boolean; }; title: string; body: string; }): Promise<{ type: 'success'; message: 'Message sent.'; }>; /** * Joins the current connection to a realtime group or leaves group membership when null. * @param params Request parameters. * @returns A promise that resolves to Promise<{ type: 'success', message: string }>. */ joinRealtime(params: { group: string | null; }): Promise<{ type: 'success'; message: string; }>; /** * Retrieves the currently authenticated user profile, optionally refreshing token/session state. * @param options Optional behavior configuration. * @returns A promise that resolves to Promise. */ getProfile(options?: { refreshToken: boolean; }): Promise; /** * Retrieves a file by URL with optional conversion mode, expiration, and progress handling. * @param url Target URL. * @param config Additional configuration options. * @returns A promise that resolves to Promise. */ getFile(url: string, // cdn endpoint url https://xxxx.cloudfront.net/path/file config?: { dataType?: 'base64' | 'download' | 'endpoint' | 'blob' | 'text' | 'info'; expires?: number; progress?: ProgressCallback; }): Promise; /** * Executes authenticated secure API requests in single or batch mode. * @param params Request parameters. * @param url Target URL. * @returns A promise that resolves to Promise. */ secureRequest(params: Params[] | Form, url?: string): Promise; /** * Returns a normalized response object for form-based handler flows. * @returns A promise that resolves to Promise. */ getFormResponse(): Promise; /** * Queries database records with filtering, sorting, and pagination options. * @param query Query object used to filter results. * @param fetchOptions Pagination and fetch behavior options. * @returns A promise that resolves to Promise>. */ getRecords(query: GetRecordQuery, fetchOptions?: FetchOptions): Promise>; /** * Lists table metadata with optional table-name filters. * @param query Query object used to filter results. * @param fetchOptions Pagination and fetch behavior options. * @returns A promise that resolves to Promise>. */ getTables( /** If null fetch all list of tables. */ query: { table: string; /** Condition operator of table name. */ condition?: Condition; }, fetchOptions?: FetchOptions): Promise>; /** * Lists index metadata and aggregated index statistics for a table. * @param query Query object used to filter results. * @param fetchOptions Pagination and fetch behavior options. * @returns A promise that resolves to Promise>. */ getIndexes(query: { /** Table name */ table: string; /** Index name. When period is at the end of name, querys nested index keys. */ index?: string; /** Queries order by */ order?: { /** Key name to order by. */ by: 'average_number' | 'total_number' | 'number_count' | 'average_bool' | 'total_bool' | 'bool_count' | 'string_count' | 'index_name'; /** Value to query. */ value?: number | boolean | string; condition?: Condition; }; }, fetchOptions?: FetchOptions): Promise>; /** * Lists tags used in a table with optional tag-name filtering. * @param query Query object used to filter results. * @param fetchOptions Pagination and fetch behavior options. * @returns A promise that resolves to Promise>. */ getTags(query: { /** Table name */ table: string; /** Tag name */ tag?: string; /** String query condition for tag name. */ condition?: Condition; }, fetchOptions?: FetchOptions): Promise>; /** * Deletes records by query or record_id and returns deletion results. * @param params Request parameters. * @param fetchOptions Pagination and fetch behavior options. * @returns A promise that resolves to Promise>. */ deleteRecords(params: DelRecordQuery, fetchOptions?: FetchOptions): Promise>; /** * Resends the signup confirmation email for the current pending account. * @returns A promise that resolves to Promise<'SUCCESS: Signup confirmation e-mail has been sent.'>. */ resendSignupConfirmation(): Promise<'SUCCESS: Signup confirmation e-mail has been sent.'>; /** * Sends an account recovery email and optionally sets a recovery redirect URL. * @param redirect Redirect URL or false to disable redirect. * @returns A promise that resolves to Promise<"SUCCESS: Recovery e-mail has been sent.">. */ recoverAccount( /** Redirect url on confirmation success. */ redirect?: boolean | string): Promise<"SUCCESS: Recovery e-mail has been sent.">; /** * Queries users by supported profile/search fields with pagination. * @param params Request parameters. * @param fetchOptions Pagination and fetch behavior options. * @returns A promise that resolves to Promise>. */ getUsers(params?: { /** Index name to search. */ searchFor: 'user_id' | 'email' | 'phone_number' | 'locale' | 'name' | 'address' | 'gender' | 'birthdate' | 'subscribers' | 'timestamp' | 'approved'; /** Index value to search. */ value: string | number | boolean | string[]; /** Search condition. */ condition?: '>' | '>=' | '=' | '<' | '<=' | 'gt' | 'gte' | 'eq' | 'lt' | 'lte'; /** Range of search. */ range?: string | number | boolean; }, fetchOptions?: FetchOptions): Promise>; /** * Disables the currently logged-in user account. * @returns A promise that resolves to Promise<'SUCCESS: account has been disabled.'>. */ disableAccount(): Promise<'SUCCESS: account has been disabled.'>; /** * Returns the last verified email or reverts to it when revert is requested. * @param params Request parameters. * @returns A promise that resolves to Promise. */ lastVerifiedEmail(params?: { revert: boolean; }): Promise; /** * Unsubscribes the user from a newsletter group. * @param params Request parameters. * @returns A promise that resolves to Promise. */ unsubscribeNewsletter(params: { group: number | 'public' | 'authorized' | null; }): Promise; /** * Registers a web push subscription endpoint for notifications. * @param endpoint Push subscription endpoint URL. * @param keys Web Push key pair values. * @returns A promise that resolves to Promise<'SUCCESS: Subscribed to receive notifications.'>. */ subscribeNotification(endpoint: string, keys: { p256dh: string; auth: string; }): Promise<'SUCCESS: Subscribed to receive notifications.'>; /** * Removes a registered web push subscription endpoint. * @param endpoint Push subscription endpoint URL. * @param keys Web Push key pair values. * @returns A promise that resolves to Promise<'SUCCESS: Unsubscribed from notifications.'>. */ unsubscribeNotification(endpoint: string, keys: { p256dh: string; auth: string; }): Promise<'SUCCESS: Unsubscribed from notifications.'>; /** * Returns the VAPID public key required for browser push subscription setup. * @returns A promise that resolves to Promise<{ VAPIDPublicKey: string }>. */ vapidPublicKey(): Promise<{ VAPIDPublicKey: string; }>; /** * Sends push notifications to one or more users. * @param params Payload for the request. * @param user_ids Parameter for this operation. * @returns A promise that resolves to Promise<"SUCCESS: Notification sent.">. */ pushNotification(params: { title: string; body: string; }, user_ids?: string | string[]): Promise<"SUCCESS: Notification sent.">; /** * Fetches newsletter delivery records with filters and pagination. * @param params Request parameters. * @param fetchOptions Pagination and fetch behavior options. * @returns A promise that resolves to Promise>. */ getNewsletters(params?: { /** * Search points.
* 'message_id' and 'subject' value should be string.
* Others numbers. */ searchFor: 'message_id' | 'timestamp' | 'read' | 'complaint' | 'subject'; value: string | number; range: string | number; /** * Defaults to '=', * Condition does not work with range. */ condition?: '>' | '>=' | '=' | '<' | '<=' | 'gt' | 'gte' | 'eq' | 'lt' | 'lte'; group: 'public' | 'authorized' | number; }, fetchOptions?: FetchOptions): Promise>; /** * Gets newsletter subscription status for the requested groups. * @param params Request parameters. * @param fetchOptions Pagination and fetch behavior options. * @returns A promise that resolves to Promise<{ active: boolean; timestamp: number; group: number; subscribed_email: string; }[]>. */ getNewsletterSubscription(params: { group?: number | 'public' | 'authorized'; }, fetchOptions?: FetchOptions): Promise<{ active: boolean; timestamp: number; group: number; subscribed_email: string; }[]>; /** * Requests a username change confirmation flow for the current user. * @param params Request parameters. * @returns A promise that resolves to Promise<'SUCCESS: confirmation e-mail has been sent.'>. */ requestUsernameChange(params: { /** Redirect URL when user clicks on the link. */ redirect?: string; /** username(e-mail) user wish to change to. */ username: string; }): Promise<'SUCCESS: confirmation e-mail has been sent.'>; /** * Grants users access to a private record. * @param params Request parameters. * @returns A promise that resolves to Promise. */ grantPrivateRecordAccess(params: { record_id: string; user_id: string | string[]; }): Promise; /** * Removes previously granted private record access. * @param params Request parameters. * @returns A promise that resolves to Promise. */ removePrivateRecordAccess(params: { record_id: string; user_id: string | string[]; }): Promise; /** * Lists current private record access grants. * @param params Request parameters. * @returns A promise that resolves to Promise>. */ listPrivateRecordAccess(params: { record_id?: string; user_id?: string | string[]; }): Promise>; /** * Requests a temporary access key for reading a private record. * @param params Request parameters. * @returns A promise that resolves to Promise. */ requestPrivateRecordAccessKey(params: { record_id: string; reference_id?: string; }): Promise; /** * Deletes uploaded files by endpoint list. * @param params Request parameters. * @returns A promise that resolves to Promise. */ deleteFiles(params: { endpoints: string | string[]; }): Promise; /** * Uploads files to an existing record and returns completed and failed results. * @param fileList Files or form event containing files. * @param params Request parameters. * @returns A promise that resolves to Promise<{ completed: File[], failed: File[], bin_endpoints: string[] }>. */ uploadFiles(fileList: FormData | HTMLFormElement | SubmitEvent, params: { record_id: string; progress?: ProgressCallback; }): Promise<{ completed: File[]; failed: File[]; bin_endpoints: string[]; }>; /** * Calls the mock endpoint for testing request and error handling flows. * @param data Data payload for the request. * @param options Optional behavior configuration. * @returns A promise that resolves to Promise<{ [key: string]: any }>. */ mock(data: Form, options?: { auth?: boolean; method?: string; responseType?: 'blob' | 'json' | 'text' | 'arrayBuffer' | 'formData' | 'document'; contentType?: string; progress?: ProgressCallback; }): Promise<{ [key: string]: any; }>; /** * Authenticates a user with email/username and password. * @param params Payload for the request. * @returns A promise that resolves to Promise. */ login(params: Form<{ /** if given, username will be used instead of email. */ username?: string; /** E-Mail for signin. 64 character max. */ email: string; /** Password for signin. Should be at least 6 characters. */ password: string; }>): Promise; /** * Logs out the current user session (optionally globally). * @param params Payload for the request. * @returns A promise that resolves to Promise<'SUCCESS: The user has been logged out.'>. */ logout(params?: Form<{ global: boolean; }>): Promise<'SUCCESS: The user has been logged out.'>; /** * Creates a new user account with optional signup and login behavior settings. * @param params Payload for the request. * @param option Optional behavior configuration. * @returns A promise that resolves to Promise. */ signup(params: Form, option?: { /** * When true, the service will send out confirmation E-Mail. * User will not be able to signin to their account unless they have confirm their email. * Parameter also accepts URL string for user to be taken to when clicked on confirmation link. * Default is false. */ signup_confirmation?: boolean | string; /** * When true, user will be subscribed to the service newsletter (group 1) once they are signed up. * User's signup confirmation is required for this parameter. * Default is false. */ email_subscription?: boolean; /** * Automatically login to account after signup. Will not work if signup confirmation is required. */ login?: boolean; }): Promise; /** * Resets a password using email, verification code, and new password. * @param params Payload for the request. * @returns A promise that resolves to Promise<"SUCCESS: New password has been set.">. */ resetPassword(params: Form<{ /** Signin E-Mail */ email: string; /** The verification code user has received. */ code: string | number; /** New password to set. Verification code is required. */ new_password: string; }>): Promise<"SUCCESS: New password has been set.">; /** * Verifies the user email address with a confirmation code. * @param params Payload for the request. * @returns A promise that resolves to Promise. */ verifyEmail(params?: Form<{ code: string; }>): Promise; /** * Verifies the user phone number with a confirmation code. * @param params Payload for the request. * @returns A promise that resolves to Promise. */ verifyPhoneNumber(params?: Form<{ code: string; }>): Promise; /** * Sends a password reset verification code to the user email. * @param params Payload for the request. * @returns A promise that resolves to Promise<"SUCCESS: Verification code has been sent.">. */ forgotPassword(params: Form<{ /** Signin E-Mail. */ email: string; }>): Promise<"SUCCESS: Verification code has been sent.">; /** * Changes password for the authenticated user. * @param params Request parameters. * @returns A promise that resolves to Promise<'SUCCESS: Password has been changed.'>. */ changePassword(params: { new_password: string; current_password: string; }): Promise<'SUCCESS: Password has been changed.'>; /** * Updates profile attributes for the authenticated user. * @param params Payload for the request. * @returns A promise that resolves to Promise. */ updateProfile(params: Form): Promise; /** * Creates or updates a database record with optional file uploads. * @param params Payload for the request. * @param config Additional configuration options. * @param files File list to process. * @returns A promise that resolves to Promise. */ postRecord(params: Form> | null | undefined, config: PostRecordConfig, files?: { name: string; file: File; }[]): Promise; /** * Fetches subscriber/subscription relationships with filters and pagination. * @param params Request parameters. * @param fetchOptions Pagination and fetch behavior options. * @returns A promise that resolves to Promise>. */ getSubscriptions(params: { /** Subscribers user id. */ subscriber?: string; /** User ID of the subscription. User id that subscriber has subscribed to. */ subscription?: string; /** Fetch blocked subscription when True */ blocked?: boolean; }, fetchOptions?: FetchOptions): Promise>; /** * Subscribes to another user with optional feed/notification/email preferences. * @param params Request parameters. * @returns A promise that resolves to Promise. */ subscribe(params: { user_id: string; get_feed?: boolean; get_notified?: boolean; get_email?: boolean; }): Promise; /** * Unsubscribes from another user. * @param params Request parameters. * @returns A promise that resolves to Promise<'SUCCESS: The user has unsubscribed.'>. */ unsubscribe(params: { user_id: string; }): Promise<'SUCCESS: The user has unsubscribed.'>; /** * Blocks a subscriber user_id. * @param params Request parameters. * @returns A promise that resolves to Promise<'SUCCESS: Blocked user ID "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx".'>. */ blockSubscriber(params: { user_id: string; }): Promise<'SUCCESS: Blocked user ID "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx".'>; /** * Unblocks a previously blocked subscriber user_id. * @param params Request parameters. * @returns A promise that resolves to Promise<'SUCCESS: Unblocked user ID "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx".'>. */ unblockSubscriber(params: { user_id: string; }): Promise<'SUCCESS: Unblocked user ID "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx".'>; /** * Subscribes an email/user to a newsletter group with optional redirect flow. * @param params Request parameters. * @returns A promise that resolves to Promise. */ subscribeNewsletter(params: Form<{ email?: string; group: number | 'public' | 'authorized' | 'admin'; redirect?: string; }>): Promise; bulkPostRecords(config: PostRecordConfig): Promise; } declare class SkapiError extends Error { code: string | number; cause: Error; constructor(error: any, options?: { name?: string; code?: string; cause?: Error; }); } export { type BinaryFile, type Condition, type Connection, type ConnectionInfo, type DatabaseResponse, type DelRecordQuery, type FetchOptions, type FileInfo, type Form, type GetRecordQuery, type Index, type Newsletter, type PostRecordConfig, type ProgressCallback, type RTCConnector, type RTCConnectorParams, type RTCEvent, type RTCReceiverParams, type RTCResolved, type RealtimeCallback, type RecordData, Skapi, SkapiError, type Subscription, type Table, type Tag, Types, type UniqueId, type UserAttributes, type UserProfile, type UserPublic, type WebSocketMessage };