Cockpit SDK
An unofficial SDK for interacting with Cockpit CMS applications. It's primary use is to make it easier to interact with collections.
NOTE
This is very much in active development and should probably not be used in any production environment.
Usage
First, create a cockpit instance using:
import Cockpit from "./Cockpit";
let instance = new Cockpit({
root: "http://localhost:8078",
token: "7wPVJkMzQdPt30o3ill8GrB88UA",
});
Then you can get an instance of a collection using:
let usersCollection = instance.collection("users");
Getting data
.all()
let entries = await usersCollection.all();
Returns all entries in the collection.
.clear()
await usersCollection.clear();
Removes all entries from the collection.
.filter()
let entries = await usersCollection.filter()
.whereId().in(["abc", "def"])
.get();
Allows you to build complex queries.