1
0
mirror of https://github.com/nikoksr/notify.git synced 2025-01-20 02:59:56 +02:00

style(fmt): make fmt

This commit is contained in:
Niko Köser 2022-08-04 15:58:38 +02:00
parent fdf31b04d3
commit 1167ab9b7d
No known key found for this signature in database
GPG Key ID: F3F28C118DAA6375
14 changed files with 65 additions and 56 deletions

View File

@ -5,7 +5,8 @@ import "context"
// Notifier defines the behavior for notification services.
//
// The Send function simply sends a subject and a message string to the internal destination Notifier.
// E.g. for telegram.Telegram it sends the message to the specified group chat.
//
// E.g. for telegram.Telegram it sends the message to the specified group chat.
type Notifier interface {
Send(context.Context, string, string) error
}

View File

@ -2,33 +2,34 @@
Package bark provides a service for sending messages to bark.
Usage:
package main
import (
"context"
"log"
package main
"github.com/nikoksr/notify"
"github.com/nikoksr/notify/service/bark"
)
import (
"context"
"log"
func main() {
// Create a bark service. `device key` is generated when you install the application. You can use the
// `bark.NewWithServers` function to create a service with a custom server.
barkService := bark.NewWithServers("your bark device key", bark.DefaultServerURL)
"github.com/nikoksr/notify"
"github.com/nikoksr/notify/service/bark"
)
// Or use `bark.New` to create a service with the default server.
barkService = bark.New("your bark device key")
func main() {
// Create a bark service. `device key` is generated when you install the application. You can use the
// `bark.NewWithServers` function to create a service with a custom server.
barkService := bark.NewWithServers("your bark device key", bark.DefaultServerURL)
// Tell our notifier to use the bark service.
notify.UseServices(barkService)
// Or use `bark.New` to create a service with the default server.
barkService = bark.New("your bark device key")
// Send a test message.
_ = notify.Send(
context.Background(),
"Subject/Title",
"The actual message - Hello, you awesome gophers! :)",
)
}
// Tell our notifier to use the bark service.
notify.UseServices(barkService)
// Send a test message.
_ = notify.Send(
context.Background(),
"Subject/Title",
"The actual message - Hello, you awesome gophers! :)",
)
}
*/
package bark

View File

@ -43,6 +43,5 @@ Usage:
log.Println("notification sent")
}
*/
package fcm

View File

@ -3,10 +3,10 @@
package fcm
import (
testing "testing"
fcm "github.com/appleboy/go-fcm"
mock "github.com/stretchr/testify/mock"
testing "testing"
)
// mockFCMClient is an autogenerated mock type for the mockFCMClient type

View File

@ -29,7 +29,8 @@ func New(senderAddress, smtpHostAddress string) *Mail {
// AuthenticateSMTP authenticates you to send emails via smtp.
// Example values: "", "test@gmail.com", "password123", "smtp.gmail.com"
// For more information about smtp authentication, see here:
// -> https://pkg.go.dev/net/smtp#PlainAuth
//
// -> https://pkg.go.dev/net/smtp#PlainAuth
func (m *Mail) AuthenticateSMTP(identity, userName, password, host string) {
m.smtpAuth = smtp.PlainAuth(identity, userName, password, host)
}

View File

@ -15,7 +15,8 @@ type MSTeams struct {
// New returns a new instance of a MSTeams notification service.
// For more information about telegram api token:
// -> https://github.com/atc0005/go-teams-notify#example-basic
//
// -> https://github.com/atc0005/go-teams-notify#example-basic
func New() *MSTeams {
client := goteamsnotify.NewClient()
@ -30,7 +31,8 @@ func New() *MSTeams {
// DisableWebhookValidation disables the validation of webhook URLs, including the validation of known prefixes so that
// custom/private webhook URL endpoints can be used (e.g., testing purposes).
// For more information about telegram api token:
// -> https://github.com/atc0005/go-teams-notify#example-disable-webhook-url-prefix-validation
//
// -> https://github.com/atc0005/go-teams-notify#example-disable-webhook-url-prefix-validation
func (m *MSTeams) DisableWebhookValidation() {
m.client.SkipWebhookURLValidationOnSend(true)
}
@ -44,7 +46,8 @@ func (m *MSTeams) AddReceivers(webHooks ...string) {
// Send accepts a subject and a message body and sends them to all previously specified channels. Message body supports
// html as markup language.
// For more information about telegram api token:
// -> https://github.com/atc0005/go-teams-notify#example-basic
//
// -> https://github.com/atc0005/go-teams-notify#example-basic
func (m MSTeams) Send(ctx context.Context, subject, message string) error {
msgCard := goteamsnotify.NewMessageCard()
msgCard.Title = subject

View File

@ -36,6 +36,5 @@ Usage:
log.Printf("notification sent")
}
*/
package plivo

View File

@ -15,7 +15,8 @@ type Pushbullet struct {
// New returns a new instance of a Pushbullet notification service.
// For more information about Pushbullet api token:
// -> https://docs.pushbullet.com/#api-overview
//
// -> https://docs.pushbullet.com/#api-overview
func New(apiToken string) *Pushbullet {
client := pushbullet.New(apiToken)

View File

@ -19,7 +19,8 @@ type SMS struct {
// Pushbullet nickname of the sms capable device from which messages are sent.
// (https://help.pushbullet.com/articles/how-do-i-send-text-messages-from-my-computer/).
// For more information about Pushbullet api token:
// -> https://docs.pushbullet.com/#api-overview
//
// -> https://docs.pushbullet.com/#api-overview
func NewSMS(apiToken, deviceNickname string) (*SMS, error) {
client := pushbullet.New(apiToken)

View File

@ -15,7 +15,8 @@ type Slack struct {
// New returns a new instance of a Slack notification service.
// For more information about slack api token:
// -> https://pkg.go.dev/github.com/slack-go/slack#New
//
// -> https://pkg.go.dev/github.com/slack-go/slack#New
func New(apiToken string) *Slack {
client := slack.New(apiToken)

View File

@ -2,30 +2,31 @@
Package syslog provides message notification integration for local or remote syslogs.
Usage:
package main
import (
"context"
"log"
package main
sl "log/syslog"
import (
"context"
"log"
"github.com/nikoksr/notify"
"github.com/nikoksr/notify/service/syslog"
)
sl "log/syslog"
func main() {
syslogSvc, err := syslog.New(sl.LOG_USER, "")
if err != nil {
log.Fatalf("syslog.New() failed: %v", err)
}
"github.com/nikoksr/notify"
"github.com/nikoksr/notify/service/syslog"
)
notify.UseServices(syslogSvc)
func main() {
syslogSvc, err := syslog.New(sl.LOG_USER, "")
if err != nil {
log.Fatalf("syslog.New() failed: %v", err)
}
err = notify.Send(context.Background(), "TEST", "Hello, World!")
if err != nil {
log.Fatalf("notify.Send() failed: %v", err)
}
}
notify.UseServices(syslogSvc)
err = notify.Send(context.Background(), "TEST", "Hello, World!")
if err != nil {
log.Fatalf("notify.Send() failed: %v", err)
}
}
*/
package syslog

View File

@ -17,7 +17,8 @@ type Telegram struct {
// New returns a new instance of a Telegram notification service.
// For more information about telegram api token:
// -> https://pkg.go.dev/github.com/go-telegram-bot-api/telegram-bot-api#NewBotAPI
//
// -> https://pkg.go.dev/github.com/go-telegram-bot-api/telegram-bot-api#NewBotAPI
func New(apiToken string) (*Telegram, error) {
client, err := tgbotapi.NewBotAPI(apiToken)
if err != nil {

View File

@ -35,7 +35,8 @@ type Credentials struct {
// New returns a new instance of a Slack notification service.
// For more information about slack api token:
// -> https://pkg.go.dev/github.com/slack-go/slack#New
//
// -> https://pkg.go.dev/github.com/slack-go/slack#New
func New(credentials Credentials) (*Twitter, error) {
config := oauth1.NewConfig(credentials.ConsumerKey, credentials.ConsumerSecret)
token := oauth1.NewToken(credentials.AccessToken, credentials.AccessTokenSecret)

View File

@ -35,6 +35,5 @@ Usage:
log.Println("notification sent")
}
*/
package whatsapp