pub struct LuckClient { /* private fields */ }
Expand description

A client for interacting with a LuckPerms instance.

Implementations§

source§

impl LuckClient

source

pub async fn users(&self) -> Result<Vec<Uuid>, RequestError>

Get a list of all users on the LuckPerms instance.

source

pub async fn create_user( &self, user: UserIdentifier ) -> Result<User, RequestError>

Create a new user on the LuckPerms instance.

source

pub async fn username_lookup( &self, username: String ) -> Result<UserIdentifier, RequestError>

Lookup a user based on a username from the LuckPerms instance.

source

pub async fn uuid_lookup( &self, uuid: Uuid ) -> Result<UserIdentifier, RequestError>

Lookup a user based on a UUID from the LuckPerms instance.

Search for users matching certain nodes.

source

pub async fn get_user(&self, uuid: Uuid) -> Result<Option<User>, RequestError>

Get a user based on their UUID.

source

pub async fn update_username( &self, uuid: Uuid, username: String ) -> Result<(), RequestError>

Update a user’s username.

source

pub async fn delete_user(&self, uuid: Uuid) -> Result<(), RequestError>

Delete a user from the LuckPerms instance.

source

pub async fn get_user_nodes( &self, uuid: Uuid ) -> Result<Vec<Node>, RequestError>

Get all nodes for a user.

source

pub async fn add_user_node( &self, uuid: Uuid, node: Node ) -> Result<(), RequestError>

Add a node to a user.

source

pub async fn add_user_nodes( &self, uuid: Uuid, nodes: Vec<Node> ) -> Result<(), RequestError>

Add multiple nodes to a user.

source

pub async fn set_user_nodes( &self, uuid: Uuid, nodes: Vec<Node> ) -> Result<(), RequestError>

Set a user’s nodes.

source

pub async fn delete_user_nodes( &self, uuid: Uuid, nodes: Vec<Node> ) -> Result<(), RequestError>

Delete nodes from a user.

source

pub async fn get_user_metadata( &self, uuid: Uuid ) -> Result<Vec<Metadata>, RequestError>

Get a user’s meta data.

source

pub async fn check_user_permission( &self, uuid: Uuid, permission: String ) -> Result<PermissionCheckResult, RequestError>

Check if a user has a permission.

source

pub async fn check_user_permission_query( &self, uuid: Uuid, request: PermissionCheckRequest ) -> Result<PermissionCheckResult, RequestError>

Check if a user has a permission with more specific query options.

source

pub async fn promote_user( &self, uuid: Uuid, track: String ) -> Result<TrackMoveResponse, RequestError>

Promote a user along a track.

source

pub async fn demote_user( &self, uuid: Uuid, track: String ) -> Result<TrackMoveResponse, RequestError>

Demote a user along a track.

source§

impl LuckClient

source

pub async fn get_groups(&self) -> Result<Vec<String>, RequestError>

Get all group names.

source

pub async fn create_group(&self, name: String) -> Result<Group, RequestError>

Create a new group.

source

pub async fn search_group( &self, search_request: SearchRequest ) -> Result<Vec<GroupSearchResult>, RequestError>

Search for a group matching nodes.

source

pub async fn get_group( &self, name: String ) -> Result<Option<Group>, RequestError>

Get a group based on its name.

source

pub async fn delete_group(&self, name: String) -> Result<(), RequestError>

Delete a group based on its name.

source

pub async fn get_group_nodes( &self, name: String ) -> Result<Vec<Node>, RequestError>

Get a group’s notes.

source

pub async fn add_group_node( &self, name: String, node: Node ) -> Result<Vec<Node>, RequestError>

Add a node to a group.

source

pub async fn add_group_nodes( &self, name: String, nodes: Vec<Node> ) -> Result<Vec<Node>, RequestError>

Add multiple nodes to a group.

source

pub async fn set_group_nodes( &self, name: String, nodes: Vec<Node> ) -> Result<(), RequestError>

Set nodes for a group.

source

pub async fn delete_group_node( &self, name: String, nodes: Vec<Node> ) -> Result<(), RequestError>

Delete nodes from a group.

source

pub async fn get_group_metadata( &self, name: String ) -> Result<Metadata, RequestError>

Get a group’s metadata.

source

pub async fn check_group_permission( &self, name: String, permission: String ) -> Result<PermissionCheckResult, RequestError>

Check if a group has a permission.

source

pub async fn check_group_permission_query( &self, name: String, request: PermissionCheckRequest ) -> Result<PermissionCheckResult, RequestError>

Check if a group has a permission with advanced query settings.

source§

impl LuckClient

source

pub async fn submit_action(&self, action: Action) -> Result<(), RequestError>

Submit an action to the server.

source§

impl LuckClient

source

pub fn try_new( base_url: String, api_key: String ) -> Result<Self, ClientCreationError>

Create a new LuckClient.

use luckperms_rs::LuckClient;

fn main() {
    let client = LuckClient::try_new("http://localhost:8080".to_string(), "YOUR API KEY".to_string()).unwrap();
}

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more