SDK (TypeScript)
Use the bknd SDK in TypeScript
To start using the bknd API, start by creating a new API instance:
The Api
class is the main entry point for interacting with the bknd API. It provides methods
for all available modules described below.
Data (api.data
)
Access the Data
specific API methods at api.data
.
data.readMany([entity], [query])
To retrieve a list of records from an entity, use the readMany
method:
You can also add additional query instructions:
The with
property automatically adds the related entries to the response.
data.readOne([entity], [id])
To retrieve a single record from an entity, use the readOne
method:
data.createOne([entity], [data])
To create a single record of an entity, use the createOne
method:
data.updateOne([entity], [id], [data])
To update a single record of an entity, use the updateOne
method:
data.deleteOne([entity], [id])
To delete a single record of an entity, use the deleteOne
method:
Auth (api.auth
)
Access the Auth
specific API methods at api.auth
. If there is successful authentication, the
API will automatically save the token and use it for subsequent requests.
auth.loginWithPassword([input])
To log in with a password, use the loginWithPassword
method:
auth.registerWithPassword([input])
To register with a password, use the registerWithPassword
method:
auth.me()
To retrieve the current user, use the me
method:
auth.strategies()
To retrieve the available authentication strategies, use the strategies
method: