2022-05-14 12:35:08 +00:00
|
|
|
use crate::ctx::Context;
|
2022-01-13 17:37:46 +00:00
|
|
|
use crate::err::Error;
|
|
|
|
use crate::sql::value::Value;
|
|
|
|
|
2022-05-14 12:35:08 +00:00
|
|
|
pub async fn head(_ctx: &Context<'_>, args: Vec<Value>) -> Result<Value, Error> {
|
2022-01-19 12:51:28 +00:00
|
|
|
match args.len() {
|
|
|
|
1 | 2 => todo!(),
|
2022-03-06 10:58:59 +00:00
|
|
|
_ => Err(Error::InvalidArguments {
|
2022-01-19 12:51:28 +00:00
|
|
|
name: String::from("http::head"),
|
|
|
|
message: String::from("The function expects 1 or 2 arguments."),
|
|
|
|
}),
|
|
|
|
}
|
2022-01-13 17:37:46 +00:00
|
|
|
}
|
|
|
|
|
2022-05-14 12:35:08 +00:00
|
|
|
pub async fn get(_ctx: &Context<'_>, args: Vec<Value>) -> Result<Value, Error> {
|
2022-01-19 12:51:28 +00:00
|
|
|
match args.len() {
|
|
|
|
1 | 2 => todo!(),
|
2022-03-06 10:58:59 +00:00
|
|
|
_ => Err(Error::InvalidArguments {
|
2022-01-19 12:51:28 +00:00
|
|
|
name: String::from("http::get"),
|
|
|
|
message: String::from("The function expects 1 or 2 arguments."),
|
|
|
|
}),
|
|
|
|
}
|
2022-01-13 17:37:46 +00:00
|
|
|
}
|
|
|
|
|
2022-05-14 12:35:08 +00:00
|
|
|
pub async fn put(_ctx: &Context<'_>, args: Vec<Value>) -> Result<Value, Error> {
|
2022-01-19 12:51:28 +00:00
|
|
|
match args.len() {
|
|
|
|
1 | 2 | 3 => todo!(),
|
2022-03-06 10:58:59 +00:00
|
|
|
_ => Err(Error::InvalidArguments {
|
2022-01-19 12:51:28 +00:00
|
|
|
name: String::from("http::put"),
|
|
|
|
message: String::from("The function expects 1, 2, or 3 arguments."),
|
|
|
|
}),
|
|
|
|
}
|
2022-01-13 17:37:46 +00:00
|
|
|
}
|
|
|
|
|
2022-05-14 12:35:08 +00:00
|
|
|
pub async fn post(_ctx: &Context<'_>, args: Vec<Value>) -> Result<Value, Error> {
|
2022-01-19 12:51:28 +00:00
|
|
|
match args.len() {
|
|
|
|
1 | 2 | 3 => todo!(),
|
2022-03-06 10:58:59 +00:00
|
|
|
_ => Err(Error::InvalidArguments {
|
2022-01-19 12:51:28 +00:00
|
|
|
name: String::from("http::post"),
|
|
|
|
message: String::from("The function expects 1, 2, or 3 arguments."),
|
|
|
|
}),
|
|
|
|
}
|
2022-01-13 17:37:46 +00:00
|
|
|
}
|
|
|
|
|
2022-05-14 12:35:08 +00:00
|
|
|
pub async fn patch(_ctx: &Context<'_>, args: Vec<Value>) -> Result<Value, Error> {
|
2022-01-19 12:51:28 +00:00
|
|
|
match args.len() {
|
|
|
|
1 | 2 | 3 => todo!(),
|
2022-03-06 10:58:59 +00:00
|
|
|
_ => Err(Error::InvalidArguments {
|
2022-01-19 12:51:28 +00:00
|
|
|
name: String::from("http::patch"),
|
|
|
|
message: String::from("The function expects 1, 2, or 3 arguments."),
|
|
|
|
}),
|
|
|
|
}
|
2022-01-13 17:37:46 +00:00
|
|
|
}
|
|
|
|
|
2022-05-14 12:35:08 +00:00
|
|
|
pub async fn delete(_ctx: &Context<'_>, args: Vec<Value>) -> Result<Value, Error> {
|
2022-01-19 12:51:28 +00:00
|
|
|
match args.len() {
|
|
|
|
1 | 2 => todo!(),
|
2022-03-06 10:58:59 +00:00
|
|
|
_ => Err(Error::InvalidArguments {
|
2022-01-19 12:51:28 +00:00
|
|
|
name: String::from("http::delete"),
|
|
|
|
message: String::from("The function expects 1 or 2 arguments."),
|
|
|
|
}),
|
|
|
|
}
|
2022-01-13 17:37:46 +00:00
|
|
|
}
|