1
0
forked from lug/matterbridge

Update vendor (#1560)

This commit is contained in:
Wim
2021-07-31 18:27:55 +02:00
committed by GitHub
parent 1f365c716e
commit 44f3e2557d
95 changed files with 1677 additions and 181 deletions

View File

@@ -4,7 +4,7 @@
# The Tengo Language
[![GoDoc](https://godoc.org/github.com/d5/tengo?status.svg)](https://godoc.org/github.com/d5/tengo)
[![GoDoc](https://godoc.org/github.com/d5/tengo/v2?status.svg)](https://godoc.org/github.com/d5/tengo/v2)
![test](https://github.com/d5/tengo/workflows/test/badge.svg)
[![Go Report Card](https://goreportcard.com/badge/github.com/d5/tengo)](https://goreportcard.com/report/github.com/d5/tengo)
@@ -53,19 +53,19 @@ fmt.println(sum("", [1, 2, 3])) // "123"
| | fib(35) | fibt(35) | Language (Type) |
| :--- | ---: | ---: | :---: |
| [**Tengo**](https://github.com/d5/tengo) | `2,931ms` | `4ms` | Tengo (VM) |
| [go-lua](https://github.com/Shopify/go-lua) | `4,824ms` | `4ms` | Lua (VM) |
| [GopherLua](https://github.com/yuin/gopher-lua) | `5,365ms` | `4ms` | Lua (VM) |
| [goja](https://github.com/dop251/goja) | `5,533ms` | `5ms` | JavaScript (VM) |
| [starlark-go](https://github.com/google/starlark-go) | `11,495ms` | `5ms` | Starlark (Interpreter) |
| [Yaegi](https://github.com/containous/yaegi) | `15,645ms` | `12ms` | Yaegi (Interpreter) |
| [gpython](https://github.com/go-python/gpython) | `16,322ms` | `5ms` | Python (Interpreter) |
| [otto](https://github.com/robertkrimen/otto) | `73,093ms` | `10ms` | JavaScript (Interpreter) |
| [Anko](https://github.com/mattn/anko) | `79,809ms` | `8ms` | Anko (Interpreter) |
| [**Tengo**](https://github.com/d5/tengo) | `2,315ms` | `3ms` | Tengo (VM) |
| [go-lua](https://github.com/Shopify/go-lua) | `4,028ms` | `3ms` | Lua (VM) |
| [GopherLua](https://github.com/yuin/gopher-lua) | `4,409ms` | `3ms` | Lua (VM) |
| [goja](https://github.com/dop251/goja) | `5,194ms` | `4ms` | JavaScript (VM) |
| [starlark-go](https://github.com/google/starlark-go) | `6,954ms` | `3ms` | Starlark (Interpreter) |
| [gpython](https://github.com/go-python/gpython) | `11,324ms` | `4ms` | Python (Interpreter) |
| [Yaegi](https://github.com/containous/yaegi) | `11,715ms` | `10ms` | Yaegi (Interpreter) |
| [otto](https://github.com/robertkrimen/otto) | `48,539ms` | `6ms` | JavaScript (Interpreter) |
| [Anko](https://github.com/mattn/anko) | `52,821ms` | `6ms` | Anko (Interpreter) |
| - | - | - | - |
| Go | `53ms` | `3ms` | Go (Native) |
| Lua | `1,612ms` | `3ms` | Lua (Native) |
| Python | `2,632ms` | `23ms` | Python 2 (Native) |
| Go | `47ms` | `2ms` | Go (Native) |
| Lua | `756ms` | `2ms` | Lua (Native) |
| Python | `1,907ms` | `14ms` | Python2 (Native) |
_* [fib(35)](https://github.com/d5/tengobench/blob/master/code/fib.tengo):
Fibonacci(35)_
@@ -93,21 +93,18 @@ import (
)
func main() {
// Tengo script code
src := `
each := func(seq, fn) {
// create a new Script instance
script := tengo.NewScript([]byte(
`each := func(seq, fn) {
for x in seq { fn(x) }
}
sum := 0
mul := 1
each([a, b, c, d], func(x) {
sum += x
mul *= x
})`
// create a new Script instance
script := tengo.NewScript([]byte(src))
sum += x
mul *= x
})`))
// set values
_ = script.Add("a", 1)
@@ -128,6 +125,19 @@ each([a, b, c, d], func(x) {
}
```
Or, if you need to evaluate a simple expression, you can use [Eval](https://pkg.go.dev/github.com/d5/tengo/v2#Eval) function instead:
```golang
res, err := tengo.Eval(ctx,
`input ? "success" : "fail"`,
map[string]interface{}{"input": 1})
if err != nil {
panic(err)
}
fmt.Println(res) // "success"
```
## References
- [Language Syntax](https://github.com/d5/tengo/blob/master/docs/tutorial.md)

35
vendor/github.com/d5/tengo/v2/eval.go generated vendored Normal file
View File

@@ -0,0 +1,35 @@
package tengo
import (
"context"
"fmt"
"strings"
)
// Eval compiles and executes given expr with params, and returns an
// evaluated value. expr must be an expression. Otherwise it will fail to
// compile. Expression must not use or define variable "__res__" as it's
// reserved for the internal usage.
func Eval(
ctx context.Context,
expr string,
params map[string]interface{},
) (interface{}, error) {
expr = strings.TrimSpace(expr)
if expr == "" {
return nil, fmt.Errorf("empty expression")
}
script := NewScript([]byte(fmt.Sprintf("__res__ := (%s)", expr)))
for pk, pv := range params {
err := script.Add(pk, pv)
if err != nil {
return nil, fmt.Errorf("script add: %w", err)
}
}
compiled, err := script.RunContext(ctx)
if err != nil {
return nil, fmt.Errorf("script run: %w", err)
}
return compiled.Get("__res__").Value(), nil
}

View File

@@ -1,5 +1,20 @@
# Changelog
## v4.4.0 - 2021-07-12
**Fixes**
* Split HeaderXForwardedFor header only by comma [#1878](https://github.com/labstack/echo/pull/1878)
* Fix Timeout middleware Context propagation [#1910](https://github.com/labstack/echo/pull/1910)
**Enhancements**
* Bind data using headers as source [#1866](https://github.com/labstack/echo/pull/1866)
* Adds JWTConfig.ParseTokenFunc to JWT middleware to allow different libraries implementing JWT parsing. [#1887](https://github.com/labstack/echo/pull/1887)
* Adding tests for Echo#Host [#1895](https://github.com/labstack/echo/pull/1895)
* Adds RequestIDHandler function to RequestID middleware [#1898](https://github.com/labstack/echo/pull/1898)
* Allow for custom JSON encoding implementations [#1880](https://github.com/labstack/echo/pull/1880)
## v4.3.0 - 2021-05-08
**Important notes**

View File

@@ -2,7 +2,6 @@ package echo
import (
"encoding"
"encoding/json"
"encoding/xml"
"errors"
"fmt"
@@ -66,13 +65,13 @@ func (b *DefaultBinder) BindBody(c Context, i interface{}) (err error) {
ctype := req.Header.Get(HeaderContentType)
switch {
case strings.HasPrefix(ctype, MIMEApplicationJSON):
if err = json.NewDecoder(req.Body).Decode(i); err != nil {
if ute, ok := err.(*json.UnmarshalTypeError); ok {
return NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Unmarshal type error: expected=%v, got=%v, field=%v, offset=%v", ute.Type, ute.Value, ute.Field, ute.Offset)).SetInternal(err)
} else if se, ok := err.(*json.SyntaxError); ok {
return NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Syntax error: offset=%v, error=%v", se.Offset, se.Error())).SetInternal(err)
if err = c.Echo().JSONSerializer.Deserialize(c, i); err != nil {
switch err.(type) {
case *HTTPError:
return err
default:
return NewHTTPError(http.StatusBadRequest, err.Error()).SetInternal(err)
}
return NewHTTPError(http.StatusBadRequest, err.Error()).SetInternal(err)
}
case strings.HasPrefix(ctype, MIMEApplicationXML), strings.HasPrefix(ctype, MIMETextXML):
if err = xml.NewDecoder(req.Body).Decode(i); err != nil {
@@ -97,6 +96,14 @@ func (b *DefaultBinder) BindBody(c Context, i interface{}) (err error) {
return nil
}
// BindHeaders binds HTTP headers to a bindable object
func (b *DefaultBinder) BindHeaders(c Context, i interface{}) error {
if err := b.bindData(i, c.Request().Header, "header"); err != nil {
return NewHTTPError(http.StatusBadRequest, err.Error()).SetInternal(err)
}
return nil
}
// Bind implements the `Binder#Bind` function.
// Binding is done in following order: 1) path params; 2) query params; 3) request body. Each step COULD override previous
// step binded values. For single source binding use their own methods BindBody, BindQueryParams, BindPathParams.
@@ -134,7 +141,7 @@ func (b *DefaultBinder) bindData(destination interface{}, data map[string][]stri
// !struct
if typ.Kind() != reflect.Struct {
if tag == "param" || tag == "query" {
if tag == "param" || tag == "query" || tag == "header" {
// incompatible type, data is probably to be found in the body
return nil
}

View File

@@ -2,7 +2,6 @@ package echo
import (
"bytes"
"encoding/json"
"encoding/xml"
"fmt"
"io"
@@ -276,9 +275,9 @@ func (c *context) RealIP() string {
}
// Fall back to legacy behavior
if ip := c.request.Header.Get(HeaderXForwardedFor); ip != "" {
i := strings.IndexAny(ip, ", ")
i := strings.IndexAny(ip, ",")
if i > 0 {
return ip[:i]
return strings.TrimSpace(ip[:i])
}
return ip
}
@@ -457,17 +456,16 @@ func (c *context) String(code int, s string) (err error) {
}
func (c *context) jsonPBlob(code int, callback string, i interface{}) (err error) {
enc := json.NewEncoder(c.response)
_, pretty := c.QueryParams()["pretty"]
if c.echo.Debug || pretty {
enc.SetIndent("", " ")
indent := ""
if _, pretty := c.QueryParams()["pretty"]; c.echo.Debug || pretty {
indent = defaultIndent
}
c.writeContentType(MIMEApplicationJavaScriptCharsetUTF8)
c.response.WriteHeader(code)
if _, err = c.response.Write([]byte(callback + "(")); err != nil {
return
}
if err = enc.Encode(i); err != nil {
if err = c.echo.JSONSerializer.Serialize(c, i, indent); err != nil {
return
}
if _, err = c.response.Write([]byte(");")); err != nil {
@@ -477,13 +475,9 @@ func (c *context) jsonPBlob(code int, callback string, i interface{}) (err error
}
func (c *context) json(code int, i interface{}, indent string) error {
enc := json.NewEncoder(c.response)
if indent != "" {
enc.SetIndent("", indent)
}
c.writeContentType(MIMEApplicationJSONCharsetUTF8)
c.response.Status = code
return enc.Encode(i)
return c.echo.JSONSerializer.Serialize(c, i, indent)
}
func (c *context) JSON(code int, i interface{}) (err error) {

View File

@@ -90,6 +90,7 @@ type (
HidePort bool
HTTPErrorHandler HTTPErrorHandler
Binder Binder
JSONSerializer JSONSerializer
Validator Validator
Renderer Renderer
Logger Logger
@@ -125,6 +126,12 @@ type (
Validate(i interface{}) error
}
// JSONSerializer is the interface that encodes and decodes JSON to and from interfaces.
JSONSerializer interface {
Serialize(c Context, i interface{}, indent string) error
Deserialize(c Context, i interface{}) error
}
// Renderer is the interface that wraps the Render function.
Renderer interface {
Render(io.Writer, string, interface{}, Context) error
@@ -234,7 +241,7 @@ const (
const (
// Version of Echo
Version = "4.3.0"
Version = "4.4.0"
website = "https://echo.labstack.com"
// http://patorjk.com/software/taag/#p=display&f=Small%20Slant&t=Echo
banner = `
@@ -315,6 +322,7 @@ func New() (e *Echo) {
e.TLSServer.Handler = e
e.HTTPErrorHandler = e.DefaultHTTPErrorHandler
e.Binder = &DefaultBinder{}
e.JSONSerializer = &DefaultJSONSerializer{}
e.Logger.SetLevel(log.ERROR)
e.StdLogger = stdLog.New(e.Logger.Output(), e.Logger.Prefix()+": ", 0)
e.pool.New = func() interface{} {

31
vendor/github.com/labstack/echo/v4/json.go generated vendored Normal file
View File

@@ -0,0 +1,31 @@
package echo
import (
"encoding/json"
"fmt"
"net/http"
)
// DefaultJSONSerializer implements JSON encoding using encoding/json.
type DefaultJSONSerializer struct{}
// Serialize converts an interface into a json and writes it to the response.
// You can optionally use the indent parameter to produce pretty JSONs.
func (d DefaultJSONSerializer) Serialize(c Context, i interface{}, indent string) error {
enc := json.NewEncoder(c.Response())
if indent != "" {
enc.SetIndent("", indent)
}
return enc.Encode(i)
}
// Deserialize reads a JSON from a request body and converts it into an interface.
func (d DefaultJSONSerializer) Deserialize(c Context, i interface{}) error {
err := json.NewDecoder(c.Request().Body).Decode(i)
if ute, ok := err.(*json.UnmarshalTypeError); ok {
return NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Unmarshal type error: expected=%v, got=%v, field=%v, offset=%v", ute.Type, ute.Value, ute.Field, ute.Offset)).SetInternal(err)
} else if se, ok := err.(*json.SyntaxError); ok {
return NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Syntax error: offset=%v, error=%v", se.Offset, se.Error())).SetInternal(err)
}
return err
}

View File

@@ -1,6 +1,7 @@
package middleware
import (
"errors"
"fmt"
"net/http"
"reflect"
@@ -49,11 +50,12 @@ type (
// Optional. Default value "user".
ContextKey string
// Claims are extendable claims data defining token content.
// Claims are extendable claims data defining token content. Used by default ParseTokenFunc implementation.
// Not used if custom ParseTokenFunc is set.
// Optional. Default value jwt.MapClaims
Claims jwt.Claims
// TokenLookup is a string in the form of "<source>:<name>" that is used
// TokenLookup is a string in the form of "<source>:<name>" or "<source>:<name>,<source>:<name>" that is used
// to extract token from the request.
// Optional. Default value "header:Authorization".
// Possible values:
@@ -62,6 +64,9 @@ type (
// - "param:<name>"
// - "cookie:<name>"
// - "form:<name>"
// Multiply sources example:
// - "header: Authorization,cookie: myowncookie"
TokenLookup string
// AuthScheme to be used in the Authorization header.
@@ -71,13 +76,20 @@ type (
// KeyFunc defines a user-defined function that supplies the public key for a token validation.
// The function shall take care of verifying the signing algorithm and selecting the proper key.
// A user-defined KeyFunc can be useful if tokens are issued by an external party.
// Used by default ParseTokenFunc implementation.
//
// When a user-defined KeyFunc is provided, SigningKey, SigningKeys, and SigningMethod are ignored.
// This is one of the three options to provide a token validation key.
// The order of precedence is a user-defined KeyFunc, SigningKeys and SigningKey.
// Required if neither SigningKeys nor SigningKey is provided.
// Not used if custom ParseTokenFunc is set.
// Default to an internal implementation verifying the signing algorithm and selecting the proper key.
KeyFunc jwt.Keyfunc
// ParseTokenFunc defines a user-defined function that parses token from given auth. Returns an error when token
// parsing fails or parsed token is invalid.
// Defaults to implementation using `github.com/dgrijalva/jwt-go` as JWT implementation library
ParseTokenFunc func(auth string, c echo.Context) (interface{}, error)
}
// JWTSuccessHandler defines a function which is executed for a valid token.
@@ -137,7 +149,7 @@ func JWTWithConfig(config JWTConfig) echo.MiddlewareFunc {
if config.Skipper == nil {
config.Skipper = DefaultJWTConfig.Skipper
}
if config.SigningKey == nil && len(config.SigningKeys) == 0 && config.KeyFunc == nil {
if config.SigningKey == nil && len(config.SigningKeys) == 0 && config.KeyFunc == nil && config.ParseTokenFunc == nil {
panic("echo: jwt middleware requires signing key")
}
if config.SigningMethod == "" {
@@ -158,6 +170,9 @@ func JWTWithConfig(config JWTConfig) echo.MiddlewareFunc {
if config.KeyFunc == nil {
config.KeyFunc = config.defaultKeyFunc
}
if config.ParseTokenFunc == nil {
config.ParseTokenFunc = config.defaultParseToken
}
// Initialize
// Split sources
@@ -211,16 +226,8 @@ func JWTWithConfig(config JWTConfig) echo.MiddlewareFunc {
return err
}
token := new(jwt.Token)
// Issue #647, #656
if _, ok := config.Claims.(jwt.MapClaims); ok {
token, err = jwt.Parse(auth, config.KeyFunc)
} else {
t := reflect.ValueOf(config.Claims).Type().Elem()
claims := reflect.New(t).Interface().(jwt.Claims)
token, err = jwt.ParseWithClaims(auth, claims, config.KeyFunc)
}
if err == nil && token.Valid {
token, err := config.ParseTokenFunc(auth, c)
if err == nil {
// Store user information from token into context.
c.Set(config.ContextKey, token)
if config.SuccessHandler != nil {
@@ -243,6 +250,26 @@ func JWTWithConfig(config JWTConfig) echo.MiddlewareFunc {
}
}
func (config *JWTConfig) defaultParseToken(auth string, c echo.Context) (interface{}, error) {
token := new(jwt.Token)
var err error
// Issue #647, #656
if _, ok := config.Claims.(jwt.MapClaims); ok {
token, err = jwt.Parse(auth, config.KeyFunc)
} else {
t := reflect.ValueOf(config.Claims).Type().Elem()
claims := reflect.New(t).Interface().(jwt.Claims)
token, err = jwt.ParseWithClaims(auth, claims, config.KeyFunc)
}
if err != nil {
return nil, err
}
if !token.Valid {
return nil, errors.New("invalid token")
}
return token, nil
}
// defaultKeyFunc returns a signing key of the given token.
func (config *JWTConfig) defaultKeyFunc(t *jwt.Token) (interface{}, error) {
// Check the signing method

View File

@@ -169,7 +169,8 @@ type (
/*
NewRateLimiterMemoryStore returns an instance of RateLimiterMemoryStore with
the provided rate (as req/s). Burst and ExpiresIn will be set to default values.
the provided rate (as req/s). The provided rate less than 1 will be treated as zero.
Burst and ExpiresIn will be set to default values.
Example (with 20 requests/sec):

View File

@@ -14,6 +14,9 @@ type (
// Generator defines a function to generate an ID.
// Optional. Default value random.String(32).
Generator func() string
// RequestIDHandler defines a function which is executed for a request id.
RequestIDHandler func(echo.Context, string)
}
)
@@ -53,6 +56,9 @@ func RequestIDWithConfig(config RequestIDConfig) echo.MiddlewareFunc {
rid = config.Generator()
}
res.Header().Set(echo.HeaderXRequestID, rid)
if config.RequestIDHandler != nil {
config.RequestIDHandler(c, rid)
}
return next(c)
}

View File

@@ -2,9 +2,10 @@ package middleware
import (
"context"
"github.com/labstack/echo/v4"
"net/http"
"time"
"github.com/labstack/echo/v4"
)
type (
@@ -87,6 +88,10 @@ type echoHandlerFuncWrapper struct {
}
func (t echoHandlerFuncWrapper) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
// replace echo.Context Request with the one provided by TimeoutHandler to let later middlewares/handler on the chain
// handle properly it's cancellation
t.ctx.SetRequest(r)
// replace writer with TimeoutHandler custom one. This will guarantee that
// `writes by h to its ResponseWriter will return ErrHandlerTimeout.`
originalWriter := t.ctx.Response().Writer

144
vendor/github.com/slack-go/slack/audit.go generated vendored Normal file
View File

@@ -0,0 +1,144 @@
package slack
import (
"context"
"net/url"
"strconv"
)
type AuditLogResponse struct {
Entries []AuditEntry `json:"entries"`
SlackResponse
}
type AuditEntry struct {
ID string `json:"id"`
DateCreate int `json:"date_create"`
Action string `json:"action"`
Actor struct {
Type string `json:"type"`
User AuditUser `json:"user"`
} `json:"actor"`
Entity struct {
Type string `json:"type"`
// Only one of the below will be completed, based on the value of Type a user, a channel, a file, an app, a workspace, or an enterprise
User AuditUser `json:"user"`
Channel AuditChannel `json:"channel"`
File AuditFile `json:"file"`
App AuditApp `json:"app"`
Workspace AuditWorkspace `json:"workspace"`
Enterprise AuditEnterprise `json:"enterprise"`
} `json:"entity"`
Context struct {
Location struct {
Type string `json:"type"`
ID string `json:"id"`
Name string `json:"name"`
Domain string `json:"domain"`
} `json:"location"`
UA string `json:"ua"`
IPAddress string `json:"ip_address"`
} `json:"context"`
}
type AuditUser struct {
ID string `json:"id"`
Name string `json:"name"`
Email string `json:"email"`
Team string `json:"team"`
}
type AuditChannel struct {
ID string `json:"id"`
Name string `json:"name"`
Privacy string `json:"privacy"`
IsShared bool `json:"is_shared"`
IsOrgShared bool `json:"is_org_shared"`
}
type AuditFile struct {
ID string `json:"id"`
Name string `json:"name"`
Filetype string `json:"filetype"`
Title string `json:"title"`
}
type AuditApp struct {
ID string `json:"id"`
Name string `json:"name"`
IsDistributed bool `json:"is_distributed"`
IsDirectoryApproved bool `json:"is_directory_approved"`
IsWorkflowApp bool `json:"is_workflow_app"`
Scopes []string `json:"scopes"`
}
type AuditWorkspace struct {
ID string `json:"id"`
Name string `json:"name"`
Domain string `json:"domain"`
}
type AuditEnterprise struct {
ID string `json:"id"`
Name string `json:"name"`
Domain string `json:"domain"`
}
// AuditLogParameters contains all the parameters necessary (including the optional ones) for a GetAuditLogs() request
type AuditLogParameters struct {
Limit int
Cursor string
Latest int
Oldest int
Action string
Actor string
Entity string
}
func (api *Client) auditLogsRequest(ctx context.Context, path string, values url.Values) (*AuditLogResponse, error) {
response := &AuditLogResponse{}
err := api.getMethod(ctx, path, api.token, values, response)
if err != nil {
return nil, err
}
return response, response.Err()
}
// GetAuditLogs retrieves a page of audit entires according to the parameters given
func (api *Client) GetAuditLogs(params AuditLogParameters) (entries []AuditEntry, nextCursor string, err error) {
return api.GetAuditLogsContext(context.Background(), params)
}
// GetAuditLogsContext retrieves a page of audit entries according to the parameters given with a custom context
func (api *Client) GetAuditLogsContext(ctx context.Context, params AuditLogParameters) (entries []AuditEntry, nextCursor string, err error) {
values := url.Values{
"token": {api.token},
}
if params.Limit != 0 {
values.Add("count", strconv.Itoa(params.Limit))
}
if params.Oldest != 0 {
values.Add("oldest", strconv.Itoa(params.Oldest))
}
if params.Latest != 0 {
values.Add("latest", strconv.Itoa(params.Latest))
}
if params.Cursor != "" {
values.Add("cursor", params.Cursor)
}
if params.Action != "" {
values.Add("action", params.Action)
}
if params.Actor != "" {
values.Add("actor", params.Actor)
}
if params.Entity != "" {
values.Add("entity", params.Entity)
}
response, err := api.auditLogsRequest(ctx, "audit/v1/logs", values)
if err != nil {
return nil, "", err
}
return response.Entries, response.ResponseMetadata.Cursor, response.Err()
}

View File

@@ -458,6 +458,7 @@ type GetConversationsParameters struct {
ExcludeArchived bool
Limit int
Types []string
TeamID string
}
// GetConversations returns the list of channels in a Slack team
@@ -482,6 +483,9 @@ func (api *Client) GetConversationsContext(ctx context.Context, params *GetConve
if params.ExcludeArchived {
values.Add("exclude_archived", strconv.FormatBool(params.ExcludeArchived))
}
if params.TeamID != "" {
values.Add("team_id", params.TeamID)
}
response := struct {
Channels []Channel `json:"channels"`

View File

@@ -54,6 +54,20 @@ func NewStaticSelectDialogInput(name, label string, options []DialogSelectOption
}
}
// NewExternalSelectDialogInput constructor for a `external` datasource menu input
func NewExternalSelectDialogInput(name, label string, options []DialogSelectOption) *DialogInputSelect {
return &DialogInputSelect{
DialogInput: DialogInput{
Type: InputTypeSelect,
Name: name,
Label: label,
Optional: true,
},
DataSource: DialogDataSourceExternal,
Options: options,
}
}
// NewGroupedSelectDialogInput creates grouped options select input for Dialogs.
func NewGroupedSelectDialogInput(name, label string, options []DialogOptionGroup) *DialogInputSelect {
return &DialogInputSelect{

View File

@@ -121,6 +121,7 @@ type Container struct {
Type string `json:"type"`
ViewID string `json:"view_id"`
MessageTs string `json:"message_ts"`
ThreadTs string `json:"thread_ts,omitempty"`
AttachmentID json.Number `json:"attachment_id"`
ChannelID string `json:"channel_id"`
IsEphemeral bool `json:"is_ephemeral"`

View File

@@ -119,7 +119,7 @@ viper.AddConfigPath("$HOME/.appname") // call multiple times to add many search
viper.AddConfigPath(".") // optionally look for config in the working directory
err := viper.ReadInConfig() // Find and read the config file
if err != nil { // Handle errors reading the config file
panic(fmt.Errorf("Fatal error config file: %s \n", err))
panic(fmt.Errorf("Fatal error config file: %w \n", err))
}
```

View File

@@ -1153,7 +1153,7 @@ func (v *Viper) find(lcaseKey string, flagDefault bool) interface{} {
return cast.ToInt(flag.ValueString())
case "bool":
return cast.ToBool(flag.ValueString())
case "stringSlice":
case "stringSlice", "stringArray":
s := strings.TrimPrefix(flag.ValueString(), "[")
s = strings.TrimSuffix(s, "]")
res, _ := readAsCSV(s)
@@ -1232,7 +1232,7 @@ func (v *Viper) find(lcaseKey string, flagDefault bool) interface{} {
return cast.ToInt(flag.ValueString())
case "bool":
return cast.ToBool(flag.ValueString())
case "stringSlice":
case "stringSlice", "stringArray":
s := strings.TrimPrefix(flag.ValueString(), "[")
s = strings.TrimSuffix(s, "]")
res, _ := readAsCSV(s)