anytype-client
v1.0.0
Published
A pure JavaScript client for the Anytype API, generated from the OpenAPI specification.
Maintainers
Readme
Anytype API JavaScript Client
A pure JavaScript client for the Anytype API, generated from the OpenAPI specification.
Installation
Install via npm:
npm install anytype-clientOr using yarn:
yarn add anytype-clientUsage
Basic Setup
import { AnytypeClient } from 'anytype-client';
// Initialize the client
const client = new AnytypeClient({
BASE: 'https://api.anytype.io',
HEADERS: {
'Authorization': 'Bearer YOUR_API_KEY'
}
});Examples
List Spaces
const spaces = await client.spaces.listSpaces();
console.log(spaces);Create an Object
const newObject = await client.objects.createObject('space_id', {
type_key: 'page',
name: 'My New Page',
body: 'This is the content of my page'
});
console.log(newObject);List Objects in a Space
const objects = await client.objects.listObjects('space_id', '2025-11-08', 0, 100);
console.log(objects);Search Objects
const searchResults = await client.search.searchObjectsWithinASpace('space_id', {
query: 'search term',
limit: 10
});
console.log(searchResults);Update an Object
const updated = await client.objects.updateObject('space_id', 'object_id', {
name: 'Updated Name',
body: 'Updated content'
});
console.log(updated);Available Services
The client includes the following services:
client.auth- Authentication (start challenge, retrieve token)client.objects- Object management (create, read, update, delete, export)client.spaces- Space managementclient.lists- List/Set operationsclient.types- Type managementclient.templates- Template operationsclient.tags- Tag managementclient.properties- Property managementclient.members- Member managementclient.search- Search operations
Notes
- All API calls return Promises
- The client uses the Fetch API for HTTP requests
- Error handling follows standard Promise rejection patterns
