Documentation
¶
Index ¶
- Constants
- Variables
- func BuildFilter(filterJSON string, queryCSV string) (any, string, error)
- func BuildRuleParam(eventKey string, opts RuleOptions) (ruleType string, ruleParam map[string]any, err error)
- func CanonicalJSON(v any) (string, error)
- func Fingerprint(endpoint, idempotencyKey string, profileSelector ...string) string
- func IdempotencyKey(identity Identity, eventKey, ruleType string, ruleParam map[string]any, ...) string
- func IsPublic(eventKey string) bool
- func IsSchemaPending(err error) bool
- func ProjectOutput(ev transport.Event) (any, error)
- func ProjectTransportOutput(ev transport.Event) (any, error)
- func PublicAvailabilityError(eventKey string) error
- func RemoveRunStates(workDir string, subscribeIDs []string) error
- func SupportsMessageFilter(eventKey string) bool
- func UpsertRunState(workDir string, st RunState) error
- type APIError
- type AttemptBlockedError
- type AttemptClaim
- type AttemptFailure
- type AttemptHold
- type AttemptSpec
- type AttemptState
- type AttemptStore
- func (s *AttemptStore) Claim(specs []AttemptSpec, lease time.Duration) (*AttemptClaim, error)
- func (s *AttemptStore) CompleteFailure(claim *AttemptClaim, succeeded []string, failure AttemptFailure) (AttemptHold, error)
- func (s *AttemptStore) CompleteSuccess(claim *AttemptClaim) error
- func (s *AttemptStore) Release(claim *AttemptClaim) error
- type AttemptStoreOption
- type CardActionEventOutput
- type Client
- func (c *Client) CreateSubscription(ctx context.Context, req CreateSubscriptionRequest) (*Subscription, error)
- func (c *Client) DeleteSubscription(ctx context.Context, subscribeID string) error
- func (c *Client) GetSubscription(ctx context.Context, subscribeID string) (*Subscription, error)
- func (c *Client) ListSubscriptions(ctx context.Context, opts ListOptions) ([]Subscription, error)
- type CreateSubscriptionRequest
- type Definition
- type GroupLifecycleEventOutput
- type GroupMemberEventMember
- type GroupMemberEventOutput
- type Identity
- type ListOptions
- type MessageEventContext
- type MessageEventOutput
- type OAApprovalInstanceCCOutput
- type OAApprovalInstanceFinishedOutput
- type OAApprovalInstanceStartedOutput
- type OAApprovalInstanceTerminatedOutput
- type OAApprovalTaskCreatedOutput
- type OAApprovalTaskFinishedOutput
- type OAApprovalTaskRedirectedOutput
- type ParameterConstraints
- type ReactionEventOutput
- type ReadEventOutput
- type RecallEventOutput
- type Retryability
- type RuleOptions
- type RunState
- type SchemaDocument
- type SchemaPendingError
- type Subscription
- type TodoTaskCreatedOutput
- type TodoTaskDeletedOutput
- type TodoTaskUpdatedOutput
- type VoIPCallReceiveInviteOutput
Constants ¶
const ( // AttemptStateFileName stores retry suppression state for personal // subscription creation. It intentionally does not share the successful // subscription run-state file. AttemptStateFileName = "personal_subscription_attempts.json" // AttemptStateLockFileName serializes cross-process attempt-state changes. AttemptStateLockFileName = "personal_subscription_attempts.lock" )
const ( EventMention = "user_im_message_receive_at" EventSingleChat = "user_im_message_receive_o2o" EventInChat = "user_im_message_receive_group" EventFromUser = "user_im_message_receive_user" EventAllSingleChat = "user_im_message_receive_o2o_all" EventAllGroupChat = "user_im_message_receive_group_all" EventReadO2O = "user_im_message_read_o2o" EventReadGroup = "user_im_message_read_group" EventRecallO2O = "user_im_message_recall_o2o" EventRecallGroup = "user_im_message_recall_group" EventReactionO2O = "user_im_message_reaction_o2o" EventReactionGroup = "user_im_message_reaction_group" EventGroupUpdated = "user_im_group_updated" EventGroupMemberAdded = "user_im_group_member_added" EventGroupMemberExited = "user_im_group_member_exited" EventGroupDisbanded = "user_im_group_disbanded" EventOAApprovalTaskCreated = "user_oa_approval_task_created" EventOAApprovalTaskFinished = "user_oa_approval_task_finished" EventOAApprovalTaskRedirected = "user_oa_approval_task_redirected" EventOAApprovalInstanceStarted = "user_oa_approval_instance_started" EventOAApprovalInstanceCC = "user_oa_approval_instance_cc" EventOAApprovalInstanceTerminated = "user_oa_approval_instance_terminated" EventOAApprovalInstanceFinished = "user_oa_approval_instance_finished" EventVoIPCallReceiveInvite = "user_voip_call_receive_invite" EventTodoTaskCreated = "user_todo_task_create" EventTodoTaskUpdated = "user_todo_task_update" EventTodoTaskDeleted = "user_todo_task_delete" EventCardAction = "user_card_action_triggered" )
const ( StatusEnabled = "enabled" StatusPending = "pending" )
const ( StateFileName = "personal_subscriptions.json" StateLockFileName = "personal_subscriptions.lock" )
const DefaultBasePath = "/dws"
Variables ¶
var ( // ErrAttemptClaimStale means another process replaced at least one claimed // fingerprint. Completion is rejected as a unit so an old process cannot // overwrite newer state. ErrAttemptClaimStale = errors.New("personal event: subscription attempt claim is stale") )
Functions ¶
func BuildRuleParam ¶
func CanonicalJSON ¶
func Fingerprint ¶ added in v1.0.56
Fingerprint hashes an endpoint, the existing subscription idempotency key, and optional profile selectors into a stable non-reversible store key. Passing the active selector ensures two profiles resolving to the same corp/user can recover independently after a profile change.
func IdempotencyKey ¶
func IsSchemaPending ¶
func ProjectOutput ¶ added in v1.0.54
ProjectOutput converts the transport envelope into the stable personal event output. On malformed VoIP or card data it returns a safe typed output so sensitive transport fields cannot leak through the projection fallback; legacy event families keep their original-envelope fallback behavior.
func ProjectTransportOutput ¶ added in v1.0.61
ProjectTransportOutput preserves the transport envelope used by the default non-flatten output mode while removing sensitive VoIP invitation fields. Callers that explicitly opt into raw debugging bypass this projector.
func PublicAvailabilityError ¶
func RemoveRunStates ¶
func SupportsMessageFilter ¶ added in v1.0.55
SupportsMessageFilter reports whether --query/--filter-json describe a stable message payload for this event. Action and group lifecycle events do not expose the same filter fields.
func UpsertRunState ¶
Types ¶
type APIError ¶
type APIError struct {
Code string `json:"code"`
Message string `json:"message"`
Retryable *bool `json:"retryable,omitempty"`
RetryAfterSeconds *int64 `json:"retry_after_seconds,omitempty"`
NextRetryAt *time.Time `json:"next_retry_at,omitempty"`
TraceID string `json:"trace_id,omitempty"`
HTTPStatus int `json:"http_status,omitempty"`
Details map[string]any `json:"details,omitempty"`
}
type AttemptBlockedError ¶ added in v1.0.56
type AttemptBlockedError struct {
Fingerprint string
EventKey string
State AttemptState
Retryability Retryability
RetryAfter time.Duration
NextAllowedAt time.Time
FailureCount int
ErrorCode string
TraceID string
}
AttemptBlockedError reports a local suppression decision. It never includes the raw endpoint, idempotency key, profile selector, rule parameter, or filter.
func (*AttemptBlockedError) Error ¶ added in v1.0.56
func (e *AttemptBlockedError) Error() string
type AttemptClaim ¶ added in v1.0.56
type AttemptClaim struct {
AttemptID string
Fingerprints []string
// contains filtered or unexported fields
}
AttemptClaim is the ownership token returned by Claim. Callers must finish it with CompleteSuccess, CompleteFailure, or Release.
type AttemptFailure ¶ added in v1.0.56
type AttemptFailure struct {
Fingerprint string
Retryability Retryability
RetryAfter time.Duration
ErrorCode string
TraceID string
}
AttemptFailure describes the one failed item in a claimed batch.
type AttemptHold ¶ added in v1.0.56
type AttemptHold struct {
Fingerprint string
State AttemptState
Retryability Retryability
RetryAfter time.Duration
NextAllowedAt time.Time
FailureCount int
}
AttemptHold is the persisted suppression decision after CompleteFailure.
type AttemptSpec ¶ added in v1.0.56
AttemptSpec identifies one normalized subscription request. Fingerprint must come from Fingerprint; only the digest and the non-sensitive event key are persisted.
type AttemptState ¶ added in v1.0.56
type AttemptState string
AttemptState is the persisted lifecycle state of one subscription attempt.
const ( AttemptStateInFlight AttemptState = "in_flight" AttemptStateCooldown AttemptState = "cooldown" AttemptStateTerminalHold AttemptState = "terminal_hold" )
type AttemptStore ¶ added in v1.0.56
type AttemptStore struct {
// contains filtered or unexported fields
}
AttemptStore coordinates personal subscription creation across CLI processes sharing one identity work directory.
func NewAttemptStore ¶ added in v1.0.56
func NewAttemptStore(workDir string, options ...AttemptStoreOption) *AttemptStore
NewAttemptStore creates a fail-closed persistent attempt guard rooted in the identity-specific personal event work directory.
func (*AttemptStore) Claim ¶ added in v1.0.56
func (s *AttemptStore) Claim(specs []AttemptSpec, lease time.Duration) (*AttemptClaim, error)
Claim atomically reserves every fingerprint in specs. If any fingerprint is still suppressed, none are reserved and an AttemptBlockedError is returned.
func (*AttemptStore) CompleteFailure ¶ added in v1.0.56
func (s *AttemptStore) CompleteFailure( claim *AttemptClaim, succeeded []string, failure AttemptFailure, ) (AttemptHold, error)
CompleteFailure records the failed item, clears successfully completed items, and restores every unexecuted item to its exact pre-claim state.
func (*AttemptStore) CompleteSuccess ¶ added in v1.0.56
func (s *AttemptStore) CompleteSuccess(claim *AttemptClaim) error
CompleteSuccess clears failure history for every item in a successful claimed batch.
func (*AttemptStore) Release ¶ added in v1.0.56
func (s *AttemptStore) Release(claim *AttemptClaim) error
Release restores every claimed item without recording a remote failure. It is intended for local failures before a subscription request is sent.
type AttemptStoreOption ¶ added in v1.0.56
type AttemptStoreOption func(*AttemptStore)
AttemptStoreOption customizes an AttemptStore.
func WithAttemptClock ¶ added in v1.0.56
func WithAttemptClock(now func() time.Time) AttemptStoreOption
WithAttemptClock installs a clock, primarily for deterministic tests.
func WithAttemptIDGenerator ¶ added in v1.0.56
func WithAttemptIDGenerator(generate func() (string, error)) AttemptStoreOption
WithAttemptIDGenerator installs an attempt-ID generator. IDs are persisted only as CAS tokens and must not contain request data.
type CardActionEventOutput ¶ added in v1.0.62
type CardActionEventOutput struct {
Type string `json:"type" description:"事件类型,固定为当前 event_key"`
EventID string `json:"event_id" description:"事件 ID,可用于去重"`
Timestamp int64 `json:"timestamp" description:"事件发生时间戳" format:"timestamp_ms"`
SubscribeID string `json:"subscribe_id" description:"订阅 ID"`
Payload map[string]any `` /* 127-byte string literal not displayed */
}
CardActionEventOutput preserves the interactive-card callback payload at runtime so reviewed fields and future business extensions survive unchanged. Its schema is described separately by cardActionSchemaOutput.
type Client ¶
type Client struct {
BaseURL string
HTTPClient *http.Client
Identity Identity
AccessTokenProvider func(context.Context) (string, error)
ClientVersion string
UserAgent string
}
func (*Client) CreateSubscription ¶
func (c *Client) CreateSubscription(ctx context.Context, req CreateSubscriptionRequest) (*Subscription, error)
func (*Client) DeleteSubscription ¶
func (*Client) GetSubscription ¶
func (*Client) ListSubscriptions ¶
func (c *Client) ListSubscriptions(ctx context.Context, opts ListOptions) ([]Subscription, error)
type CreateSubscriptionRequest ¶
type CreateSubscriptionRequest struct {
EventKey string `json:"event_key"`
RuleType string `json:"rule_type"`
Name string `json:"name,omitempty"`
RuleParam map[string]any `json:"rule_param"`
Filter any `json:"filter,omitempty"`
Delivery map[string]any `json:"delivery"`
TTLSeconds int64 `json:"ttl_seconds,omitempty"`
IdempotencyKey string `json:"idempotency_key,omitempty"`
}
type Definition ¶
type Definition struct {
EventKey string `json:"event_key"`
DisplayName string `json:"display_name"`
Description string `json:"description"`
Category string `json:"category"`
RuleType string `json:"rule_type"`
Status string `json:"status"`
RequiredParams []string `json:"required_params"`
Constraints *ParameterConstraints `json:"constraints,omitempty"`
Auth map[string]any `json:"auth,omitempty"`
Public bool `json:"-"`
}
func Catalog ¶
func Catalog(category string, enabledOnly, includePending bool) []Definition
func Definitions ¶
func Definitions() []Definition
func Lookup ¶
func Lookup(eventKey string) (Definition, bool)
type GroupLifecycleEventOutput ¶ added in v1.0.55
type GroupLifecycleEventOutput struct {
Type string `json:"type" description:"事件类型,固定为当前 event_key"`
EventID string `json:"event_id" description:"事件 ID,可用于去重"`
Timestamp int64 `json:"timestamp" description:"事件发生时间戳" format:"timestamp_ms"`
SubscribeID string `json:"subscribe_id" description:"订阅 ID"`
Payload map[string]any `` /* 130-byte string literal not displayed */
}
GroupLifecycleEventOutput is intentionally conservative until stable group event payload samples are available. Payload keeps unknown business fields while transport identity and routing metadata remain available only in raw output.
type GroupMemberEventMember ¶ added in v1.0.55
type GroupMemberEventOutput ¶ added in v1.0.55
type GroupMemberEventOutput struct {
Type string `json:"type" description:"事件类型,固定为当前 event_key"`
EventID string `json:"event_id" description:"事件 ID,可用于去重"`
Timestamp int64 `json:"timestamp" description:"事件发生时间戳" format:"timestamp_ms"`
SubscribeID string `json:"subscribe_id" description:"订阅 ID"`
ConversationID string `json:"conversation_id" description:"发生成员变更的群会话 ID" format:"open_conversation_id"`
Operator string `json:"operator" description:"执行成员变更操作的用户展示名,系统操作或成员自行退出时可能为空"`
OperatorOpenDingTalkID string `` /* 166-byte string literal not displayed */
Members []GroupMemberEventMember `json:"members" description:"本次加入或退出的成员列表"`
EventTime int64 `json:"event_time" description:"群成员变更事件时间戳" format:"timestamp_ms"`
}
type Identity ¶
type ListOptions ¶
type MessageEventContext ¶ added in v1.0.55
type MessageEventContext struct {
MessageID string `json:"message_id" description:"内部消息的开放消息 ID" format:"open_message_id"`
ConversationID string `json:"conversation_id" description:"内部消息原来所在的会话 ID" format:"open_conversation_id"`
Sender string `json:"sender" description:"内部消息发送人展示名;服务端未提供时可能为空或为 null 字符串"`
SenderOpenDingTalkID string `` /* 131-byte string literal not displayed */
Content string `json:"content" description:"内部消息正文;媒体消息可能包含 mediaId 等下载定位信息"`
CreateTime string `json:"create_time" description:"内部消息创建时间"`
}
MessageEventContext preserves the business context nested under a quoted reply or merged-forward message. Keep these fields structured instead of parsing the localized outer content summary.
type MessageEventOutput ¶ added in v1.0.54
type MessageEventOutput struct {
Type string `json:"type" description:"事件类型,固定为当前 event_key"`
EventID string `json:"event_id" description:"事件 ID,可用于去重"`
Timestamp int64 `json:"timestamp" description:"事件发生时间戳" format:"timestamp_ms"`
SubscribeID string `json:"subscribe_id" description:"订阅 ID"`
MessageID string `json:"message_id" description:"开放消息 ID" format:"open_message_id"`
ConversationID string `json:"conversation_id" description:"会话 ID" format:"open_conversation_id"`
Sender string `json:"sender" description:"发送人展示名"`
SenderOpenDingTalkID string `json:"sender_open_dingtalk_id" description:"发送人开放 ID" format:"open_dingtalk_id"`
Content string `json:"content" description:"消息正文"`
CreateTime string `json:"create_time" description:"消息创建时间"`
EventTime int64 `json:"event_time" description:"消息事件时间戳" format:"timestamp_ms"`
QuotedMessage *MessageEventContext `json:"quoted_message,omitempty" description:"引用回复所引用的原消息;非引用回复时不输出"`
ForwardMessages []MessageEventContext `json:"forward_messages,omitempty" description:"合并转发包含的原消息列表;非合并转发时不输出"`
}
MessageEventOutput is the stable business-facing output for personal message receive events. Schema output is generated from these tags so the documented fields cannot drift from the values written by consume.
type OAApprovalInstanceCCOutput ¶ added in v1.0.59
type OAApprovalInstanceCCOutput struct {
Type string `json:"type" description:"事件类型,固定为当前 event_key"`
EventID string `json:"event_id" description:"事件 ID,可用于去重"`
Timestamp int64 `json:"timestamp" description:"事件发生时间戳" format:"timestamp_ms"`
SubscribeID string `json:"subscribe_id" description:"订阅 ID"`
ProcessInstanceID string `json:"process_instance_id" description:"审批实例 ID"`
ProcessCode string `json:"process_code" description:"审批流程模板编码"`
Title string `json:"title" description:"审批标题"`
Status string `json:"status" description:"审批实例到达抄送节点时的状态"`
CreateTime int64 `json:"create_time" description:"审批实例创建时间" format:"timestamp_ms"`
EventTime int64 `json:"event_time" description:"审批抄送事件业务时间" format:"timestamp_ms"`
}
type OAApprovalInstanceFinishedOutput ¶ added in v1.0.58
type OAApprovalInstanceFinishedOutput struct {
Type string `json:"type" description:"事件类型,固定为当前 event_key"`
EventID string `json:"event_id" description:"事件 ID,可用于去重"`
Timestamp int64 `json:"timestamp" description:"事件发生时间戳" format:"timestamp_ms"`
SubscribeID string `json:"subscribe_id" description:"订阅 ID"`
ProcessInstanceID string `json:"process_instance_id" description:"审批实例 ID"`
ProcessCode string `json:"process_code" description:"审批流程模板编码"`
Title string `json:"title" description:"审批标题"`
Status string `json:"status" description:"审批实例状态"`
Result string `json:"result" description:"审批实例处理结果,值以服务端实际推送为准"`
CreateTime int64 `json:"create_time" description:"审批实例创建时间" format:"timestamp_ms"`
FinishTime int64 `json:"finish_time" description:"审批实例完成时间" format:"timestamp_ms"`
EventTime int64 `json:"event_time" description:"审批实例事件业务时间" format:"timestamp_ms"`
}
type OAApprovalInstanceStartedOutput ¶ added in v1.0.58
type OAApprovalInstanceStartedOutput struct {
Type string `json:"type" description:"事件类型,固定为当前 event_key"`
EventID string `json:"event_id" description:"事件 ID,可用于去重"`
Timestamp int64 `json:"timestamp" description:"事件发生时间戳" format:"timestamp_ms"`
SubscribeID string `json:"subscribe_id" description:"订阅 ID"`
ProcessInstanceID string `json:"process_instance_id" description:"审批实例 ID"`
ProcessCode string `json:"process_code" description:"审批流程模板编码"`
Title string `json:"title" description:"审批标题"`
Status string `json:"status" description:"审批实例状态"`
CreateTime int64 `json:"create_time" description:"审批实例创建时间" format:"timestamp_ms"`
EventTime int64 `json:"event_time" description:"审批实例事件业务时间" format:"timestamp_ms"`
}
type OAApprovalInstanceTerminatedOutput ¶ added in v1.0.58
type OAApprovalInstanceTerminatedOutput struct {
Type string `json:"type" description:"事件类型,固定为当前 event_key"`
EventID string `json:"event_id" description:"事件 ID,可用于去重"`
Timestamp int64 `json:"timestamp" description:"事件发生时间戳" format:"timestamp_ms"`
SubscribeID string `json:"subscribe_id" description:"订阅 ID"`
ProcessInstanceID string `json:"process_instance_id" description:"审批实例 ID"`
ProcessCode string `json:"process_code" description:"审批流程模板编码"`
Title string `json:"title" description:"审批标题"`
Status string `json:"status" description:"审批实例状态"`
CreateTime int64 `json:"create_time" description:"审批实例创建时间" format:"timestamp_ms"`
FinishTime int64 `json:"finish_time" description:"审批实例终止时间" format:"timestamp_ms"`
EventTime int64 `json:"event_time" description:"审批实例终止事件业务时间" format:"timestamp_ms"`
}
type OAApprovalTaskCreatedOutput ¶ added in v1.0.58
type OAApprovalTaskCreatedOutput struct {
Type string `json:"type" description:"事件类型,固定为当前 event_key"`
EventID string `json:"event_id" description:"事件 ID,可用于去重"`
Timestamp int64 `json:"timestamp" description:"事件发生时间戳" format:"timestamp_ms"`
SubscribeID string `json:"subscribe_id" description:"订阅 ID"`
ProcessInstanceID string `json:"process_instance_id" description:"审批实例 ID"`
ProcessCode string `json:"process_code" description:"审批流程模板编码"`
TaskID string `json:"task_id" description:"审批任务 ID"`
Title string `json:"title" description:"审批标题"`
Status string `json:"status" description:"审批任务状态"`
CreateTime int64 `json:"create_time" description:"审批任务创建时间" format:"timestamp_ms"`
EventTime int64 `json:"event_time" description:"审批任务事件业务时间" format:"timestamp_ms"`
}
type OAApprovalTaskFinishedOutput ¶ added in v1.0.58
type OAApprovalTaskFinishedOutput struct {
Type string `json:"type" description:"事件类型,固定为当前 event_key"`
EventID string `json:"event_id" description:"事件 ID,可用于去重"`
Timestamp int64 `json:"timestamp" description:"事件发生时间戳" format:"timestamp_ms"`
SubscribeID string `json:"subscribe_id" description:"订阅 ID"`
ProcessInstanceID string `json:"process_instance_id" description:"审批实例 ID"`
ProcessCode string `json:"process_code" description:"审批流程模板编码"`
TaskID string `json:"task_id" description:"审批任务 ID"`
Title string `json:"title" description:"审批标题"`
Status string `json:"status" description:"审批任务状态"`
Result string `json:"result" description:"审批任务处理结果,值以服务端实际推送为准"`
CreateTime int64 `json:"create_time" description:"审批任务创建时间" format:"timestamp_ms"`
FinishTime int64 `json:"finish_time" description:"审批任务完成时间" format:"timestamp_ms"`
EventTime int64 `json:"event_time" description:"审批任务事件业务时间" format:"timestamp_ms"`
}
type OAApprovalTaskRedirectedOutput ¶ added in v1.0.58
type OAApprovalTaskRedirectedOutput struct {
Type string `json:"type" description:"事件类型,固定为当前 event_key"`
EventID string `json:"event_id" description:"事件 ID,可用于去重"`
Timestamp int64 `json:"timestamp" description:"事件发生时间戳" format:"timestamp_ms"`
SubscribeID string `json:"subscribe_id" description:"订阅 ID"`
ProcessInstanceID string `json:"process_instance_id" description:"审批实例 ID"`
ProcessCode string `json:"process_code" description:"审批流程模板编码"`
TaskID string `json:"task_id" description:"原审批任务 ID"`
Title string `json:"title" description:"审批标题"`
Status string `json:"status" description:"原审批任务状态"`
Result string `json:"result" description:"审批任务转交结果,值以服务端实际推送为准"`
CreateTime int64 `json:"create_time" description:"原审批任务创建时间" format:"timestamp_ms"`
FinishTime int64 `json:"finish_time" description:"原审批任务转交完成时间" format:"timestamp_ms"`
EventTime int64 `json:"event_time" description:"审批任务转交事件业务时间" format:"timestamp_ms"`
}
type ParameterConstraints ¶ added in v1.0.54
type ReactionEventOutput ¶ added in v1.0.54
type ReactionEventOutput struct {
Type string `json:"type" description:"事件类型,固定为当前 event_key"`
EventID string `json:"event_id" description:"事件 ID,可用于去重"`
Timestamp int64 `json:"timestamp" description:"事件发生时间戳" format:"timestamp_ms"`
SubscribeID string `json:"subscribe_id" description:"订阅 ID"`
MessageID string `json:"message_id" description:"收到表情回应的开放消息 ID" format:"open_message_id"`
ConversationID string `json:"conversation_id" description:"会话 ID" format:"open_conversation_id"`
Operator string `json:"operator" description:"执行表情回应操作的用户展示名"`
OperatorOpenDingTalkID string `json:"operator_open_dingtalk_id" description:"执行表情回应操作的用户开放 ID" format:"open_dingtalk_id"`
ReactionName string `json:"reaction_name" description:"表情回应名称"`
ReactionText string `json:"reaction_text" description:"表情回应文本"`
OperationType string `json:"operation_type" description:"表情回应操作类型"`
OperationTime string `json:"operation_time" description:"表情回应操作时间"`
Sender string `json:"sender" description:"原消息发送人展示名"`
SenderOpenDingTalkID string `json:"sender_open_dingtalk_id" description:"原消息发送人开放 ID" format:"open_dingtalk_id"`
EventTime int64 `json:"event_time" description:"消息事件时间戳" format:"timestamp_ms"`
}
type ReadEventOutput ¶ added in v1.0.54
type ReadEventOutput struct {
Type string `json:"type" description:"事件类型,固定为当前 event_key"`
EventID string `json:"event_id" description:"事件 ID,可用于去重"`
Timestamp int64 `json:"timestamp" description:"事件发生时间戳" format:"timestamp_ms"`
SubscribeID string `json:"subscribe_id" description:"订阅 ID"`
MessageID string `json:"message_id" description:"被读取消息的开放消息 ID" format:"open_message_id"`
ConversationID string `json:"conversation_id" description:"会话 ID" format:"open_conversation_id"`
Reader string `json:"reader" description:"读取消息的用户展示名"`
ReaderOpenDingTalkID string `json:"reader_open_dingtalk_id" description:"读取消息的用户开放 ID" format:"open_dingtalk_id"`
Sender string `json:"sender" description:"原消息发送人展示名"`
SenderOpenDingTalkID string `json:"sender_open_dingtalk_id" description:"原消息发送人开放 ID" format:"open_dingtalk_id"`
ReadTime string `json:"read_time" description:"消息读取时间"`
EventTime int64 `json:"event_time" description:"消息事件时间戳" format:"timestamp_ms"`
}
type RecallEventOutput ¶ added in v1.0.54
type RecallEventOutput struct {
Type string `json:"type" description:"事件类型,固定为当前 event_key"`
EventID string `json:"event_id" description:"事件 ID,可用于去重"`
Timestamp int64 `json:"timestamp" description:"事件发生时间戳" format:"timestamp_ms"`
SubscribeID string `json:"subscribe_id" description:"订阅 ID"`
MessageID string `json:"message_id" description:"被撤回消息的开放消息 ID" format:"open_message_id"`
ConversationID string `json:"conversation_id" description:"会话 ID" format:"open_conversation_id"`
Recaller string `json:"recaller" description:"撤回消息的用户展示名"`
RecallerOpenDingTalkID string `json:"recaller_open_dingtalk_id" description:"撤回消息的用户开放 ID" format:"open_dingtalk_id"`
Sender string `json:"sender" description:"原消息发送人展示名"`
SenderOpenDingTalkID string `json:"sender_open_dingtalk_id" description:"原消息发送人开放 ID" format:"open_dingtalk_id"`
RecallTime string `json:"recall_time" description:"消息撤回时间"`
EventTime int64 `json:"event_time" description:"消息事件时间戳" format:"timestamp_ms"`
}
type Retryability ¶ added in v1.0.56
type Retryability string
Retryability preserves the distinction between an explicit server decision and an error for which the server did not provide retry guidance.
const ( RetryabilityUnknown Retryability = "unknown" RetryabilityRetryable Retryability = "retryable" RetryabilityNonRetryable Retryability = "non_retryable" )
func (Retryability) Value ¶ added in v1.0.56
func (r Retryability) Value() (value bool, known bool)
Value converts retryability to a bool while preserving whether it is known.
type RuleOptions ¶
type RunState ¶
type RunState struct {
SubscribeID string `json:"subscribe_id"`
EventKey string `json:"event_key,omitempty"`
RuleType string `json:"rule_type,omitempty"`
ClientID string `json:"client_id,omitempty"`
SourceID string `json:"source_id,omitempty"`
IdentityHash string `json:"identity_hash,omitempty"`
CreatedAt time.Time `json:"created_at"`
}
func LoadRunStates ¶
type SchemaDocument ¶
type SchemaDocument struct {
EventKey string `json:"event_key"`
DisplayName string `json:"display_name"`
Description string `json:"description"`
Category string `json:"category"`
RuleType string `json:"rule_type"`
RequiredParams []string `json:"required_params"`
Constraints *ParameterConstraints `json:"constraints,omitempty"`
JQRootPath string `json:"jq_root_path"`
Schema map[string]any `json:"schema"`
}
func BuildSchemaDocument ¶
func BuildSchemaDocument(def Definition) SchemaDocument
func BuildSchemaDocumentForMode ¶ added in v1.0.54
func BuildSchemaDocumentForMode(def Definition, flatten bool) SchemaDocument
type SchemaPendingError ¶
type SchemaPendingError struct {
EventKey string
}
func (*SchemaPendingError) Error ¶
func (e *SchemaPendingError) Error() string
type Subscription ¶
type Subscription struct {
SubscribeID string `json:"subscribe_id"`
EventKey string `json:"event_key,omitempty"`
RuleType string `json:"rule_type,omitempty"`
Status string `json:"status,omitempty"`
SourceID string `json:"source_id,omitempty"`
CreatedAt string `json:"created_at,omitempty"`
ExpiresAt *time.Time `json:"expires_at,omitempty"`
}
type TodoTaskCreatedOutput ¶ added in v1.0.61
type TodoTaskCreatedOutput struct {
Type string `json:"type" description:"事件类型,固定为当前 event_key"`
EventID string `json:"event_id" description:"事件 ID,可用于去重"`
Timestamp int64 `json:"timestamp" description:"事件发生时间戳" format:"timestamp_ms"`
SubscribeID string `json:"subscribe_id" description:"订阅 ID"`
TaskID string `json:"task_id" description:"待办任务 ID"`
Subject string `json:"subject" description:"待办标题"`
CreatorID string `json:"creator_id" description:"创建者 staffId"`
ExecutorIDs []string `json:"executor_ids" description:"执行者 staffId 列表"`
ParticipantIDs []string `json:"participant_ids" description:"参与者 staffId 列表"`
Priority int64 `json:"priority" description:"待办优先级"`
StatusStage int64 `json:"status_stage" description:"状态阶段:0 未开始、1 进行中、2 正常完成、3 异常完成"`
PlanStartDate *int64 `json:"plan_start_date,omitempty" description:"计划开始时间" format:"timestamp_ms"`
PlanFinishDate *int64 `json:"plan_finish_date,omitempty" description:"计划结束时间" format:"timestamp_ms"`
StartDate *int64 `json:"start_date,omitempty" description:"实际开始时间" format:"timestamp_ms"`
FinishDate *int64 `json:"finish_date,omitempty" description:"实际结束时间" format:"timestamp_ms"`
Description string `json:"description" description:"待办描述"`
Source string `json:"source" description:"待办来源"`
SourceID string `json:"source_id" description:"来源业务 ID"`
BizTag string `json:"biz_tag" description:"业务标识"`
ParentID *string `json:"parent_id,omitempty" description:"父任务 ID"`
IsMultiExecutor bool `json:"is_multi_executor" description:"是否多执行者待办"`
SceneType string `json:"scene_type" description:"待办场景类型"`
CreateTime int64 `json:"create_time" description:"待办创建时间" format:"timestamp_ms"`
}
type TodoTaskDeletedOutput ¶ added in v1.0.61
type TodoTaskDeletedOutput struct {
Type string `json:"type" description:"事件类型,固定为当前 event_key"`
EventID string `json:"event_id" description:"事件 ID,可用于去重"`
Timestamp int64 `json:"timestamp" description:"事件发生时间戳" format:"timestamp_ms"`
SubscribeID string `json:"subscribe_id" description:"订阅 ID"`
TaskID string `json:"task_id" description:"待办任务 ID"`
Subject string `json:"subject" description:"被删除的待办标题"`
CreatorID string `json:"creator_id" description:"创建者 staffId"`
CreateTime int64 `json:"create_time" description:"待办创建时间" format:"timestamp_ms"`
DeleteTime int64 `json:"delete_time" description:"待办删除时间" format:"timestamp_ms"`
}
type TodoTaskUpdatedOutput ¶ added in v1.0.61
type TodoTaskUpdatedOutput struct {
Type string `json:"type" description:"事件类型,固定为当前 event_key"`
EventID string `json:"event_id" description:"事件 ID,可用于去重"`
Timestamp int64 `json:"timestamp" description:"事件发生时间戳" format:"timestamp_ms"`
SubscribeID string `json:"subscribe_id" description:"订阅 ID"`
TaskID string `json:"task_id" description:"待办任务 ID"`
Subject string `json:"subject" description:"待办标题"`
CreatorID string `json:"creator_id" description:"创建者 staffId"`
ExecutorIDs []string `json:"executor_ids" description:"执行者 staffId 列表"`
ParticipantIDs []string `json:"participant_ids" description:"参与者 staffId 列表"`
Priority int64 `json:"priority" description:"待办优先级"`
StatusStage int64 `json:"status_stage" description:"新状态阶段:0 未开始、1 进行中、2 正常完成、3 异常完成"`
OldStatusStage int64 `json:"old_status_stage" description:"更新前状态阶段"`
PlanStartDate *int64 `json:"plan_start_date,omitempty" description:"计划开始时间" format:"timestamp_ms"`
PlanFinishDate *int64 `json:"plan_finish_date,omitempty" description:"计划结束时间" format:"timestamp_ms"`
StartDate *int64 `json:"start_date,omitempty" description:"实际开始时间" format:"timestamp_ms"`
FinishDate *int64 `json:"finish_date,omitempty" description:"实际结束时间" format:"timestamp_ms"`
Description string `json:"description" description:"待办描述"`
Source string `json:"source" description:"待办来源"`
SourceID string `json:"source_id" description:"来源业务 ID"`
BizTag string `json:"biz_tag" description:"业务标识"`
ParentID *string `json:"parent_id,omitempty" description:"父任务 ID"`
IsMultiExecutor bool `json:"is_multi_executor" description:"是否多执行者待办"`
SceneType string `json:"scene_type" description:"待办场景类型"`
CreateTime int64 `json:"create_time" description:"待办创建时间" format:"timestamp_ms"`
UpdateTime int64 `json:"update_time" description:"待办更新时间" format:"timestamp_ms"`
}
type VoIPCallReceiveInviteOutput ¶ added in v1.0.61
type VoIPCallReceiveInviteOutput struct {
Type string `json:"type" description:"事件类型,固定为当前 event_key"`
EventID string `json:"event_id" description:"transport 事件 ID,可用于传输层去重"`
Timestamp int64 `json:"timestamp" description:"事件发生时间戳" format:"timestamp_ms"`
SubscribeID string `json:"subscribe_id" description:"订阅 ID"`
BizID string `json:"biz_id" description:"业务事件唯一 ID;同一事件重试时保持不变,可用于业务去重"`
CorpID string `json:"corp_id" description:"事件所属组织的 corpId"`
OrgID int64 `json:"org_id" description:"事件所属组织 ID"`
TargetUID int64 `json:"target_uid" description:"订阅并接收邀请的目标用户 UID"`
CallID string `json:"call_id" description:"通话会话 ID"`
CallerUID string `json:"caller_uid" description:"主叫用户标识,按上游协议保留字符串原值"`
CallerCorpID string `json:"caller_corp_id" description:"主叫用户所属组织 corpId"`
CalleeUID string `json:"callee_uid" description:"被叫用户标识,按上游协议保留字符串原值"`
CalleeCorpID string `json:"callee_corp_id" description:"被叫用户所属组织 corpId"`
CallType string `json:"call_type" description:"通话类型;值以服务端实际推送为准"`
RoomID string `json:"room_id" description:"会议房间 ID"`
CreateTime int64 `json:"create_time" description:"通话邀请创建时间" format:"timestamp_ms"`
EventTime int64 `json:"event_time" description:"通话邀请事件业务时间" format:"timestamp_ms"`
}
VoIPCallReceiveInviteOutput is the stable business-facing output emitted when the current user receives a VoIP call invitation. BizID is preserved because it is the business event's retry-stable deduplication key.