Introduction
This Rust crate provides an easy-to-use async interface to the Anytype API. At this stage of development, the code consists largely of builder structs that setup and execute an Anytype API call.
WARNING!
This crate is still in development and therefore subject to change and not yet optimized nor fully tested.
Example of how to use the crate
The code shown below will, once it is modified to use a 'real' api_key, list all the spaces contained in the Anytype vault
use ListSpacesRequest;
use Vault;
async
Getting started
Example code is provided in the any_type_examples repository. The code contained in that repository is intended to be used as a starting point for developing applications that use the any_type crate. The code illustrates the following elements of the Anytype API:
- How to generate an api key
- How to create a space
- How to create a type
- How to create a property
- How to create a tag
- How to create an object of a type
- How to search Anytype spaces
Important library features
Limited abstraction
The library creates a very thin layer of abstraction for the Anytype API. The goal is to develop the crate in-step with the development of the Anytype API. For example, since there are currently no Chat related API calls, this library does not provide functions that allow for working with a chat channel.
Builder structs
The any_type library crate provide access to Anytypes objects via objects created by builder structs. This results in code that looks like this:
use GetProperty;
let request = new
.space_id
.property_id
.send;
The "send" function will return either the desired object or a RequestFailure object.
Several enum types to simplify defining Anytype values
The Anytype API requires the programmer to use string literals to define a number of API parameters. In order to make life easier for the application programmer, a set of enums have been created to make this easier:
- The "PropertyFormat" enum defines values for the various property formats (e.g. checkbox, select, multi_select, etc)
- The "AnytypeColor" enum defines values for the colors that icons and tags can have(e.g grey, yellow, orange, etc)
- The "IconName" enum defines values for various "named" icons that can be defined (e.g airplane, bluetooth radio, etc)
Current state of development (v0.5.0)
Complete set of API calls
All the API calls documented on the Antype website have now been implemented.
Not optimized
Owing to the state of development of the Anytype API (i.e. subject to change), the code has not been written to be efficient. The focus has been on developing a library that is easy for the user (i.e. software developer) to use.
Incomplete documentation
Some of the elements of the library have been documented, but there is still work to be done!
Limited Testing
Testing is being conducted every day, but there is still some way to go! However, at this stage at the very least the intro binaries should work on all systems. If this is not the case, the author would be very happy to receive any feedback you may have via email.
Known Bugs (i.e. no fix)
- GetTemplateRequest will fail if no template-id is provided
- Not fixed because this is an Anytype API error that should be fixed by the Anytype API developers
License
Licensed under either of
- Apache License, Version 2.0 (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)
at your option.
Contribution
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.