octopus

package
v0.2.5 Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package octopus octopus 消息平台推送客户端(公司 IM 基建件,收编自 argus internal/notify,v0.32.0):POST /api/v2/send/quick,X-User-Id 机器账号头(octopus AuthMiddleware 按 header 自动建账号)+ 可选 Bearer。 单一固定上游、共享连接池、缺省 10s 超时。

非目标:不做重试与收件人路由(终态推送失败由调用方按 status/err 自行 记账降级——审查主链路不因 IM 推送阻断);不做富文本卡片模板(markdown 内容由调用方渲染,业务文案不入本包)。

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	BaseURL   string // 如 http://octopus.svc(不带尾斜杠)
	ChannelID int64  // octopus 渠道 ID(企微/飞书/钉钉机器人渠道)
	User      string // 机器账号名(X-User-Id 头,必填——octopus 建账号语义)
	Token     string // 可选 Bearer(octopus 前置网关需要时用)
	// contains filtered or unexported fields
}

Client octopus 推送客户端(零值不可用;经 New 构建)。

func New

func New(baseURL string, channelID int64, user, token string, timeout time.Duration, hc *http.Client) *Client

New 构建客户端(timeout <=0 取 10s;hc 为 nil 时内置)。

func (*Client) SendMarkdown

func (c *Client) SendMarkdown(ctx context.Context, content string) (int, error)

SendMarkdown 推送 markdown 消息;返回 HTTP 状态码(网络错误时为 0)。 非 2xx 由调用方按业务记账(本包不重试不吞错)。

Jump to

Keyboard shortcuts

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