-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'slack-ai-assistant' of github.com:MattDavisRV/slack int…
…o slack-ai-assistant
- Loading branch information
Showing
108 changed files
with
8,265 additions
and
692 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
name: 'Close stale issues and PRs' | ||
on: | ||
schedule: | ||
- cron: '0 0 * * 1' # every Monday 0:00 UTC | ||
|
||
workflow_dispatch: | ||
|
||
permissions: | ||
issues: write | ||
pull-requests: write | ||
|
||
jobs: | ||
stale: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/stale@28ca1036281a5e5922ead5184a1bbf96e5fc984e # v9.0.0 | ||
with: | ||
any-of-labels: 'feedback given' | ||
days-before-stale: 45 | ||
days-before-pr-close: 10 | ||
stale-issue-message: 'This issue is stale because it has been open 45 days with no activity. Remove stale label or comment or this will be closed in 10 days.' | ||
stale-pr-message: 'This PR is stale because it has been open 45 days with no activity. Remove stale label or comment or this will be closed in 10 days.' | ||
close-issue-message: 'This issue was closed because it has been stalled for 10 days with no activity.' | ||
close-pr-message: 'This PR was closed because it has been stalled for 10 days with no activity.' | ||
operations-per-run: 120 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
*.test | ||
*~ | ||
.idea/ | ||
/vendor/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
package slack | ||
|
||
import ( | ||
"net/http" | ||
"testing" | ||
|
||
"github.com/stretchr/testify/assert" | ||
) | ||
|
||
func getTeamList(rw http.ResponseWriter, r *http.Request) { | ||
rw.Header().Set("Content-Type", "application/json") | ||
response := []byte(`{ | ||
"ok": true, | ||
"teams": [ | ||
{ | ||
"name": "Shinichi's workspace", | ||
"id": "T12345678" | ||
}, | ||
{ | ||
"name": "Migi's workspace", | ||
"id": "T12345679" | ||
} | ||
], | ||
"response_metadata": { | ||
"next_cursor": "dXNlcl9pZDo5MTQyOTI5Mzkz" | ||
} | ||
}`) | ||
rw.Write(response) | ||
} | ||
|
||
func TestListTeams(t *testing.T) { | ||
http.HandleFunc("/auth.teams.list", getTeamList) | ||
|
||
once.Do(startServer) | ||
api := New("testing-token", OptionAPIURL("http://"+serverAddr+"/")) | ||
|
||
teams, cursor, err := api.ListTeams(ListTeamsParameters{}) | ||
if err != nil { | ||
t.Errorf("Unexpected error: %s", err) | ||
return | ||
} | ||
|
||
assert.Len(t, teams, 2) | ||
assert.Equal(t, "T12345678", teams[0].ID) | ||
assert.Equal(t, "Shinichi's workspace", teams[0].Name) | ||
|
||
assert.Equal(t, "T12345679", teams[1].ID) | ||
assert.Equal(t, "Migi's workspace", teams[1].Name) | ||
|
||
assert.Equal(t, "dXNlcl9pZDo5MTQyOTI5Mzkz", cursor) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package slack | ||
|
||
// CallBlock defines data that is used to display a call in slack. | ||
// | ||
// More Information: https://api.slack.com/apis/calls#post_to_channel | ||
type CallBlock struct { | ||
Type MessageBlockType `json:"type"` | ||
BlockID string `json:"block_id,omitempty"` | ||
CallID string `json:"call_id"` | ||
} | ||
|
||
// BlockType returns the type of the block | ||
func (s CallBlock) BlockType() MessageBlockType { | ||
return s.Type | ||
} | ||
|
||
// NewFileBlock returns a new instance of a file block | ||
func NewCallBlock(callID string) *CallBlock { | ||
return &CallBlock{ | ||
Type: MBTCall, | ||
CallID: callID, | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package slack | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/stretchr/testify/assert" | ||
) | ||
|
||
func TestNewCallBlock(t *testing.T) { | ||
callBlock := NewCallBlock("ACallID") | ||
assert.Equal(t, string(callBlock.Type), "call") | ||
assert.Equal(t, callBlock.CallID, "ACallID") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.