PHP 클래스 Slack\ApiClient

파일 보기 프로젝트 열기: coderstephen/slack-client 1 사용 예제들

보호된 프로퍼티들

프로퍼티 타입 설명
$httpClient A Guzzle HTTP client.
$loop An event loop instance.
$token The Slack API token string.

공개 메소드들

메소드 설명
__construct ( React\EventLoop\LoopInterface $loop, GuzzleHttp\ClientInterface $httpClient = null ) Creates a new API client instance.
apiCall ( string $method, array $args = [] ) : React\Promise\PromiseInterface Sends an API request.
getAuthedUser ( ) : React\Promise\PromiseInterface Gets the currently authenticated user.
getChannelById ( string $id ) : React\Promise\PromiseInterface Gets a channel by its ID.
getChannelByName ( string $name ) : React\Promise\PromiseInterface Gets a channel by its name.
getChannelGroupOrDMByID ( string $id ) : React\Promise\PromiseInterface Gets a channel, group, or DM channel by ID.
getChannels ( ) : React\Promise\PromiseInterface Gets all channels in the team.
getDMById ( string $id ) : React\Promise\PromiseInterface Gets a direct message channel by its ID.
getDMByUser ( User $user ) : React\Promise\PromiseInterface Gets a direct message channel for a given user.
getDMByUserId ( string $id ) : React\Promise\PromiseInterface Gets a direct message channel by user's ID.
getDMs ( ) : React\Promise\PromiseInterface Gets all DMs the authenticated user has.
getGroupById ( string $id ) : React\Promise\PromiseInterface Gets a group by its ID.
getGroupByName ( string $name ) : React\Promise\PromiseInterface Gets a group by its name.
getGroups ( ) : React\Promise\PromiseInterface Gets all groups the authenticated user is a member of.
getMessageBuilder ( ) : Slack\Message\MessageBuilder Gets a message builder for creating a new message object.
getTeam ( ) : React\Promise\PromiseInterface Gets information about the current Slack team logged in to.
getUserById ( string $id ) : React\Promise\PromiseInterface Gets a user by its ID.
getUserByName ( $username ) : React\Promise\PromiseInterface Gets a user by username.
getUsers ( ) : React\Promise\PromiseInterface Gets all users in the Slack team.
postMessage ( Message $message ) : React\Promise\PromiseInterface Posts a message.
send ( string $text, slack\ChannelInterface $channel ) : React\Promise\PromiseInterface Sends a regular text message to a given channel.
setToken ( string $token ) Sets the Slack API token to be used during method calls.

메소드 상세

__construct() 공개 메소드

Creates a new API client instance.
public __construct ( React\EventLoop\LoopInterface $loop, GuzzleHttp\ClientInterface $httpClient = null )
$loop React\EventLoop\LoopInterface
$httpClient GuzzleHttp\ClientInterface A Guzzle client instance to send requests with.

apiCall() 공개 메소드

Sends an API request.
public apiCall ( string $method, array $args = [] ) : React\Promise\PromiseInterface
$method string The API method to call.
$args array An associative array of arguments to pass to the method call.
리턴 React\Promise\PromiseInterface A promise for an API response.

getAuthedUser() 공개 메소드

Gets the currently authenticated user.
public getAuthedUser ( ) : React\Promise\PromiseInterface
리턴 React\Promise\PromiseInterface A promise for the currently authenticated user.

getChannelById() 공개 메소드

Gets a channel by its ID.
public getChannelById ( string $id ) : React\Promise\PromiseInterface
$id string A channel ID.
리턴 React\Promise\PromiseInterface A promise for a channel object.

getChannelByName() 공개 메소드

Gets a channel by its name.
public getChannelByName ( string $name ) : React\Promise\PromiseInterface
$name string The name of the channel.
리턴 React\Promise\PromiseInterface

getChannelGroupOrDMByID() 공개 메소드

Gets a channel, group, or DM channel by ID.
public getChannelGroupOrDMByID ( string $id ) : React\Promise\PromiseInterface
$id string The channel ID.
리턴 React\Promise\PromiseInterface A promise for a channel interface.

getChannels() 공개 메소드

Gets all channels in the team.
public getChannels ( ) : React\Promise\PromiseInterface
리턴 React\Promise\PromiseInterface

getDMById() 공개 메소드

Gets a direct message channel by its ID.
public getDMById ( string $id ) : React\Promise\PromiseInterface
$id string A DM channel ID.
리턴 React\Promise\PromiseInterface A promise for a DM object.

getDMByUser() 공개 메소드

Gets a direct message channel for a given user.
public getDMByUser ( User $user ) : React\Promise\PromiseInterface
$user User The user to get a DM for.
리턴 React\Promise\PromiseInterface A promise for a DM object.

getDMByUserId() 공개 메소드

Gets a direct message channel by user's ID.
public getDMByUserId ( string $id ) : React\Promise\PromiseInterface
$id string A user ID.
리턴 React\Promise\PromiseInterface A promise for a DM object.

getDMs() 공개 메소드

Gets all DMs the authenticated user has.
public getDMs ( ) : React\Promise\PromiseInterface
리턴 React\Promise\PromiseInterface

getGroupById() 공개 메소드

Gets a group by its ID.
public getGroupById ( string $id ) : React\Promise\PromiseInterface
$id string A group ID.
리턴 React\Promise\PromiseInterface A promise for a group object.

getGroupByName() 공개 메소드

Gets a group by its name.
public getGroupByName ( string $name ) : React\Promise\PromiseInterface
$name string The name of the group.
리턴 React\Promise\PromiseInterface

getGroups() 공개 메소드

Gets all groups the authenticated user is a member of.
public getGroups ( ) : React\Promise\PromiseInterface
리턴 React\Promise\PromiseInterface

getMessageBuilder() 공개 메소드

Gets a message builder for creating a new message object.
public getMessageBuilder ( ) : Slack\Message\MessageBuilder
리턴 Slack\Message\MessageBuilder

getTeam() 공개 메소드

Gets information about the current Slack team logged in to.
public getTeam ( ) : React\Promise\PromiseInterface
리턴 React\Promise\PromiseInterface A promise for the current Slack team.

getUserById() 공개 메소드

Gets a user by its ID.
public getUserById ( string $id ) : React\Promise\PromiseInterface
$id string A user ID.
리턴 React\Promise\PromiseInterface A promise for a user object.

getUserByName() 공개 메소드

If the user could not be found, the returned promise is rejected with a UserNotFoundException exception.
public getUserByName ( $username ) : React\Promise\PromiseInterface
리턴 React\Promise\PromiseInterface A promise for a user object.

getUsers() 공개 메소드

Gets all users in the Slack team.
public getUsers ( ) : React\Promise\PromiseInterface
리턴 React\Promise\PromiseInterface A promise for an array of users.

postMessage() 공개 메소드

Posts a message.
public postMessage ( Message $message ) : React\Promise\PromiseInterface
$message Slack\Message\Message The message to post.
리턴 React\Promise\PromiseInterface

send() 공개 메소드

Sends a regular text message to a given channel.
public send ( string $text, slack\ChannelInterface $channel ) : React\Promise\PromiseInterface
$text string The message text.
$channel slack\ChannelInterface The channel to send the message to.
리턴 React\Promise\PromiseInterface

setToken() 공개 메소드

Sets the Slack API token to be used during method calls.
public setToken ( string $token )
$token string The API token string.

프로퍼티 상세

$httpClient 보호되어 있는 프로퍼티

A Guzzle HTTP client.
protected $httpClient

$loop 보호되어 있는 프로퍼티

An event loop instance.
protected $loop

$token 보호되어 있는 프로퍼티

The Slack API token string.
protected $token