Skip to content

API Reference ​

Every method of skapi-kotlin 2.4.1. Each one throws SkapiException on failure. Methods that talk to the server are suspend functions that run on Dispatchers.IO.

From Java, every method below has the same name on SkapiJava and returns a CompletableFuture. See Using from Java.

Connection ​

method
Skapi(projectId, storage = MemoryStorage(), timeoutSeconds = 120, targetCdn = null, encryption = null)connects to one project
getConnectionInfo(refresh = false)project name and settings
onForeground() / onNetworkAvailable()checks a temporary account and the realtime connection after a pause
close()stops the object's timers and realtime connection
FetchOptions(limit, ascending, startKey, fetchMore)paging options
SkapiStorage / MemoryStorage / FileStoragewhere the session is kept
jsonOf, jsonArrayOf, toJsonElement, toJsStringJSON helpers

Authentication ​

method
signup(params, option = null)creates an account
resendSignupConfirmation()sends the confirmation e-mail again
login(email, password, username = null)signs in
verifyMfa(code)finishes a login that needs an authenticator code
logout(globalLogout = false)signs out
getProfile(refreshToken = false)the signed-in user's profile; restores a saved sign-in
user / sessionthe signed-in profile and tokens
loginWithToken(idToken, accessToken, refreshToken)adopts tokens from another sign-in
updateProfile(params)changes the user's profile
changePassword(currentPassword, newPassword)changes the password
forgotPassword(email, template = null)sends a password reset code
resetPassword(email, code, newPassword)sets a new password with the code
verifyEmail(code = null, template = null)sends or checks an e-mail verification code
lastVerifiedEmail(revert = null)the last verified e-mail
disableAccount()disables the user's own account
recoverAccount(redirect = null)sends the recovery e-mail to a disabled account
openIdLogin(token, id, merge = null, template = null)signs in through an OpenID provider
anonymousLogin()a temporary account without e-mail or password
verifyAnonymousSession()checks a restored temporary account still exists
setupMfa() / enableMfa(code) / disableMfa() / getMfaStatus()two-step login with an authenticator app

Database ​

method
postRecord(data, config, files = null)creates or updates a record
postRecords(items)many records in few requests
getRecords(query = null, fetchOptions = null)reads records
deleteRecords(query, fetchOptions = null)deletes records
getTables / getTags / getIndexes / getUniqueIdwhat the database holds
uploadFiles(files, recordId)attaches files to a record
getFile(url) / getFileText(url) / getFileUrl(url, expiresSeconds = 0) / getFileInfo(url) / downloadFile(url, destination)downloads a file, or makes a link to it
deleteFiles(endpoints)removes files from records
grantPrivateRecordAccess / removePrivateRecordAccess / listPrivateRecordAccess / requestPrivateRecordAccessKeysharing private records

Encryption ​

method
getEncryptionStatus()locked, unlocked or disabled
unlockEncryption(password) / lockEncryption(forgetDevice = false)opens or forgets the user's keys
unlockEncryptionWithRecoveryCode(code, password = null) / regenerateEncryptionRecoveryCode()encryption recovery codes (the first one is shown once in getConnectionInfo())
pinPeerKey(userId, fingerprint)trusts another user's key for sharing
isWithheld(value)tells the placeholder of undecryptable data apart

Users ​

method
getUsers(params = null, fetchOptions = null)searches the project's users
subscribe(userId, getFeed, getNotified, getEmail) / unsubscribe(userId)subscribes to another user
blockSubscriber(userId) / unblockSubscriber(userId)blocks a subscriber
getSubscriptions(subscriber, subscription, blocked, fetchOptions)who subscribes to whom
getFeed(params = null, fetchOptions = null)records from the users you subscribe to
subscribeNewsletter(params) / unsubscribeNewsletter(group)newsletter subscription
getNewsletters(params = null, fetchOptions = null) / getNewsletterSubscription()sent newsletters and the user's subscriptions
sendInquiry(name, email, subject, message)sends a message to the project owner

Realtime ​

method
connectRealtime(callback) / closeRealtime()opens or closes the realtime connection
joinRealtime(group)joins or leaves a group
postRealtime(message, recipient, notification = null)sends to a user or to the group
getRealtimeGroups(params = null, fetchOptions = null) / getRealtimeUsers(params = null, fetchOptions = null)who is connected where

API Bridge ​

method
forwardRequest(options, form = null, onStream = null)calls another API through Skapi, with your client secrets
forwardRequestPoll(requestId) / forwardRequestStream(requestId)waits for a queued or streamed answer
forwardRequestFinalize(requestId, data)stores a streamed request's final answer
forwardRequestHistory(params, fetchOptions = null)past forwarded requests and their answers
cancelForwardRequest(params) / forwardRequestQueueCount(params)queue control

Tickets ​

method
consumeTicket(ticketId, method = "POST", data = null, auth = false)calls a ticket
getTickets(params = null, fetchOptions = null)the project's tickets
getConsumedTickets(params = null, fetchOptions = null)the user's own ticket calls

Android helpers (skapi-android) ​

class
SharedPreferencesStorage(context, name = "skapi-session", encrypt = true)keeps the session, sealed by the Android Keystore
AndroidKeystoreDeviceKeyStore(context, name = "skapi-enc")"remember this device" for record encryption
SkapiLifecycle.watch(application, skapi)calls onForeground() and onNetworkAvailable() for you

skapi-kotlin 2.4.1