Struct slack_chat_api::Client
source · [−]pub struct Client { /* private fields */ }Expand description
Entrypoint for interacting with the API client.
Implementations
sourceimpl Client
impl Client
sourcepub fn new<I, K, R, T, Q>(
client_id: I,
client_secret: K,
redirect_uri: R,
token: T,
refresh_token: Q
) -> Self where
I: ToString,
K: ToString,
R: ToString,
T: ToString,
Q: ToString,
pub fn new<I, K, R, T, Q>(
client_id: I,
client_secret: K,
redirect_uri: R,
token: T,
refresh_token: Q
) -> Self where
I: ToString,
K: ToString,
R: ToString,
T: ToString,
Q: ToString,
Create a new Client struct. It takes a type that can convert into
an &str (String or Vec<u8> for example). As long as the function is
given a valid API key your requests will work.
sourcepub fn set_auto_access_token_refresh(&mut self, enabled: bool) -> &mut Self
pub fn set_auto_access_token_refresh(&mut self, enabled: bool) -> &mut Self
Enables or disables the automatic refreshing of access tokens upon expiration
sourcepub async fn set_expires_at(&self, expires_at: Option<Instant>) -> &Self
pub async fn set_expires_at(&self, expires_at: Option<Instant>) -> &Self
Sets a specific Instant at which the access token should be considered expired.
The expiration value will only be used when automatic access token refreshing is
also enabled. None may be passed in if the expiration is unknown. In this case
automatic refreshes will be attempted when encountering an UNAUTHENTICATED status
code on a response.
sourcepub async fn expires_at(&self) -> Option<Instant>
pub async fn expires_at(&self) -> Option<Instant>
Gets the Instant at which the access token used by this client is set to expire
if one is known
sourcepub async fn set_expires_in(&self, expires_in: i64) -> &Self
pub async fn set_expires_in(&self, expires_in: i64) -> &Self
Sets the number of seconds in which the current access token should be considered expired
sourcepub async fn expires_in(&self) -> Option<Duration>
pub async fn expires_in(&self) -> Option<Duration>
Gets the number of seconds from now in which the current access token will be considered expired if one is known
sourcepub async fn is_expired(&self) -> Option<bool>
pub async fn is_expired(&self) -> Option<bool>
Determines if the access token currently stored in the client is expired. If the expiration can not be determined, None is returned
sourcepub fn with_host<H>(&self, host: H) -> Self where
H: ToString,
pub fn with_host<H>(&self, host: H) -> Self where
H: ToString,
Override the default host for the client.
sourcepub fn new_from_env<T, R>(token: T, refresh_token: R) -> Self where
T: ToString,
R: ToString,
pub fn new_from_env<T, R>(token: T, refresh_token: R) -> Self where
T: ToString,
R: ToString,
Create a new Client struct from environment variables. It
takes a type that can convert into
an &str (String or Vec<u8> for example). As long as the function is
given a valid API key and your requests will work.
We pass in the token and refresh token to the client so if you are storing
it in a database, you can get it first.
sourcepub fn user_consent_url(&self, scopes: &[String]) -> String
pub fn user_consent_url(&self, scopes: &[String]) -> String
Return a user consent url with an optional set of scopes. If no scopes are provided, they will not be passed in the url.
sourcepub async fn refresh_access_token(&self) -> Result<AccessToken>
pub async fn refresh_access_token(&self) -> Result<AccessToken>
Refresh an access token from a refresh token. Client must have a refresh token for this to work.
sourcepub async fn get_access_token(
&mut self,
code: &str,
state: &str
) -> Result<AccessToken>
pub async fn get_access_token(
&mut self,
code: &str,
state: &str
) -> Result<AccessToken>
Get an access token from the code returned by the URL paramter sent to the redirect URL.
pub fn admin_apps(&self) -> AdminApps
pub fn admin_apps_approved(&self) -> AdminAppsApproved
pub fn admin_apps_requests(&self) -> AdminAppsRequests
pub fn admin_apps_restricted(&self) -> AdminAppsRestricted
pub fn admin_conversations(&self) -> AdminConversations
pub fn admin_conversations_ekm(&self) -> AdminConversationsEkm
pub fn admin_conversations_restrict_access(
&self
) -> AdminConversationsRestrictAccess
pub fn admin_emoji(&self) -> AdminEmoji
pub fn admin_invite_requests(&self) -> AdminInviteRequests
pub fn admin_invite_requests_approved(&self) -> AdminInviteRequestsApproved
pub fn admin_invite_requests_denied(&self) -> AdminInviteRequestsDenied
pub fn admin_teams(&self) -> AdminTeams
pub fn admin_teams_admins(&self) -> AdminTeamsAdmins
pub fn admin_teams_owners(&self) -> AdminTeamsOwners
pub fn admin_teams_settings(&self) -> AdminTeamsSettings
pub fn admin_usergroups(&self) -> AdminUsergroups
pub fn admin_users(&self) -> AdminUsers
pub fn admin_users_session(&self) -> AdminUsersSession
pub fn api(&self) -> Api
pub fn apps(&self) -> Apps
pub fn apps_permissions(&self) -> AppsPermissions
pub fn apps_permissions_resources(&self) -> AppsPermissionsResources
pub fn apps_permissions_scopes(&self) -> AppsPermissionsScopes
pub fn apps_permissions_users(&self) -> AppsPermissionsUsers
pub fn auth(&self) -> Auth
pub fn bots(&self) -> Bots
pub fn calls(&self) -> Calls
pub fn calls_participants(&self) -> CallsParticipants
pub fn chat(&self) -> Chat
pub fn chat_scheduled_messages(&self) -> ChatScheduledMessages
pub fn conversations(&self) -> Conversations
pub fn dialog(&self) -> Dialog
pub fn dnd(&self) -> Dnd
pub fn emoji(&self) -> Emoji
pub fn files(&self) -> Files
pub fn files_comments(&self) -> FilesComments
pub fn files_remote(&self) -> FilesRemote
pub fn migration(&self) -> Migration
pub fn oauth(&self) -> Oauth
pub fn oauth_v_2(&self) -> OauthV2
pub fn pins(&self) -> Pins
pub fn reactions(&self) -> Reactions
pub fn reminders(&self) -> Reminders
pub fn rtm(&self) -> Rtm
pub fn search(&self) -> Search
pub fn stars(&self) -> Stars
pub fn team(&self) -> Team
pub fn team_profile(&self) -> TeamProfile
pub fn usergroups(&self) -> Usergroups
pub fn usergroups_users(&self) -> UsergroupsUsers
pub fn users(&self) -> Users
pub fn users_profile(&self) -> UsersProfile
pub fn views(&self) -> Views
pub fn workflows(&self) -> Workflows
Trait Implementations
Auto Trait Implementations
impl !RefUnwindSafe for Client
impl Send for Client
impl Sync for Client
impl Unpin for Client
impl !UnwindSafe for Client
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<T> FutureExt for T
impl<T> FutureExt for T
fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
fn vzip(self) -> V
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
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
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber to this type, returning a
WithDispatch wrapper. Read more