dingtalk

package
v1.20.1 Latest Latest
Warning

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

Go to latest
Published: Jul 11, 2023 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SecuritySign    = "sign"
	SecurityKeyword = "keyword"
)

Variables

View Source
var (
	ErrNotFoundRobot = fmt.Errorf("未找到对应机器人")
)

Functions

This section is empty.

Types

type Dingtalk

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

func New

func New(options ...Option) *Dingtalk

func (*Dingtalk) Provide

func (ding *Dingtalk) Provide(ctx context.Context) interface{}

func (*Dingtalk) SendMessage

func (ding *Dingtalk) SendMessage(params interface{}) error

func (*Dingtalk) WithdrawMessage

func (ding *Dingtalk) WithdrawMessage(params interface{}) error

type Option

type Option func(*Options)

func WithAccessKey

func WithAccessKey(accessKey string) Option

func WithAccessKeySecret

func WithAccessKeySecret(accessKeySecret string) Option

func WithConnectTimeout

func WithConnectTimeout(connectTimeout time.Duration) Option

func WithEndpoint

func WithEndpoint(endpoint string) Option

func WithMaxIdleConns

func WithMaxIdleConns(maxIdleConns int) Option

func WithNetwork

func WithNetwork(network string) Option

func WithReadTimeout

func WithReadTimeout(readTimeout time.Duration) Option

func WithRegionId

func WithRegionId(regionId string) Option

func WithRobots

func WithRobots(robots []*RobotOptions) Option

type Options

type Options struct {
	AccessKey       string        // 验证 key
	AccessKeySecret string        // 验证秘钥
	RegionId        string        // 区域 例:cn-hangzhou
	Network         string        // 需访问服务器的网络类型。例:inner,vpc
	Endpoint        string        // 服务器地址,例:ecs-cn-hangzhou.aliyuncs.com
	ReadTimeout     time.Duration // 读超时,单位:秒
	ConnectTimeout  time.Duration // 连接超时,单位:秒
	MaxIdleConns    int           // 最大连接数
	Robots          []*RobotOptions
}

Options 基础配置

type Robot

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

func NewRobot

func NewRobot(options *RobotOptions) *Robot

type RobotOption

type RobotOption func(*RobotOptions)

func WithConversationId

func WithConversationId(conversationId string) RobotOption

func WithCoolAppCode

func WithCoolAppCode(coolAppCode string) RobotOption

func WithName

func WithName(name string) RobotOption

func WithRobotCode

func WithRobotCode(robotCode string) RobotOption

func WithToken

func WithToken(token string) RobotOption

type RobotOptions

type RobotOptions struct {
	Name           string
	RobotCode      string
	ConversationId string
	Token          string
	CoolAppCode    string
}

RobotOptions 机器人配置

type SendMessageRequest

type SendMessageRequest struct {
	RobotName string
	MsgKey    string
	MsgParam  string
}

type Webhook

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

func NewWebhook

func NewWebhook(opts ...WebhookOption) *Webhook

func (*Webhook) Provide

func (hook *Webhook) Provide(ctx context.Context) interface{}

func (*Webhook) SendMessage

func (hook *Webhook) SendMessage(params interface{}) error

func (*Webhook) WithdrawMessage

func (hook *Webhook) WithdrawMessage(params interface{}) error

type WebhookOption

type WebhookOption func(*WebhookOptions)

func WithWebhookRobot

func WithWebhookRobot(robots []*WebhookRobotOptions) WebhookOption

type WebhookOptions

type WebhookOptions struct {
	Robots []*WebhookRobotOptions
}

type WebhookRobot

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

func NewWebhookRobot

func NewWebhookRobot(options *WebhookRobotOptions) *WebhookRobot

func (*WebhookRobot) PostMessage

func (robot *WebhookRobot) PostMessage(body map[string]interface{}) error

func (*WebhookRobot) SendMessage

func (robot *WebhookRobot) SendMessage(msg *WebhookSendMessageReq) error

func (*WebhookRobot) Sign

func (robot *WebhookRobot) Sign(timestamp int64) string

type WebhookRobotOption

type WebhookRobotOption func(*WebhookRobotOptions)

func WithSignSecret

func WithSignSecret(signSecret string) WebhookRobotOption

func WithWebhook

func WithWebhook(webhook string) WebhookRobotOption

func WithWebhookRobotName

func WithWebhookRobotName(name string) WebhookRobotOption

type WebhookRobotOptions

type WebhookRobotOptions struct {
	Name    string
	Webhook string
	//Keyword    string
	SignSecret string
	//Security    string
	Security    bool
	ConnTimeout time.Duration
}

type WebhookSendMessageReq

type WebhookSendMessageReq struct {
	Name string
	Body map[string]interface{}
}

type WebhookSendMessageReqAt

type WebhookSendMessageReqAt struct {
	AtMobiles []string
	AtUserIds []string
	IsAtAll   bool
}

type WithdrawMessageRequest

type WithdrawMessageRequest struct {
	RobotName        string
	ProcessQueryKeys []string
}

Jump to

Keyboard shortcuts

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