Documentation ¶
Overview ¶
Package edge provides a limited implementation of undocumented Slack Edge API necessary to get the data from a slack workspace.
Index ¶
- Variables
- type BaseRequest
- type BaseResponse
- type Client
- func (cl *Client) ChannelMembership(ctx context.Context, req *UserMembershipRequest) (*UserMembershipResponse, error)
- func (cl *Client) GetUsers(ctx context.Context, ids []string) ([]UserInfo, error)
- func (cl *Client) ParseResponse(req any, resp *http.Response) error
- func (cl *Client) Post(_ context.Context, path string, req PostRequest) (*http.Response, error)
- func (cl *Client) Raw() *http.Client
- func (cl *Client) UsersInfo(ctx context.Context, req *UsersInfoRequest) (*UserInfoResponse, error)
- type PostRequest
- type Profile
- type User
- type UserInfo
- type UserInfoResponse
- type UserMembershipRequest
- type UserMembershipResponse
- type UsersInfoRequest
- type UsersListRequest
- type UsersListResponse
Constants ¶
This section is empty.
Variables ¶
var ErrNotOK = errors.New("server returned NOT OK")
Functions ¶
This section is empty.
Types ¶
type BaseRequest ¶
type BaseRequest struct {
Token string `json:"token"`
}
func (*BaseRequest) IsTokenSet ¶
func (r *BaseRequest) IsTokenSet() bool
func (*BaseRequest) SetToken ¶
func (r *BaseRequest) SetToken(token string)
type BaseResponse ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func (*Client) ChannelMembership ¶
func (cl *Client) ChannelMembership(ctx context.Context, req *UserMembershipRequest) (*UserMembershipResponse, error)
ChannelMembership calls channels.membership endpoint.
func (*Client) GetUsers ¶
GetUsers returns users from the slack edge api for the channel. User IDs should be provided by the caller. If ids is empty, does nothing.
This tries to replicate the logic of the Slack client, when it fetches the channel users while being logged in as a guest user.
func (*Client) UsersInfo ¶
func (cl *Client) UsersInfo(ctx context.Context, req *UsersInfoRequest) (*UserInfoResponse, error)
UsersInfo calls a users.info endpoint. This endpoint does not return results straight away. It may return "pending ids", and when it does, it should be called again to get the actual user info (see Client.GetUsers).
type PostRequest ¶
type Profile ¶
type Profile struct { Title string `json:"title"` Phone string `json:"phone"` Skype string `json:"skype"` RealName string `json:"real_name"` RealNameNormalized string `json:"real_name_normalized"` DisplayName string `json:"display_name"` DisplayNameNormalized string `json:"display_name_normalized"` Fields any `json:"fields"` StatusText string `json:"status_text"` StatusEmoji string `json:"status_emoji"` StatusEmojiDisplayInfo []any `json:"status_emoji_display_info"` StatusExpiration int64 `json:"status_expiration"` AvatarHash string `json:"avatar_hash"` GuestInvitedBy string `json:"guest_invited_by"` ImageOriginal *string `json:"image_original,omitempty"` IsCustomImage *bool `json:"is_custom_image,omitempty"` Email string `json:"email"` FirstName *string `json:"first_name,omitempty"` LastName *string `json:"last_name,omitempty"` StatusTextCanonical string `json:"status_text_canonical"` Team string `json:"team"` }
type User ¶
type User struct { ID string `json:"id"` TeamID string `json:"team_id"` Name string `json:"name"` Deleted bool `json:"deleted"` Color string `json:"color"` RealName string `json:"real_name"` Tz string `json:"tz"` TzLabel string `json:"tz_label"` TzOffset int64 `json:"tz_offset"` Profile Profile `json:"profile"` IsAdmin bool `json:"is_admin"` IsOwner bool `json:"is_owner"` IsPrimaryOwner bool `json:"is_primary_owner"` IsRestricted bool `json:"is_restricted"` IsUltraRestricted bool `json:"is_ultra_restricted"` IsBot bool `json:"is_bot"` IsAppUser bool `json:"is_app_user"` Updated int64 `json:"updated"` IsEmailConfirmed bool `json:"is_email_confirmed"` }
type UserInfo ¶
type UserInfo struct { ID string `json:"id"` TeamID string `json:"team_id"` Name string `json:"name"` Color string `json:"color"` IsBot bool `json:"is_bot"` IsAppUser bool `json:"is_app_user"` Deleted bool `json:"deleted"` Profile Profile `json:"profile"` IsStranger bool `json:"is_stranger"` Updated int64 `json:"updated"` }
type UserInfoResponse ¶
type UserMembershipRequest ¶
type UserMembershipRequest struct { BaseRequest Channel string `json:"channel"` Users []string `json:"users"` AsAdmin bool `json:"as_admin"` }
type UserMembershipResponse ¶
type UserMembershipResponse struct { Channel string `json:"channel"` NonMembers []string `json:"non_members"` BaseResponse }
type UsersInfoRequest ¶
type UsersInfoRequest struct { BaseRequest CheckInteraction bool `json:"check_interaction"` IncludeProfileOnlyUsers bool `json:"include_profile_only_users"` UpdatedIDS map[string]int64 `json:"updated_ids"` }
type UsersListRequest ¶
type UsersListRequest struct { BaseRequest Channels []string `json:"channels"` PresentFirst bool `json:"present_first"` Filter string `json:"filter"` Count int64 `json:"count"` }
type UsersListResponse ¶
type UsersListResponse struct { Results []User `json:"results"` BaseResponse }