Client Library
Process workspace data by using Pine's API client.
Last updated
Process workspace data by using Pine's API client.
Last updated
Pine's client library provides an easy way to interact with the Pine API from within a frontend extension.
To get started, you'll need to install the library in your project with your preferred package manager:
The PineSDKClient
uses under the hood to securely communicate with Pine. To create the connection, it's thus necessary to call connectSDKClient
as soon as possible in the global scope of your application:
The cards
, decks
, and fields
namespaces follow a similar signature to , while namespaces like routes
, storage
, and context
are available exclusively through the client library.
The cards
namespace provides methods for interacting with card data.
Data can be queried using read
and list
, as expanded on in .
Data can be mutated using create
, update
, and delete
, as expanded on in .
Data can be subscribed to by using the on
handler:
The cards
namespace also supports the following sub-namespaces:
associations
: create, update, and delete card associations (comments, etc...).
connections
: create, update, and delete card connections (links, backlinks, etc...).
embeddings
: read and list local AI card embeddings.
The decks
namespace provides methods for interacting with deck data.
Data can be subscribed to by using the on
handler:
The decks
namespace also supports the following sub-namespaces:
associations
: create, update, and delete deck associations (comments, etc...).
connections
: create, update, and delete deck connections (links, backlinks, etc...).
embeddings
: read and list local AI deck embeddings.
The fields
namespace provides methods for interacting with a workspace's configured preferences. This will return an object/dictionary data structure with the appropriate field type matching the corresponding value type:
text
string
number
number
switch
boolean
date
string
Fields that haven't been assigned a value will return a null
value.
You can retrieve the value of a configured number field as follows:
The routes
namespace allows you to listen to route changes, as well as navigate users to specific routes.
The storage
namespace provides methods for storing data in IndexedDB.
The data that is stored in IndexedDB is not encrypted. It's thus not recommended that any sensitive data be stored here. Instead, it should be used to persist in the application state between sessions or store other forms of non-sensitive data.
To minimize security risks, both the key
and value
arguments must be strings. It's recommended to serialize your inputs to strings (e.g. using JSON.stringify())
if you wish to store more complex objects:
The context
namespace provides utilities for accessing information such as theme data or manipulating the optional badge that appears next to the integration icon in the sidebar.
Data can be queried using read
and list
, as expanded on in .
Data can be mutated using create
, update
, and delete
, as expanded on in .
As mentioned in , Pine also limits the size of input parameters and overall storage requests to 256KB.