-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from int-tt/feature/private-channel
Feature/private channel
- Loading branch information
Showing
130 changed files
with
4,880 additions
and
1,909 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
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
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
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,56 @@ | ||
package slack | ||
|
||
import ( | ||
"fmt" | ||
|
||
"github.com/hashicorp/terraform-plugin-sdk/helper/schema" | ||
|
||
slackapi "github.com/slack-go/slack" | ||
) | ||
|
||
func resourceSendMessage() *schema.Resource { | ||
return &schema.Resource{ | ||
Create: resourceSendMessageCreate, | ||
Read: resourceChannelRead, | ||
Update: resourceChannelUpdate, | ||
Delete: resourceChannelDelete, | ||
Schema: map[string]*schema.Schema{ | ||
"channel_id": { | ||
Type: schema.TypeString, | ||
Required: true, | ||
}, | ||
"text": { | ||
Type: schema.TypeString, | ||
Required: true, | ||
}, | ||
"timestamp": { | ||
Type: schema.TypeString, | ||
Computed: true, | ||
}, | ||
}, | ||
} | ||
} | ||
|
||
func resourceSendMessageCreate(d *schema.ResourceData, meta interface{}) error { | ||
// https://github.com/nlopes/slack/blob/v0.6.0/chat.go#L283 | ||
channel, timestamp, _, err := meta.(*slackapi.Client).SendMessage( | ||
d.Get("channel_id").(string), slackapi.MsgOptionText(d.Get("text").(string), false), | ||
) | ||
if err != nil { | ||
return fmt.Errorf("failed to send message: %s", err.Error()) | ||
} | ||
d.SetId(fmt.Sprintf("%s:%s", channel, timestamp)) | ||
d.Set("timestamp", timestamp) | ||
|
||
return resourceSendMessageRead(d, meta) | ||
} | ||
|
||
func resourceSendMessageRead(d *schema.ResourceData, meta interface{}) error { | ||
return nil | ||
} | ||
func resourceSendMessageUpdate(d *schema.ResourceData, meta interface{}) error { | ||
return nil | ||
} | ||
func resourceSendMessageDelete(d *schema.ResourceData, meta interface{}) error { | ||
return nil | ||
} |
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 was deleted.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.