0.0.1 • Published 9 months ago
znjaaaaaa v0.0.1
@analog/timegraph-js
A typed GraphQL API wrapper for fetching and creating resources on Analog Timegraph.
Usage
import { TimegraphClient } from '@analog/timegraph-js';
// Instantiate
const timegraph = new TimegraphClient({
url: 'http://localhost:4000',
sessionKey: '0;2Evg4riXZjyK3...'
})
// Retrieve objects
const collections = await timegraph.collection.global({ limit: 10 });
/*
[
{
hashId: '',
schema: [{...}],
with: [],
...
},
...
]
*/
// Retrieve a specific object
const view = await timegraph.view.get({ hashId: 'asdf' });
/*
{
hashId: 'asdf',
sql: '...',
name: '',
...
}
*/
// Publish new objects
const created = await timegraph.collection.create({
collection: [
{
name: 'name',
schema: [{
//...
}],
// ...
}
]
});
/*
[
{
hashId: 'newHashId',
name: 'name',
...
}
]
*/