SlackClient

Struct SlackClient 

Source
pub struct SlackClient { /* private fields */ }
Expand description

Main Slack API client

This is the primary entry point for interacting with the Slack API. It provides access to all API endpoints through specialized API clients.

§Example

use slacko::{SlackClient, AuthConfig};

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let client = SlackClient::new(AuthConfig::oauth("xoxp-token"))?;

    // Post a message
    client.chat()
        .post_message("C12345", "Hello!")
        .await?;

    // List channels
    let channels = client.conversations()
        .list()
        .await?;

    Ok(())
}

Implementations§

Source§

impl SlackClient

Source

pub fn new(auth: AuthConfig) -> Result<Self>

Create a new Slack client with the given authentication configuration

§Arguments
  • auth - Authentication configuration
§Example
use slacko::{SlackClient, AuthConfig};

let client = SlackClient::new(
    AuthConfig::oauth("xoxp-token")
).unwrap();
Source

pub fn api(&self) -> ApiApi

Get the API test client

Provides methods for testing the Slack API connection.

Source

pub fn bots(&self) -> BotsApi

Get the Bots API client

Provides methods for getting information about bot users.

Source

pub fn chat(&self) -> ChatApi

Get the Chat API client

Provides methods for posting, updating, and deleting messages.

Source

pub fn conversations(&self) -> ConversationsApi

Get the Conversations API client

Provides methods for managing channels, groups, and DMs.

Source

pub fn users(&self) -> UsersApi

Get the Users API client

Provides methods for retrieving user information.

Source

pub fn files(&self) -> FilesApi

Get the Files API client

Provides methods for uploading and managing files.

Source

pub fn reactions(&self) -> ReactionsApi

Get the Reactions API client

Provides methods for adding and removing emoji reactions.

Source

pub fn search(&self) -> SearchApi

Get the Search API client

Provides methods for searching messages and files.

Source

pub fn team(&self) -> TeamApi

Get the Team API client

Provides methods for retrieving team/workspace information.

Source

pub fn rtm(&self) -> RtmApi

Get the RTM API client

Provides methods for real-time messaging via WebSocket.

Source

pub fn socket_mode(&self) -> SocketModeApi

Get the Socket Mode API client

Provides methods for receiving events via WebSocket using Socket Mode. This is the modern alternative to RTM for receiving events. Note: Requires an app-level token (xapp-…).

Source

pub fn auth(&self) -> AuthApi

Get the Auth API client

Provides methods for testing and managing authentication.

Source

pub fn pins(&self) -> PinsApi

Get the Pins API client

Provides methods for pinning and unpinning messages.

Source

pub fn stars(&self) -> StarsApi

Get the Stars API client

Provides methods for starring items.

Source

pub fn reminders(&self) -> RemindersApi

Get the Reminders API client

Provides methods for creating and managing reminders.

Source

pub fn dnd(&self) -> DndApi

Get the DND API client

Provides methods for Do Not Disturb settings.

Source

pub fn emoji(&self) -> EmojiApi

Get the Emoji API client

Provides methods for listing custom emoji.

Source

pub fn oauth(&self) -> OAuthApi

Get the OAuth v2 API client

Provides methods for OAuth token exchange and management. Use this for building public Slack apps with OAuth flows.

Source

pub fn openid(&self) -> OpenIDApi

Get the OpenID Connect API client

Provides methods for OpenID Connect authentication flows. Use this for implementing Sign in with Slack and identity verification.

Source

pub fn usergroups(&self) -> UsergroupsApi

Get the Usergroups API client

Provides methods for managing user groups.

Source

pub fn views(&self) -> ViewsApi

Get the Views API client

Provides methods for managing modals and App Home.

Source

pub fn dialog(&self) -> DialogApi

Get the Dialog API client (Legacy)

Provides methods for opening legacy dialogs.

Source

pub fn bookmarks(&self) -> BookmarksApi

Get the Bookmarks API client

Provides methods for managing channel bookmarks.

Source

pub fn admin(&self) -> AdminApi

Get the Admin API client

Provides methods for Enterprise Grid administration.

Source

pub fn apps(&self) -> AppsApi

Get the Apps API client

Provides methods for managing app configurations.

Source

pub fn calls(&self) -> CallsApi

Get the Calls API client

Provides methods for Slack Calls integration.

Source

pub fn workflows(&self) -> WorkflowsApi

Get the Workflows API client

Provides methods for Workflow Builder integrations.

Source

pub fn lists(&self) -> ListsApi

Get the Lists API client

Provides methods for managing Slack Lists.

Trait Implementations§

Source§

impl Clone for SlackClient

Source§

fn clone(&self) -> SlackClient

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

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

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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 T
where 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> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

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 T
where U: TryFrom<T>,

Source§

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<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

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