Documentation ¶
Index ¶
- Variables
- type AuthUserResp
- type Importer
- type Member
- type OAuthResponseIncomingWebhook
- type OAuthV2ResponseAuthedUser
- type OAuthV2ResponseEnterprise
- type OAuthV2ResponseTeam
- type RespBody
- type SlackClient
- type SlackUserResponse
- type TokenResponse
- type UserCenter
- func (uc *UserCenter) AfterLogin(externalID, accessToken string)
- func (uc *UserCenter) BuildSlackBaseRedirectURL() string
- func (uc *UserCenter) ConfigFields() []plugin.ConfigField
- func (uc *UserCenter) ConfigReceiver(config []byte) error
- func (uc *UserCenter) ControlCenterItems() []plugin.ControlCenter
- func (uc *UserCenter) CronSyncData()
- func (uc *UserCenter) Description() plugin.UserCenterDesc
- func (uc *UserCenter) GetNewQuestionSubscribers() (userIDs []string)
- func (uc *UserCenter) GetQuestion(ctx *gin.Context) (questionInfo plugin.QuestionImporterInfo, err error)
- func (uc *UserCenter) GetSlackRedirectURL(ctx *gin.Context)
- func (uc *UserCenter) Info() plugin.Info
- func (uc *UserCenter) LoginCallback(ctx *plugin.GinContext) (userInfo *plugin.UserCenterBasicUserInfo, err error)
- func (uc *UserCenter) Notify(msg plugin.NotificationMessage)
- func (uc *UserCenter) PersonalBranding(externalID string) (branding []*plugin.PersonalBranding)
- func (uc *UserCenter) RegisterAuthAdminRouter(r *gin.RouterGroup)
- func (uc *UserCenter) RegisterAuthUserRouter(r *gin.RouterGroup)
- func (uc *UserCenter) RegisterImporterFunc(ctx context.Context, importerFunc plugin.ImporterFunc)
- func (uc *UserCenter) RegisterUnAuthRouter(r *gin.RouterGroup)
- func (uc *UserCenter) SignUpCallback(ctx *plugin.GinContext) (userInfo *plugin.UserCenterBasicUserInfo, err error)
- func (uc *UserCenter) SlashCommand(ctx *gin.Context)
- func (uc *UserCenter) Sync(ctx *gin.Context)
- func (uc *UserCenter) UserConfigFields() []plugin.ConfigField
- func (uc *UserCenter) UserConfigReceiver(userID string, config []byte) error
- func (uc *UserCenter) UserInfo(externalID string) (userInfo *plugin.UserCenterBasicUserInfo, err error)
- func (uc *UserCenter) UserList(externalIDs []string) (userList []*plugin.UserCenterBasicUserInfo, err error)
- func (uc *UserCenter) UserSettings(externalID string) (userSettings *plugin.SettingInfo, err error)
- func (uc *UserCenter) UserStatus(externalID string) (userStatus plugin.UserStatus)
- type UserCenterConfig
- type UserConfig
- type UserConfigCache
- type UserInfo
- type UserProfile
- type WebhookReq
Constants ¶
This section is empty.
Variables ¶
View Source
var Info embed.FS
Functions ¶
This section is empty.
Types ¶
type AuthUserResp ¶
type OAuthResponseIncomingWebhook ¶
type OAuthResponseIncomingWebhook struct { URL string `json:"url"` Channel string `json:"channel"` ChannelID string `json:"channel_id,omitempty"` ConfigurationURL string `json:"configuration_url"` }
OAuthResponseIncomingWebhook
type OAuthV2ResponseAuthedUser ¶
type OAuthV2ResponseAuthedUser struct { ID string `json:"id"` Scope string `json:"scope"` AccessToken string `json:"access_token"` ExpiresIn int `json:"expires_in"` RefreshToken string `json:"refresh_token"` TokenType string `json:"token_type"` }
OAuthV2ResponseAuthedUser
type OAuthV2ResponseEnterprise ¶
OAuthV2ResponseEnterprise
type OAuthV2ResponseTeam ¶
OAuthV2ResponseTeam
type RespBody ¶
type RespBody struct { // http code Code int `json:"code"` // reason key Reason string `json:"reason"` // response message Message string `json:"msg"` // response data Data interface{} `json:"data"` }
RespBody response body.
func NewRespBodyData ¶
NewRespBodyData new response body with data
type SlackClient ¶
type SlackClient struct { AccessToken string ClientID string ClientSecret string RedirectURI string AuthedUserID string UserInfoMapping map[string]*UserInfo ChannelMapping string }
func NewSlackClient ¶
func NewSlackClient(clientID, clientSecret string) *SlackClient
func NewSlackClientWithConfig ¶
func NewSlackClientWithConfig(clientID, clientSecret, redirectURI string) *SlackClient
func (*SlackClient) AuthUser ¶
func (sc *SlackClient) AuthUser(code string) (info *UserInfo, err error)
ExchangeCodeForUser through OAuthToken
func (*SlackClient) GetUserDetailInfo ¶
func (sc *SlackClient) GetUserDetailInfo(userid string) (info *UserInfo, err error)
func (*SlackClient) UpdateUserInfo ¶
func (sc *SlackClient) UpdateUserInfo() (err error)
type SlackUserResponse ¶
type TokenResponse ¶
type TokenResponse struct { AccessToken string `json:"access_token"` TokenType string `json:"token_type"` Scope string `json:"scope"` BotUserID string `json:"bot_user_id"` AppID string `json:"app_id"` Team OAuthV2ResponseTeam `json:"team"` IncomingWebhook OAuthResponseIncomingWebhook `json:"incoming_webhook"` Enterprise OAuthV2ResponseEnterprise `json:"enterprise"` IsEnterpriseInstall bool `json:"is_enterprise_install"` AuthedUser OAuthV2ResponseAuthedUser `json:"authed_user"` RefreshToken string `json:"refresh_token"` ExpiresIn int `json:"expires_in"` Error string `json:"error,omitempty"` }
type UserCenter ¶
type UserCenter struct { Config *UserCenterConfig SlackClient *SlackClient UserConfigCache *UserConfigCache Cache *cache.Cache // contains filtered or unexported fields }
func (*UserCenter) AfterLogin ¶
func (uc *UserCenter) AfterLogin(externalID, accessToken string)
func (*UserCenter) BuildSlackBaseRedirectURL ¶
func (uc *UserCenter) BuildSlackBaseRedirectURL() string
func (*UserCenter) ConfigFields ¶
func (uc *UserCenter) ConfigFields() []plugin.ConfigField
func (*UserCenter) ConfigReceiver ¶
func (uc *UserCenter) ConfigReceiver(config []byte) error
func (*UserCenter) ControlCenterItems ¶
func (uc *UserCenter) ControlCenterItems() []plugin.ControlCenter
func (*UserCenter) CronSyncData ¶
func (uc *UserCenter) CronSyncData()
func (*UserCenter) Description ¶
func (uc *UserCenter) Description() plugin.UserCenterDesc
func (*UserCenter) GetNewQuestionSubscribers ¶
func (uc *UserCenter) GetNewQuestionSubscribers() (userIDs []string)
GetNewQuestionSubscribers returns the subscribers of the new question notification
func (*UserCenter) GetQuestion ¶
func (uc *UserCenter) GetQuestion(ctx *gin.Context) (questionInfo plugin.QuestionImporterInfo, err error)
func (*UserCenter) GetSlackRedirectURL ¶
func (uc *UserCenter) GetSlackRedirectURL(ctx *gin.Context)
func (*UserCenter) Info ¶
func (uc *UserCenter) Info() plugin.Info
func (*UserCenter) LoginCallback ¶
func (uc *UserCenter) LoginCallback(ctx *plugin.GinContext) (userInfo *plugin.UserCenterBasicUserInfo, err error)
func (*UserCenter) Notify ¶
func (uc *UserCenter) Notify(msg plugin.NotificationMessage)
Notify sends a notification to the user
func (*UserCenter) PersonalBranding ¶
func (uc *UserCenter) PersonalBranding(externalID string) (branding []*plugin.PersonalBranding)
func (*UserCenter) RegisterAuthAdminRouter ¶
func (uc *UserCenter) RegisterAuthAdminRouter(r *gin.RouterGroup)
func (*UserCenter) RegisterAuthUserRouter ¶
func (uc *UserCenter) RegisterAuthUserRouter(r *gin.RouterGroup)
func (*UserCenter) RegisterImporterFunc ¶
func (uc *UserCenter) RegisterImporterFunc(ctx context.Context, importerFunc plugin.ImporterFunc)
func (*UserCenter) RegisterUnAuthRouter ¶
func (uc *UserCenter) RegisterUnAuthRouter(r *gin.RouterGroup)
func (*UserCenter) SignUpCallback ¶
func (uc *UserCenter) SignUpCallback(ctx *plugin.GinContext) (userInfo *plugin.UserCenterBasicUserInfo, err error)
func (*UserCenter) SlashCommand ¶
func (uc *UserCenter) SlashCommand(ctx *gin.Context)
func (*UserCenter) Sync ¶
func (uc *UserCenter) Sync(ctx *gin.Context)
func (*UserCenter) UserConfigFields ¶
func (uc *UserCenter) UserConfigFields() []plugin.ConfigField
func (*UserCenter) UserConfigReceiver ¶
func (uc *UserCenter) UserConfigReceiver(userID string, config []byte) error
func (*UserCenter) UserInfo ¶
func (uc *UserCenter) UserInfo(externalID string) (userInfo *plugin.UserCenterBasicUserInfo, err error)
func (*UserCenter) UserList ¶
func (uc *UserCenter) UserList(externalIDs []string) (userList []*plugin.UserCenterBasicUserInfo, err error)
func (*UserCenter) UserSettings ¶
func (uc *UserCenter) UserSettings(externalID string) (userSettings *plugin.SettingInfo, err error)
func (*UserCenter) UserStatus ¶
func (uc *UserCenter) UserStatus(externalID string) (userStatus plugin.UserStatus)
type UserCenterConfig ¶
type UserCenterConfig struct { ClientID string `json:"client_id"` // Slack Client ID ClientSecret string `json:"client_secret"` // Slack Client Secret RedirectURI string `json:"redirect_uri"` // OAuth Redirect URI SigningSecret string `json:"signing_secret"` // Slack Signing Secret AutoSync bool `json:"auto_sync"` // Auto sync Notification bool `json:"notification"` // Notification }
type UserConfig ¶
type UserConfig struct { WebhookURL string `json:"webhook_url"` InboxNotifications bool `json:"inbox_notifications"` AllNewQuestions bool `json:"all_new_questions"` NewQuestionsForFollowingTags bool `json:"new_questions_for_following_tags"` UpvotedAnswers bool `json:"upvoted_answers"` DownvotedAnswers bool `json:"downvoted_answers"` UpdatedQuestions bool `json:"updated_questions"` UpdatedAnswers bool `json:"updated_answers"` }
type UserConfigCache ¶
func NewUserConfigCache ¶
func NewUserConfigCache() *UserConfigCache
func (*UserConfigCache) SetUserConfig ¶
func (ucc *UserConfigCache) SetUserConfig(userID string, config *UserConfig)
type UserInfo ¶
type UserInfo struct { ID string `json:"id"` TeamID string `json:"team_id"` Name string `json:"name"` RealName string `json:"real_name"` Deleted bool `json:"deleted"` TimeZone string `json:"tz"` TimeZoneLabel string `json:"tz_label"` TimeZoneOffset int `json:"tz_offset"` Profile UserProfile `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"` Updated int64 `json:"updated"` IsAppUser bool `json:"is_app_user"` Has2FA bool `json:"has_2fa"` LastLogin int64 `json:"last_login,omitempty"` IsAvailable bool `json:"is_available"` Enable bool `json:"true"` Status int `json:"status"` }
type UserProfile ¶
type UserProfile struct { AvatarHash string `json:"avatar_hash"` StatusText string `json:"status_text"` StatusEmoji string `json:"status_emoji"` RealName string `json:"real_name"` DisplayName string `json:"display_name"` Email string `json:"email"` ImageOriginal string `json:"image_original"` Image24 string `json:"image_24"` Image32 string `json:"image_32"` Image48 string `json:"image_48"` Image72 string `json:"image_72"` Image192 string `json:"image_192"` Image512 string `json:"image_512"` }
type WebhookReq ¶
type WebhookReq struct { Blocks []struct { Type string `json:"type"` Text struct { Type string `json:"type"` Text string `json:"text"` } `json:"text"` } `json:"blocks"` }
func NewWebhookReq ¶
func NewWebhookReq(content string) *WebhookReq
Source Files ¶
Click to show internal directories.
Click to hide internal directories.