Implement rfs-client
This commit is contained in:
64
rfs-client/openapi/src/apis/authentication_api.rs
Normal file
64
rfs-client/openapi/src/apis/authentication_api.rs
Normal file
@@ -0,0 +1,64 @@
|
||||
/*
|
||||
* rfs
|
||||
*
|
||||
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
||||
*
|
||||
* The version of the OpenAPI document: 0.2.0
|
||||
*
|
||||
* Generated by: https://openapi-generator.tech
|
||||
*/
|
||||
|
||||
|
||||
use reqwest;
|
||||
use serde::{Deserialize, Serialize, de::Error as _};
|
||||
use crate::{apis::ResponseContent, models};
|
||||
use super::{Error, configuration, ContentType};
|
||||
|
||||
|
||||
/// struct for typed errors of method [`sign_in_handler`]
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[serde(untagged)]
|
||||
pub enum SignInHandlerError {
|
||||
Status401(models::ResponseError),
|
||||
Status500(models::ResponseError),
|
||||
UnknownValue(serde_json::Value),
|
||||
}
|
||||
|
||||
|
||||
pub async fn sign_in_handler(configuration: &configuration::Configuration, sign_in_body: models::SignInBody) -> Result<models::SignInResponse, Error<SignInHandlerError>> {
|
||||
// add a prefix to parameters to efficiently prevent name collisions
|
||||
let p_sign_in_body = sign_in_body;
|
||||
|
||||
let uri_str = format!("{}/api/v1/signin", configuration.base_path);
|
||||
let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
|
||||
|
||||
if let Some(ref user_agent) = configuration.user_agent {
|
||||
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
|
||||
}
|
||||
req_builder = req_builder.json(&p_sign_in_body);
|
||||
|
||||
let req = req_builder.build()?;
|
||||
let resp = configuration.client.execute(req).await?;
|
||||
|
||||
let status = resp.status();
|
||||
let content_type = resp
|
||||
.headers()
|
||||
.get("content-type")
|
||||
.and_then(|v| v.to_str().ok())
|
||||
.unwrap_or("application/octet-stream");
|
||||
let content_type = super::ContentType::from(content_type);
|
||||
|
||||
if !status.is_client_error() && !status.is_server_error() {
|
||||
let content = resp.text().await?;
|
||||
match content_type {
|
||||
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
|
||||
ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::SignInResponse`"))),
|
||||
ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::SignInResponse`")))),
|
||||
}
|
||||
} else {
|
||||
let content = resp.text().await?;
|
||||
let entity: Option<SignInHandlerError> = serde_json::from_str(&content).ok();
|
||||
Err(Error::ResponseError(ResponseContent { status, content, entity }))
|
||||
}
|
||||
}
|
||||
|
385
rfs-client/openapi/src/apis/block_management_api.rs
Normal file
385
rfs-client/openapi/src/apis/block_management_api.rs
Normal file
@@ -0,0 +1,385 @@
|
||||
/*
|
||||
* rfs
|
||||
*
|
||||
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
||||
*
|
||||
* The version of the OpenAPI document: 0.2.0
|
||||
*
|
||||
* Generated by: https://openapi-generator.tech
|
||||
*/
|
||||
|
||||
|
||||
use reqwest;
|
||||
use serde::{Deserialize, Serialize, de::Error as _};
|
||||
use crate::{apis::ResponseContent, models};
|
||||
use super::{Error, configuration, ContentType};
|
||||
|
||||
|
||||
/// struct for typed errors of method [`check_block_handler`]
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[serde(untagged)]
|
||||
pub enum CheckBlockHandlerError {
|
||||
Status404(models::ResponseError),
|
||||
UnknownValue(serde_json::Value),
|
||||
}
|
||||
|
||||
/// struct for typed errors of method [`get_block_downloads_handler`]
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[serde(untagged)]
|
||||
pub enum GetBlockDownloadsHandlerError {
|
||||
Status404(),
|
||||
Status500(),
|
||||
UnknownValue(serde_json::Value),
|
||||
}
|
||||
|
||||
/// struct for typed errors of method [`get_block_handler`]
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[serde(untagged)]
|
||||
pub enum GetBlockHandlerError {
|
||||
Status404(models::ResponseError),
|
||||
Status500(models::ResponseError),
|
||||
UnknownValue(serde_json::Value),
|
||||
}
|
||||
|
||||
/// struct for typed errors of method [`get_blocks_by_hash_handler`]
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[serde(untagged)]
|
||||
pub enum GetBlocksByHashHandlerError {
|
||||
Status404(models::ResponseError),
|
||||
Status500(models::ResponseError),
|
||||
UnknownValue(serde_json::Value),
|
||||
}
|
||||
|
||||
/// struct for typed errors of method [`get_user_blocks_handler`]
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[serde(untagged)]
|
||||
pub enum GetUserBlocksHandlerError {
|
||||
Status401(),
|
||||
Status500(),
|
||||
UnknownValue(serde_json::Value),
|
||||
}
|
||||
|
||||
/// struct for typed errors of method [`list_blocks_handler`]
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[serde(untagged)]
|
||||
pub enum ListBlocksHandlerError {
|
||||
Status400(),
|
||||
Status500(),
|
||||
UnknownValue(serde_json::Value),
|
||||
}
|
||||
|
||||
/// struct for typed errors of method [`upload_block_handler`]
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[serde(untagged)]
|
||||
pub enum UploadBlockHandlerError {
|
||||
Status400(models::ResponseError),
|
||||
Status500(models::ResponseError),
|
||||
UnknownValue(serde_json::Value),
|
||||
}
|
||||
|
||||
/// struct for typed errors of method [`verify_blocks_handler`]
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[serde(untagged)]
|
||||
pub enum VerifyBlocksHandlerError {
|
||||
Status400(models::ResponseError),
|
||||
Status500(models::ResponseError),
|
||||
UnknownValue(serde_json::Value),
|
||||
}
|
||||
|
||||
|
||||
pub async fn check_block_handler(configuration: &configuration::Configuration, hash: &str) -> Result<(), Error<CheckBlockHandlerError>> {
|
||||
// add a prefix to parameters to efficiently prevent name collisions
|
||||
let p_hash = hash;
|
||||
|
||||
let uri_str = format!("{}/api/v1/block/{hash}", configuration.base_path, hash=crate::apis::urlencode(p_hash));
|
||||
let mut req_builder = configuration.client.request(reqwest::Method::HEAD, &uri_str);
|
||||
|
||||
if let Some(ref user_agent) = configuration.user_agent {
|
||||
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
|
||||
}
|
||||
|
||||
let req = req_builder.build()?;
|
||||
let resp = configuration.client.execute(req).await?;
|
||||
|
||||
let status = resp.status();
|
||||
|
||||
if !status.is_client_error() && !status.is_server_error() {
|
||||
Ok(())
|
||||
} else {
|
||||
let content = resp.text().await?;
|
||||
let entity: Option<CheckBlockHandlerError> = serde_json::from_str(&content).ok();
|
||||
Err(Error::ResponseError(ResponseContent { status, content, entity }))
|
||||
}
|
||||
}
|
||||
|
||||
pub async fn get_block_downloads_handler(configuration: &configuration::Configuration, hash: &str) -> Result<models::BlockDownloadsResponse, Error<GetBlockDownloadsHandlerError>> {
|
||||
// add a prefix to parameters to efficiently prevent name collisions
|
||||
let p_hash = hash;
|
||||
|
||||
let uri_str = format!("{}/api/v1/block/{hash}/downloads", configuration.base_path, hash=crate::apis::urlencode(p_hash));
|
||||
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
|
||||
|
||||
if let Some(ref user_agent) = configuration.user_agent {
|
||||
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
|
||||
}
|
||||
|
||||
let req = req_builder.build()?;
|
||||
let resp = configuration.client.execute(req).await?;
|
||||
|
||||
let status = resp.status();
|
||||
let content_type = resp
|
||||
.headers()
|
||||
.get("content-type")
|
||||
.and_then(|v| v.to_str().ok())
|
||||
.unwrap_or("application/octet-stream");
|
||||
let content_type = super::ContentType::from(content_type);
|
||||
|
||||
if !status.is_client_error() && !status.is_server_error() {
|
||||
let content = resp.text().await?;
|
||||
match content_type {
|
||||
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
|
||||
ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::BlockDownloadsResponse`"))),
|
||||
ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::BlockDownloadsResponse`")))),
|
||||
}
|
||||
} else {
|
||||
let content = resp.text().await?;
|
||||
let entity: Option<GetBlockDownloadsHandlerError> = serde_json::from_str(&content).ok();
|
||||
Err(Error::ResponseError(ResponseContent { status, content, entity }))
|
||||
}
|
||||
}
|
||||
|
||||
pub async fn get_block_handler(configuration: &configuration::Configuration, hash: &str) -> Result<reqwest::Response, Error<GetBlockHandlerError>> {
|
||||
// add a prefix to parameters to efficiently prevent name collisions
|
||||
let p_hash = hash;
|
||||
|
||||
let uri_str = format!("{}/api/v1/block/{hash}", configuration.base_path, hash=crate::apis::urlencode(p_hash));
|
||||
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
|
||||
|
||||
if let Some(ref user_agent) = configuration.user_agent {
|
||||
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
|
||||
}
|
||||
|
||||
let req = req_builder.build()?;
|
||||
let resp = configuration.client.execute(req).await?;
|
||||
|
||||
let status = resp.status();
|
||||
|
||||
if !status.is_client_error() && !status.is_server_error() {
|
||||
Ok(resp)
|
||||
} else {
|
||||
let content = resp.text().await?;
|
||||
let entity: Option<GetBlockHandlerError> = serde_json::from_str(&content).ok();
|
||||
Err(Error::ResponseError(ResponseContent { status, content, entity }))
|
||||
}
|
||||
}
|
||||
|
||||
/// If the hash is a file hash, returns all blocks with their block index related to that file. If the hash is a block hash, returns the block itself.
|
||||
pub async fn get_blocks_by_hash_handler(configuration: &configuration::Configuration, hash: &str) -> Result<models::BlocksResponse, Error<GetBlocksByHashHandlerError>> {
|
||||
// add a prefix to parameters to efficiently prevent name collisions
|
||||
let p_hash = hash;
|
||||
|
||||
let uri_str = format!("{}/api/v1/blocks/{hash}", configuration.base_path, hash=crate::apis::urlencode(p_hash));
|
||||
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
|
||||
|
||||
if let Some(ref user_agent) = configuration.user_agent {
|
||||
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
|
||||
}
|
||||
|
||||
let req = req_builder.build()?;
|
||||
let resp = configuration.client.execute(req).await?;
|
||||
|
||||
let status = resp.status();
|
||||
let content_type = resp
|
||||
.headers()
|
||||
.get("content-type")
|
||||
.and_then(|v| v.to_str().ok())
|
||||
.unwrap_or("application/octet-stream");
|
||||
let content_type = super::ContentType::from(content_type);
|
||||
|
||||
if !status.is_client_error() && !status.is_server_error() {
|
||||
let content = resp.text().await?;
|
||||
match content_type {
|
||||
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
|
||||
ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::BlocksResponse`"))),
|
||||
ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::BlocksResponse`")))),
|
||||
}
|
||||
} else {
|
||||
let content = resp.text().await?;
|
||||
let entity: Option<GetBlocksByHashHandlerError> = serde_json::from_str(&content).ok();
|
||||
Err(Error::ResponseError(ResponseContent { status, content, entity }))
|
||||
}
|
||||
}
|
||||
|
||||
pub async fn get_user_blocks_handler(configuration: &configuration::Configuration, page: Option<i32>, per_page: Option<i32>) -> Result<models::UserBlocksResponse, Error<GetUserBlocksHandlerError>> {
|
||||
// add a prefix to parameters to efficiently prevent name collisions
|
||||
let p_page = page;
|
||||
let p_per_page = per_page;
|
||||
|
||||
let uri_str = format!("{}/api/v1/user/blocks", configuration.base_path);
|
||||
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
|
||||
|
||||
if let Some(ref param_value) = p_page {
|
||||
req_builder = req_builder.query(&[("page", ¶m_value.to_string())]);
|
||||
}
|
||||
if let Some(ref param_value) = p_per_page {
|
||||
req_builder = req_builder.query(&[("per_page", ¶m_value.to_string())]);
|
||||
}
|
||||
if let Some(ref user_agent) = configuration.user_agent {
|
||||
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
|
||||
}
|
||||
if let Some(ref token) = configuration.bearer_access_token {
|
||||
req_builder = req_builder.bearer_auth(token.to_owned());
|
||||
};
|
||||
|
||||
let req = req_builder.build()?;
|
||||
let resp = configuration.client.execute(req).await?;
|
||||
|
||||
let status = resp.status();
|
||||
let content_type = resp
|
||||
.headers()
|
||||
.get("content-type")
|
||||
.and_then(|v| v.to_str().ok())
|
||||
.unwrap_or("application/octet-stream");
|
||||
let content_type = super::ContentType::from(content_type);
|
||||
|
||||
if !status.is_client_error() && !status.is_server_error() {
|
||||
let content = resp.text().await?;
|
||||
match content_type {
|
||||
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
|
||||
ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::UserBlocksResponse`"))),
|
||||
ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::UserBlocksResponse`")))),
|
||||
}
|
||||
} else {
|
||||
let content = resp.text().await?;
|
||||
let entity: Option<GetUserBlocksHandlerError> = serde_json::from_str(&content).ok();
|
||||
Err(Error::ResponseError(ResponseContent { status, content, entity }))
|
||||
}
|
||||
}
|
||||
|
||||
pub async fn list_blocks_handler(configuration: &configuration::Configuration, page: Option<i32>, per_page: Option<i32>) -> Result<models::ListBlocksResponse, Error<ListBlocksHandlerError>> {
|
||||
// add a prefix to parameters to efficiently prevent name collisions
|
||||
let p_page = page;
|
||||
let p_per_page = per_page;
|
||||
|
||||
let uri_str = format!("{}/api/v1/blocks", configuration.base_path);
|
||||
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
|
||||
|
||||
if let Some(ref param_value) = p_page {
|
||||
req_builder = req_builder.query(&[("page", ¶m_value.to_string())]);
|
||||
}
|
||||
if let Some(ref param_value) = p_per_page {
|
||||
req_builder = req_builder.query(&[("per_page", ¶m_value.to_string())]);
|
||||
}
|
||||
if let Some(ref user_agent) = configuration.user_agent {
|
||||
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
|
||||
}
|
||||
|
||||
let req = req_builder.build()?;
|
||||
let resp = configuration.client.execute(req).await?;
|
||||
|
||||
let status = resp.status();
|
||||
let content_type = resp
|
||||
.headers()
|
||||
.get("content-type")
|
||||
.and_then(|v| v.to_str().ok())
|
||||
.unwrap_or("application/octet-stream");
|
||||
let content_type = super::ContentType::from(content_type);
|
||||
|
||||
if !status.is_client_error() && !status.is_server_error() {
|
||||
let content = resp.text().await?;
|
||||
match content_type {
|
||||
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
|
||||
ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ListBlocksResponse`"))),
|
||||
ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::ListBlocksResponse`")))),
|
||||
}
|
||||
} else {
|
||||
let content = resp.text().await?;
|
||||
let entity: Option<ListBlocksHandlerError> = serde_json::from_str(&content).ok();
|
||||
Err(Error::ResponseError(ResponseContent { status, content, entity }))
|
||||
}
|
||||
}
|
||||
|
||||
/// If the block already exists, the server will return a 200 OK response. If the block is new, the server will return a 201 Created response.
|
||||
pub async fn upload_block_handler(configuration: &configuration::Configuration, file_hash: &str, idx: i64, body: std::path::PathBuf) -> Result<models::BlockUploadedResponse, Error<UploadBlockHandlerError>> {
|
||||
// add a prefix to parameters to efficiently prevent name collisions
|
||||
let p_file_hash = file_hash;
|
||||
let p_idx = idx;
|
||||
let p_body = body;
|
||||
|
||||
let uri_str = format!("{}/api/v1/block", configuration.base_path);
|
||||
let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
|
||||
|
||||
req_builder = req_builder.query(&[("file_hash", &p_file_hash.to_string())]);
|
||||
req_builder = req_builder.query(&[("idx", &p_idx.to_string())]);
|
||||
if let Some(ref user_agent) = configuration.user_agent {
|
||||
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
|
||||
}
|
||||
if let Some(ref token) = configuration.bearer_access_token {
|
||||
req_builder = req_builder.bearer_auth(token.to_owned());
|
||||
};
|
||||
let file_content = std::fs::read(&p_body).map_err(|e| Error::Io(e))?;
|
||||
req_builder = req_builder.body(file_content);
|
||||
|
||||
let req = req_builder.build()?;
|
||||
let resp = configuration.client.execute(req).await?;
|
||||
|
||||
let status = resp.status();
|
||||
let content_type = resp
|
||||
.headers()
|
||||
.get("content-type")
|
||||
.and_then(|v| v.to_str().ok())
|
||||
.unwrap_or("application/octet-stream");
|
||||
let content_type = super::ContentType::from(content_type);
|
||||
|
||||
if !status.is_client_error() && !status.is_server_error() {
|
||||
let content = resp.text().await?;
|
||||
match content_type {
|
||||
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
|
||||
ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::BlockUploadedResponse`"))),
|
||||
ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::BlockUploadedResponse`")))),
|
||||
}
|
||||
} else {
|
||||
let content = resp.text().await?;
|
||||
let entity: Option<UploadBlockHandlerError> = serde_json::from_str(&content).ok();
|
||||
Err(Error::ResponseError(ResponseContent { status, content, entity }))
|
||||
}
|
||||
}
|
||||
|
||||
/// Returns a list of missing blocks.
|
||||
pub async fn verify_blocks_handler(configuration: &configuration::Configuration, verify_blocks_request: models::VerifyBlocksRequest) -> Result<models::VerifyBlocksResponse, Error<VerifyBlocksHandlerError>> {
|
||||
// add a prefix to parameters to efficiently prevent name collisions
|
||||
let p_verify_blocks_request = verify_blocks_request;
|
||||
|
||||
let uri_str = format!("{}/api/v1/block/verify", configuration.base_path);
|
||||
let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
|
||||
|
||||
if let Some(ref user_agent) = configuration.user_agent {
|
||||
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
|
||||
}
|
||||
req_builder = req_builder.json(&p_verify_blocks_request);
|
||||
|
||||
let req = req_builder.build()?;
|
||||
let resp = configuration.client.execute(req).await?;
|
||||
|
||||
let status = resp.status();
|
||||
let content_type = resp
|
||||
.headers()
|
||||
.get("content-type")
|
||||
.and_then(|v| v.to_str().ok())
|
||||
.unwrap_or("application/octet-stream");
|
||||
let content_type = super::ContentType::from(content_type);
|
||||
|
||||
if !status.is_client_error() && !status.is_server_error() {
|
||||
let content = resp.text().await?;
|
||||
match content_type {
|
||||
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
|
||||
ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::VerifyBlocksResponse`"))),
|
||||
ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::VerifyBlocksResponse`")))),
|
||||
}
|
||||
} else {
|
||||
let content = resp.text().await?;
|
||||
let entity: Option<VerifyBlocksHandlerError> = serde_json::from_str(&content).ok();
|
||||
Err(Error::ResponseError(ResponseContent { status, content, entity }))
|
||||
}
|
||||
}
|
||||
|
51
rfs-client/openapi/src/apis/configuration.rs
Normal file
51
rfs-client/openapi/src/apis/configuration.rs
Normal file
@@ -0,0 +1,51 @@
|
||||
/*
|
||||
* rfs
|
||||
*
|
||||
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
||||
*
|
||||
* The version of the OpenAPI document: 0.2.0
|
||||
*
|
||||
* Generated by: https://openapi-generator.tech
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct Configuration {
|
||||
pub base_path: String,
|
||||
pub user_agent: Option<String>,
|
||||
pub client: reqwest::Client,
|
||||
pub basic_auth: Option<BasicAuth>,
|
||||
pub oauth_access_token: Option<String>,
|
||||
pub bearer_access_token: Option<String>,
|
||||
pub api_key: Option<ApiKey>,
|
||||
}
|
||||
|
||||
pub type BasicAuth = (String, Option<String>);
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct ApiKey {
|
||||
pub prefix: Option<String>,
|
||||
pub key: String,
|
||||
}
|
||||
|
||||
|
||||
impl Configuration {
|
||||
pub fn new() -> Configuration {
|
||||
Configuration::default()
|
||||
}
|
||||
}
|
||||
|
||||
impl Default for Configuration {
|
||||
fn default() -> Self {
|
||||
Configuration {
|
||||
base_path: "http://localhost".to_owned(),
|
||||
user_agent: Some("OpenAPI-Generator/0.2.0/rust".to_owned()),
|
||||
client: reqwest::Client::new(),
|
||||
basic_auth: None,
|
||||
oauth_access_token: None,
|
||||
bearer_access_token: None,
|
||||
api_key: None,
|
||||
}
|
||||
}
|
||||
}
|
106
rfs-client/openapi/src/apis/file_management_api.rs
Normal file
106
rfs-client/openapi/src/apis/file_management_api.rs
Normal file
@@ -0,0 +1,106 @@
|
||||
/*
|
||||
* rfs
|
||||
*
|
||||
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
||||
*
|
||||
* The version of the OpenAPI document: 0.2.0
|
||||
*
|
||||
* Generated by: https://openapi-generator.tech
|
||||
*/
|
||||
|
||||
|
||||
use reqwest;
|
||||
use serde::{Deserialize, Serialize, de::Error as _};
|
||||
use crate::{apis::ResponseContent, models};
|
||||
use super::{Error, configuration, ContentType};
|
||||
|
||||
|
||||
/// struct for typed errors of method [`get_file_handler`]
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[serde(untagged)]
|
||||
pub enum GetFileHandlerError {
|
||||
Status404(models::ResponseError),
|
||||
Status500(models::ResponseError),
|
||||
UnknownValue(serde_json::Value),
|
||||
}
|
||||
|
||||
/// struct for typed errors of method [`upload_file_handler`]
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[serde(untagged)]
|
||||
pub enum UploadFileHandlerError {
|
||||
Status400(models::ResponseError),
|
||||
Status500(models::ResponseError),
|
||||
UnknownValue(serde_json::Value),
|
||||
}
|
||||
|
||||
|
||||
/// The file will be reconstructed from its blocks.
|
||||
pub async fn get_file_handler(configuration: &configuration::Configuration, hash: &str, file_download_request: models::FileDownloadRequest) -> Result<reqwest::Response, Error<GetFileHandlerError>> {
|
||||
// add a prefix to parameters to efficiently prevent name collisions
|
||||
let p_hash = hash;
|
||||
let p_file_download_request = file_download_request;
|
||||
|
||||
let uri_str = format!("{}/api/v1/file/{hash}", configuration.base_path, hash=crate::apis::urlencode(p_hash));
|
||||
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
|
||||
|
||||
if let Some(ref user_agent) = configuration.user_agent {
|
||||
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
|
||||
}
|
||||
req_builder = req_builder.json(&p_file_download_request);
|
||||
|
||||
let req = req_builder.build()?;
|
||||
let resp = configuration.client.execute(req).await?;
|
||||
|
||||
let status = resp.status();
|
||||
|
||||
if !status.is_client_error() && !status.is_server_error() {
|
||||
Ok(resp)
|
||||
} else {
|
||||
let content = resp.text().await?;
|
||||
let entity: Option<GetFileHandlerError> = serde_json::from_str(&content).ok();
|
||||
Err(Error::ResponseError(ResponseContent { status, content, entity }))
|
||||
}
|
||||
}
|
||||
|
||||
/// The file will be split into blocks and stored in the database.
|
||||
pub async fn upload_file_handler(configuration: &configuration::Configuration, body: std::path::PathBuf) -> Result<models::FileUploadResponse, Error<UploadFileHandlerError>> {
|
||||
// add a prefix to parameters to efficiently prevent name collisions
|
||||
let p_body = body;
|
||||
|
||||
let uri_str = format!("{}/api/v1/file", configuration.base_path);
|
||||
let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
|
||||
|
||||
if let Some(ref user_agent) = configuration.user_agent {
|
||||
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
|
||||
}
|
||||
if let Some(ref token) = configuration.bearer_access_token {
|
||||
req_builder = req_builder.bearer_auth(token.to_owned());
|
||||
};
|
||||
let file_content = std::fs::read(&p_body).map_err(|e| Error::Io(e))?;
|
||||
req_builder = req_builder.body(file_content);
|
||||
|
||||
let req = req_builder.build()?;
|
||||
let resp = configuration.client.execute(req).await?;
|
||||
|
||||
let status = resp.status();
|
||||
let content_type = resp
|
||||
.headers()
|
||||
.get("content-type")
|
||||
.and_then(|v| v.to_str().ok())
|
||||
.unwrap_or("application/octet-stream");
|
||||
let content_type = super::ContentType::from(content_type);
|
||||
|
||||
if !status.is_client_error() && !status.is_server_error() {
|
||||
let content = resp.text().await?;
|
||||
match content_type {
|
||||
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
|
||||
ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::FileUploadResponse`"))),
|
||||
ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::FileUploadResponse`")))),
|
||||
}
|
||||
} else {
|
||||
let content = resp.text().await?;
|
||||
let entity: Option<UploadFileHandlerError> = serde_json::from_str(&content).ok();
|
||||
Err(Error::ResponseError(ResponseContent { status, content, entity }))
|
||||
}
|
||||
}
|
||||
|
244
rfs-client/openapi/src/apis/flist_management_api.rs
Normal file
244
rfs-client/openapi/src/apis/flist_management_api.rs
Normal file
@@ -0,0 +1,244 @@
|
||||
/*
|
||||
* rfs
|
||||
*
|
||||
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
||||
*
|
||||
* The version of the OpenAPI document: 0.2.0
|
||||
*
|
||||
* Generated by: https://openapi-generator.tech
|
||||
*/
|
||||
|
||||
|
||||
use reqwest;
|
||||
use serde::{Deserialize, Serialize, de::Error as _};
|
||||
use crate::{apis::ResponseContent, models};
|
||||
use super::{Error, configuration, ContentType};
|
||||
|
||||
|
||||
/// struct for typed errors of method [`create_flist_handler`]
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[serde(untagged)]
|
||||
pub enum CreateFlistHandlerError {
|
||||
Status401(models::ResponseError),
|
||||
Status403(models::ResponseError),
|
||||
Status409(models::ResponseError),
|
||||
Status500(models::ResponseError),
|
||||
UnknownValue(serde_json::Value),
|
||||
}
|
||||
|
||||
/// struct for typed errors of method [`get_flist_state_handler`]
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[serde(untagged)]
|
||||
pub enum GetFlistStateHandlerError {
|
||||
Status401(models::ResponseError),
|
||||
Status403(models::ResponseError),
|
||||
Status404(models::ResponseError),
|
||||
Status500(models::ResponseError),
|
||||
UnknownValue(serde_json::Value),
|
||||
}
|
||||
|
||||
/// struct for typed errors of method [`list_flists_handler`]
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[serde(untagged)]
|
||||
pub enum ListFlistsHandlerError {
|
||||
Status401(models::ResponseError),
|
||||
Status403(models::ResponseError),
|
||||
Status500(models::ResponseError),
|
||||
UnknownValue(serde_json::Value),
|
||||
}
|
||||
|
||||
/// struct for typed errors of method [`preview_flist_handler`]
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[serde(untagged)]
|
||||
pub enum PreviewFlistHandlerError {
|
||||
Status400(models::ResponseError),
|
||||
Status401(models::ResponseError),
|
||||
Status403(models::ResponseError),
|
||||
Status500(models::ResponseError),
|
||||
UnknownValue(serde_json::Value),
|
||||
}
|
||||
|
||||
/// struct for typed errors of method [`serve_flists`]
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[serde(untagged)]
|
||||
pub enum ServeFlistsError {
|
||||
Status404(models::ResponseError),
|
||||
Status500(models::ResponseError),
|
||||
UnknownValue(serde_json::Value),
|
||||
}
|
||||
|
||||
|
||||
pub async fn create_flist_handler(configuration: &configuration::Configuration, flist_body: models::FlistBody) -> Result<models::Job, Error<CreateFlistHandlerError>> {
|
||||
// add a prefix to parameters to efficiently prevent name collisions
|
||||
let p_flist_body = flist_body;
|
||||
|
||||
let uri_str = format!("{}/api/v1/fl", configuration.base_path);
|
||||
let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
|
||||
|
||||
if let Some(ref user_agent) = configuration.user_agent {
|
||||
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
|
||||
}
|
||||
if let Some(ref token) = configuration.bearer_access_token {
|
||||
req_builder = req_builder.bearer_auth(token.to_owned());
|
||||
};
|
||||
req_builder = req_builder.json(&p_flist_body);
|
||||
|
||||
let req = req_builder.build()?;
|
||||
let resp = configuration.client.execute(req).await?;
|
||||
|
||||
let status = resp.status();
|
||||
let content_type = resp
|
||||
.headers()
|
||||
.get("content-type")
|
||||
.and_then(|v| v.to_str().ok())
|
||||
.unwrap_or("application/octet-stream");
|
||||
let content_type = super::ContentType::from(content_type);
|
||||
|
||||
if !status.is_client_error() && !status.is_server_error() {
|
||||
let content = resp.text().await?;
|
||||
match content_type {
|
||||
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
|
||||
ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Job`"))),
|
||||
ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::Job`")))),
|
||||
}
|
||||
} else {
|
||||
let content = resp.text().await?;
|
||||
let entity: Option<CreateFlistHandlerError> = serde_json::from_str(&content).ok();
|
||||
Err(Error::ResponseError(ResponseContent { status, content, entity }))
|
||||
}
|
||||
}
|
||||
|
||||
pub async fn get_flist_state_handler(configuration: &configuration::Configuration, job_id: &str) -> Result<models::FlistStateResponse, Error<GetFlistStateHandlerError>> {
|
||||
// add a prefix to parameters to efficiently prevent name collisions
|
||||
let p_job_id = job_id;
|
||||
|
||||
let uri_str = format!("{}/api/v1/fl/{job_id}", configuration.base_path, job_id=crate::apis::urlencode(p_job_id));
|
||||
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
|
||||
|
||||
if let Some(ref user_agent) = configuration.user_agent {
|
||||
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
|
||||
}
|
||||
if let Some(ref token) = configuration.bearer_access_token {
|
||||
req_builder = req_builder.bearer_auth(token.to_owned());
|
||||
};
|
||||
|
||||
let req = req_builder.build()?;
|
||||
let resp = configuration.client.execute(req).await?;
|
||||
|
||||
let status = resp.status();
|
||||
let content_type = resp
|
||||
.headers()
|
||||
.get("content-type")
|
||||
.and_then(|v| v.to_str().ok())
|
||||
.unwrap_or("application/octet-stream");
|
||||
let content_type = super::ContentType::from(content_type);
|
||||
|
||||
if !status.is_client_error() && !status.is_server_error() {
|
||||
let content = resp.text().await?;
|
||||
match content_type {
|
||||
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
|
||||
ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::FlistStateResponse`"))),
|
||||
ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::FlistStateResponse`")))),
|
||||
}
|
||||
} else {
|
||||
let content = resp.text().await?;
|
||||
let entity: Option<GetFlistStateHandlerError> = serde_json::from_str(&content).ok();
|
||||
Err(Error::ResponseError(ResponseContent { status, content, entity }))
|
||||
}
|
||||
}
|
||||
|
||||
pub async fn list_flists_handler(configuration: &configuration::Configuration, ) -> Result<std::collections::HashMap<String, Vec<models::FileInfo>>, Error<ListFlistsHandlerError>> {
|
||||
|
||||
let uri_str = format!("{}/api/v1/fl", configuration.base_path);
|
||||
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
|
||||
|
||||
if let Some(ref user_agent) = configuration.user_agent {
|
||||
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
|
||||
}
|
||||
|
||||
let req = req_builder.build()?;
|
||||
let resp = configuration.client.execute(req).await?;
|
||||
|
||||
let status = resp.status();
|
||||
let content_type = resp
|
||||
.headers()
|
||||
.get("content-type")
|
||||
.and_then(|v| v.to_str().ok())
|
||||
.unwrap_or("application/octet-stream");
|
||||
let content_type = super::ContentType::from(content_type);
|
||||
|
||||
if !status.is_client_error() && !status.is_server_error() {
|
||||
let content = resp.text().await?;
|
||||
match content_type {
|
||||
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
|
||||
ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `std::collections::HashMap<String, Vec<models::FileInfo>>`"))),
|
||||
ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `std::collections::HashMap<String, Vec<models::FileInfo>>`")))),
|
||||
}
|
||||
} else {
|
||||
let content = resp.text().await?;
|
||||
let entity: Option<ListFlistsHandlerError> = serde_json::from_str(&content).ok();
|
||||
Err(Error::ResponseError(ResponseContent { status, content, entity }))
|
||||
}
|
||||
}
|
||||
|
||||
pub async fn preview_flist_handler(configuration: &configuration::Configuration, flist_path: &str) -> Result<models::PreviewResponse, Error<PreviewFlistHandlerError>> {
|
||||
// add a prefix to parameters to efficiently prevent name collisions
|
||||
let p_flist_path = flist_path;
|
||||
|
||||
let uri_str = format!("{}/api/v1/fl/preview/{flist_path}", configuration.base_path, flist_path=crate::apis::urlencode(p_flist_path));
|
||||
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
|
||||
|
||||
if let Some(ref user_agent) = configuration.user_agent {
|
||||
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
|
||||
}
|
||||
|
||||
let req = req_builder.build()?;
|
||||
let resp = configuration.client.execute(req).await?;
|
||||
|
||||
let status = resp.status();
|
||||
let content_type = resp
|
||||
.headers()
|
||||
.get("content-type")
|
||||
.and_then(|v| v.to_str().ok())
|
||||
.unwrap_or("application/octet-stream");
|
||||
let content_type = super::ContentType::from(content_type);
|
||||
|
||||
if !status.is_client_error() && !status.is_server_error() {
|
||||
let content = resp.text().await?;
|
||||
match content_type {
|
||||
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
|
||||
ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::PreviewResponse`"))),
|
||||
ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::PreviewResponse`")))),
|
||||
}
|
||||
} else {
|
||||
let content = resp.text().await?;
|
||||
let entity: Option<PreviewFlistHandlerError> = serde_json::from_str(&content).ok();
|
||||
Err(Error::ResponseError(ResponseContent { status, content, entity }))
|
||||
}
|
||||
}
|
||||
|
||||
pub async fn serve_flists(configuration: &configuration::Configuration, path: &str) -> Result<reqwest::Response, Error<ServeFlistsError>> {
|
||||
// add a prefix to parameters to efficiently prevent name collisions
|
||||
let p_path = path;
|
||||
|
||||
let uri_str = format!("{}/{path}", configuration.base_path, path=crate::apis::urlencode(p_path));
|
||||
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
|
||||
|
||||
if let Some(ref user_agent) = configuration.user_agent {
|
||||
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
|
||||
}
|
||||
|
||||
let req = req_builder.build()?;
|
||||
let resp = configuration.client.execute(req).await?;
|
||||
|
||||
let status = resp.status();
|
||||
|
||||
if !status.is_client_error() && !status.is_server_error() {
|
||||
Ok(resp)
|
||||
} else {
|
||||
let content = resp.text().await?;
|
||||
let entity: Option<ServeFlistsError> = serde_json::from_str(&content).ok();
|
||||
Err(Error::ResponseError(ResponseContent { status, content, entity }))
|
||||
}
|
||||
}
|
||||
|
63
rfs-client/openapi/src/apis/flist_serving_api.rs
Normal file
63
rfs-client/openapi/src/apis/flist_serving_api.rs
Normal file
@@ -0,0 +1,63 @@
|
||||
/*
|
||||
* rfs
|
||||
*
|
||||
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
||||
*
|
||||
* The version of the OpenAPI document: 0.2.0
|
||||
*
|
||||
* Generated by: https://openapi-generator.tech
|
||||
*/
|
||||
|
||||
|
||||
use reqwest;
|
||||
use serde::{Deserialize, Serialize, de::Error as _};
|
||||
use crate::{apis::ResponseContent, models};
|
||||
use super::{Error, configuration, ContentType};
|
||||
|
||||
|
||||
/// struct for typed errors of method [`serve_flists`]
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[serde(untagged)]
|
||||
pub enum ServeFlistsError {
|
||||
Status404(models::ResponseError),
|
||||
Status500(models::ResponseError),
|
||||
UnknownValue(serde_json::Value),
|
||||
}
|
||||
|
||||
|
||||
pub async fn serve_flists(configuration: &configuration::Configuration, path: &str) -> Result<models::ResponseResult, Error<ServeFlistsError>> {
|
||||
// add a prefix to parameters to efficiently prevent name collisions
|
||||
let p_path = path;
|
||||
|
||||
let uri_str = format!("{}/{path}", configuration.base_path, path=crate::apis::urlencode(p_path));
|
||||
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
|
||||
|
||||
if let Some(ref user_agent) = configuration.user_agent {
|
||||
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
|
||||
}
|
||||
|
||||
let req = req_builder.build()?;
|
||||
let resp = configuration.client.execute(req).await?;
|
||||
|
||||
let status = resp.status();
|
||||
let content_type = resp
|
||||
.headers()
|
||||
.get("content-type")
|
||||
.and_then(|v| v.to_str().ok())
|
||||
.unwrap_or("application/octet-stream");
|
||||
let content_type = super::ContentType::from(content_type);
|
||||
|
||||
if !status.is_client_error() && !status.is_server_error() {
|
||||
let content = resp.text().await?;
|
||||
match content_type {
|
||||
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
|
||||
ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ResponseResult`"))),
|
||||
ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::ResponseResult`")))),
|
||||
}
|
||||
} else {
|
||||
let content = resp.text().await?;
|
||||
let entity: Option<ServeFlistsError> = serde_json::from_str(&content).ok();
|
||||
Err(Error::ResponseError(ResponseContent { status, content, entity }))
|
||||
}
|
||||
}
|
||||
|
121
rfs-client/openapi/src/apis/mod.rs
Normal file
121
rfs-client/openapi/src/apis/mod.rs
Normal file
@@ -0,0 +1,121 @@
|
||||
use std::error;
|
||||
use std::fmt;
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct ResponseContent<T> {
|
||||
pub status: reqwest::StatusCode,
|
||||
pub content: String,
|
||||
pub entity: Option<T>,
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub enum Error<T> {
|
||||
Reqwest(reqwest::Error),
|
||||
Serde(serde_json::Error),
|
||||
Io(std::io::Error),
|
||||
ResponseError(ResponseContent<T>),
|
||||
}
|
||||
|
||||
impl <T> fmt::Display for Error<T> {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
let (module, e) = match self {
|
||||
Error::Reqwest(e) => ("reqwest", e.to_string()),
|
||||
Error::Serde(e) => ("serde", e.to_string()),
|
||||
Error::Io(e) => ("IO", e.to_string()),
|
||||
Error::ResponseError(e) => ("response", format!("status code {}", e.status)),
|
||||
};
|
||||
write!(f, "error in {}: {}", module, e)
|
||||
}
|
||||
}
|
||||
|
||||
impl <T: fmt::Debug> error::Error for Error<T> {
|
||||
fn source(&self) -> Option<&(dyn error::Error + 'static)> {
|
||||
Some(match self {
|
||||
Error::Reqwest(e) => e,
|
||||
Error::Serde(e) => e,
|
||||
Error::Io(e) => e,
|
||||
Error::ResponseError(_) => return None,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
impl <T> From<reqwest::Error> for Error<T> {
|
||||
fn from(e: reqwest::Error) -> Self {
|
||||
Error::Reqwest(e)
|
||||
}
|
||||
}
|
||||
|
||||
impl <T> From<serde_json::Error> for Error<T> {
|
||||
fn from(e: serde_json::Error) -> Self {
|
||||
Error::Serde(e)
|
||||
}
|
||||
}
|
||||
|
||||
impl <T> From<std::io::Error> for Error<T> {
|
||||
fn from(e: std::io::Error) -> Self {
|
||||
Error::Io(e)
|
||||
}
|
||||
}
|
||||
|
||||
pub fn urlencode<T: AsRef<str>>(s: T) -> String {
|
||||
::url::form_urlencoded::byte_serialize(s.as_ref().as_bytes()).collect()
|
||||
}
|
||||
|
||||
pub fn parse_deep_object(prefix: &str, value: &serde_json::Value) -> Vec<(String, String)> {
|
||||
if let serde_json::Value::Object(object) = value {
|
||||
let mut params = vec![];
|
||||
|
||||
for (key, value) in object {
|
||||
match value {
|
||||
serde_json::Value::Object(_) => params.append(&mut parse_deep_object(
|
||||
&format!("{}[{}]", prefix, key),
|
||||
value,
|
||||
)),
|
||||
serde_json::Value::Array(array) => {
|
||||
for (i, value) in array.iter().enumerate() {
|
||||
params.append(&mut parse_deep_object(
|
||||
&format!("{}[{}][{}]", prefix, key, i),
|
||||
value,
|
||||
));
|
||||
}
|
||||
},
|
||||
serde_json::Value::String(s) => params.push((format!("{}[{}]", prefix, key), s.clone())),
|
||||
_ => params.push((format!("{}[{}]", prefix, key), value.to_string())),
|
||||
}
|
||||
}
|
||||
|
||||
return params;
|
||||
}
|
||||
|
||||
unimplemented!("Only objects are supported with style=deepObject")
|
||||
}
|
||||
|
||||
/// Internal use only
|
||||
/// A content type supported by this client.
|
||||
#[allow(dead_code)]
|
||||
enum ContentType {
|
||||
Json,
|
||||
Text,
|
||||
Unsupported(String)
|
||||
}
|
||||
|
||||
impl From<&str> for ContentType {
|
||||
fn from(content_type: &str) -> Self {
|
||||
if content_type.starts_with("application") && content_type.contains("json") {
|
||||
return Self::Json;
|
||||
} else if content_type.starts_with("text/plain") {
|
||||
return Self::Text;
|
||||
} else {
|
||||
return Self::Unsupported(content_type.to_string());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub mod authentication_api;
|
||||
pub mod block_management_api;
|
||||
pub mod file_management_api;
|
||||
pub mod flist_management_api;
|
||||
pub mod system_api;
|
||||
pub mod website_serving_api;
|
||||
|
||||
pub mod configuration;
|
59
rfs-client/openapi/src/apis/system_api.rs
Normal file
59
rfs-client/openapi/src/apis/system_api.rs
Normal file
@@ -0,0 +1,59 @@
|
||||
/*
|
||||
* rfs
|
||||
*
|
||||
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
||||
*
|
||||
* The version of the OpenAPI document: 0.2.0
|
||||
*
|
||||
* Generated by: https://openapi-generator.tech
|
||||
*/
|
||||
|
||||
|
||||
use reqwest;
|
||||
use serde::{Deserialize, Serialize, de::Error as _};
|
||||
use crate::{apis::ResponseContent, models};
|
||||
use super::{Error, configuration, ContentType};
|
||||
|
||||
|
||||
/// struct for typed errors of method [`health_check_handler`]
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[serde(untagged)]
|
||||
pub enum HealthCheckHandlerError {
|
||||
UnknownValue(serde_json::Value),
|
||||
}
|
||||
|
||||
|
||||
pub async fn health_check_handler(configuration: &configuration::Configuration, ) -> Result<models::HealthResponse, Error<HealthCheckHandlerError>> {
|
||||
|
||||
let uri_str = format!("{}/api/v1", configuration.base_path);
|
||||
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
|
||||
|
||||
if let Some(ref user_agent) = configuration.user_agent {
|
||||
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
|
||||
}
|
||||
|
||||
let req = req_builder.build()?;
|
||||
let resp = configuration.client.execute(req).await?;
|
||||
|
||||
let status = resp.status();
|
||||
let content_type = resp
|
||||
.headers()
|
||||
.get("content-type")
|
||||
.and_then(|v| v.to_str().ok())
|
||||
.unwrap_or("application/octet-stream");
|
||||
let content_type = super::ContentType::from(content_type);
|
||||
|
||||
if !status.is_client_error() && !status.is_server_error() {
|
||||
let content = resp.text().await?;
|
||||
match content_type {
|
||||
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
|
||||
ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::HealthResponse`"))),
|
||||
ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::HealthResponse`")))),
|
||||
}
|
||||
} else {
|
||||
let content = resp.text().await?;
|
||||
let entity: Option<HealthCheckHandlerError> = serde_json::from_str(&content).ok();
|
||||
Err(Error::ResponseError(ResponseContent { status, content, entity }))
|
||||
}
|
||||
}
|
||||
|
53
rfs-client/openapi/src/apis/website_serving_api.rs
Normal file
53
rfs-client/openapi/src/apis/website_serving_api.rs
Normal file
@@ -0,0 +1,53 @@
|
||||
/*
|
||||
* rfs
|
||||
*
|
||||
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
||||
*
|
||||
* The version of the OpenAPI document: 0.2.0
|
||||
*
|
||||
* Generated by: https://openapi-generator.tech
|
||||
*/
|
||||
|
||||
|
||||
use reqwest;
|
||||
use serde::{Deserialize, Serialize, de::Error as _};
|
||||
use crate::{apis::ResponseContent, models};
|
||||
use super::{Error, configuration, ContentType};
|
||||
|
||||
|
||||
/// struct for typed errors of method [`serve_website_handler`]
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[serde(untagged)]
|
||||
pub enum ServeWebsiteHandlerError {
|
||||
Status404(models::ResponseError),
|
||||
Status500(models::ResponseError),
|
||||
UnknownValue(serde_json::Value),
|
||||
}
|
||||
|
||||
|
||||
pub async fn serve_website_handler(configuration: &configuration::Configuration, website_hash: &str, path: &str) -> Result<reqwest::Response, Error<ServeWebsiteHandlerError>> {
|
||||
// add a prefix to parameters to efficiently prevent name collisions
|
||||
let p_website_hash = website_hash;
|
||||
let p_path = path;
|
||||
|
||||
let uri_str = format!("{}/api/v1/website/{website_hash}/{path}", configuration.base_path, website_hash=crate::apis::urlencode(p_website_hash), path=crate::apis::urlencode(p_path));
|
||||
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
|
||||
|
||||
if let Some(ref user_agent) = configuration.user_agent {
|
||||
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
|
||||
}
|
||||
|
||||
let req = req_builder.build()?;
|
||||
let resp = configuration.client.execute(req).await?;
|
||||
|
||||
let status = resp.status();
|
||||
|
||||
if !status.is_client_error() && !status.is_server_error() {
|
||||
Ok(resp)
|
||||
} else {
|
||||
let content = resp.text().await?;
|
||||
let entity: Option<ServeWebsiteHandlerError> = serde_json::from_str(&content).ok();
|
||||
Err(Error::ResponseError(ResponseContent { status, content, entity }))
|
||||
}
|
||||
}
|
||||
|
11
rfs-client/openapi/src/lib.rs
Normal file
11
rfs-client/openapi/src/lib.rs
Normal file
@@ -0,0 +1,11 @@
|
||||
#![allow(unused_imports)]
|
||||
#![allow(clippy::too_many_arguments)]
|
||||
|
||||
extern crate serde_repr;
|
||||
extern crate serde;
|
||||
extern crate serde_json;
|
||||
extern crate url;
|
||||
extern crate reqwest;
|
||||
|
||||
pub mod apis;
|
||||
pub mod models;
|
36
rfs-client/openapi/src/models/block.rs
Normal file
36
rfs-client/openapi/src/models/block.rs
Normal file
@@ -0,0 +1,36 @@
|
||||
/*
|
||||
* rfs
|
||||
*
|
||||
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
||||
*
|
||||
* The version of the OpenAPI document: 0.2.0
|
||||
*
|
||||
* Generated by: https://openapi-generator.tech
|
||||
*/
|
||||
|
||||
use crate::models;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
|
||||
pub struct Block {
|
||||
#[serde(rename = "data")]
|
||||
pub data: std::path::PathBuf,
|
||||
#[serde(rename = "hash")]
|
||||
pub hash: String,
|
||||
#[serde(rename = "index")]
|
||||
pub index: i64,
|
||||
#[serde(rename = "size")]
|
||||
pub size: i32,
|
||||
}
|
||||
|
||||
impl Block {
|
||||
pub fn new(data: std::path::PathBuf, hash: String, index: i64, size: i32) -> Block {
|
||||
Block {
|
||||
data,
|
||||
hash,
|
||||
index,
|
||||
size,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
38
rfs-client/openapi/src/models/block_downloads_response.rs
Normal file
38
rfs-client/openapi/src/models/block_downloads_response.rs
Normal file
@@ -0,0 +1,38 @@
|
||||
/*
|
||||
* rfs
|
||||
*
|
||||
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
||||
*
|
||||
* The version of the OpenAPI document: 0.2.0
|
||||
*
|
||||
* Generated by: https://openapi-generator.tech
|
||||
*/
|
||||
|
||||
use crate::models;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
/// BlockDownloadsResponse : Response for block downloads endpoint
|
||||
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
|
||||
pub struct BlockDownloadsResponse {
|
||||
/// Block hash
|
||||
#[serde(rename = "block_hash")]
|
||||
pub block_hash: String,
|
||||
/// Size of the block in bytes
|
||||
#[serde(rename = "block_size")]
|
||||
pub block_size: i64,
|
||||
/// Number of times the block has been downloaded
|
||||
#[serde(rename = "downloads_count")]
|
||||
pub downloads_count: i64,
|
||||
}
|
||||
|
||||
impl BlockDownloadsResponse {
|
||||
/// Response for block downloads endpoint
|
||||
pub fn new(block_hash: String, block_size: i64, downloads_count: i64) -> BlockDownloadsResponse {
|
||||
BlockDownloadsResponse {
|
||||
block_hash,
|
||||
block_size,
|
||||
downloads_count,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
34
rfs-client/openapi/src/models/block_info.rs
Normal file
34
rfs-client/openapi/src/models/block_info.rs
Normal file
@@ -0,0 +1,34 @@
|
||||
/*
|
||||
* rfs
|
||||
*
|
||||
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
||||
*
|
||||
* The version of the OpenAPI document: 0.2.0
|
||||
*
|
||||
* Generated by: https://openapi-generator.tech
|
||||
*/
|
||||
|
||||
use crate::models;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
/// BlockInfo : Block information with hash and index
|
||||
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
|
||||
pub struct BlockInfo {
|
||||
/// Block hash
|
||||
#[serde(rename = "hash")]
|
||||
pub hash: String,
|
||||
/// Block index within the file
|
||||
#[serde(rename = "index")]
|
||||
pub index: i64,
|
||||
}
|
||||
|
||||
impl BlockInfo {
|
||||
/// Block information with hash and index
|
||||
pub fn new(hash: String, index: i64) -> BlockInfo {
|
||||
BlockInfo {
|
||||
hash,
|
||||
index,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
30
rfs-client/openapi/src/models/block_uploaded_response.rs
Normal file
30
rfs-client/openapi/src/models/block_uploaded_response.rs
Normal file
@@ -0,0 +1,30 @@
|
||||
/*
|
||||
* rfs
|
||||
*
|
||||
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
||||
*
|
||||
* The version of the OpenAPI document: 0.2.0
|
||||
*
|
||||
* Generated by: https://openapi-generator.tech
|
||||
*/
|
||||
|
||||
use crate::models;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
|
||||
pub struct BlockUploadedResponse {
|
||||
#[serde(rename = "hash")]
|
||||
pub hash: String,
|
||||
#[serde(rename = "message")]
|
||||
pub message: String,
|
||||
}
|
||||
|
||||
impl BlockUploadedResponse {
|
||||
pub fn new(hash: String, message: String) -> BlockUploadedResponse {
|
||||
BlockUploadedResponse {
|
||||
hash,
|
||||
message,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
30
rfs-client/openapi/src/models/blocks_response.rs
Normal file
30
rfs-client/openapi/src/models/blocks_response.rs
Normal file
@@ -0,0 +1,30 @@
|
||||
/*
|
||||
* rfs
|
||||
*
|
||||
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
||||
*
|
||||
* The version of the OpenAPI document: 0.2.0
|
||||
*
|
||||
* Generated by: https://openapi-generator.tech
|
||||
*/
|
||||
|
||||
use crate::models;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
/// BlocksResponse : Response for blocks by hash endpoint
|
||||
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
|
||||
pub struct BlocksResponse {
|
||||
/// List of blocks with their indices
|
||||
#[serde(rename = "blocks")]
|
||||
pub blocks: Vec<models::BlockInfo>,
|
||||
}
|
||||
|
||||
impl BlocksResponse {
|
||||
/// Response for blocks by hash endpoint
|
||||
pub fn new(blocks: Vec<models::BlockInfo>) -> BlocksResponse {
|
||||
BlocksResponse {
|
||||
blocks,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
30
rfs-client/openapi/src/models/dir_list_template.rs
Normal file
30
rfs-client/openapi/src/models/dir_list_template.rs
Normal file
@@ -0,0 +1,30 @@
|
||||
/*
|
||||
* rfs
|
||||
*
|
||||
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
||||
*
|
||||
* The version of the OpenAPI document: 0.2.0
|
||||
*
|
||||
* Generated by: https://openapi-generator.tech
|
||||
*/
|
||||
|
||||
use crate::models;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
|
||||
pub struct DirListTemplate {
|
||||
#[serde(rename = "cur_path")]
|
||||
pub cur_path: String,
|
||||
#[serde(rename = "lister")]
|
||||
pub lister: Box<models::DirLister>,
|
||||
}
|
||||
|
||||
impl DirListTemplate {
|
||||
pub fn new(cur_path: String, lister: models::DirLister) -> DirListTemplate {
|
||||
DirListTemplate {
|
||||
cur_path,
|
||||
lister: Box::new(lister),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
27
rfs-client/openapi/src/models/dir_lister.rs
Normal file
27
rfs-client/openapi/src/models/dir_lister.rs
Normal file
@@ -0,0 +1,27 @@
|
||||
/*
|
||||
* rfs
|
||||
*
|
||||
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
||||
*
|
||||
* The version of the OpenAPI document: 0.2.0
|
||||
*
|
||||
* Generated by: https://openapi-generator.tech
|
||||
*/
|
||||
|
||||
use crate::models;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
|
||||
pub struct DirLister {
|
||||
#[serde(rename = "files")]
|
||||
pub files: Vec<models::FileInfo>,
|
||||
}
|
||||
|
||||
impl DirLister {
|
||||
pub fn new(files: Vec<models::FileInfo>) -> DirLister {
|
||||
DirLister {
|
||||
files,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
33
rfs-client/openapi/src/models/error_template.rs
Normal file
33
rfs-client/openapi/src/models/error_template.rs
Normal file
@@ -0,0 +1,33 @@
|
||||
/*
|
||||
* rfs
|
||||
*
|
||||
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
||||
*
|
||||
* The version of the OpenAPI document: 0.2.0
|
||||
*
|
||||
* Generated by: https://openapi-generator.tech
|
||||
*/
|
||||
|
||||
use crate::models;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
|
||||
pub struct ErrorTemplate {
|
||||
#[serde(rename = "cur_path")]
|
||||
pub cur_path: String,
|
||||
#[serde(rename = "err")]
|
||||
pub err: Box<models::TemplateErr>,
|
||||
#[serde(rename = "message")]
|
||||
pub message: String,
|
||||
}
|
||||
|
||||
impl ErrorTemplate {
|
||||
pub fn new(cur_path: String, err: models::TemplateErr, message: String) -> ErrorTemplate {
|
||||
ErrorTemplate {
|
||||
cur_path,
|
||||
err: Box::new(err),
|
||||
message,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
30
rfs-client/openapi/src/models/file.rs
Normal file
30
rfs-client/openapi/src/models/file.rs
Normal file
@@ -0,0 +1,30 @@
|
||||
/*
|
||||
* rfs
|
||||
*
|
||||
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
||||
*
|
||||
* The version of the OpenAPI document: 0.2.0
|
||||
*
|
||||
* Generated by: https://openapi-generator.tech
|
||||
*/
|
||||
|
||||
use crate::models;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
|
||||
pub struct File {
|
||||
#[serde(rename = "file_content")]
|
||||
pub file_content: std::path::PathBuf,
|
||||
#[serde(rename = "file_hash")]
|
||||
pub file_hash: String,
|
||||
}
|
||||
|
||||
impl File {
|
||||
pub fn new(file_content: std::path::PathBuf, file_hash: String) -> File {
|
||||
File {
|
||||
file_content,
|
||||
file_hash,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
30
rfs-client/openapi/src/models/file_download_request.rs
Normal file
30
rfs-client/openapi/src/models/file_download_request.rs
Normal file
@@ -0,0 +1,30 @@
|
||||
/*
|
||||
* rfs
|
||||
*
|
||||
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
||||
*
|
||||
* The version of the OpenAPI document: 0.2.0
|
||||
*
|
||||
* Generated by: https://openapi-generator.tech
|
||||
*/
|
||||
|
||||
use crate::models;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
/// FileDownloadRequest : Request for file download with custom filename
|
||||
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
|
||||
pub struct FileDownloadRequest {
|
||||
/// The custom filename to use for download
|
||||
#[serde(rename = "file_name")]
|
||||
pub file_name: String,
|
||||
}
|
||||
|
||||
impl FileDownloadRequest {
|
||||
/// Request for file download with custom filename
|
||||
pub fn new(file_name: String) -> FileDownloadRequest {
|
||||
FileDownloadRequest {
|
||||
file_name,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
42
rfs-client/openapi/src/models/file_info.rs
Normal file
42
rfs-client/openapi/src/models/file_info.rs
Normal file
@@ -0,0 +1,42 @@
|
||||
/*
|
||||
* rfs
|
||||
*
|
||||
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
||||
*
|
||||
* The version of the OpenAPI document: 0.2.0
|
||||
*
|
||||
* Generated by: https://openapi-generator.tech
|
||||
*/
|
||||
|
||||
use crate::models;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
|
||||
pub struct FileInfo {
|
||||
#[serde(rename = "is_file")]
|
||||
pub is_file: bool,
|
||||
#[serde(rename = "last_modified")]
|
||||
pub last_modified: i64,
|
||||
#[serde(rename = "name")]
|
||||
pub name: String,
|
||||
#[serde(rename = "path_uri")]
|
||||
pub path_uri: String,
|
||||
#[serde(rename = "progress")]
|
||||
pub progress: f32,
|
||||
#[serde(rename = "size")]
|
||||
pub size: i64,
|
||||
}
|
||||
|
||||
impl FileInfo {
|
||||
pub fn new(is_file: bool, last_modified: i64, name: String, path_uri: String, progress: f32, size: i64) -> FileInfo {
|
||||
FileInfo {
|
||||
is_file,
|
||||
last_modified,
|
||||
name,
|
||||
path_uri,
|
||||
progress,
|
||||
size,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
34
rfs-client/openapi/src/models/file_upload_response.rs
Normal file
34
rfs-client/openapi/src/models/file_upload_response.rs
Normal file
@@ -0,0 +1,34 @@
|
||||
/*
|
||||
* rfs
|
||||
*
|
||||
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
||||
*
|
||||
* The version of the OpenAPI document: 0.2.0
|
||||
*
|
||||
* Generated by: https://openapi-generator.tech
|
||||
*/
|
||||
|
||||
use crate::models;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
/// FileUploadResponse : Response for file upload
|
||||
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
|
||||
pub struct FileUploadResponse {
|
||||
/// The file hash
|
||||
#[serde(rename = "file_hash")]
|
||||
pub file_hash: String,
|
||||
/// Message indicating success
|
||||
#[serde(rename = "message")]
|
||||
pub message: String,
|
||||
}
|
||||
|
||||
impl FileUploadResponse {
|
||||
/// Response for file upload
|
||||
pub fn new(file_hash: String, message: String) -> FileUploadResponse {
|
||||
FileUploadResponse {
|
||||
file_hash,
|
||||
message,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
48
rfs-client/openapi/src/models/flist_body.rs
Normal file
48
rfs-client/openapi/src/models/flist_body.rs
Normal file
@@ -0,0 +1,48 @@
|
||||
/*
|
||||
* rfs
|
||||
*
|
||||
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
||||
*
|
||||
* The version of the OpenAPI document: 0.2.0
|
||||
*
|
||||
* Generated by: https://openapi-generator.tech
|
||||
*/
|
||||
|
||||
use crate::models;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
|
||||
pub struct FlistBody {
|
||||
#[serde(rename = "auth", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
|
||||
pub auth: Option<Option<String>>,
|
||||
#[serde(rename = "email", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
|
||||
pub email: Option<Option<String>>,
|
||||
#[serde(rename = "identity_token", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
|
||||
pub identity_token: Option<Option<String>>,
|
||||
#[serde(rename = "image_name")]
|
||||
pub image_name: String,
|
||||
#[serde(rename = "password", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
|
||||
pub password: Option<Option<String>>,
|
||||
#[serde(rename = "registry_token", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
|
||||
pub registry_token: Option<Option<String>>,
|
||||
#[serde(rename = "server_address", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
|
||||
pub server_address: Option<Option<String>>,
|
||||
#[serde(rename = "username", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
|
||||
pub username: Option<Option<String>>,
|
||||
}
|
||||
|
||||
impl FlistBody {
|
||||
pub fn new(image_name: String) -> FlistBody {
|
||||
FlistBody {
|
||||
auth: None,
|
||||
email: None,
|
||||
identity_token: None,
|
||||
image_name,
|
||||
password: None,
|
||||
registry_token: None,
|
||||
server_address: None,
|
||||
username: None,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
29
rfs-client/openapi/src/models/flist_state.rs
Normal file
29
rfs-client/openapi/src/models/flist_state.rs
Normal file
@@ -0,0 +1,29 @@
|
||||
/*
|
||||
* rfs
|
||||
*
|
||||
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
||||
*
|
||||
* The version of the OpenAPI document: 0.2.0
|
||||
*
|
||||
* Generated by: https://openapi-generator.tech
|
||||
*/
|
||||
|
||||
use crate::models;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[serde(untagged)]
|
||||
pub enum FlistState {
|
||||
FlistStateAccepted(Box<models::FlistStateAccepted>),
|
||||
FlistStateStarted(Box<models::FlistStateStarted>),
|
||||
FlistStateInProgress(Box<models::FlistStateInProgress>),
|
||||
FlistStateCreated(Box<models::FlistStateCreated>),
|
||||
FlistStateFailed(String),
|
||||
}
|
||||
|
||||
impl Default for FlistState {
|
||||
fn default() -> Self {
|
||||
Self::FlistStateAccepted(Default::default())
|
||||
}
|
||||
}
|
||||
|
27
rfs-client/openapi/src/models/flist_state_accepted.rs
Normal file
27
rfs-client/openapi/src/models/flist_state_accepted.rs
Normal file
@@ -0,0 +1,27 @@
|
||||
/*
|
||||
* rfs
|
||||
*
|
||||
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
||||
*
|
||||
* The version of the OpenAPI document: 0.2.0
|
||||
*
|
||||
* Generated by: https://openapi-generator.tech
|
||||
*/
|
||||
|
||||
use crate::models;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
|
||||
pub struct FlistStateAccepted {
|
||||
#[serde(rename = "Accepted")]
|
||||
pub accepted: String,
|
||||
}
|
||||
|
||||
impl FlistStateAccepted {
|
||||
pub fn new(accepted: String) -> FlistStateAccepted {
|
||||
FlistStateAccepted {
|
||||
accepted,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
27
rfs-client/openapi/src/models/flist_state_created.rs
Normal file
27
rfs-client/openapi/src/models/flist_state_created.rs
Normal file
@@ -0,0 +1,27 @@
|
||||
/*
|
||||
* rfs
|
||||
*
|
||||
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
||||
*
|
||||
* The version of the OpenAPI document: 0.2.0
|
||||
*
|
||||
* Generated by: https://openapi-generator.tech
|
||||
*/
|
||||
|
||||
use crate::models;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
|
||||
pub struct FlistStateCreated {
|
||||
#[serde(rename = "Created")]
|
||||
pub created: String,
|
||||
}
|
||||
|
||||
impl FlistStateCreated {
|
||||
pub fn new(created: String) -> FlistStateCreated {
|
||||
FlistStateCreated {
|
||||
created,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
27
rfs-client/openapi/src/models/flist_state_in_progress.rs
Normal file
27
rfs-client/openapi/src/models/flist_state_in_progress.rs
Normal file
@@ -0,0 +1,27 @@
|
||||
/*
|
||||
* rfs
|
||||
*
|
||||
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
||||
*
|
||||
* The version of the OpenAPI document: 0.2.0
|
||||
*
|
||||
* Generated by: https://openapi-generator.tech
|
||||
*/
|
||||
|
||||
use crate::models;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
|
||||
pub struct FlistStateInProgress {
|
||||
#[serde(rename = "InProgress")]
|
||||
pub in_progress: Box<models::FlistStateInfo>,
|
||||
}
|
||||
|
||||
impl FlistStateInProgress {
|
||||
pub fn new(in_progress: models::FlistStateInfo) -> FlistStateInProgress {
|
||||
FlistStateInProgress {
|
||||
in_progress: Box::new(in_progress),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
30
rfs-client/openapi/src/models/flist_state_info.rs
Normal file
30
rfs-client/openapi/src/models/flist_state_info.rs
Normal file
@@ -0,0 +1,30 @@
|
||||
/*
|
||||
* rfs
|
||||
*
|
||||
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
||||
*
|
||||
* The version of the OpenAPI document: 0.2.0
|
||||
*
|
||||
* Generated by: https://openapi-generator.tech
|
||||
*/
|
||||
|
||||
use crate::models;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
|
||||
pub struct FlistStateInfo {
|
||||
#[serde(rename = "msg")]
|
||||
pub msg: String,
|
||||
#[serde(rename = "progress")]
|
||||
pub progress: f32,
|
||||
}
|
||||
|
||||
impl FlistStateInfo {
|
||||
pub fn new(msg: String, progress: f32) -> FlistStateInfo {
|
||||
FlistStateInfo {
|
||||
msg,
|
||||
progress,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
27
rfs-client/openapi/src/models/flist_state_response.rs
Normal file
27
rfs-client/openapi/src/models/flist_state_response.rs
Normal file
@@ -0,0 +1,27 @@
|
||||
/*
|
||||
* rfs
|
||||
*
|
||||
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
||||
*
|
||||
* The version of the OpenAPI document: 0.2.0
|
||||
*
|
||||
* Generated by: https://openapi-generator.tech
|
||||
*/
|
||||
|
||||
use crate::models;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
|
||||
pub struct FlistStateResponse {
|
||||
#[serde(rename = "flist_state")]
|
||||
pub flist_state: Box<models::FlistState>,
|
||||
}
|
||||
|
||||
impl FlistStateResponse {
|
||||
pub fn new(flist_state: models::FlistState) -> FlistStateResponse {
|
||||
FlistStateResponse {
|
||||
flist_state: Box::new(flist_state),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
27
rfs-client/openapi/src/models/flist_state_started.rs
Normal file
27
rfs-client/openapi/src/models/flist_state_started.rs
Normal file
@@ -0,0 +1,27 @@
|
||||
/*
|
||||
* rfs
|
||||
*
|
||||
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
||||
*
|
||||
* The version of the OpenAPI document: 0.2.0
|
||||
*
|
||||
* Generated by: https://openapi-generator.tech
|
||||
*/
|
||||
|
||||
use crate::models;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
|
||||
pub struct FlistStateStarted {
|
||||
#[serde(rename = "Started")]
|
||||
pub started: String,
|
||||
}
|
||||
|
||||
impl FlistStateStarted {
|
||||
pub fn new(started: String) -> FlistStateStarted {
|
||||
FlistStateStarted {
|
||||
started,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
27
rfs-client/openapi/src/models/health_response.rs
Normal file
27
rfs-client/openapi/src/models/health_response.rs
Normal file
@@ -0,0 +1,27 @@
|
||||
/*
|
||||
* rfs
|
||||
*
|
||||
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
||||
*
|
||||
* The version of the OpenAPI document: 0.2.0
|
||||
*
|
||||
* Generated by: https://openapi-generator.tech
|
||||
*/
|
||||
|
||||
use crate::models;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
|
||||
pub struct HealthResponse {
|
||||
#[serde(rename = "msg")]
|
||||
pub msg: String,
|
||||
}
|
||||
|
||||
impl HealthResponse {
|
||||
pub fn new(msg: String) -> HealthResponse {
|
||||
HealthResponse {
|
||||
msg,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
27
rfs-client/openapi/src/models/job.rs
Normal file
27
rfs-client/openapi/src/models/job.rs
Normal file
@@ -0,0 +1,27 @@
|
||||
/*
|
||||
* rfs
|
||||
*
|
||||
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
||||
*
|
||||
* The version of the OpenAPI document: 0.2.0
|
||||
*
|
||||
* Generated by: https://openapi-generator.tech
|
||||
*/
|
||||
|
||||
use crate::models;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
|
||||
pub struct Job {
|
||||
#[serde(rename = "id")]
|
||||
pub id: String,
|
||||
}
|
||||
|
||||
impl Job {
|
||||
pub fn new(id: String) -> Job {
|
||||
Job {
|
||||
id,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
34
rfs-client/openapi/src/models/list_blocks_params.rs
Normal file
34
rfs-client/openapi/src/models/list_blocks_params.rs
Normal file
@@ -0,0 +1,34 @@
|
||||
/*
|
||||
* rfs
|
||||
*
|
||||
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
||||
*
|
||||
* The version of the OpenAPI document: 0.2.0
|
||||
*
|
||||
* Generated by: https://openapi-generator.tech
|
||||
*/
|
||||
|
||||
use crate::models;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
/// ListBlocksParams : Query parameters for listing blocks
|
||||
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
|
||||
pub struct ListBlocksParams {
|
||||
/// Page number (1-indexed)
|
||||
#[serde(rename = "page", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
|
||||
pub page: Option<Option<i32>>,
|
||||
/// Number of items per page
|
||||
#[serde(rename = "per_page", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
|
||||
pub per_page: Option<Option<i32>>,
|
||||
}
|
||||
|
||||
impl ListBlocksParams {
|
||||
/// Query parameters for listing blocks
|
||||
pub fn new() -> ListBlocksParams {
|
||||
ListBlocksParams {
|
||||
page: None,
|
||||
per_page: None,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
42
rfs-client/openapi/src/models/list_blocks_response.rs
Normal file
42
rfs-client/openapi/src/models/list_blocks_response.rs
Normal file
@@ -0,0 +1,42 @@
|
||||
/*
|
||||
* rfs
|
||||
*
|
||||
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
||||
*
|
||||
* The version of the OpenAPI document: 0.2.0
|
||||
*
|
||||
* Generated by: https://openapi-generator.tech
|
||||
*/
|
||||
|
||||
use crate::models;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
/// ListBlocksResponse : Response for listing blocks
|
||||
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
|
||||
pub struct ListBlocksResponse {
|
||||
/// List of block hashes
|
||||
#[serde(rename = "blocks")]
|
||||
pub blocks: Vec<String>,
|
||||
/// Current page number
|
||||
#[serde(rename = "page")]
|
||||
pub page: i32,
|
||||
/// Number of items per page
|
||||
#[serde(rename = "per_page")]
|
||||
pub per_page: i32,
|
||||
/// Total number of blocks
|
||||
#[serde(rename = "total")]
|
||||
pub total: i64,
|
||||
}
|
||||
|
||||
impl ListBlocksResponse {
|
||||
/// Response for listing blocks
|
||||
pub fn new(blocks: Vec<String>, page: i32, per_page: i32, total: i64) -> ListBlocksResponse {
|
||||
ListBlocksResponse {
|
||||
blocks,
|
||||
page,
|
||||
per_page,
|
||||
total,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
102
rfs-client/openapi/src/models/mod.rs
Normal file
102
rfs-client/openapi/src/models/mod.rs
Normal file
@@ -0,0 +1,102 @@
|
||||
pub mod block_downloads_response;
|
||||
pub use self::block_downloads_response::BlockDownloadsResponse;
|
||||
pub mod block_info;
|
||||
pub use self::block_info::BlockInfo;
|
||||
pub mod block_uploaded_response;
|
||||
pub use self::block_uploaded_response::BlockUploadedResponse;
|
||||
pub mod blocks_response;
|
||||
pub use self::blocks_response::BlocksResponse;
|
||||
pub mod dir_list_template;
|
||||
pub use self::dir_list_template::DirListTemplate;
|
||||
pub mod dir_lister;
|
||||
pub use self::dir_lister::DirLister;
|
||||
pub mod error_template;
|
||||
pub use self::error_template::ErrorTemplate;
|
||||
pub mod file_download_request;
|
||||
pub use self::file_download_request::FileDownloadRequest;
|
||||
pub mod file_info;
|
||||
pub use self::file_info::FileInfo;
|
||||
pub mod file_upload_response;
|
||||
pub use self::file_upload_response::FileUploadResponse;
|
||||
pub mod flist_body;
|
||||
pub use self::flist_body::FlistBody;
|
||||
pub mod flist_state;
|
||||
pub use self::flist_state::FlistState;
|
||||
pub mod flist_state_accepted;
|
||||
pub use self::flist_state_accepted::FlistStateAccepted;
|
||||
pub mod flist_state_created;
|
||||
pub use self::flist_state_created::FlistStateCreated;
|
||||
pub mod flist_state_in_progress;
|
||||
pub use self::flist_state_in_progress::FlistStateInProgress;
|
||||
pub mod flist_state_info;
|
||||
pub use self::flist_state_info::FlistStateInfo;
|
||||
pub mod flist_state_response;
|
||||
pub use self::flist_state_response::FlistStateResponse;
|
||||
pub mod flist_state_started;
|
||||
pub use self::flist_state_started::FlistStateStarted;
|
||||
pub mod health_response;
|
||||
pub use self::health_response::HealthResponse;
|
||||
pub mod job;
|
||||
pub use self::job::Job;
|
||||
pub mod list_blocks_params;
|
||||
pub use self::list_blocks_params::ListBlocksParams;
|
||||
pub mod list_blocks_response;
|
||||
pub use self::list_blocks_response::ListBlocksResponse;
|
||||
pub mod preview_response;
|
||||
pub use self::preview_response::PreviewResponse;
|
||||
pub mod response_error;
|
||||
pub use self::response_error::ResponseError;
|
||||
pub mod response_error_bad_request;
|
||||
pub use self::response_error_bad_request::ResponseErrorBadRequest;
|
||||
pub mod response_error_conflict;
|
||||
pub use self::response_error_conflict::ResponseErrorConflict;
|
||||
pub mod response_error_forbidden;
|
||||
pub use self::response_error_forbidden::ResponseErrorForbidden;
|
||||
pub mod response_error_not_found;
|
||||
pub use self::response_error_not_found::ResponseErrorNotFound;
|
||||
pub mod response_error_template_error;
|
||||
pub use self::response_error_template_error::ResponseErrorTemplateError;
|
||||
pub mod response_error_unauthorized;
|
||||
pub use self::response_error_unauthorized::ResponseErrorUnauthorized;
|
||||
pub mod response_result;
|
||||
pub use self::response_result::ResponseResult;
|
||||
pub mod response_result_block_uploaded;
|
||||
pub use self::response_result_block_uploaded::ResponseResultBlockUploaded;
|
||||
pub mod response_result_dir_template;
|
||||
pub use self::response_result_dir_template::ResponseResultDirTemplate;
|
||||
pub mod response_result_file_uploaded;
|
||||
pub use self::response_result_file_uploaded::ResponseResultFileUploaded;
|
||||
pub mod response_result_flist_created;
|
||||
pub use self::response_result_flist_created::ResponseResultFlistCreated;
|
||||
pub mod response_result_flist_state;
|
||||
pub use self::response_result_flist_state::ResponseResultFlistState;
|
||||
pub mod response_result_flists;
|
||||
pub use self::response_result_flists::ResponseResultFlists;
|
||||
pub mod response_result_preview_flist;
|
||||
pub use self::response_result_preview_flist::ResponseResultPreviewFlist;
|
||||
pub mod response_result_res;
|
||||
pub use self::response_result_res::ResponseResultRes;
|
||||
pub mod response_result_signed_in;
|
||||
pub use self::response_result_signed_in::ResponseResultSignedIn;
|
||||
pub mod sign_in_body;
|
||||
pub use self::sign_in_body::SignInBody;
|
||||
pub mod sign_in_response;
|
||||
pub use self::sign_in_response::SignInResponse;
|
||||
pub mod template_err;
|
||||
pub use self::template_err::TemplateErr;
|
||||
pub mod template_err_bad_request;
|
||||
pub use self::template_err_bad_request::TemplateErrBadRequest;
|
||||
pub mod template_err_internal_server_error;
|
||||
pub use self::template_err_internal_server_error::TemplateErrInternalServerError;
|
||||
pub mod template_err_not_found;
|
||||
pub use self::template_err_not_found::TemplateErrNotFound;
|
||||
pub mod upload_block_params;
|
||||
pub use self::upload_block_params::UploadBlockParams;
|
||||
pub mod user_blocks_response;
|
||||
pub use self::user_blocks_response::UserBlocksResponse;
|
||||
pub mod verify_block;
|
||||
pub use self::verify_block::VerifyBlock;
|
||||
pub mod verify_blocks_request;
|
||||
pub use self::verify_blocks_request::VerifyBlocksRequest;
|
||||
pub mod verify_blocks_response;
|
||||
pub use self::verify_blocks_response::VerifyBlocksResponse;
|
33
rfs-client/openapi/src/models/preview_response.rs
Normal file
33
rfs-client/openapi/src/models/preview_response.rs
Normal file
@@ -0,0 +1,33 @@
|
||||
/*
|
||||
* rfs
|
||||
*
|
||||
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
||||
*
|
||||
* The version of the OpenAPI document: 0.2.0
|
||||
*
|
||||
* Generated by: https://openapi-generator.tech
|
||||
*/
|
||||
|
||||
use crate::models;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
|
||||
pub struct PreviewResponse {
|
||||
#[serde(rename = "checksum")]
|
||||
pub checksum: String,
|
||||
#[serde(rename = "content")]
|
||||
pub content: Vec<String>,
|
||||
#[serde(rename = "metadata")]
|
||||
pub metadata: String,
|
||||
}
|
||||
|
||||
impl PreviewResponse {
|
||||
pub fn new(checksum: String, content: Vec<String>, metadata: String) -> PreviewResponse {
|
||||
PreviewResponse {
|
||||
checksum,
|
||||
content,
|
||||
metadata,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
31
rfs-client/openapi/src/models/response_error.rs
Normal file
31
rfs-client/openapi/src/models/response_error.rs
Normal file
@@ -0,0 +1,31 @@
|
||||
/*
|
||||
* rfs
|
||||
*
|
||||
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
||||
*
|
||||
* The version of the OpenAPI document: 0.2.0
|
||||
*
|
||||
* Generated by: https://openapi-generator.tech
|
||||
*/
|
||||
|
||||
use crate::models;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[serde(untagged)]
|
||||
pub enum ResponseError {
|
||||
ResponseErrorInternalServerError(String),
|
||||
ResponseErrorConflict(Box<models::ResponseErrorConflict>),
|
||||
ResponseErrorNotFound(Box<models::ResponseErrorNotFound>),
|
||||
ResponseErrorUnauthorized(Box<models::ResponseErrorUnauthorized>),
|
||||
ResponseErrorBadRequest(Box<models::ResponseErrorBadRequest>),
|
||||
ResponseErrorForbidden(Box<models::ResponseErrorForbidden>),
|
||||
ResponseErrorTemplateError(Box<models::ResponseErrorTemplateError>),
|
||||
}
|
||||
|
||||
impl Default for ResponseError {
|
||||
fn default() -> Self {
|
||||
Self::ResponseErrorInternalServerError(Default::default())
|
||||
}
|
||||
}
|
||||
|
27
rfs-client/openapi/src/models/response_error_bad_request.rs
Normal file
27
rfs-client/openapi/src/models/response_error_bad_request.rs
Normal file
@@ -0,0 +1,27 @@
|
||||
/*
|
||||
* rfs
|
||||
*
|
||||
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
||||
*
|
||||
* The version of the OpenAPI document: 0.2.0
|
||||
*
|
||||
* Generated by: https://openapi-generator.tech
|
||||
*/
|
||||
|
||||
use crate::models;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
|
||||
pub struct ResponseErrorBadRequest {
|
||||
#[serde(rename = "BadRequest")]
|
||||
pub bad_request: String,
|
||||
}
|
||||
|
||||
impl ResponseErrorBadRequest {
|
||||
pub fn new(bad_request: String) -> ResponseErrorBadRequest {
|
||||
ResponseErrorBadRequest {
|
||||
bad_request,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
27
rfs-client/openapi/src/models/response_error_conflict.rs
Normal file
27
rfs-client/openapi/src/models/response_error_conflict.rs
Normal file
@@ -0,0 +1,27 @@
|
||||
/*
|
||||
* rfs
|
||||
*
|
||||
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
||||
*
|
||||
* The version of the OpenAPI document: 0.2.0
|
||||
*
|
||||
* Generated by: https://openapi-generator.tech
|
||||
*/
|
||||
|
||||
use crate::models;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
|
||||
pub struct ResponseErrorConflict {
|
||||
#[serde(rename = "Conflict")]
|
||||
pub conflict: String,
|
||||
}
|
||||
|
||||
impl ResponseErrorConflict {
|
||||
pub fn new(conflict: String) -> ResponseErrorConflict {
|
||||
ResponseErrorConflict {
|
||||
conflict,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
27
rfs-client/openapi/src/models/response_error_forbidden.rs
Normal file
27
rfs-client/openapi/src/models/response_error_forbidden.rs
Normal file
@@ -0,0 +1,27 @@
|
||||
/*
|
||||
* rfs
|
||||
*
|
||||
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
||||
*
|
||||
* The version of the OpenAPI document: 0.2.0
|
||||
*
|
||||
* Generated by: https://openapi-generator.tech
|
||||
*/
|
||||
|
||||
use crate::models;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
|
||||
pub struct ResponseErrorForbidden {
|
||||
#[serde(rename = "Forbidden")]
|
||||
pub forbidden: String,
|
||||
}
|
||||
|
||||
impl ResponseErrorForbidden {
|
||||
pub fn new(forbidden: String) -> ResponseErrorForbidden {
|
||||
ResponseErrorForbidden {
|
||||
forbidden,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
27
rfs-client/openapi/src/models/response_error_not_found.rs
Normal file
27
rfs-client/openapi/src/models/response_error_not_found.rs
Normal file
@@ -0,0 +1,27 @@
|
||||
/*
|
||||
* rfs
|
||||
*
|
||||
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
||||
*
|
||||
* The version of the OpenAPI document: 0.2.0
|
||||
*
|
||||
* Generated by: https://openapi-generator.tech
|
||||
*/
|
||||
|
||||
use crate::models;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
|
||||
pub struct ResponseErrorNotFound {
|
||||
#[serde(rename = "NotFound")]
|
||||
pub not_found: String,
|
||||
}
|
||||
|
||||
impl ResponseErrorNotFound {
|
||||
pub fn new(not_found: String) -> ResponseErrorNotFound {
|
||||
ResponseErrorNotFound {
|
||||
not_found,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -0,0 +1,27 @@
|
||||
/*
|
||||
* rfs
|
||||
*
|
||||
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
||||
*
|
||||
* The version of the OpenAPI document: 0.2.0
|
||||
*
|
||||
* Generated by: https://openapi-generator.tech
|
||||
*/
|
||||
|
||||
use crate::models;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
|
||||
pub struct ResponseErrorTemplateError {
|
||||
#[serde(rename = "TemplateError")]
|
||||
pub template_error: Box<models::ErrorTemplate>,
|
||||
}
|
||||
|
||||
impl ResponseErrorTemplateError {
|
||||
pub fn new(template_error: models::ErrorTemplate) -> ResponseErrorTemplateError {
|
||||
ResponseErrorTemplateError {
|
||||
template_error: Box::new(template_error),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
27
rfs-client/openapi/src/models/response_error_unauthorized.rs
Normal file
27
rfs-client/openapi/src/models/response_error_unauthorized.rs
Normal file
@@ -0,0 +1,27 @@
|
||||
/*
|
||||
* rfs
|
||||
*
|
||||
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
||||
*
|
||||
* The version of the OpenAPI document: 0.2.0
|
||||
*
|
||||
* Generated by: https://openapi-generator.tech
|
||||
*/
|
||||
|
||||
use crate::models;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
|
||||
pub struct ResponseErrorUnauthorized {
|
||||
#[serde(rename = "Unauthorized")]
|
||||
pub unauthorized: String,
|
||||
}
|
||||
|
||||
impl ResponseErrorUnauthorized {
|
||||
pub fn new(unauthorized: String) -> ResponseErrorUnauthorized {
|
||||
ResponseErrorUnauthorized {
|
||||
unauthorized,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
34
rfs-client/openapi/src/models/response_result.rs
Normal file
34
rfs-client/openapi/src/models/response_result.rs
Normal file
@@ -0,0 +1,34 @@
|
||||
/*
|
||||
* rfs
|
||||
*
|
||||
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
||||
*
|
||||
* The version of the OpenAPI document: 0.2.0
|
||||
*
|
||||
* Generated by: https://openapi-generator.tech
|
||||
*/
|
||||
|
||||
use crate::models;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[serde(untagged)]
|
||||
pub enum ResponseResult {
|
||||
ResponseResultHealth(String),
|
||||
ResponseResultFlistCreated(Box<models::ResponseResultFlistCreated>),
|
||||
ResponseResultFlistState(Box<models::ResponseResultFlistState>),
|
||||
ResponseResultFlists(Box<models::ResponseResultFlists>),
|
||||
ResponseResultPreviewFlist(Box<models::ResponseResultPreviewFlist>),
|
||||
ResponseResultSignedIn(Box<models::ResponseResultSignedIn>),
|
||||
ResponseResultDirTemplate(Box<models::ResponseResultDirTemplate>),
|
||||
ResponseResultBlockUploaded(Box<models::ResponseResultBlockUploaded>),
|
||||
ResponseResultFileUploaded(Box<models::ResponseResultFileUploaded>),
|
||||
ResponseResultRes(Box<models::ResponseResultRes>),
|
||||
}
|
||||
|
||||
impl Default for ResponseResult {
|
||||
fn default() -> Self {
|
||||
Self::ResponseResultHealth(Default::default())
|
||||
}
|
||||
}
|
||||
|
@@ -0,0 +1,27 @@
|
||||
/*
|
||||
* rfs
|
||||
*
|
||||
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
||||
*
|
||||
* The version of the OpenAPI document: 0.2.0
|
||||
*
|
||||
* Generated by: https://openapi-generator.tech
|
||||
*/
|
||||
|
||||
use crate::models;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
|
||||
pub struct ResponseResultBlockUploaded {
|
||||
#[serde(rename = "BlockUploaded")]
|
||||
pub block_uploaded: String,
|
||||
}
|
||||
|
||||
impl ResponseResultBlockUploaded {
|
||||
pub fn new(block_uploaded: String) -> ResponseResultBlockUploaded {
|
||||
ResponseResultBlockUploaded {
|
||||
block_uploaded,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -0,0 +1,27 @@
|
||||
/*
|
||||
* rfs
|
||||
*
|
||||
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
||||
*
|
||||
* The version of the OpenAPI document: 0.2.0
|
||||
*
|
||||
* Generated by: https://openapi-generator.tech
|
||||
*/
|
||||
|
||||
use crate::models;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
|
||||
pub struct ResponseResultDirTemplate {
|
||||
#[serde(rename = "DirTemplate")]
|
||||
pub dir_template: Box<models::DirListTemplate>,
|
||||
}
|
||||
|
||||
impl ResponseResultDirTemplate {
|
||||
pub fn new(dir_template: models::DirListTemplate) -> ResponseResultDirTemplate {
|
||||
ResponseResultDirTemplate {
|
||||
dir_template: Box::new(dir_template),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -0,0 +1,27 @@
|
||||
/*
|
||||
* rfs
|
||||
*
|
||||
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
||||
*
|
||||
* The version of the OpenAPI document: 0.2.0
|
||||
*
|
||||
* Generated by: https://openapi-generator.tech
|
||||
*/
|
||||
|
||||
use crate::models;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
|
||||
pub struct ResponseResultFileUploaded {
|
||||
#[serde(rename = "FileUploaded")]
|
||||
pub file_uploaded: Box<models::FileUploadResponse>,
|
||||
}
|
||||
|
||||
impl ResponseResultFileUploaded {
|
||||
pub fn new(file_uploaded: models::FileUploadResponse) -> ResponseResultFileUploaded {
|
||||
ResponseResultFileUploaded {
|
||||
file_uploaded: Box::new(file_uploaded),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -0,0 +1,27 @@
|
||||
/*
|
||||
* rfs
|
||||
*
|
||||
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
||||
*
|
||||
* The version of the OpenAPI document: 0.2.0
|
||||
*
|
||||
* Generated by: https://openapi-generator.tech
|
||||
*/
|
||||
|
||||
use crate::models;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
|
||||
pub struct ResponseResultFlistCreated {
|
||||
#[serde(rename = "FlistCreated")]
|
||||
pub flist_created: Box<models::Job>,
|
||||
}
|
||||
|
||||
impl ResponseResultFlistCreated {
|
||||
pub fn new(flist_created: models::Job) -> ResponseResultFlistCreated {
|
||||
ResponseResultFlistCreated {
|
||||
flist_created: Box::new(flist_created),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
27
rfs-client/openapi/src/models/response_result_flist_state.rs
Normal file
27
rfs-client/openapi/src/models/response_result_flist_state.rs
Normal file
@@ -0,0 +1,27 @@
|
||||
/*
|
||||
* rfs
|
||||
*
|
||||
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
||||
*
|
||||
* The version of the OpenAPI document: 0.2.0
|
||||
*
|
||||
* Generated by: https://openapi-generator.tech
|
||||
*/
|
||||
|
||||
use crate::models;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
|
||||
pub struct ResponseResultFlistState {
|
||||
#[serde(rename = "FlistState")]
|
||||
pub flist_state: Box<models::FlistState>,
|
||||
}
|
||||
|
||||
impl ResponseResultFlistState {
|
||||
pub fn new(flist_state: models::FlistState) -> ResponseResultFlistState {
|
||||
ResponseResultFlistState {
|
||||
flist_state: Box::new(flist_state),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
27
rfs-client/openapi/src/models/response_result_flists.rs
Normal file
27
rfs-client/openapi/src/models/response_result_flists.rs
Normal file
@@ -0,0 +1,27 @@
|
||||
/*
|
||||
* rfs
|
||||
*
|
||||
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
||||
*
|
||||
* The version of the OpenAPI document: 0.2.0
|
||||
*
|
||||
* Generated by: https://openapi-generator.tech
|
||||
*/
|
||||
|
||||
use crate::models;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
|
||||
pub struct ResponseResultFlists {
|
||||
#[serde(rename = "Flists")]
|
||||
pub flists: std::collections::HashMap<String, Vec<models::FileInfo>>,
|
||||
}
|
||||
|
||||
impl ResponseResultFlists {
|
||||
pub fn new(flists: std::collections::HashMap<String, Vec<models::FileInfo>>) -> ResponseResultFlists {
|
||||
ResponseResultFlists {
|
||||
flists,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -0,0 +1,27 @@
|
||||
/*
|
||||
* rfs
|
||||
*
|
||||
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
||||
*
|
||||
* The version of the OpenAPI document: 0.2.0
|
||||
*
|
||||
* Generated by: https://openapi-generator.tech
|
||||
*/
|
||||
|
||||
use crate::models;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
|
||||
pub struct ResponseResultPreviewFlist {
|
||||
#[serde(rename = "PreviewFlist")]
|
||||
pub preview_flist: Box<models::PreviewResponse>,
|
||||
}
|
||||
|
||||
impl ResponseResultPreviewFlist {
|
||||
pub fn new(preview_flist: models::PreviewResponse) -> ResponseResultPreviewFlist {
|
||||
ResponseResultPreviewFlist {
|
||||
preview_flist: Box::new(preview_flist),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
27
rfs-client/openapi/src/models/response_result_res.rs
Normal file
27
rfs-client/openapi/src/models/response_result_res.rs
Normal file
@@ -0,0 +1,27 @@
|
||||
/*
|
||||
* rfs
|
||||
*
|
||||
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
||||
*
|
||||
* The version of the OpenAPI document: 0.2.0
|
||||
*
|
||||
* Generated by: https://openapi-generator.tech
|
||||
*/
|
||||
|
||||
use crate::models;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
|
||||
pub struct ResponseResultRes {
|
||||
#[serde(rename = "Res")]
|
||||
pub res: std::path::PathBuf,
|
||||
}
|
||||
|
||||
impl ResponseResultRes {
|
||||
pub fn new(res: std::path::PathBuf) -> ResponseResultRes {
|
||||
ResponseResultRes {
|
||||
res,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
27
rfs-client/openapi/src/models/response_result_signed_in.rs
Normal file
27
rfs-client/openapi/src/models/response_result_signed_in.rs
Normal file
@@ -0,0 +1,27 @@
|
||||
/*
|
||||
* rfs
|
||||
*
|
||||
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
||||
*
|
||||
* The version of the OpenAPI document: 0.2.0
|
||||
*
|
||||
* Generated by: https://openapi-generator.tech
|
||||
*/
|
||||
|
||||
use crate::models;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
|
||||
pub struct ResponseResultSignedIn {
|
||||
#[serde(rename = "SignedIn")]
|
||||
pub signed_in: Box<models::SignInResponse>,
|
||||
}
|
||||
|
||||
impl ResponseResultSignedIn {
|
||||
pub fn new(signed_in: models::SignInResponse) -> ResponseResultSignedIn {
|
||||
ResponseResultSignedIn {
|
||||
signed_in: Box::new(signed_in),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
30
rfs-client/openapi/src/models/sign_in_body.rs
Normal file
30
rfs-client/openapi/src/models/sign_in_body.rs
Normal file
@@ -0,0 +1,30 @@
|
||||
/*
|
||||
* rfs
|
||||
*
|
||||
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
||||
*
|
||||
* The version of the OpenAPI document: 0.2.0
|
||||
*
|
||||
* Generated by: https://openapi-generator.tech
|
||||
*/
|
||||
|
||||
use crate::models;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
|
||||
pub struct SignInBody {
|
||||
#[serde(rename = "password")]
|
||||
pub password: String,
|
||||
#[serde(rename = "username")]
|
||||
pub username: String,
|
||||
}
|
||||
|
||||
impl SignInBody {
|
||||
pub fn new(password: String, username: String) -> SignInBody {
|
||||
SignInBody {
|
||||
password,
|
||||
username,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
27
rfs-client/openapi/src/models/sign_in_response.rs
Normal file
27
rfs-client/openapi/src/models/sign_in_response.rs
Normal file
@@ -0,0 +1,27 @@
|
||||
/*
|
||||
* rfs
|
||||
*
|
||||
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
||||
*
|
||||
* The version of the OpenAPI document: 0.2.0
|
||||
*
|
||||
* Generated by: https://openapi-generator.tech
|
||||
*/
|
||||
|
||||
use crate::models;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
|
||||
pub struct SignInResponse {
|
||||
#[serde(rename = "access_token")]
|
||||
pub access_token: String,
|
||||
}
|
||||
|
||||
impl SignInResponse {
|
||||
pub fn new(access_token: String) -> SignInResponse {
|
||||
SignInResponse {
|
||||
access_token,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
27
rfs-client/openapi/src/models/template_err.rs
Normal file
27
rfs-client/openapi/src/models/template_err.rs
Normal file
@@ -0,0 +1,27 @@
|
||||
/*
|
||||
* rfs
|
||||
*
|
||||
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
||||
*
|
||||
* The version of the OpenAPI document: 0.2.0
|
||||
*
|
||||
* Generated by: https://openapi-generator.tech
|
||||
*/
|
||||
|
||||
use crate::models;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[serde(untagged)]
|
||||
pub enum TemplateErr {
|
||||
TemplateErrBadRequest(Box<models::TemplateErrBadRequest>),
|
||||
TemplateErrNotFound(Box<models::TemplateErrNotFound>),
|
||||
TemplateErrInternalServerError(Box<models::TemplateErrInternalServerError>),
|
||||
}
|
||||
|
||||
impl Default for TemplateErr {
|
||||
fn default() -> Self {
|
||||
Self::TemplateErrBadRequest(Default::default())
|
||||
}
|
||||
}
|
||||
|
27
rfs-client/openapi/src/models/template_err_bad_request.rs
Normal file
27
rfs-client/openapi/src/models/template_err_bad_request.rs
Normal file
@@ -0,0 +1,27 @@
|
||||
/*
|
||||
* rfs
|
||||
*
|
||||
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
||||
*
|
||||
* The version of the OpenAPI document: 0.2.0
|
||||
*
|
||||
* Generated by: https://openapi-generator.tech
|
||||
*/
|
||||
|
||||
use crate::models;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
|
||||
pub struct TemplateErrBadRequest {
|
||||
#[serde(rename = "BadRequest")]
|
||||
pub bad_request: String,
|
||||
}
|
||||
|
||||
impl TemplateErrBadRequest {
|
||||
pub fn new(bad_request: String) -> TemplateErrBadRequest {
|
||||
TemplateErrBadRequest {
|
||||
bad_request,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -0,0 +1,27 @@
|
||||
/*
|
||||
* rfs
|
||||
*
|
||||
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
||||
*
|
||||
* The version of the OpenAPI document: 0.2.0
|
||||
*
|
||||
* Generated by: https://openapi-generator.tech
|
||||
*/
|
||||
|
||||
use crate::models;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
|
||||
pub struct TemplateErrInternalServerError {
|
||||
#[serde(rename = "InternalServerError")]
|
||||
pub internal_server_error: String,
|
||||
}
|
||||
|
||||
impl TemplateErrInternalServerError {
|
||||
pub fn new(internal_server_error: String) -> TemplateErrInternalServerError {
|
||||
TemplateErrInternalServerError {
|
||||
internal_server_error,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
27
rfs-client/openapi/src/models/template_err_not_found.rs
Normal file
27
rfs-client/openapi/src/models/template_err_not_found.rs
Normal file
@@ -0,0 +1,27 @@
|
||||
/*
|
||||
* rfs
|
||||
*
|
||||
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
||||
*
|
||||
* The version of the OpenAPI document: 0.2.0
|
||||
*
|
||||
* Generated by: https://openapi-generator.tech
|
||||
*/
|
||||
|
||||
use crate::models;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
|
||||
pub struct TemplateErrNotFound {
|
||||
#[serde(rename = "NotFound")]
|
||||
pub not_found: String,
|
||||
}
|
||||
|
||||
impl TemplateErrNotFound {
|
||||
pub fn new(not_found: String) -> TemplateErrNotFound {
|
||||
TemplateErrNotFound {
|
||||
not_found,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
34
rfs-client/openapi/src/models/upload_block_params.rs
Normal file
34
rfs-client/openapi/src/models/upload_block_params.rs
Normal file
@@ -0,0 +1,34 @@
|
||||
/*
|
||||
* rfs
|
||||
*
|
||||
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
||||
*
|
||||
* The version of the OpenAPI document: 0.2.0
|
||||
*
|
||||
* Generated by: https://openapi-generator.tech
|
||||
*/
|
||||
|
||||
use crate::models;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
/// UploadBlockParams : Query parameters for uploading a block
|
||||
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
|
||||
pub struct UploadBlockParams {
|
||||
/// File hash associated with the block
|
||||
#[serde(rename = "file_hash")]
|
||||
pub file_hash: String,
|
||||
/// Block index within the file
|
||||
#[serde(rename = "idx")]
|
||||
pub idx: i64,
|
||||
}
|
||||
|
||||
impl UploadBlockParams {
|
||||
/// Query parameters for uploading a block
|
||||
pub fn new(file_hash: String, idx: i64) -> UploadBlockParams {
|
||||
UploadBlockParams {
|
||||
file_hash,
|
||||
idx,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
38
rfs-client/openapi/src/models/user_blocks_response.rs
Normal file
38
rfs-client/openapi/src/models/user_blocks_response.rs
Normal file
@@ -0,0 +1,38 @@
|
||||
/*
|
||||
* rfs
|
||||
*
|
||||
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
||||
*
|
||||
* The version of the OpenAPI document: 0.2.0
|
||||
*
|
||||
* Generated by: https://openapi-generator.tech
|
||||
*/
|
||||
|
||||
use crate::models;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
/// UserBlocksResponse : Response for user blocks endpoint
|
||||
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
|
||||
pub struct UserBlocksResponse {
|
||||
/// Total number of all blocks
|
||||
#[serde(rename = "all_blocks")]
|
||||
pub all_blocks: i64,
|
||||
/// List of blocks with their indices
|
||||
#[serde(rename = "blocks")]
|
||||
pub blocks: Vec<models::BlockInfo>,
|
||||
/// Total number of blocks
|
||||
#[serde(rename = "total")]
|
||||
pub total: i64,
|
||||
}
|
||||
|
||||
impl UserBlocksResponse {
|
||||
/// Response for user blocks endpoint
|
||||
pub fn new(all_blocks: i64, blocks: Vec<models::BlockInfo>, total: i64) -> UserBlocksResponse {
|
||||
UserBlocksResponse {
|
||||
all_blocks,
|
||||
blocks,
|
||||
total,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
38
rfs-client/openapi/src/models/verify_block.rs
Normal file
38
rfs-client/openapi/src/models/verify_block.rs
Normal file
@@ -0,0 +1,38 @@
|
||||
/*
|
||||
* rfs
|
||||
*
|
||||
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
||||
*
|
||||
* The version of the OpenAPI document: 0.2.0
|
||||
*
|
||||
* Generated by: https://openapi-generator.tech
|
||||
*/
|
||||
|
||||
use crate::models;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
/// VerifyBlock : Request to verify if multiple blocks exist on the server
|
||||
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
|
||||
pub struct VerifyBlock {
|
||||
/// Block hash to verify
|
||||
#[serde(rename = "block_hash")]
|
||||
pub block_hash: String,
|
||||
/// Block index within the file
|
||||
#[serde(rename = "block_index")]
|
||||
pub block_index: i64,
|
||||
/// File hash associated with the block
|
||||
#[serde(rename = "file_hash")]
|
||||
pub file_hash: String,
|
||||
}
|
||||
|
||||
impl VerifyBlock {
|
||||
/// Request to verify if multiple blocks exist on the server
|
||||
pub fn new(block_hash: String, block_index: i64, file_hash: String) -> VerifyBlock {
|
||||
VerifyBlock {
|
||||
block_hash,
|
||||
block_index,
|
||||
file_hash,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
28
rfs-client/openapi/src/models/verify_blocks_request.rs
Normal file
28
rfs-client/openapi/src/models/verify_blocks_request.rs
Normal file
@@ -0,0 +1,28 @@
|
||||
/*
|
||||
* rfs
|
||||
*
|
||||
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
||||
*
|
||||
* The version of the OpenAPI document: 0.2.0
|
||||
*
|
||||
* Generated by: https://openapi-generator.tech
|
||||
*/
|
||||
|
||||
use crate::models;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
|
||||
pub struct VerifyBlocksRequest {
|
||||
/// List of blocks to verify
|
||||
#[serde(rename = "blocks")]
|
||||
pub blocks: Vec<models::VerifyBlock>,
|
||||
}
|
||||
|
||||
impl VerifyBlocksRequest {
|
||||
pub fn new(blocks: Vec<models::VerifyBlock>) -> VerifyBlocksRequest {
|
||||
VerifyBlocksRequest {
|
||||
blocks,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
30
rfs-client/openapi/src/models/verify_blocks_response.rs
Normal file
30
rfs-client/openapi/src/models/verify_blocks_response.rs
Normal file
@@ -0,0 +1,30 @@
|
||||
/*
|
||||
* rfs
|
||||
*
|
||||
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
||||
*
|
||||
* The version of the OpenAPI document: 0.2.0
|
||||
*
|
||||
* Generated by: https://openapi-generator.tech
|
||||
*/
|
||||
|
||||
use crate::models;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
/// VerifyBlocksResponse : Response with list of missing blocks
|
||||
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
|
||||
pub struct VerifyBlocksResponse {
|
||||
/// List of block hashes that are missing on the server
|
||||
#[serde(rename = "missing")]
|
||||
pub missing: Vec<String>,
|
||||
}
|
||||
|
||||
impl VerifyBlocksResponse {
|
||||
/// Response with list of missing blocks
|
||||
pub fn new(missing: Vec<String>) -> VerifyBlocksResponse {
|
||||
VerifyBlocksResponse {
|
||||
missing,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user