step1 script

This commit is contained in:
folex
2019-08-15 18:46:20 +03:00
parent 0815a14ff2
commit aa4d9e1b02
9 changed files with 52 additions and 11 deletions

View File

@@ -7,7 +7,7 @@ pub type AppResult<T> = ::std::result::Result<T, Box<Error>>;
#[derive(Deserialize)]
#[serde(tag = "action")]
pub enum Request {
Post { msg: String, handle: String },
Post { message: String, handle: String },
Fetch { handle: Option<String> },
}

View File

@@ -22,7 +22,7 @@ fn init() {
fn run(arg: String) -> String {
// Parse and handle JSON request
let result = api::parse(arg).and_then(|request| match request {
Request::Post { msg, handle } => add_post(msg, handle),
Request::Post { message, handle } => add_post(message, handle),
Request::Fetch { handle } => fetch_posts(handle),
});