Shuffle web_interface into web::interface

This commit is contained in:
Lucien Greathouse
2019-09-03 14:00:31 -07:00
parent 27517e1aee
commit 27839dfd21
5 changed files with 7 additions and 5 deletions

View File

@@ -10,9 +10,11 @@ use rbx_dom_weak::RbxId;
use crate::{
serve_session::ServeSession,
web::util::response_json,
web_interface::{
ReadResponse, ServerInfoResponse, SubscribeResponse, PROTOCOL_VERSION, SERVER_VERSION,
web::{
interface::{
ReadResponse, ServerInfoResponse, SubscribeResponse, PROTOCOL_VERSION, SERVER_VERSION,
},
util::response_json,
},
};

37
src/web/interface.rs Normal file
View File

@@ -0,0 +1,37 @@
//! Defines all the structs needed to interact with the Rojo API from an
//! automation test perspective.
use std::collections::HashSet;
use serde::{Deserialize, Serialize};
use crate::session_id::SessionId;
pub const SERVER_VERSION: &str = env!("CARGO_PKG_VERSION");
pub const PROTOCOL_VERSION: u64 = 3;
#[derive(Debug, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct ServerInfoResponse<'a> {
pub session_id: SessionId,
pub server_version: &'a str,
pub protocol_version: u64,
pub expected_place_ids: Option<HashSet<u64>>,
// pub root_instance_id: RbxId,
}
#[derive(Debug, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct ReadResponse {
pub session_id: SessionId,
// pub message_cursor: u32,
// pub instances: HashMap<RbxId, InstanceWithMetadata<'a>>,
}
#[derive(Debug, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct SubscribeResponse {
pub session_id: SessionId,
// pub message_cursor: u32,
// pub messages: Cow<'a, [InstanceChanges]>,
}

View File

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

View File

@@ -6,7 +6,7 @@ use futures::{future, Future};
use hyper::{header, service::Service, Body, Method, Request, Response, StatusCode};
use ritz::html;
use crate::{serve_session::ServeSession, web_interface::SERVER_VERSION};
use crate::{serve_session::ServeSession, web::interface::SERVER_VERSION};
static HOME_CSS: &str = include_str!("../../assets/index.css");