Document and expose public members for Rojo API

This commit is contained in:
Lucien Greathouse
2019-09-03 14:20:12 -07:00
parent cf5f20bbb5
commit d5c816f24d
4 changed files with 19 additions and 6 deletions

View File

@@ -1,12 +1,13 @@
// Recursion limit bump is to support Ritz, a JSX-like proc macro used for
// Rojo's web UI currently.
#![recursion_limit = "128"]
// Macros
#[macro_use]
mod impl_from;
pub mod commands;
// This module is only public for the purpose of testing right now, and won't be
// This module is only public for testing right now, and won't be
// part of the first version of the Rojo API.
#[doc(hidden)]
pub mod project;
@@ -21,3 +22,6 @@ mod session_id;
mod snapshot;
mod snapshot_middleware;
mod web;
pub use crate::session_id::SessionId;
pub use crate::web::interface as web_interface;

View File

@@ -1,6 +1,10 @@
use serde::{Deserialize, Serialize};
use uuid::Uuid;
/// A randomly generated ID generated by Rojo during a serve session.
///
/// If the session ID of the server changes between requests, that indicates
/// that a new server has started up and the session should be terminated.
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub struct SessionId(Uuid);

View File

@@ -1,5 +1,4 @@
//! Defines all the structs needed to interact with the Rojo API from an
//! automation test perspective.
//! Defines all the structs needed to interact with the Rojo Serve API.
use std::collections::HashSet;
@@ -7,9 +6,13 @@ use serde::{Deserialize, Serialize};
use crate::session_id::SessionId;
pub const SERVER_VERSION: &str = env!("CARGO_PKG_VERSION");
/// Server version to report over the API, not exposed outside this crate.
pub(crate) const SERVER_VERSION: &str = env!("CARGO_PKG_VERSION");
/// Current protocol version, which is required to match.
pub const PROTOCOL_VERSION: u64 = 3;
/// Response body from /api/rojo
#[derive(Debug, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct ServerInfoResponse<'a> {
@@ -20,6 +23,7 @@ pub struct ServerInfoResponse<'a> {
// pub root_instance_id: RbxId,
}
/// Response body from /api/read/{id}
#[derive(Debug, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct ReadResponse {
@@ -28,6 +32,7 @@ pub struct ReadResponse {
// pub instances: HashMap<RbxId, InstanceWithMetadata<'a>>,
}
/// Response body from /api/subscribe/{cursor}
#[derive(Debug, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct SubscribeResponse {

View File

@@ -1,5 +1,5 @@
mod api;
mod interface;
pub mod interface;
mod ui;
mod util;