pub struct Client {
pub config: AuthConfig,
pub custom_headers: HashMap<String, String>,
pub access_token: Option<String>,
/* private fields */
}Expand description
Client is the Casdoor client, it holds the config of the Casdoor application and sends all the API requests to the Casdoor server.
use casdoor_rust_sdk::Client;
let client = Client::new(
"http://localhost:8000",
"<client-id>",
"<client-secret>",
"<certificate>",
"built-in",
"app-built-in",
);
let users = client.get_users().await?;Fields§
§config: AuthConfigThe config of the Casdoor application.
custom_headers: HashMap<String, String>The extra HTTP headers added to every request sent to the Casdoor server.
access_token: Option<String>The user’s access token. If it’s not empty, all the API requests sent by this
client are authenticated as the user who owns the access token (via the
Authorization: Bearer header), instead of as the application itself (via the
client ID and client secret’s Basic Auth).
Use Client::with_access_token() to get such a client.
Implementations§
Source§impl Client
impl Client
Sourcepub async fn get_adapters(&self) -> Result<Vec<Adapter>>
pub async fn get_adapters(&self) -> Result<Vec<Adapter>>
Get the adapters of the client’s organization.
Sourcepub async fn get_pagination_adapters(
&self,
p: i32,
page_size: i32,
query: &[(&str, &str)],
) -> Result<(Vec<Adapter>, i32)>
pub async fn get_pagination_adapters( &self, p: i32, page_size: i32, query: &[(&str, &str)], ) -> Result<(Vec<Adapter>, i32)>
Get one page of the adapters of the client’s organization, together with the total number of the adapters.
Sourcepub async fn get_adapter(&self, name: &str) -> Result<Option<Adapter>>
pub async fn get_adapter(&self, name: &str) -> Result<Option<Adapter>>
Get one adapter by name.
Sourcepub async fn add_adapter(&self, adapter: &Adapter) -> Result<bool>
pub async fn add_adapter(&self, adapter: &Adapter) -> Result<bool>
Add an adapter.
Sourcepub async fn update_adapter(&self, adapter: &Adapter) -> Result<bool>
pub async fn update_adapter(&self, adapter: &Adapter) -> Result<bool>
Update an adapter.
Sourcepub async fn delete_adapter(&self, adapter: &Adapter) -> Result<bool>
pub async fn delete_adapter(&self, adapter: &Adapter) -> Result<bool>
Delete an adapter.
Source§impl Client
impl Client
Sourcepub async fn get_applications(&self) -> Result<Vec<Application>>
pub async fn get_applications(&self) -> Result<Vec<Application>>
Get all the applications.
Sourcepub async fn get_organization_applications(&self) -> Result<Vec<Application>>
pub async fn get_organization_applications(&self) -> Result<Vec<Application>>
Get the applications of the client’s organization.
Sourcepub async fn get_application(&self, name: &str) -> Result<Option<Application>>
pub async fn get_application(&self, name: &str) -> Result<Option<Application>>
Get one application by name.
Sourcepub async fn add_application(&self, application: &Application) -> Result<bool>
pub async fn add_application(&self, application: &Application) -> Result<bool>
Add an application.
Sourcepub async fn update_application(
&self,
application: &Application,
) -> Result<bool>
pub async fn update_application( &self, application: &Application, ) -> Result<bool>
Update an application.
Sourcepub async fn delete_application(
&self,
application: &Application,
) -> Result<bool>
pub async fn delete_application( &self, application: &Application, ) -> Result<bool>
Delete an application.
Source§impl Client
impl Client
Sourcepub async fn get_oauth_token(&self, code: &str) -> Result<OAuthToken>
pub async fn get_oauth_token(&self, code: &str) -> Result<OAuthToken>
Get the pivotal and necessary secret to interact with the Casdoor server, by exchanging the authorization code that Casdoor sent back to the redirect URI.
Sourcepub async fn refresh_oauth_token(
&self,
refresh_token: &str,
) -> Result<OAuthToken>
pub async fn refresh_oauth_token( &self, refresh_token: &str, ) -> Result<OAuthToken>
Refresh the OAuth token with a refresh token.
Sourcepub async fn get_oauth_token_by_password(
&self,
username: &str,
password: &str,
) -> Result<OAuthToken>
pub async fn get_oauth_token_by_password( &self, username: &str, password: &str, ) -> Result<OAuthToken>
Get the OAuth token via the password grant type, i.e. the “Resource Owner
Password Credentials Grant” of OAuth 2.0. The password grant type must be enabled
in the application’s “Grant types” in Casdoor.
The username is the user’s name inside the application’s organization, like
alice instead of my-org/alice.
Sourcepub async fn impersonate_user(
&self,
username: &str,
master_password: &str,
) -> Result<OAuthToken>
pub async fn impersonate_user( &self, username: &str, master_password: &str, ) -> Result<OAuthToken>
Get an OAuth token which acts as the given user, so that an admin can call the APIs on behalf of the user, without knowing the user’s own password. It’s the SDK equivalent of the “Impersonation” button in Casdoor’s Web UI.
The master_password is the “Master password” of the user’s organization, it needs
to be set in Casdoor first: “Organizations” -> Edit the organization -> “Master
password”. See https://casdoor.org/docs/user/impersonation.
Source§impl Client
impl Client
Sourcepub async fn get_global_certs(&self) -> Result<Vec<Cert>>
pub async fn get_global_certs(&self) -> Result<Vec<Cert>>
Get the certs shared by all the organizations.
Sourcepub async fn update_cert(&self, cert: &Cert) -> Result<bool>
pub async fn update_cert(&self, cert: &Cert) -> Result<bool>
Update a cert.
Sourcepub async fn delete_cert(&self, cert: &Cert) -> Result<bool>
pub async fn delete_cert(&self, cert: &Cert) -> Result<bool>
Delete a cert.
Source§impl Client
impl Client
Sourcepub fn new(
endpoint: impl Into<String>,
client_id: impl Into<String>,
client_secret: impl Into<String>,
certificate: impl Into<String>,
organization_name: impl Into<String>,
application_name: impl Into<String>,
) -> Self
pub fn new( endpoint: impl Into<String>, client_id: impl Into<String>, client_secret: impl Into<String>, certificate: impl Into<String>, organization_name: impl Into<String>, application_name: impl Into<String>, ) -> Self
Create a new client from the 6 config values.
Sourcepub fn from_config(config: AuthConfig) -> Self
pub fn from_config(config: AuthConfig) -> Self
Create a new client from an AuthConfig.
Sourcepub fn from_toml(path: &str) -> Result<Self>
pub fn from_toml(path: &str) -> Result<Self>
Create a new client from a TOML config file, see AuthConfig::from_toml().
Sourcepub fn with_access_token(&self, access_token: impl Into<String>) -> Self
pub fn with_access_token(&self, access_token: impl Into<String>) -> Self
Return a copy of the client that calls all the Casdoor APIs as the user who owns
the given access token, rather than as the application. The access token is the
user’s OAuth access token returned by Client::get_oauth_token(),
Client::refresh_oauth_token(), Client::get_oauth_token_by_password() or
Client::impersonate_user().
The returned client is independent from the original one, so the original client keeps using the application’s client ID and client secret, and it’s safe to create one client per user request:
let token = client.get_oauth_token(code).await?;
let user = client.with_access_token(token.access_token).get_account().await?;Note that the APIs are still subject to Casdoor’s permission check, so a non-admin user can only access their own data.
Sourcepub fn with_custom_header(
&self,
key: impl Into<String>,
value: impl Into<String>,
) -> Self
pub fn with_custom_header( &self, key: impl Into<String>, value: impl Into<String>, ) -> Self
Return a copy of the client that adds the given HTTP header to every request.
Sourcepub fn with_http_client(&self, http: Client) -> Self
pub fn with_http_client(&self, http: Client) -> Self
Return a copy of the client that uses the given reqwest::Client, so that the
timeout, the proxy, the TLS options, etc. can be customized.
Sourcepub fn get_url(&self, action: &str, query: &[(&str, &str)]) -> String
pub fn get_url(&self, action: &str, query: &[(&str, &str)]) -> String
Return the URL of an API action, such as
http://localhost:8000/api/get-user?id=built-in%2Fadmin.
Sourcepub fn get_id(&self, name: &str) -> String
pub fn get_id(&self, name: &str) -> String
Return the Casdoor object ID ("owner/name") of an object owned by an
organization. If name is already a qualified "owner/name" ID, it is returned
as-is, so that a client can also address objects that live outside of its own
organization. Object names never contain a slash in Casdoor.
Sourcepub async fn do_get_response(&self, url: &str) -> Result<Response>
pub async fn do_get_response(&self, url: &str) -> Result<Response>
The general function to send a GET request and get the whole Response.
Sourcepub async fn do_get_bytes_raw(&self, url: &str) -> Result<Vec<u8>>
pub async fn do_get_bytes_raw(&self, url: &str) -> Result<Vec<u8>>
The general function to send a GET request and get the raw response body.
Source§impl Client
impl Client
Source§impl Client
impl Client
Sourcepub async fn enforce(
&self,
permission_id: &str,
model_id: &str,
resource_id: &str,
enforcer_id: &str,
owner: &str,
casbin_request: &CasbinRequest,
) -> Result<bool>
pub async fn enforce( &self, permission_id: &str, model_id: &str, resource_id: &str, enforcer_id: &str, owner: &str, casbin_request: &CasbinRequest, ) -> Result<bool>
Check whether a Casbin request is allowed by a permission, a model, a resource or
an enforcer. Only one of permission_id, model_id, resource_id and
enforcer_id needs to be given, the others can be empty.
Sourcepub async fn batch_enforce(
&self,
permission_id: &str,
model_id: &str,
resource_id: &str,
enforcer_id: &str,
owner: &str,
casbin_requests: &[CasbinRequest],
) -> Result<Vec<Vec<bool>>>
pub async fn batch_enforce( &self, permission_id: &str, model_id: &str, resource_id: &str, enforcer_id: &str, owner: &str, casbin_requests: &[CasbinRequest], ) -> Result<Vec<Vec<bool>>>
Check a batch of Casbin requests at once, the returned matrix has one row per permission and one column per request.
Source§impl Client
impl Client
Sourcepub async fn get_enforcers(&self) -> Result<Vec<Enforcer>>
pub async fn get_enforcers(&self) -> Result<Vec<Enforcer>>
Get the enforcers of the client’s organization.
Sourcepub async fn get_pagination_enforcers(
&self,
p: i32,
page_size: i32,
query: &[(&str, &str)],
) -> Result<(Vec<Enforcer>, i32)>
pub async fn get_pagination_enforcers( &self, p: i32, page_size: i32, query: &[(&str, &str)], ) -> Result<(Vec<Enforcer>, i32)>
Get one page of the enforcers of the client’s organization, together with the total number of the enforcers.
Sourcepub async fn get_enforcer(&self, name: &str) -> Result<Option<Enforcer>>
pub async fn get_enforcer(&self, name: &str) -> Result<Option<Enforcer>>
Get one enforcer by name.
Sourcepub async fn add_enforcer(&self, enforcer: &Enforcer) -> Result<bool>
pub async fn add_enforcer(&self, enforcer: &Enforcer) -> Result<bool>
Add an enforcer.
Sourcepub async fn update_enforcer(&self, enforcer: &Enforcer) -> Result<bool>
pub async fn update_enforcer(&self, enforcer: &Enforcer) -> Result<bool>
Update an enforcer.
Sourcepub async fn delete_enforcer(&self, enforcer: &Enforcer) -> Result<bool>
pub async fn delete_enforcer(&self, enforcer: &Enforcer) -> Result<bool>
Delete an enforcer.
Source§impl Client
impl Client
Sourcepub async fn get_groups(&self) -> Result<Vec<Group>>
pub async fn get_groups(&self) -> Result<Vec<Group>>
Get the groups of the client’s organization.
Sourcepub async fn get_pagination_groups(
&self,
p: i32,
page_size: i32,
query: &[(&str, &str)],
) -> Result<(Vec<Group>, i32)>
pub async fn get_pagination_groups( &self, p: i32, page_size: i32, query: &[(&str, &str)], ) -> Result<(Vec<Group>, i32)>
Get one page of the groups of the client’s organization, together with the total number of the groups.
Sourcepub async fn update_group(&self, group: &Group) -> Result<bool>
pub async fn update_group(&self, group: &Group) -> Result<bool>
Update a group.
Sourcepub async fn delete_group(&self, group: &Group) -> Result<bool>
pub async fn delete_group(&self, group: &Group) -> Result<bool>
Delete a group.
Source§impl Client
impl Client
Sourcepub async fn get_invitations(&self) -> Result<Vec<Invitation>>
pub async fn get_invitations(&self) -> Result<Vec<Invitation>>
Get the invitations of the client’s organization.
Sourcepub async fn get_pagination_invitations(
&self,
p: i32,
page_size: i32,
query: &[(&str, &str)],
) -> Result<(Vec<Invitation>, i32)>
pub async fn get_pagination_invitations( &self, p: i32, page_size: i32, query: &[(&str, &str)], ) -> Result<(Vec<Invitation>, i32)>
Get one page of the invitations of the client’s organization, together with the total number of the invitations.
Sourcepub async fn get_invitation(&self, name: &str) -> Result<Option<Invitation>>
pub async fn get_invitation(&self, name: &str) -> Result<Option<Invitation>>
Get one invitation by name.
Sourcepub async fn get_invitation_info(
&self,
code: &str,
application_name: &str,
) -> Result<Option<Invitation>>
pub async fn get_invitation_info( &self, code: &str, application_name: &str, ) -> Result<Option<Invitation>>
Get the invitation of an invitation code in an application.
Sourcepub async fn add_invitation(&self, invitation: &Invitation) -> Result<bool>
pub async fn add_invitation(&self, invitation: &Invitation) -> Result<bool>
Add an invitation.
Sourcepub async fn update_invitation(&self, invitation: &Invitation) -> Result<bool>
pub async fn update_invitation(&self, invitation: &Invitation) -> Result<bool>
Update an invitation.
Sourcepub async fn update_invitation_for_columns(
&self,
invitation: &Invitation,
columns: &[&str],
) -> Result<bool>
pub async fn update_invitation_for_columns( &self, invitation: &Invitation, columns: &[&str], ) -> Result<bool>
Update only the given columns of an invitation.
Sourcepub async fn delete_invitation(&self, invitation: &Invitation) -> Result<bool>
pub async fn delete_invitation(&self, invitation: &Invitation) -> Result<bool>
Delete an invitation.
Source§impl Client
impl Client
Sourcepub fn parse_jwt_token(&self, token: &str) -> Result<Claims>
pub fn parse_jwt_token(&self, token: &str) -> Result<Claims>
Parse and verify a JWT token issued by Casdoor with the application’s certificate,
and return its claims. The RSA (RS256, RS384, RS512, PS256, PS384,
PS512) and the ECDSA (ES256, ES384) signing methods are supported.
Source§impl Client
impl Client
Sourcepub async fn update_ldap(&self, ldap: &Ldap) -> Result<bool>
pub async fn update_ldap(&self, ldap: &Ldap) -> Result<bool>
Update an LDAP server.
Sourcepub async fn delete_ldap(&self, ldap: &Ldap) -> Result<bool>
pub async fn delete_ldap(&self, ldap: &Ldap) -> Result<bool>
Delete an LDAP server.
Sourcepub async fn get_ldap_users(
&self,
id: &str,
) -> Result<Option<LdapUsersResponse>>
pub async fn get_ldap_users( &self, id: &str, ) -> Result<Option<LdapUsersResponse>>
Get the users of an LDAP server, together with the UUIDs that already exist in Casdoor.
Sourcepub async fn sync_ldap_users(
&self,
id: &str,
users: &[LdapUser],
) -> Result<Option<SyncLdapUsersResponse>>
pub async fn sync_ldap_users( &self, id: &str, users: &[LdapUser], ) -> Result<Option<SyncLdapUsersResponse>>
Sync the given LDAP users into Casdoor.
Sourcepub async fn sync_ldap_users_from_server(
&self,
id: &str,
) -> Result<Option<SyncLdapUsersResponse>>
pub async fn sync_ldap_users_from_server( &self, id: &str, ) -> Result<Option<SyncLdapUsersResponse>>
Read the users of an LDAP server and sync them all into Casdoor.
Source§impl Client
impl Client
Sourcepub async fn logout(&self, access_token: &str) -> Result<()>
pub async fn logout(&self, access_token: &str) -> Result<()>
Log out the user that owns the access_token by calling the /api/sso-logout API.
It performs a single sign-out: all the sessions of the user across all the
applications of the organization are deleted and all the access tokens issued to
the user are expired.
The access_token is the user’s access token returned by
Client::get_oauth_token().
Sourcepub async fn logout_current_session(&self, access_token: &str) -> Result<()>
pub async fn logout_current_session(&self, access_token: &str) -> Result<()>
Like Client::logout(), but only ends the session that the access_token
belongs to, so the user stays signed in on their other devices and browsers.
Source§impl Client
impl Client
Sourcepub async fn initiate_mfa(
&self,
owner: &str,
mfa_type: &str,
name: &str,
) -> Result<MfaInitiateData>
pub async fn initiate_mfa( &self, owner: &str, mfa_type: &str, name: &str, ) -> Result<MfaInitiateData>
Start the setup of an MFA method for a user, the returned secret and URL are used to show the QR code of the authenticator app.
Sourcepub async fn verify_mfa(
&self,
owner: &str,
mfa_type: &str,
name: &str,
secret: &str,
passcode: &str,
) -> Result<bool>
pub async fn verify_mfa( &self, owner: &str, mfa_type: &str, name: &str, secret: &str, passcode: &str, ) -> Result<bool>
Verify the passcode of an MFA method that is being set up.
Sourcepub async fn enable_mfa(
&self,
owner: &str,
mfa_type: &str,
name: &str,
secret: &str,
recovery_code: &str,
) -> Result<bool>
pub async fn enable_mfa( &self, owner: &str, mfa_type: &str, name: &str, secret: &str, recovery_code: &str, ) -> Result<bool>
Enable a verified MFA method for a user.
Source§impl Client
impl Client
Sourcepub async fn get_models(&self) -> Result<Vec<Model>>
pub async fn get_models(&self) -> Result<Vec<Model>>
Get the models of the client’s organization.
Sourcepub async fn get_pagination_models(
&self,
p: i32,
page_size: i32,
query: &[(&str, &str)],
) -> Result<(Vec<Model>, i32)>
pub async fn get_pagination_models( &self, p: i32, page_size: i32, query: &[(&str, &str)], ) -> Result<(Vec<Model>, i32)>
Get one page of the models of the client’s organization, together with the total number of the models.
Sourcepub async fn update_model(&self, model: &Model) -> Result<bool>
pub async fn update_model(&self, model: &Model) -> Result<bool>
Update a model.
Sourcepub async fn delete_model(&self, model: &Model) -> Result<bool>
pub async fn delete_model(&self, model: &Model) -> Result<bool>
Delete a model.
Source§impl Client
impl Client
Sourcepub async fn get_orders(&self) -> Result<Vec<Order>>
pub async fn get_orders(&self) -> Result<Vec<Order>>
Get the orders of the client’s organization.
Sourcepub async fn get_pagination_orders(
&self,
p: i32,
page_size: i32,
query: &[(&str, &str)],
) -> Result<(Vec<Order>, i32)>
pub async fn get_pagination_orders( &self, p: i32, page_size: i32, query: &[(&str, &str)], ) -> Result<(Vec<Order>, i32)>
Get one page of the orders of the client’s organization, together with the total number of the orders.
Sourcepub async fn get_user_orders(&self, user_name: &str) -> Result<Vec<Order>>
pub async fn get_user_orders(&self, user_name: &str) -> Result<Vec<Order>>
Get the orders of one user.
Sourcepub async fn update_order(&self, order: &Order) -> Result<bool>
pub async fn update_order(&self, order: &Order) -> Result<bool>
Update an order.
Sourcepub async fn delete_order(&self, order: &Order) -> Result<bool>
pub async fn delete_order(&self, order: &Order) -> Result<bool>
Delete an order.
Sourcepub async fn cancel_order(&self, name: &str) -> Result<bool>
pub async fn cancel_order(&self, name: &str) -> Result<bool>
Cancel an order by name.
Source§impl Client
impl Client
Sourcepub async fn place_order(
&self,
product_infos: &[ProductInfo],
user_name: &str,
) -> Result<Order>
pub async fn place_order( &self, product_infos: &[ProductInfo], user_name: &str, ) -> Result<Order>
Place an order for the given products. user_name can be empty to place the order
for the user that the client is authenticated as.
Source§impl Client
impl Client
Sourcepub async fn get_organization(&self, name: &str) -> Result<Option<Organization>>
pub async fn get_organization(&self, name: &str) -> Result<Option<Organization>>
Get one organization by name.
Sourcepub async fn get_organizations(&self) -> Result<Vec<Organization>>
pub async fn get_organizations(&self) -> Result<Vec<Organization>>
Get all the organizations.
Sourcepub async fn get_organization_names(&self) -> Result<Vec<Organization>>
pub async fn get_organization_names(&self) -> Result<Vec<Organization>>
Get all the organizations, with only their names filled in.
Sourcepub async fn add_organization(
&self,
organization: &Organization,
) -> Result<bool>
pub async fn add_organization( &self, organization: &Organization, ) -> Result<bool>
Add an organization.
Sourcepub async fn update_organization(
&self,
organization: &Organization,
) -> Result<bool>
pub async fn update_organization( &self, organization: &Organization, ) -> Result<bool>
Update an organization.
Sourcepub async fn delete_organization(
&self,
organization: &Organization,
) -> Result<bool>
pub async fn delete_organization( &self, organization: &Organization, ) -> Result<bool>
Delete an organization.
Source§impl Client
impl Client
Sourcepub async fn get_payments(&self) -> Result<Vec<Payment>>
pub async fn get_payments(&self) -> Result<Vec<Payment>>
Get the payments of the client’s organization.
Sourcepub async fn get_pagination_payments(
&self,
p: i32,
page_size: i32,
query: &[(&str, &str)],
) -> Result<(Vec<Payment>, i32)>
pub async fn get_pagination_payments( &self, p: i32, page_size: i32, query: &[(&str, &str)], ) -> Result<(Vec<Payment>, i32)>
Get one page of the payments of the client’s organization, together with the total number of the payments.
Sourcepub async fn get_payment(&self, name: &str) -> Result<Option<Payment>>
pub async fn get_payment(&self, name: &str) -> Result<Option<Payment>>
Get one payment by name.
Sourcepub async fn get_user_payments(&self, user_name: &str) -> Result<Vec<Payment>>
pub async fn get_user_payments(&self, user_name: &str) -> Result<Vec<Payment>>
Get the payments of one user.
Sourcepub async fn add_payment(&self, payment: &Payment) -> Result<bool>
pub async fn add_payment(&self, payment: &Payment) -> Result<bool>
Add a payment.
Sourcepub async fn update_payment(&self, payment: &Payment) -> Result<bool>
pub async fn update_payment(&self, payment: &Payment) -> Result<bool>
Update a payment.
Sourcepub async fn delete_payment(&self, payment: &Payment) -> Result<bool>
pub async fn delete_payment(&self, payment: &Payment) -> Result<bool>
Delete a payment.
Sourcepub async fn notify_payment(&self, payment: &Payment) -> Result<bool>
pub async fn notify_payment(&self, payment: &Payment) -> Result<bool>
Notify Casdoor that a payment was made, so that it queries the payment provider and updates the state of the payment.
Sourcepub async fn invoice_payment(&self, payment: &Payment) -> Result<bool>
pub async fn invoice_payment(&self, payment: &Payment) -> Result<bool>
Ask the payment provider to issue the invoice of a payment.
Source§impl Client
impl Client
Sourcepub async fn get_permissions(&self) -> Result<Vec<Permission>>
pub async fn get_permissions(&self) -> Result<Vec<Permission>>
Get the permissions of the client’s organization.
Sourcepub async fn get_permissions_by_role(
&self,
name: &str,
) -> Result<Vec<Permission>>
pub async fn get_permissions_by_role( &self, name: &str, ) -> Result<Vec<Permission>>
Get the permissions of a role.
Sourcepub async fn get_pagination_permissions(
&self,
p: i32,
page_size: i32,
query: &[(&str, &str)],
) -> Result<(Vec<Permission>, i32)>
pub async fn get_pagination_permissions( &self, p: i32, page_size: i32, query: &[(&str, &str)], ) -> Result<(Vec<Permission>, i32)>
Get one page of the permissions of the client’s organization, together with the total number of the permissions.
Sourcepub async fn get_permission(&self, name: &str) -> Result<Option<Permission>>
pub async fn get_permission(&self, name: &str) -> Result<Option<Permission>>
Get one permission by name.
Sourcepub async fn add_permission(&self, permission: &Permission) -> Result<bool>
pub async fn add_permission(&self, permission: &Permission) -> Result<bool>
Add a permission.
Sourcepub async fn update_permission(&self, permission: &Permission) -> Result<bool>
pub async fn update_permission(&self, permission: &Permission) -> Result<bool>
Update a permission.
Sourcepub async fn update_permission_for_columns(
&self,
permission: &Permission,
columns: &[&str],
) -> Result<bool>
pub async fn update_permission_for_columns( &self, permission: &Permission, columns: &[&str], ) -> Result<bool>
Update only the given columns of a permission.
Sourcepub async fn delete_permission(&self, permission: &Permission) -> Result<bool>
pub async fn delete_permission(&self, permission: &Permission) -> Result<bool>
Delete a permission.
Source§impl Client
impl Client
Sourcepub async fn get_pagination_plans(
&self,
p: i32,
page_size: i32,
query: &[(&str, &str)],
) -> Result<(Vec<Plan>, i32)>
pub async fn get_pagination_plans( &self, p: i32, page_size: i32, query: &[(&str, &str)], ) -> Result<(Vec<Plan>, i32)>
Get one page of the plans of the client’s organization, together with the total number of the plans.
Sourcepub async fn update_plan(&self, plan: &Plan) -> Result<bool>
pub async fn update_plan(&self, plan: &Plan) -> Result<bool>
Update a plan.
Sourcepub async fn delete_plan(&self, plan: &Plan) -> Result<bool>
pub async fn delete_plan(&self, plan: &Plan) -> Result<bool>
Delete a plan.
Source§impl Client
impl Client
Sourcepub async fn get_policies(
&self,
enforcer_name: &str,
adapter_id: &str,
) -> Result<Vec<CasbinRule>>
pub async fn get_policies( &self, enforcer_name: &str, adapter_id: &str, ) -> Result<Vec<CasbinRule>>
Get the policies of an enforcer. adapter_id can be empty to use the adapter of
the enforcer.
Sourcepub async fn get_filtered_policies(
&self,
enforcer_id: &str,
filters: &[PolicyFilter],
) -> Result<Vec<CasbinRule>>
pub async fn get_filtered_policies( &self, enforcer_id: &str, filters: &[PolicyFilter], ) -> Result<Vec<CasbinRule>>
Get the policies of an enforcer, filtered by the field index and the field values.
Sourcepub async fn add_policy(
&self,
enforcer: &Enforcer,
policy: &CasbinRule,
) -> Result<bool>
pub async fn add_policy( &self, enforcer: &Enforcer, policy: &CasbinRule, ) -> Result<bool>
Add one policy to an enforcer.
Sourcepub async fn update_policy(
&self,
enforcer: &Enforcer,
old_policy: &CasbinRule,
new_policy: &CasbinRule,
) -> Result<bool>
pub async fn update_policy( &self, enforcer: &Enforcer, old_policy: &CasbinRule, new_policy: &CasbinRule, ) -> Result<bool>
Update one policy of an enforcer.
Sourcepub async fn remove_policy(
&self,
enforcer: &Enforcer,
policy: &CasbinRule,
) -> Result<bool>
pub async fn remove_policy( &self, enforcer: &Enforcer, policy: &CasbinRule, ) -> Result<bool>
Remove one policy from an enforcer.
Source§impl Client
impl Client
Sourcepub async fn get_pricings(&self) -> Result<Vec<Pricing>>
pub async fn get_pricings(&self) -> Result<Vec<Pricing>>
Get the pricings of the client’s organization.
Sourcepub async fn get_pagination_pricings(
&self,
p: i32,
page_size: i32,
query: &[(&str, &str)],
) -> Result<(Vec<Pricing>, i32)>
pub async fn get_pagination_pricings( &self, p: i32, page_size: i32, query: &[(&str, &str)], ) -> Result<(Vec<Pricing>, i32)>
Get one page of the pricings of the client’s organization, together with the total number of the pricings.
Sourcepub async fn get_pricing(&self, name: &str) -> Result<Option<Pricing>>
pub async fn get_pricing(&self, name: &str) -> Result<Option<Pricing>>
Get one pricing by name.
Sourcepub async fn add_pricing(&self, pricing: &Pricing) -> Result<bool>
pub async fn add_pricing(&self, pricing: &Pricing) -> Result<bool>
Add a pricing.
Sourcepub async fn update_pricing(&self, pricing: &Pricing) -> Result<bool>
pub async fn update_pricing(&self, pricing: &Pricing) -> Result<bool>
Update a pricing.
Sourcepub async fn delete_pricing(&self, pricing: &Pricing) -> Result<bool>
pub async fn delete_pricing(&self, pricing: &Pricing) -> Result<bool>
Delete a pricing.
Source§impl Client
impl Client
Sourcepub async fn get_products(&self) -> Result<Vec<Product>>
pub async fn get_products(&self) -> Result<Vec<Product>>
Get the products of the client’s organization.
Sourcepub async fn get_pagination_products(
&self,
p: i32,
page_size: i32,
query: &[(&str, &str)],
) -> Result<(Vec<Product>, i32)>
pub async fn get_pagination_products( &self, p: i32, page_size: i32, query: &[(&str, &str)], ) -> Result<(Vec<Product>, i32)>
Get one page of the products of the client’s organization, together with the total number of the products.
Sourcepub async fn get_product(&self, name: &str) -> Result<Option<Product>>
pub async fn get_product(&self, name: &str) -> Result<Option<Product>>
Get one product by name.
Sourcepub async fn add_product(&self, product: &Product) -> Result<bool>
pub async fn add_product(&self, product: &Product) -> Result<bool>
Add a product.
Sourcepub async fn update_product(&self, product: &Product) -> Result<bool>
pub async fn update_product(&self, product: &Product) -> Result<bool>
Update a product.
Sourcepub async fn delete_product(&self, product: &Product) -> Result<bool>
pub async fn delete_product(&self, product: &Product) -> Result<bool>
Delete a product.
Source§impl Client
impl Client
Sourcepub async fn get_providers(&self) -> Result<Vec<Provider>>
pub async fn get_providers(&self) -> Result<Vec<Provider>>
Get the providers of the client’s organization.
Sourcepub async fn get_provider(&self, name: &str) -> Result<Option<Provider>>
pub async fn get_provider(&self, name: &str) -> Result<Option<Provider>>
Get one provider by name.
Sourcepub async fn get_pagination_providers(
&self,
p: i32,
page_size: i32,
query: &[(&str, &str)],
) -> Result<(Vec<Provider>, i32)>
pub async fn get_pagination_providers( &self, p: i32, page_size: i32, query: &[(&str, &str)], ) -> Result<(Vec<Provider>, i32)>
Get one page of the providers of the client’s organization, together with the total number of the providers.
Sourcepub async fn add_provider(&self, provider: &Provider) -> Result<bool>
pub async fn add_provider(&self, provider: &Provider) -> Result<bool>
Add a provider.
Sourcepub async fn update_provider(&self, provider: &Provider) -> Result<bool>
pub async fn update_provider(&self, provider: &Provider) -> Result<bool>
Update a provider.
Sourcepub async fn delete_provider(&self, provider: &Provider) -> Result<bool>
pub async fn delete_provider(&self, provider: &Provider) -> Result<bool>
Delete a provider.
Source§impl Client
impl Client
Sourcepub async fn get_records(&self) -> Result<Vec<Record>>
pub async fn get_records(&self) -> Result<Vec<Record>>
Get the records of the client’s organization.
Sourcepub async fn get_pagination_records(
&self,
p: i32,
page_size: i32,
query: &[(&str, &str)],
) -> Result<(Vec<Record>, i32)>
pub async fn get_pagination_records( &self, p: i32, page_size: i32, query: &[(&str, &str)], ) -> Result<(Vec<Record>, i32)>
Get one page of the records of the client’s organization, together with the total number of the records.
Sourcepub async fn get_record(&self, name: &str) -> Result<Option<Record>>
pub async fn get_record(&self, name: &str) -> Result<Option<Record>>
Get one record by name, None if it doesn’t exist. Casdoor has no API to get a
single record, so it searches the records by name. Like the other APIs that read
records, it needs the access token of an admin user, see
Client::with_access_token().
Sourcepub async fn add_record(&self, record: &Record) -> Result<bool>
pub async fn add_record(&self, record: &Record) -> Result<bool>
Add a record.
Source§impl Client
impl Client
Sourcepub async fn get_resource(&self, id: &str) -> Result<Option<Resource>>
pub async fn get_resource(&self, id: &str) -> Result<Option<Resource>>
Get one resource by its owner/name ID.
Sourcepub async fn get_resource_ex(
&self,
owner: &str,
name: &str,
) -> Result<Option<Resource>>
pub async fn get_resource_ex( &self, owner: &str, name: &str, ) -> Result<Option<Resource>>
Get one resource by its owner and name.
Sourcepub async fn get_resources(
&self,
owner: &str,
user: &str,
field: &str,
value: &str,
sort_field: &str,
sort_order: &str,
) -> Result<Vec<Resource>>
pub async fn get_resources( &self, owner: &str, user: &str, field: &str, value: &str, sort_field: &str, sort_order: &str, ) -> Result<Vec<Resource>>
Get the resources that match the given filters.
Sourcepub async fn get_pagination_resources(
&self,
owner: &str,
user: &str,
field: &str,
value: &str,
page_size: i32,
page: i32,
sort_field: &str,
sort_order: &str,
) -> Result<Vec<Resource>>
pub async fn get_pagination_resources( &self, owner: &str, user: &str, field: &str, value: &str, page_size: i32, page: i32, sort_field: &str, sort_order: &str, ) -> Result<Vec<Resource>>
Get one page of the resources that match the given filters.
Sourcepub async fn upload_resource(
&self,
user: &str,
tag: &str,
parent: &str,
full_file_path: &str,
file_bytes: &[u8],
) -> Result<(String, String)>
pub async fn upload_resource( &self, user: &str, tag: &str, parent: &str, full_file_path: &str, file_bytes: &[u8], ) -> Result<(String, String)>
Upload a file to Casdoor, the returned values are the URL and the name of the created resource.
Sourcepub async fn upload_resource_ex(
&self,
user: &str,
tag: &str,
parent: &str,
full_file_path: &str,
file_bytes: &[u8],
created_time: &str,
description: &str,
) -> Result<(String, String)>
pub async fn upload_resource_ex( &self, user: &str, tag: &str, parent: &str, full_file_path: &str, file_bytes: &[u8], created_time: &str, description: &str, ) -> Result<(String, String)>
Like Client::upload_resource(), but also sets the created time and the
description of the resource.
Sourcepub async fn add_resource(&self, resource: &Resource) -> Result<bool>
pub async fn add_resource(&self, resource: &Resource) -> Result<bool>
Add a resource.
Sourcepub async fn update_resource(&self, resource: &Resource) -> Result<bool>
pub async fn update_resource(&self, resource: &Resource) -> Result<bool>
Update a resource.
Sourcepub async fn delete_resource(&self, resource: &Resource) -> Result<bool>
pub async fn delete_resource(&self, resource: &Resource) -> Result<bool>
Delete a resource.
Source§impl Client
impl Client
Sourcepub async fn get_pagination_roles(
&self,
p: i32,
page_size: i32,
query: &[(&str, &str)],
) -> Result<(Vec<Role>, i32)>
pub async fn get_pagination_roles( &self, p: i32, page_size: i32, query: &[(&str, &str)], ) -> Result<(Vec<Role>, i32)>
Get one page of the roles of the client’s organization, together with the total number of the roles.
Sourcepub async fn update_role(&self, role: &Role) -> Result<bool>
pub async fn update_role(&self, role: &Role) -> Result<bool>
Update a role.
Sourcepub async fn update_role_for_columns(
&self,
role: &Role,
columns: &[&str],
) -> Result<bool>
pub async fn update_role_for_columns( &self, role: &Role, columns: &[&str], ) -> Result<bool>
Update only the given columns of a role.
Sourcepub async fn delete_role(&self, role: &Role) -> Result<bool>
pub async fn delete_role(&self, role: &Role) -> Result<bool>
Delete a role.
Source§impl Client
impl Client
Sourcepub async fn get_sessions(&self) -> Result<Vec<Session>>
pub async fn get_sessions(&self) -> Result<Vec<Session>>
Get the sessions of the client’s organization.
Sourcepub async fn get_pagination_sessions(
&self,
p: i32,
page_size: i32,
query: &[(&str, &str)],
) -> Result<(Vec<Session>, i32)>
pub async fn get_pagination_sessions( &self, p: i32, page_size: i32, query: &[(&str, &str)], ) -> Result<(Vec<Session>, i32)>
Get one page of the sessions of the client’s organization, together with the total number of the sessions.
Sourcepub async fn get_session(
&self,
name: &str,
application: &str,
) -> Result<Option<Session>>
pub async fn get_session( &self, name: &str, application: &str, ) -> Result<Option<Session>>
Get the session of a user in an application.
Sourcepub async fn add_session(&self, session: &Session) -> Result<bool>
pub async fn add_session(&self, session: &Session) -> Result<bool>
Add a session.
Sourcepub async fn update_session(&self, session: &Session) -> Result<bool>
pub async fn update_session(&self, session: &Session) -> Result<bool>
Update a session.
Sourcepub async fn update_session_for_columns(
&self,
session: &Session,
columns: &[&str],
) -> Result<bool>
pub async fn update_session_for_columns( &self, session: &Session, columns: &[&str], ) -> Result<bool>
Update only the given columns of a session.
Sourcepub async fn delete_session(&self, session: &Session) -> Result<bool>
pub async fn delete_session(&self, session: &Session) -> Result<bool>
Delete a session.
Source§impl Client
impl Client
Source§impl Client
impl Client
Sourcepub async fn get_subscriptions(&self) -> Result<Vec<Subscription>>
pub async fn get_subscriptions(&self) -> Result<Vec<Subscription>>
Get the subscriptions of the client’s organization.
Sourcepub async fn get_pagination_subscriptions(
&self,
p: i32,
page_size: i32,
query: &[(&str, &str)],
) -> Result<(Vec<Subscription>, i32)>
pub async fn get_pagination_subscriptions( &self, p: i32, page_size: i32, query: &[(&str, &str)], ) -> Result<(Vec<Subscription>, i32)>
Get one page of the subscriptions of the client’s organization, together with the total number of the subscriptions.
Sourcepub async fn get_subscription(&self, name: &str) -> Result<Option<Subscription>>
pub async fn get_subscription(&self, name: &str) -> Result<Option<Subscription>>
Get one subscription by name.
Sourcepub async fn add_subscription(
&self,
subscription: &Subscription,
) -> Result<bool>
pub async fn add_subscription( &self, subscription: &Subscription, ) -> Result<bool>
Add a subscription.
Sourcepub async fn update_subscription(
&self,
subscription: &Subscription,
) -> Result<bool>
pub async fn update_subscription( &self, subscription: &Subscription, ) -> Result<bool>
Update a subscription.
Sourcepub async fn delete_subscription(
&self,
subscription: &Subscription,
) -> Result<bool>
pub async fn delete_subscription( &self, subscription: &Subscription, ) -> Result<bool>
Delete a subscription.
Source§impl Client
impl Client
Sourcepub async fn get_syncers(&self) -> Result<Vec<Syncer>>
pub async fn get_syncers(&self) -> Result<Vec<Syncer>>
Get the syncers of the client’s organization.
Sourcepub async fn get_pagination_syncers(
&self,
p: i32,
page_size: i32,
query: &[(&str, &str)],
) -> Result<(Vec<Syncer>, i32)>
pub async fn get_pagination_syncers( &self, p: i32, page_size: i32, query: &[(&str, &str)], ) -> Result<(Vec<Syncer>, i32)>
Get one page of the syncers of the client’s organization, together with the total number of the syncers.
Sourcepub async fn add_syncer(&self, syncer: &Syncer) -> Result<bool>
pub async fn add_syncer(&self, syncer: &Syncer) -> Result<bool>
Add a syncer.
Sourcepub async fn update_syncer(&self, syncer: &Syncer) -> Result<bool>
pub async fn update_syncer(&self, syncer: &Syncer) -> Result<bool>
Update a syncer.
Sourcepub async fn delete_syncer(&self, syncer: &Syncer) -> Result<bool>
pub async fn delete_syncer(&self, syncer: &Syncer) -> Result<bool>
Delete a syncer.
Source§impl Client
impl Client
Sourcepub async fn get_tokens(&self) -> Result<Vec<Token>>
pub async fn get_tokens(&self) -> Result<Vec<Token>>
Get all the tokens.
Sourcepub async fn get_pagination_tokens(
&self,
p: i32,
page_size: i32,
query: &[(&str, &str)],
) -> Result<(Vec<Token>, i32)>
pub async fn get_pagination_tokens( &self, p: i32, page_size: i32, query: &[(&str, &str)], ) -> Result<(Vec<Token>, i32)>
Get one page of the tokens, together with the total number of the tokens.
Sourcepub async fn update_token(&self, token: &Token) -> Result<bool>
pub async fn update_token(&self, token: &Token) -> Result<bool>
Update a token.
Sourcepub async fn update_token_for_columns(
&self,
token: &Token,
columns: &[&str],
) -> Result<bool>
pub async fn update_token_for_columns( &self, token: &Token, columns: &[&str], ) -> Result<bool>
Update only the given columns of a token.
Sourcepub async fn delete_token(&self, token: &Token) -> Result<bool>
pub async fn delete_token(&self, token: &Token) -> Result<bool>
Delete a token.
Sourcepub async fn introspect_token(
&self,
token: &str,
token_type_hint: &str,
) -> Result<IntrospectTokenResult>
pub async fn introspect_token( &self, token: &str, token_type_hint: &str, ) -> Result<IntrospectTokenResult>
Introspect an access token or a refresh token, token_type_hint is
"access_token" or "refresh_token".
Source§impl Client
impl Client
Sourcepub async fn get_transactions(&self) -> Result<Vec<Transaction>>
pub async fn get_transactions(&self) -> Result<Vec<Transaction>>
Get the transactions of the client’s organization.
Sourcepub async fn get_pagination_transactions(
&self,
p: i32,
page_size: i32,
query: &[(&str, &str)],
) -> Result<(Vec<Transaction>, i32)>
pub async fn get_pagination_transactions( &self, p: i32, page_size: i32, query: &[(&str, &str)], ) -> Result<(Vec<Transaction>, i32)>
Get one page of the transactions of the client’s organization, together with the total number of the transactions.
Sourcepub async fn get_transaction(&self, name: &str) -> Result<Option<Transaction>>
pub async fn get_transaction(&self, name: &str) -> Result<Option<Transaction>>
Get one transaction by name.
Sourcepub async fn get_user_transactions(
&self,
user_name: &str,
) -> Result<Vec<Transaction>>
pub async fn get_user_transactions( &self, user_name: &str, ) -> Result<Vec<Transaction>>
Get the transactions of one user.
Sourcepub async fn add_transaction(
&self,
transaction: &Transaction,
) -> Result<(bool, String)>
pub async fn add_transaction( &self, transaction: &Transaction, ) -> Result<(bool, String)>
Add a transaction, the returned string is the ID of the created transaction.
Sourcepub async fn add_transaction_with_dry_run(
&self,
transaction: &Transaction,
dry_run: bool,
) -> Result<(bool, String)>
pub async fn add_transaction_with_dry_run( &self, transaction: &Transaction, dry_run: bool, ) -> Result<(bool, String)>
Add a transaction, or only check whether it would succeed when dry_run is true.
Sourcepub async fn update_transaction(
&self,
transaction: &Transaction,
) -> Result<bool>
pub async fn update_transaction( &self, transaction: &Transaction, ) -> Result<bool>
Update a transaction.
Sourcepub async fn delete_transaction(
&self,
transaction: &Transaction,
) -> Result<bool>
pub async fn delete_transaction( &self, transaction: &Transaction, ) -> Result<bool>
Delete a transaction.
Source§impl Client
impl Client
Sourcepub fn get_signup_url(
&self,
enable_password: bool,
redirect_uri: &str,
) -> String
pub fn get_signup_url( &self, enable_password: bool, redirect_uri: &str, ) -> String
Return the URL of the Casdoor sign-up page. redirect_uri can be empty when
enable_password is true, since only the password based sign-up page is needed
then.
Sourcepub fn get_signin_url(&self, redirect_uri: &str) -> String
pub fn get_signin_url(&self, redirect_uri: &str) -> String
Return the URL of the Casdoor sign-in page, the user is redirected to
redirect_uri with an authorization code after signing in.
Sourcepub fn get_user_profile_url(
&self,
user_name: &str,
access_token: Option<&str>,
) -> String
pub fn get_user_profile_url( &self, user_name: &str, access_token: Option<&str>, ) -> String
Return the URL of a user’s profile page.
Sourcepub fn get_my_profile_url(&self, access_token: Option<&str>) -> String
pub fn get_my_profile_url(&self, access_token: Option<&str>) -> String
Return the URL of the account page of the user who owns the access token.
Source§impl Client
impl Client
Sourcepub async fn get_global_users(&self) -> Result<Vec<User>>
pub async fn get_global_users(&self) -> Result<Vec<User>>
Get the users of all the organizations.
Sourcepub async fn get_sorted_users(
&self,
sorter: &str,
limit: i32,
) -> Result<Vec<User>>
pub async fn get_sorted_users( &self, sorter: &str, limit: i32, ) -> Result<Vec<User>>
Get the users of the client’s organization, sorted by sorter and limited to
limit results.
Sourcepub async fn get_pagination_users(
&self,
p: i32,
page_size: i32,
query: &[(&str, &str)],
) -> Result<(Vec<User>, i32)>
pub async fn get_pagination_users( &self, p: i32, page_size: i32, query: &[(&str, &str)], ) -> Result<(Vec<User>, i32)>
Get one page of the users of the client’s organization, together with the total number of the users.
Sourcepub async fn get_user_count(&self, is_online: &str) -> Result<i32>
pub async fn get_user_count(&self, is_online: &str) -> Result<i32>
Get the number of the users of the client’s organization. is_online can be ""
for all the users, "1" for the online ones and "0" for the offline ones.
Sourcepub async fn get_user(&self, name: &str) -> Result<Option<User>>
pub async fn get_user(&self, name: &str) -> Result<Option<User>>
Get one user by name, or by the owner/name ID for a user of another
organization.
Sourcepub async fn get_account(&self) -> Result<Option<User>>
pub async fn get_account(&self) -> Result<Option<User>>
Get the user that the client is authenticated as, by calling the
/api/get-account API. It’s meant to be used with a client returned by
Client::with_access_token(), so that the owner of an access token can be
retrieved.
Sourcepub async fn get_user_by_email(&self, email: &str) -> Result<Option<User>>
pub async fn get_user_by_email(&self, email: &str) -> Result<Option<User>>
Get one user of the client’s organization by email.
Sourcepub async fn get_user_by_phone(&self, phone: &str) -> Result<Option<User>>
pub async fn get_user_by_phone(&self, phone: &str) -> Result<Option<User>>
Get one user of the client’s organization by phone.
Sourcepub async fn get_user_by_user_id(&self, user_id: &str) -> Result<Option<User>>
pub async fn get_user_by_user_id(&self, user_id: &str) -> Result<Option<User>>
Get one user of the client’s organization by the user’s id field.
Sourcepub async fn set_password(
&self,
owner: &str,
name: &str,
old_password: &str,
new_password: &str,
) -> Result<bool>
pub async fn set_password( &self, owner: &str, name: &str, old_password: &str, new_password: &str, ) -> Result<bool>
Set the password of a user. old_password is not required, just pass an empty
string when you don’t need it.
Sourcepub async fn update_user(&self, user: &User) -> Result<bool>
pub async fn update_user(&self, user: &User) -> Result<bool>
Update a user.
Sourcepub async fn update_user_for_columns(
&self,
user: &User,
columns: &[&str],
) -> Result<bool>
pub async fn update_user_for_columns( &self, user: &User, columns: &[&str], ) -> Result<bool>
Update only the given columns of a user.
Sourcepub async fn update_user_by_id(&self, id: &str, user: &User) -> Result<bool>
pub async fn update_user_by_id(&self, id: &str, user: &User) -> Result<bool>
Update the user addressed by the given owner/name ID.
Sourcepub async fn update_user_by_user_id(
&self,
owner: &str,
user_id: &str,
user: &User,
) -> Result<bool>
pub async fn update_user_by_user_id( &self, owner: &str, user_id: &str, user: &User, ) -> Result<bool>
Update the user of owner whose id field is user_id.
Sourcepub async fn delete_user(&self, user: &User) -> Result<bool>
pub async fn delete_user(&self, user: &User) -> Result<bool>
Delete a user.
Sourcepub async fn check_user_password(&self, user: &User) -> Result<bool>
pub async fn check_user_password(&self, user: &User) -> Result<bool>
Check whether the password field of the given user is the user’s password.
Source§impl Client
impl Client
Sourcepub async fn get_webhooks(&self) -> Result<Vec<Webhook>>
pub async fn get_webhooks(&self) -> Result<Vec<Webhook>>
Get the webhooks of the client’s organization.
Sourcepub async fn get_pagination_webhooks(
&self,
p: i32,
page_size: i32,
query: &[(&str, &str)],
) -> Result<(Vec<Webhook>, i32)>
pub async fn get_pagination_webhooks( &self, p: i32, page_size: i32, query: &[(&str, &str)], ) -> Result<(Vec<Webhook>, i32)>
Get one page of the webhooks of the client’s organization, together with the total number of the webhooks.
Sourcepub async fn get_webhook(&self, name: &str) -> Result<Option<Webhook>>
pub async fn get_webhook(&self, name: &str) -> Result<Option<Webhook>>
Get one webhook by name.
Sourcepub async fn add_webhook(&self, webhook: &Webhook) -> Result<bool>
pub async fn add_webhook(&self, webhook: &Webhook) -> Result<bool>
Add a webhook.
Sourcepub async fn update_webhook(&self, webhook: &Webhook) -> Result<bool>
pub async fn update_webhook(&self, webhook: &Webhook) -> Result<bool>
Update a webhook.
Sourcepub async fn delete_webhook(&self, webhook: &Webhook) -> Result<bool>
pub async fn delete_webhook(&self, webhook: &Webhook) -> Result<bool>
Delete a webhook.