line

package
v4.0.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 9, 2022 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package line provides sarah.Alerter implementation for LINE Notify.

Index

Constants

This section is empty.

Variables

View Source
var Endpoint = "https://notify-api.line.me/api/notify"

Endpoint defines the API endpoint to be used for notification.

Functions

This section is empty.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client is an API client for LINE notification.

func New

func New(config *Config, options ...Option) *Client

New creates and returns a new Client instant.

func (*Client) Alert

func (c *Client) Alert(ctx context.Context, botType sarah.BotType, err error) error

Alert sends an alert message to notify the critical state of sarah.Bot.

type Config

type Config struct {
	// Token declares the API token to use LINE Notify.
	Token string `json:"token" yaml:"token"`

	// RequestTimeout declares the timeout duration of each API call.
	RequestTimeout time.Duration `json:"timeout" yaml:"timeout"`
}

Config contains some configuration variables.

func NewConfig

func NewConfig() *Config

NewConfig creates and returns a new Config instance with default settings. Token is empty at this point as there can not be a default value. Use json.Unmarshal, yaml.Unmarshal, or manual manipulation to populate the blank value or override those default values.

type Option

type Option func(*Client)

Option defines a function's signature that New's functional options must satisfy.

func WithHTTPClient

func WithHTTPClient(httpClient *http.Client) Option

WithHTTPClient creates an Option that replaces http.DefaultClient with the given one.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL