#![allow(dead_code, non_camel_case_types, non_snake_case, unused_imports, unused_mut)]
use crate::{AMPAPI, types::*};
use std::collections::HashMap;
use serde_json::{Value, Map};
#[derive(Debug, Clone)]
pub struct FileManagerPlugin {
pub ampapi: AMPAPI
}
impl FileManagerPlugin {
pub fn new(ampapi: AMPAPI) -> FileManagerPlugin {
FileManagerPlugin {
ampapi
}
}
pub fn AppendFileChunk(&mut self, Filename: String, Data: String, Delete: bool) -> core::result::Result<Value, reqwest::Error> {
let mut args: HashMap<String, Value> = HashMap::new();
args.insert("Filename".to_string(), Filename.into());
args.insert("Data".to_string(), Data.into());
args.insert("Delete".to_string(), Delete.into());
self.ampapi.api_call::<Value>("FileManagerPlugin/AppendFileChunk".to_string(), args)
}
pub fn CalculateFileMD5Sum(&mut self, FilePath: String) -> core::result::Result<ActionResult<String>, reqwest::Error> {
let mut args: HashMap<String, Value> = HashMap::new();
args.insert("FilePath".to_string(), FilePath.into());
self.ampapi.api_call::<ActionResult<String>>("FileManagerPlugin/CalculateFileMD5Sum".to_string(), args)
}
pub fn ChangeExclusion(&mut self, ModifyPath: String, AsDirectory: bool, Exclude: bool) -> core::result::Result<ActionResult<Value>, reqwest::Error> {
let mut args: HashMap<String, Value> = HashMap::new();
args.insert("ModifyPath".to_string(), ModifyPath.into());
args.insert("AsDirectory".to_string(), AsDirectory.into());
args.insert("Exclude".to_string(), Exclude.into());
self.ampapi.api_call::<ActionResult<Value>>("FileManagerPlugin/ChangeExclusion".to_string(), args)
}
pub fn CopyFile(&mut self, Origin: String, TargetDirectory: String) -> core::result::Result<ActionResult<Value>, reqwest::Error> {
let mut args: HashMap<String, Value> = HashMap::new();
args.insert("Origin".to_string(), Origin.into());
args.insert("TargetDirectory".to_string(), TargetDirectory.into());
self.ampapi.api_call::<ActionResult<Value>>("FileManagerPlugin/CopyFile".to_string(), args)
}
pub fn CreateArchive(&mut self, PathToArchive: String) -> core::result::Result<ActionResult<Value>, reqwest::Error> {
let mut args: HashMap<String, Value> = HashMap::new();
args.insert("PathToArchive".to_string(), PathToArchive.into());
self.ampapi.api_call::<ActionResult<Value>>("FileManagerPlugin/CreateArchive".to_string(), args)
}
pub fn CreateDirectory(&mut self, NewPath: String) -> core::result::Result<ActionResult<Value>, reqwest::Error> {
let mut args: HashMap<String, Value> = HashMap::new();
args.insert("NewPath".to_string(), NewPath.into());
self.ampapi.api_call::<ActionResult<Value>>("FileManagerPlugin/CreateDirectory".to_string(), args)
}
pub fn DownloadFileFromURL(&mut self, Source: URL, TargetDirectory: String) -> core::result::Result<ActionResult<Value>, reqwest::Error> {
let mut args: HashMap<String, Value> = HashMap::new();
args.insert("Source".to_string(), Source.into());
args.insert("TargetDirectory".to_string(), TargetDirectory.into());
self.ampapi.api_call::<ActionResult<Value>>("FileManagerPlugin/DownloadFileFromURL".to_string(), args)
}
pub fn Dummy(&mut self, ) -> core::result::Result<Value, reqwest::Error> {
let mut args: HashMap<String, Value> = HashMap::new();
self.ampapi.api_call::<Value>("FileManagerPlugin/Dummy".to_string(), args)
}
pub fn EmptyTrash(&mut self, TrashDirectoryName: String) -> core::result::Result<ActionResult<Value>, reqwest::Error> {
let mut args: HashMap<String, Value> = HashMap::new();
args.insert("TrashDirectoryName".to_string(), TrashDirectoryName.into());
self.ampapi.api_call::<ActionResult<Value>>("FileManagerPlugin/EmptyTrash".to_string(), args)
}
pub fn ExtractArchive(&mut self, ArchivePath: String, DestinationPath: String) -> core::result::Result<ActionResult<Value>, reqwest::Error> {
let mut args: HashMap<String, Value> = HashMap::new();
args.insert("ArchivePath".to_string(), ArchivePath.into());
args.insert("DestinationPath".to_string(), DestinationPath.into());
self.ampapi.api_call::<ActionResult<Value>>("FileManagerPlugin/ExtractArchive".to_string(), args)
}
pub fn GetDirectoryListing(&mut self, Dir: String) -> core::result::Result<Vec<Value>, reqwest::Error> {
let mut args: HashMap<String, Value> = HashMap::new();
args.insert("Dir".to_string(), Dir.into());
self.ampapi.api_call::<Vec<Value>>("FileManagerPlugin/GetDirectoryListing".to_string(), args)
}
pub fn GetFileChunk(&mut self, Filename: String, Position: i64, Length: i32) -> core::result::Result<Value, reqwest::Error> {
let mut args: HashMap<String, Value> = HashMap::new();
args.insert("Filename".to_string(), Filename.into());
args.insert("Position".to_string(), Position.into());
args.insert("Length".to_string(), Length.into());
self.ampapi.api_call::<Value>("FileManagerPlugin/GetFileChunk".to_string(), args)
}
pub fn ReadFileChunk(&mut self, Filename: String, Offset: i64, ChunkSize: i64) -> core::result::Result<ActionResult<String>, reqwest::Error> {
let mut args: HashMap<String, Value> = HashMap::new();
args.insert("Filename".to_string(), Filename.into());
args.insert("Offset".to_string(), Offset.into());
args.insert("ChunkSize".to_string(), ChunkSize.into());
self.ampapi.api_call::<ActionResult<String>>("FileManagerPlugin/ReadFileChunk".to_string(), args)
}
pub fn RenameDirectory(&mut self, oldDirectory: String, NewDirectoryName: String) -> core::result::Result<ActionResult<Value>, reqwest::Error> {
let mut args: HashMap<String, Value> = HashMap::new();
args.insert("oldDirectory".to_string(), oldDirectory.into());
args.insert("NewDirectoryName".to_string(), NewDirectoryName.into());
self.ampapi.api_call::<ActionResult<Value>>("FileManagerPlugin/RenameDirectory".to_string(), args)
}
pub fn RenameFile(&mut self, Filename: String, NewFilename: String) -> core::result::Result<ActionResult<Value>, reqwest::Error> {
let mut args: HashMap<String, Value> = HashMap::new();
args.insert("Filename".to_string(), Filename.into());
args.insert("NewFilename".to_string(), NewFilename.into());
self.ampapi.api_call::<ActionResult<Value>>("FileManagerPlugin/RenameFile".to_string(), args)
}
pub fn TrashDirectory(&mut self, DirectoryName: String) -> core::result::Result<ActionResult<Value>, reqwest::Error> {
let mut args: HashMap<String, Value> = HashMap::new();
args.insert("DirectoryName".to_string(), DirectoryName.into());
self.ampapi.api_call::<ActionResult<Value>>("FileManagerPlugin/TrashDirectory".to_string(), args)
}
pub fn TrashFile(&mut self, Filename: String) -> core::result::Result<ActionResult<Value>, reqwest::Error> {
let mut args: HashMap<String, Value> = HashMap::new();
args.insert("Filename".to_string(), Filename.into());
self.ampapi.api_call::<ActionResult<Value>>("FileManagerPlugin/TrashFile".to_string(), args)
}
pub fn WriteFileChunk(&mut self, Filename: String, Data: String, Offset: i64, FinalChunk: bool) -> core::result::Result<ActionResult<Value>, reqwest::Error> {
let mut args: HashMap<String, Value> = HashMap::new();
args.insert("Filename".to_string(), Filename.into());
args.insert("Data".to_string(), Data.into());
args.insert("Offset".to_string(), Offset.into());
args.insert("FinalChunk".to_string(), FinalChunk.into());
self.ampapi.api_call::<ActionResult<Value>>("FileManagerPlugin/WriteFileChunk".to_string(), args)
}
}