Skip to content

Commit

Permalink
Merge branch 'master' into socketmode-handler
Browse files Browse the repository at this point in the history
  • Loading branch information
kanata2 committed Apr 24, 2022
2 parents b11c9d1 + 835fab1 commit 2a3c452
Show file tree
Hide file tree
Showing 85 changed files with 6,680 additions and 845 deletions.
4 changes: 4 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Expand Up @@ -9,6 +9,10 @@ about: Create a report to help us improve

### Steps to reproduce

#### reproducible code

#### manifest.yaml

### Versions
- Go:
- slack-go/slack:
28 changes: 13 additions & 15 deletions .github/workflows/test.yml
Expand Up @@ -7,32 +7,30 @@ on:
pull_request:

jobs:
ci:
runs-on: ubuntu-latest
name: lint
steps:
- uses: actions/checkout@v2
- name: golangci-lint
uses: golangci/golangci-lint-action@v2
with:
version: v1.32
test:
runs-on: ubuntu-latest
runs-on: ubuntu-20.04
strategy:
matrix:
go:
- '1.13'
- '1.14'
- '1.15'
- '1.16'
- '1.17'
- '1.18'
name: test go-${{ matrix.go }}
steps:
- uses: actions/checkout@v2
- uses: actions/setup-go@v2
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version: ${{ matrix.go }}
- name: run test
run: go test -v -race ./...
env:
GO111MODULE: on
lint:
runs-on: ubuntu-20.04
name: lint
steps:
- uses: actions/checkout@v3
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
with:
version: latest
11 changes: 9 additions & 2 deletions README.md
@@ -1,9 +1,9 @@
Slack API in Go [![Go Reference](https://pkg.go.dev/badge/github.com/slack-go/slack.svg)](https://pkg.go.dev/github.com/slack-go/slack)
===============

This is the original Slack library for Go created by Norberto Lopes, transferred to a Github organization.
This is the original Slack library for Go created by Norberto Lopes, transferred to a GitHub organization.

[![Join the chat at https://gitter.im/go-slack/Lobby](https://badges.gitter.im/go-slack/Lobby.svg)](https://gitter.im/go-slack/Lobby?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
You can also chat with us on the #slack-go, #slack-go-ja Slack channel on the Gophers Slack.

![logo](logo.png "icon")

Expand Down Expand Up @@ -70,8 +70,15 @@ func main() {
}
```

## Minimal Socket Mode usage:

See https://github.com/slack-go/slack/blob/master/examples/socketmode/socketmode.go


## Minimal RTM usage:

As mentioned in https://api.slack.com/rtm - for most applications, Socket Mode is a better way to communicate with Slack.

See https://github.com/slack-go/slack/blob/master/examples/websocket/websocket.go


Expand Down
6 changes: 5 additions & 1 deletion apps.go
Expand Up @@ -44,14 +44,18 @@ func (api *Client) ListEventAuthorizationsContext(ctx context.Context, eventCont
}

func (api *Client) UninstallApp(clientID, clientSecret string) error {
return api.UninstallAppContext(context.Background(), clientID, clientSecret)
}

func (api *Client) UninstallAppContext(ctx context.Context, clientID, clientSecret string) error {
values := url.Values{
"client_id": {clientID},
"client_secret": {clientSecret},
}

response := SlackResponse{}

err := api.getMethod(context.Background(), "apps.uninstall", api.token, values, &response)
err := api.getMethod(ctx, "apps.uninstall", api.token, values, &response)
if err != nil {
return err
}
Expand Down
10 changes: 10 additions & 0 deletions audit.go
Expand Up @@ -39,6 +39,16 @@ type AuditEntry struct {
UA string `json:"ua"`
IPAddress string `json:"ip_address"`
} `json:"context"`
Details struct {
NewValue interface{} `json:"new_value"`
PreviousValue interface{} `json:"previous_value"`
MobileOnly bool `json:"mobile_only"`
WebOnly bool `json:"web_only"`
NonSSOOnly bool `json:"non_sso_only"`
ExportType string `json:"export_type"`
ExportStart string `json:"export_start_ts"`
ExportEnd string `json:"export_end_ts"`
} `json:"details"`
}

type AuditUser struct {
Expand Down
17 changes: 9 additions & 8 deletions block.go
Expand Up @@ -9,14 +9,15 @@ package slack
type MessageBlockType string

const (
MBTSection MessageBlockType = "section"
MBTDivider MessageBlockType = "divider"
MBTImage MessageBlockType = "image"
MBTAction MessageBlockType = "actions"
MBTContext MessageBlockType = "context"
MBTFile MessageBlockType = "file"
MBTInput MessageBlockType = "input"
MBTHeader MessageBlockType = "header"
MBTSection MessageBlockType = "section"
MBTDivider MessageBlockType = "divider"
MBTImage MessageBlockType = "image"
MBTAction MessageBlockType = "actions"
MBTContext MessageBlockType = "context"
MBTFile MessageBlockType = "file"
MBTInput MessageBlockType = "input"
MBTHeader MessageBlockType = "header"
MBTRichText MessageBlockType = "rich_text"
)

// Block defines an interface all block types should implement
Expand Down
5 changes: 3 additions & 2 deletions block_conv.go
Expand Up @@ -2,9 +2,8 @@ package slack

import (
"encoding/json"
"errors"
"fmt"

"github.com/pkg/errors"
)

type sumtype struct {
Expand Down Expand Up @@ -65,6 +64,8 @@ func (b *Blocks) UnmarshalJSON(data []byte) error {
block = &ImageBlock{}
case "input":
block = &InputBlock{}
case "rich_text":
block = &RichTextBlock{}
case "section":
block = &SectionBlock{}
default:
Expand Down
6 changes: 6 additions & 0 deletions block_element.go
Expand Up @@ -167,6 +167,12 @@ func (s *ButtonBlockElement) WithStyle(style Style) *ButtonBlockElement {
return s
}

// WithConfirm adds a confirmation dialogue to the button object and returns the modified ButtonBlockElement
func (s *ButtonBlockElement) WithConfirm(confirm *ConfirmationBlockObject) *ButtonBlockElement {
s.Confirm = confirm
return s
}

// NewButtonBlockElement returns an instance of a new button element to be used within a block
func NewButtonBlockElement(actionID, value string, text *TextBlockObject) *ButtonBlockElement {
return &ButtonBlockElement{
Expand Down
3 changes: 2 additions & 1 deletion block_object.go
Expand Up @@ -187,8 +187,9 @@ func (s ConfirmationBlockObject) validateType() MessageObjectType {
}

// WithStyle add styling to confirmation object
func (s *ConfirmationBlockObject) WithStyle(style Style) {
func (s *ConfirmationBlockObject) WithStyle(style Style) *ConfirmationBlockObject {
s.Style = style
return s
}

// NewConfirmationBlockObject returns an instance of a new Confirmation Block Object
Expand Down

0 comments on commit 2a3c452

Please sign in to comment.