Something went wrong. Try again.
A lexicon-driven AppView for ATProto.
Something went wrong. Try again.
Rust
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107use serde_json::{Value, json};
/// A minimal record-type lexicon JSON for testing.pub fn game_record_lexicon() -> Value { json!({ "lexicon": 1, "id": "games.gamesgamesgamesgames.game", "defs": { "main": { "type": "record", "key": "tid", "record": { "type": "object", "properties": { "title": { "type": "string" } } } } } })}
/// A query-type lexicon JSON that targets the game record collection.pub fn list_games_query_lexicon() -> Value { json!({ "lexicon": 1, "id": "games.gamesgamesgamesgames.listGames", "defs": { "main": { "type": "query", "parameters": { "type": "params", "properties": { "limit": { "type": "integer" } } }, "output": { "encoding": "application/json" } } } })}
/// A procedure-type lexicon JSON that targets the game record collection.pub fn create_game_procedure_lexicon() -> Value { json!({ "lexicon": 1, "id": "games.gamesgamesgamesgames.createGame", "defs": { "main": { "type": "procedure", "input": { "encoding": "application/json" }, "output": { "encoding": "application/json" } } } })}
/// A procedure-type lexicon JSON for deleting a game record.pub fn delete_game_procedure_lexicon() -> Value { json!({ "lexicon": 1, "id": "games.gamesgamesgamesgames.deleteGame", "defs": { "main": { "type": "procedure", "input": { "encoding": "application/json" }, "output": { "encoding": "application/json" } } } })}
/// A fake DID document for testing PLC directory resolution.pub fn did_document(did: &str, pds_endpoint: &str) -> Value { json!({ "id": did, "alsoKnownAs": [format!("at://test.handle")], "service": [{ "id": "#atproto_pds", "type": "AtprotoPersonalDataServer", "serviceEndpoint": pds_endpoint }] })}
/// A fake app.bsky.actor.profile getRecord response.pub fn profile_record() -> Value { json!({ "uri": "at://did:plc:test/app.bsky.actor.profile/self", "cid": "bafytest", "value": { "displayName": "Test User", "description": "A test user" } })}