Struct fractal_api::ClientV1
[−]
[src]
pub struct ClientV1 {
// some fields omitted
}The client struct.
This struct will be in charge of connections to the Fractal Global Credits API.
Methods
impl ClientV1[src]
fn new() -> ClientV1
Creates a new Fractal Global Credits API client.
fn new_with_url<S: AsRef<str>>(url: S) -> ClientV1
Creates a new Fractal Global Credits API client.
fn new_dev() -> ClientV1
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.
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.
fn register<S: AsRef<str>>(&self, access_token: &AccessToken, username: S, password: S, email: S) -> Result<()>
Registers the user
fn resend_email_confirmation(&self, access_token: &AccessToken) -> Result<()>
Resends the email confirmation
fn start_reset_password<S: AsRef<str>>(&self, access_token: &AccessToken, username: S, email: S) -> Result<()>
Begins a the reset password procecss
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 login<S: AsRef<str>>(&self, access_token: &AccessToken, user_email: S, password: S, remember_me: bool) -> Result<AccessToken>
Logs the user in
fn get_all_transactions(&self, access_token: &AccessToken, first_transaction: u64) -> Result<Vec<Transaction>>
Gets all the transactions since the given transaction
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_all_users(&self, access_token: &AccessToken) -> Result<Vec<User>>
Gets all users from the database.
fn generate_transaction(&self, access_token: &AccessToken, receiver_wallet: WalletAddress, receiver_id: u64, amount: Amount) -> Result<()>
Generates a transaction
fn set_username<S: AsRef<str>>(&self, access_token: &AccessToken, user_id: u64, password: Option<S>, username: S) -> Result<()>
Sets the users username
fn set_phone<S: AsRef<str>>(&self, access_token: &AccessToken, user_id: u64, password: Option<S>, phone: S) -> Result<()>
Sets the users phone
fn set_birthday<S: AsRef<str>>(&self, access_token: &AccessToken, user_id: u64, password: Option<S>, birthday: NaiveDate) -> Result<()>
Sets the users birthday
fn set_name<S: AsRef<str>>(&self, access_token: &AccessToken, user_id: u64, password: Option<S>, 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, password: Option<S>, email: S) -> Result<()>
Sets the users email
fn set_image<S: AsRef<str>>(&self, access_token: &AccessToken, user_id: u64, password: Option<S>, image: S) -> Result<()>
Sets the users profile picture
fn set_address<S: AsRef<str>>(&self, access_token: &AccessToken, user_id: u64, password: Option<S>, 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 invite_user_to_connect<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, connection_id: u64, user: u64) -> Result<()>
Confirms a connection
fn confirm_email<S: AsRef<str>>(&self, access_token: &AccessToken, email_key: S) -> Result<()>
Confirms the users email
fn confirm_new_password_reset<S: AsRef<str>>(&self, access_token: &AccessToken, password_key: S, new_password: S) -> Result<()>
Attempts to confirm the new password reset
fn delete_user(&self, access_token: &AccessToken, user_id: u64) -> Result<()>
Deletes the user
fn get_authenticator_qrcode(&self, access_token: &AccessToken, user_id: u64) -> Result<String>
Gets the authenticator qrcode to scan for 2 factor authentication
fn authenticate(&self, access_token: &AccessToken, user_id: u64, code: u32) -> Result<()>
Authenticates the user with 2FA