[−][src]Struct cms_tools::Client
Client you will do almost everything with
Fields
client: Client
The reqwest client
username: String
username
logged: bool
if client has token, this should be true and false otherwise
Methods
impl Client
[src]
Client functions return:
Err(1)
if request is not Ok, usually when server is unreachableErr(2)
when json cannot be parsed, usually unreachable or due to incorrect parametersErr(3)
if the json contains success=0
pub fn new(username: String) -> Self
[src]
create a new client with given username.
always use this to create a client
for requests you don't need to be logged in to do, username will not be used
pub fn login(&mut self, password: &str) -> Result<bool, u8>
[src]
login with self.username and password
Returns Ok(true)
if the client was already logged and Ok(false)
if it was not and succeeds in logging
pub fn recover(&self, email: &str, code: &str) -> Result<RecoverResponse, u8>
[src]
recover lost password, use empty code to get the email
pub fn user_update(
&self,
email: &str,
password: &str,
old_password: &str
) -> Result<(), u8>
[src]
&self,
email: &str,
password: &str,
old_password: &str
) -> Result<(), u8>
update password/email, empty string for fields you dont want to update
pub fn check_username(&self, username: &str) -> Result<CheckResponse, u8>
[src]
check if username is valid, note: Ok
does not mean username is valid
pub fn check_email(&self, email: &str) -> Result<CheckResponse, u8>
[src]
check if email is valid, note: Ok
does not mean email is valid
pub fn check_password(&self, password: &str) -> bool
[src]
check if password is valid, note: this is done locally
unlike other functions, this returs true if password is acceptable and false otherwise
pub fn user_exists(&self, username: &str) -> Result<bool, u8>
[src]
check if there is an user with username = username
pub fn get_user_list(&self, first: usize, last: usize) -> Result<UserList, u8>
[src]
get list of users in reverse order of score in [first,last)
pub fn get_user(&self, username: &str) -> Result<User, u8>
[src]
get the details of a specific user
pub fn get_task_list(
&self,
first: usize,
last: usize,
order: &str,
tag: Option<&str>,
search: Option<&str>
) -> Result<TaskList, u8>
[src]
&self,
first: usize,
last: usize,
order: &str,
tag: Option<&str>,
search: Option<&str>
) -> Result<TaskList, u8>
get list of tasks in [first,last) in the given order with the given tag that matches search
possible orders are: newest, easiest, hardest
if an invalid order is given, it is assumed to be newest
pub fn get_task(&self, name: &str) -> Result<DetailedTask, u8>
[src]
get the details of a specific task
pub fn get_stats(&self, name: &str) -> Result<Stats, u8>
[src]
get the statistics for a specific task
pub fn get_submission_list(&self, task_name: &str) -> Result<SubmissionList, u8>
[src]
get your submissions for a task
pub fn get_submission(&self, id: usize) -> Result<DetailedSubmission, u8>
[src]
get details for specific submission
pub fn submit_normal(
&self,
task_name: &str,
text: &str,
lang: &str
) -> Result<DetailedSubmission, u8>
[src]
&self,
task_name: &str,
text: &str,
lang: &str
) -> Result<DetailedSubmission, u8>
submit a not output-only task
lang should be the extension of the file (c, cpp, pas)
pub fn get_test_list(&self) -> Result<TestList, u8>
[src]
get the list of available tests
pub fn get_test(&self, test_name: &str) -> Result<Test, u8>
[src]
get the details and text of a specific test
pub fn get_region_list(&self) -> Result<RegionList, u8>
[src]
Misc get a list of the regions
pub fn get_technique_list(&self) -> Result<TechniqueList, u8>
[src]
get list of technique tags
pub fn get_file(&self, file: &File) -> Result<String, u8>
[src]
download file
Auto Trait Implementations
impl Send for Client
impl Sync for Client
impl Unpin for Client
impl !UnwindSafe for Client
impl !RefUnwindSafe for Client
Blanket Implementations
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From<T> for T
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
U: TryFrom<T>,