slack

package
v0.0.0-...-aa934f5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 30, 2022 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthedUser

type AuthedUser struct {
	ID          string `json:"id"`
	Scope       string `json:"scope"`
	AccessToken string `json:"access_token"`
	TokenType   string `json:"token_type"`
}

type Client

type Client struct {
	// contains filtered or unexported fields
}

func NewClient

func NewClient(config Config, store Store) *Client

func (*Client) Authenticate

func (s *Client) Authenticate(code string) error

func (*Client) SendRant

func (s *Client) SendRant(sc SlashCommand, genedRant string) error

type CommandReply

type CommandReply struct {
	ResponseType    ResponseTpe `json:"response_type"`
	Text            string      `json:"text"`
	ReplaceOriginal bool        `json:"replace_original"`
	DeleteOriginal  bool        `json:"delete_original"`
}

type Config

type Config struct {
	Oauth OauthConfig `json:"oauth"`
}

type OauthConfig

type OauthConfig struct {
	ClientID     string `json:"client_id" envconfig:"SLACK_OAUTH_CLIENT_ID"`
	ClientSecret string `json:"client_secret" envconfig:"SLACK_OAUTH_CLIENT_SECRET"`
	RedirectUrl  string `json:"redirect_url" envconfig:"SLACK_OAUTH_REDIRECT_URL"`
}

type OauthResponse

type OauthResponse struct {
	Ok         bool       `json:"ok"`
	Error      *string    `json:"error"`
	AuthedUser AuthedUser `json:"authed_user"`
}

type ResponseTpe

type ResponseTpe string

type SlashCommand

type SlashCommand struct {
	Token               string `schema:"token"`
	Command             string `schema:"command"`
	Text                string `schema:"text"`
	ResponseURL         string `schema:"response_url"`
	TriggerID           string `schema:"trigger_id"`
	UserId              string `schema:"user_id"`
	UserName            string `schema:"user_name"`
	TeamID              string `schema:"team_id"`
	ChannelID           string `schema:"channel_id"`
	ChannelName         string `schema:"channel_name"`
	APIAppID            string `schema:"api_app_id"`
	IsEnterpriseInstall bool   `schema:"is_enterprise_install"`
	TeamDomain          string `schema:"team_domain"`
}

type Store

type Store interface {
	GetAuthedUser(userID string) (AuthedUser, bool, error)
	StoreAuthedUser(userID string, authedUser AuthedUser) error
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL