mirror of
https://github.com/cwinfo/matterbridge.git
synced 2025-07-03 09:37:44 +00:00
Update vendor (#1265)
This commit is contained in:
43
vendor/github.com/slack-go/slack/apps.go
generated
vendored
Normal file
43
vendor/github.com/slack-go/slack/apps.go
generated
vendored
Normal file
@ -0,0 +1,43 @@
|
||||
package slack
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
)
|
||||
|
||||
type listEventAuthorizationsResponse struct {
|
||||
SlackResponse
|
||||
Authorizations []EventAuthorization `json:"authorizations"`
|
||||
}
|
||||
|
||||
type EventAuthorization struct {
|
||||
EnterpriseID string `json:"enterprise_id"`
|
||||
TeamID string `json:"team_id"`
|
||||
UserID string `json:"user_id"`
|
||||
IsBot bool `json:"is_bot"`
|
||||
IsEnterpriseInstall bool `json:"is_enterprise_install"`
|
||||
}
|
||||
|
||||
func (api *Client) ListEventAuthorizations(eventContext string) ([]EventAuthorization, error) {
|
||||
return api.ListEventAuthorizationsContext(context.Background(), eventContext)
|
||||
}
|
||||
|
||||
// ListEventAuthorizationsContext lists authed users and teams for the given event_context. You must provide an app-level token to the client using OptionAppLevelToken. More info: https://api.slack.com/methods/apps.event.authorizations.list
|
||||
func (api *Client) ListEventAuthorizationsContext(ctx context.Context, eventContext string) ([]EventAuthorization, error) {
|
||||
resp := &listEventAuthorizationsResponse{}
|
||||
|
||||
request, _ := json.Marshal(map[string]string{
|
||||
"event_context": eventContext,
|
||||
})
|
||||
|
||||
err := postJSON(ctx, api.httpclient, api.endpoint+"apps.event.authorizations.list", api.appLevelToken, request, &resp, api)
|
||||
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if !resp.Ok {
|
||||
return nil, resp.Err()
|
||||
}
|
||||
|
||||
return resp.Authorizations, nil
|
||||
}
|
4
vendor/github.com/slack-go/slack/dialog.go
generated
vendored
4
vendor/github.com/slack-go/slack/dialog.go
generated
vendored
@ -54,7 +54,9 @@ type DialogCallback InteractionCallback
|
||||
|
||||
// DialogSubmissionCallback is sent from Slack when a user submits a form from within a dialog
|
||||
type DialogSubmissionCallback struct {
|
||||
State string `json:"state,omitempty"`
|
||||
// NOTE: State is only used with the dialog_submission type.
|
||||
// You should use InteractionCallback.BlockActionsState for block_actions type.
|
||||
State string `json:"-"`
|
||||
Submission map[string]string `json:"submission"`
|
||||
}
|
||||
|
||||
|
59
vendor/github.com/slack-go/slack/interactions.go
generated
vendored
59
vendor/github.com/slack-go/slack/interactions.go
generated
vendored
@ -56,6 +56,65 @@ type InteractionCallback struct {
|
||||
DialogSubmissionCallback
|
||||
ViewSubmissionCallback
|
||||
ViewClosedCallback
|
||||
|
||||
// FIXME(kanata2): just workaround for backward-compatibility.
|
||||
// See also https://github.com/slack-go/slack/issues/816
|
||||
RawState json.RawMessage `json:"state,omitempty"`
|
||||
|
||||
// BlockActionState stands for the `state` field in block_actions type.
|
||||
// NOTE: InteractionCallback.State has a role for the state of dialog_submission type,
|
||||
// so we cannot use this field for backward-compatibility for now.
|
||||
BlockActionState *BlockActionStates `json:"-"`
|
||||
}
|
||||
|
||||
type BlockActionStates struct {
|
||||
Values map[string]map[string]BlockAction `json:"values"`
|
||||
}
|
||||
|
||||
func (ic *InteractionCallback) MarshalJSON() ([]byte, error) {
|
||||
type alias InteractionCallback
|
||||
tmp := alias(*ic)
|
||||
if tmp.Type == InteractionTypeBlockActions {
|
||||
if tmp.BlockActionState == nil {
|
||||
tmp.RawState = []byte(`{}`)
|
||||
} else {
|
||||
state, err := json.Marshal(tmp.BlockActionState.Values)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
tmp.RawState = []byte(`{"values":` + string(state) + `}`)
|
||||
}
|
||||
} else if ic.Type == InteractionTypeDialogSubmission {
|
||||
tmp.RawState = []byte(tmp.State)
|
||||
}
|
||||
// Use pointer for go1.7
|
||||
return json.Marshal(&tmp)
|
||||
}
|
||||
|
||||
func (ic *InteractionCallback) UnmarshalJSON(b []byte) error {
|
||||
type alias InteractionCallback
|
||||
tmp := struct {
|
||||
Type InteractionType `json:"type"`
|
||||
*alias
|
||||
}{
|
||||
alias: (*alias)(ic),
|
||||
}
|
||||
if err := json.Unmarshal(b, &tmp); err != nil {
|
||||
return err
|
||||
}
|
||||
*ic = InteractionCallback(*tmp.alias)
|
||||
ic.Type = tmp.Type
|
||||
if ic.Type == InteractionTypeBlockActions {
|
||||
if len(ic.RawState) > 0 {
|
||||
err := json.Unmarshal(ic.RawState, &ic.BlockActionState)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
} else if ic.Type == InteractionTypeDialogSubmission {
|
||||
ic.State = string(ic.RawState)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type Container struct {
|
||||
|
30
vendor/github.com/slack-go/slack/reminders.go
generated
vendored
30
vendor/github.com/slack-go/slack/reminders.go
generated
vendored
@ -21,6 +21,11 @@ type reminderResp struct {
|
||||
Reminder Reminder `json:"reminder"`
|
||||
}
|
||||
|
||||
type remindersResp struct {
|
||||
SlackResponse
|
||||
Reminders []Reminder `json:"reminders"`
|
||||
}
|
||||
|
||||
func (api *Client) doReminder(ctx context.Context, path string, values url.Values) (*Reminder, error) {
|
||||
response := &reminderResp{}
|
||||
if err := api.postMethod(ctx, path, values, response); err != nil {
|
||||
@ -29,6 +34,31 @@ func (api *Client) doReminder(ctx context.Context, path string, values url.Value
|
||||
return &response.Reminder, response.Err()
|
||||
}
|
||||
|
||||
func (api *Client) doReminders(ctx context.Context, path string, values url.Values) ([]*Reminder, error) {
|
||||
response := &remindersResp{}
|
||||
if err := api.postMethod(ctx, path, values, response); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// create an array of pointers to reminders
|
||||
var reminders = make([]*Reminder, 0, len(response.Reminders))
|
||||
for _, reminder := range response.Reminders {
|
||||
reminders = append(reminders, &reminder)
|
||||
}
|
||||
|
||||
return reminders, response.Err()
|
||||
}
|
||||
|
||||
// ListReminders lists all the reminders created by or for the authenticated user
|
||||
//
|
||||
// See https://api.slack.com/methods/reminders.list
|
||||
func (api *Client) ListReminders() ([]*Reminder, error) {
|
||||
values := url.Values{
|
||||
"token": {api.token},
|
||||
}
|
||||
return api.doReminders(context.Background(), "reminders.list", values)
|
||||
}
|
||||
|
||||
// AddChannelReminder adds a reminder for a channel.
|
||||
//
|
||||
// See https://api.slack.com/methods/reminders.add (NOTE: the ability to set
|
||||
|
16
vendor/github.com/slack-go/slack/slack.go
generated
vendored
16
vendor/github.com/slack-go/slack/slack.go
generated
vendored
@ -57,11 +57,12 @@ type authTestResponseFull struct {
|
||||
type ParamOption func(*url.Values)
|
||||
|
||||
type Client struct {
|
||||
token string
|
||||
endpoint string
|
||||
debug bool
|
||||
log ilogger
|
||||
httpclient httpClient
|
||||
token string
|
||||
appLevelToken string
|
||||
endpoint string
|
||||
debug bool
|
||||
log ilogger
|
||||
httpclient httpClient
|
||||
}
|
||||
|
||||
// Option defines an option for a Client
|
||||
@ -93,6 +94,11 @@ func OptionAPIURL(u string) func(*Client) {
|
||||
return func(c *Client) { c.endpoint = u }
|
||||
}
|
||||
|
||||
// OptionAppLevelToken sets an app-level token for the client.
|
||||
func OptionAppLevelToken(token string) func(*Client) {
|
||||
return func(c *Client) { c.appLevelToken = token }
|
||||
}
|
||||
|
||||
// New builds a slack client from the provided token and options.
|
||||
func New(token string, options ...Option) *Client {
|
||||
s := &Client{
|
||||
|
2
vendor/github.com/slack-go/slack/slash.go
generated
vendored
2
vendor/github.com/slack-go/slack/slash.go
generated
vendored
@ -19,6 +19,7 @@ type SlashCommand struct {
|
||||
Text string `json:"text"`
|
||||
ResponseURL string `json:"response_url"`
|
||||
TriggerID string `json:"trigger_id"`
|
||||
APIAppID string `json:"api_app_id"`
|
||||
}
|
||||
|
||||
// SlashCommandParse will parse the request of the slash command
|
||||
@ -39,6 +40,7 @@ func SlashCommandParse(r *http.Request) (s SlashCommand, err error) {
|
||||
s.Text = r.PostForm.Get("text")
|
||||
s.ResponseURL = r.PostForm.Get("response_url")
|
||||
s.TriggerID = r.PostForm.Get("trigger_id")
|
||||
s.APIAppID = r.PostForm.Get("api_app_id")
|
||||
return s, nil
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user