Struct fractal_api::v1::Client
[−]
[src]
pub struct Client { // some fields omitted }
The client struct.
This struct will be in charge of connections to the Fractal Global Credits API.
Methods
impl Client
[src]
Client creation and modification.
fn new() -> Client
Creates a new Fractal Global Credits API client.
fn new_with_url<S: AsRef<str>>(url: S) -> Client
Creates a new Fractal Global Credits API client.
fn new_dev() -> Client
Creates a new Fractal Global Credits API development client.
fn set_read_timeout(&mut self, timeout: Option<Duration>)
Sets the read timeout for requests.
fn set_write_timeout(&mut self, timeout: Option<Duration>)
Sets the write timeout for requests.
impl Client
[src]
OAuth methods for clients.
fn token<S: AsRef<str>>(&self, app_id: S, secret: S) -> Result<AccessToken>
Gets a token from the API.
fn create_client<S: AsRef<str>>(&self, access_token: &AccessToken, name: S, scopes: &[Scope], request_limit: usize) -> Result<ClientInfo>
Creates a client
Creates a client with the given name, scopes and request limit per hour. An admin scoped token is required to use this API call.
impl Client
[src]
Public methods for the client.
These are the public methods for getting a token, creating and logging in users, and confirming their information.
fn register<S: AsRef<str>>(&self, access_token: &AccessToken, username: S, password: S, email: S) -> Result<()>
Registers the user
fn login<S: AsRef<str>>(&self, access_token: &AccessToken, user_email: S, password: S, remember_me: bool) -> Result<AccessToken>
Logs the user in
fn confirm_email<S: AsRef<str>>(&self, access_token: &AccessToken, email_key: S) -> Result<()>
Confirms the users email
fn start_reset_password<S: AsRef<str>>(&self, access_token: &AccessToken, username: S, email: S) -> Result<()>
Begins a the reset password procecss
fn reset_password<S: AsRef<str>>(&self, access_token: &AccessToken, password_key: S, new_password: S) -> Result<()>
Attempts to confirm the new password reset
impl Client
[src]
User methods for the client.
This are the user getters, setters and creators for the client.
fn resend_email_confirmation(&self, access_token: &AccessToken) -> Result<()>
Resends the email confirmation
fn get_user(&self, access_token: &AccessToken, user_id: u64) -> Result<User>
Get the user
fn get_me(&self, access_token: &AccessToken) -> Result<User>
Gets the logged in users info
fn get_all_users(&self, access_token: &AccessToken) -> Result<Vec<User>>
Gets all users.
fn delete_user(&self, access_token: &AccessToken, user_id: u64) -> Result<()>
Deletes the given user.
fn generate_authenticator_code(&self, access_token: &AccessToken) -> Result<String>
Generates a new authenticator code, and returns the URL.
fn authenticate(&self, access_token: &AccessToken, code: u32) -> Result<()>
Authenticates the user with 2FA
fn set_username<S: AsRef<str>>(&self, access_token: &AccessToken, user_id: u64, username: S) -> Result<()>
Sets the users username
fn set_phone<S: AsRef<str>>(&self, access_token: &AccessToken, user_id: u64, phone: S) -> Result<()>
Sets the users phone
fn set_birthday<S: AsRef<str>>(&self, access_token: &AccessToken, user_id: u64, birthday: NaiveDate) -> Result<()>
Sets the users birthday
fn set_name<S: AsRef<str>>(&self, access_token: &AccessToken, user_id: u64, first: S, last: S) -> Result<()>
Sets the users first and last name
fn set_email<S: AsRef<str>>(&self, access_token: &AccessToken, user_id: u64, email: S) -> Result<()>
Sets the users email
fn set_image<S: AsRef<str>>(&self, access_token: &AccessToken, user_id: u64, image_url: S) -> Result<()>
Sets the users profile picture to the given URL
fn set_address<S: AsRef<str>>(&self, access_token: &AccessToken, user_id: u64, address: Address) -> Result<()>
Sets the users address
fn set_password<S: AsRef<str>>(&self, access_token: &AccessToken, old_password: S, new_password: S) -> Result<()>
Sets the user password
fn search_user_random<S: AsRef<str>>(&self, access_token: &AccessToken, random: S) -> Result<Vec<Profile>>
Searches users doing a random search with the given string. It will try to find the string in names, emails etc.
impl Client
[src]
Methods for working with friend requests.
fn send_friend_request<S: AsRef<str>>(&self, access_token: &AccessToken, user: u64, relation: Relationship, message: Option<S>) -> Result<()>
Creates a pending invitation to connect to the user
fn confirm_friend_request(&self, access_token: &AccessToken, request_id: u64, user: u64) -> Result<()>
Confirms a connection
fn get_friend_requests(&self, access_token: &AccessToken, user_id: u64) -> Result<Vec<PendingFriendRequest>>
Gets all the pending friend requests for the given user.
fn get_friends(&self, access_token: &AccessToken, user_id: u64) -> Result<Vec<Profile>>
Returns the given users friends
impl Client
[src]
Methods for working with transactions.
fn get_transaction(&self, access_token: &AccessToken, transaction_id: u64) -> Result<Transaction>
Gets the given transaction, if authorized.
fn new_transaction(&self, access_token: &AccessToken, receiver_wallet: WalletAddress, receiver_id: u64, amount: Amount) -> Result<String>
Generates a new transaction. Returns the code of the transaction
fn get_all_transactions(&self, access_token: &AccessToken, first_transaction: u64) -> Result<Vec<Transaction>>
Gets all the transactions since the given transaction