BDO Rust Client
This is the Rust client SDK for the BDO (Blockchain Data Objects) miniservice.
Installation
Add this to your Cargo.toml:
[]
= { = "path/to/bdo-rs" }
= "0.x"
= { = "1", = ["full"] }
= "1"
Usage
Basic Example
use BDO;
use Sessionless;
use json;
async
Working with Emojicodes
Emojicodes are human-memorable identifiers for public BDOs. They consist of 8 emoji (3 base emoji + 5 unique emoji) and are automatically assigned when you create a public BDO.
use BDO;
use Sessionless;
use json;
async
Getting Public BDOs
// Get a public BDO using the pubKey parameter
let pub_key = "02a1b2c3..."; // Public key of the BDO owner
let public_user = bdo.get_public_bdo.await?;
Working with Bases
Bases are Planet Nine base preferences:
use Bases;
use json;
// Get user's bases
let bases_value = bdo.get_bases.await?;
// Save bases
let new_bases = Bases ;
let saved_bases = bdo.save_bases.await?;
Working with Spellbooks
Spellbooks are used for the MAGIC protocol:
use Spellbook;
use json;
// Get user's spellbooks
let spellbooks = bdo.get_spellbooks.await?;
for spellbook in spellbooks
// Save a new spellbook
let new_spellbook = Spellbook ;
let updated_spellbooks = bdo.put_spellbook.await?;
Teleportation
The teleport feature validates teleportation tags with allyabase:// protocol support:
let teleport_url = "allyabase://some/resource";
let content = bdo.teleport.await?;
println!;
API Reference
BDO Client
BDO::new(base_url: Option<String>, sessionless: Option<Sessionless>) -> Self
Creates a new BDO client instance.
base_url: Optional custom base URL (defaults tohttps://dev.bdo.allyabase.com/)sessionless: Optional sessionless instance for key management (creates a new one if not provided)
create_user(&self, hash: &str, bdo: &Value, is_public: &bool) -> Result<BDOUser, Error>
Creates a new BDO user with an optional initial BDO.
update_bdo(&self, uuid: &str, hash: &str, bdo: &Value, is_public: &bool) -> Result<BDOUser, Error>
Updates or creates a BDO for an existing user.
get_bdo(&self, uuid: &str, hash: &str) -> Result<BDOUser, Error>
Retrieves a private BDO.
get_public_bdo(&self, uuid: &str, hash: &str, pub_key: &str) -> Result<BDOUser, Error>
Retrieves a public BDO using the pubKey parameter.
get_bdo_by_emojicode(&self, emojicode: &str) -> Result<EmojicodeResponse, Error>
Retrieves a public BDO by its emojicode. Returns the emojicode, public key, BDO data, and creation timestamp.
get_bases(&self, uuid: &str, hash: &str) -> Result<Value, Error>
Gets user's Planet Nine bases.
save_bases(&self, uuid: &str, hash: &str, bases: &Bases) -> Result<Value, Error>
Updates user's bases.
get_spellbooks(&self, uuid: &str, hash: &str) -> Result<Vec<Spellbook>, Error>
Gets user's spellbooks.
put_spellbook(&self, uuid: &str, hash: &str, spellbook: &Spellbook) -> Result<Vec<Spellbook>, Error>
Stores a user spellbook.
delete_user(&self, uuid: &str, hash: &str) -> Result<SuccessResult, Error>
Deletes a user account. Returns a SuccessResult indicating if the operation succeeded.
teleport(&self, uuid: &str, hash: &str, url: &str) -> Result<Value, Error>
Validates teleportation tags with allyabase:// protocol support.
Data Structures
BDOUser
EmojicodeResponse
Spellbook
Bases
SuccessResult
Environment
By default, the client connects to the development BDO server at https://dev.bdo.allyabase.com/. To use a different environment, pass a custom base URL when creating the client:
let bdo = BDOnew;
Testing
Run the test suite:
License
[Your License Here]