larkevent

package
v3.0.12 Latest Latest
Warning

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

Go to latest
Published: Dec 15, 2022 License: MIT Imports: 9 Imported by: 66

Documentation

Index

Constants

View Source
const (
	EventRequestNonce     = "X-Lark-Request-Nonce"
	EventRequestTimestamp = "X-Lark-Request-Timestamp"
	EventSignature        = "X-Lark-Signature"
)
View Source
const ChallengeResponseFormat = `{"challenge":"%s"}`
View Source
const ContentTypeHeader = "Content-Type"
View Source
const ContentTypeJson = "application/json"
View Source
const DefaultContentType = ContentTypeJson + "; charset=utf-8"
View Source
const WebhookResponseFormat = `{"msg":"%s"}`

Variables

This section is empty.

Functions

func EventDecrypt

func EventDecrypt(encrypt string, secret string) ([]byte, error)

eventDecrypt returns decrypt bytes

func Signature

func Signature(timestamp string, nonce string, eventEncryptKey string, body string) string

Types

type DecryptErr

type DecryptErr struct {
	Message string
}

func (DecryptErr) Error

func (e DecryptErr) Error() string

type EventBase

type EventBase struct {
	Ts    string `json:"ts"`    // 事件发送的时间,一般近似于事件发生的时间。
	UUID  string `json:"uuid"`  // 事件的唯一标识
	Token string `json:"token"` // 即Verification Token
	Type  string `json:"type"`  // event_callback-事件推送,url_verification-url地址验证
}

type EventEncryptMsg

type EventEncryptMsg struct {
	Encrypt string `json:"encrypt"`
}

type EventFuzzy

type EventFuzzy struct {
	Encrypt   string       `json:"encrypt"`
	Schema    string       `json:"schema"`
	Token     string       `json:"token"`
	Type      string       `json:"type"`
	Challenge string       `json:"challenge"`
	Header    *EventHeader `json:"header"`
	Event     *struct {
		Type interface{} `json:"type"`
	} `json:"event"`
}

type EventHandler

type EventHandler interface {
	Event() interface{}                        // 用于返回事件消息结构体(即承载回调消息内容的结构体)
	Handle(context.Context, interface{}) error // 用于处理事件
}

type EventHandlerModel

type EventHandlerModel interface {
	RawReq(req *EventReq)
}

type EventHeader

type EventHeader struct {
	EventID    string `json:"event_id"`    // 事件 ID
	EventType  string `json:"event_type"`  // 事件类型
	AppID      string `json:"app_id"`      // 应用 ID
	TenantKey  string `json:"tenant_key"`  // 租户 Key
	CreateTime string `json:"create_time"` // 事件创建时间戳(单位:毫秒)
	Token      string `json:"token"`       // 事件 Token
}

type EventReq

type EventReq struct {
	Header     map[string][]string
	Body       []byte
	RequestURI string
}

func (*EventReq) RequestId

func (req *EventReq) RequestId() string

type EventResp

type EventResp struct {
	Header     http.Header // http请求 header
	Body       []byte      // http请求 body
	StatusCode int         // http请求状态码
}

type EventV1Header

type EventV1Header struct {
	AppID     string `json:"app_id"`       // 应用 ID
	OpenAppID string `json:"open_chat_id"` // Open App Id
	OpenID    string `json:"open_id"`      // Open Id
	TenantKey string `json:"tenant_key"`   // 租户 Key
	Type      string `json:"type"`         // event_callback-事件推送,url_verification-url地址验证
}

type EventV2Base

type EventV2Base struct {
	Schema string       `json:"schema"` // 事件模式
	Header *EventHeader `json:"header"` // 事件头
}

func (*EventV2Base) TenantKey added in v3.0.1

func (base *EventV2Base) TenantKey() string

type EventV2Body

type EventV2Body struct {
	EventV2Base
	Challenge string      `json:"challenge"`
	Event     interface{} `json:"event"`
	Type      string      `json:"type"`
}

type IReqHandler

type IReqHandler interface {
	Handle(ctx context.Context, req *EventReq) *EventResp
	Logger() larkcore.Logger
}

type OptionFunc

type OptionFunc func(config *larkcore.Config)

func WithLogLevel

func WithLogLevel(logLevel larkcore.LogLevel) OptionFunc

func WithLogger

func WithLogger(logger larkcore.Logger) OptionFunc

func WithSkipSignVerify added in v3.0.11

func WithSkipSignVerify(skipSignVerify bool) OptionFunc

type ReqType

type ReqType string
const (
	ReqTypeChallenge     ReqType = "url_verification"
	ReqTypeEventCallBack ReqType = "event_callback"
)

Directories

Path Synopsis
Package dispatcher code generated by oapi sdk gen
Package dispatcher code generated by oapi sdk gen

Jump to

Keyboard shortcuts

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