Files
forge/services/webhook/dingtalk_payload.go
zeekayandHanzo Dev 27cde39e36 Name every remaining identifier, path and default for this product
Storage buckets, indexer names, the bleve analyzer, the lock prefix, SSH host
keys, the markdown front-matter key, the container data paths, the RPM repo id
and the API security scheme all read as this product now, and app.example.ini
matches the code again. The upstream maintainer list and the changelog
generator config went with the release history they belonged to, and the
citation comments state the fact rather than link the issue.

Three inert rules turn out to have been inert because they named a module path
this tree does not use: gci grouped no first-party imports under prefix(), and
depguard let models/migrations import models and modules/structs. They now name
github.com/hanzoai/git. The config example also documented .gitea/workflows
while the code has read .hanzo/workflows for some time.

The authorized_keys marker follows the delegate-hook precedent: the new name is
written and the old one is still recognised, because a marker we do not know is
copied through as a hand-added key and leaves a revoked key authorized. The
stored user_setting key keeps its value; only a migration may change that.

Co-authored-by: Hanzo Dev <[email protected]>
2026-09-10 19:14:35 -07:00

65 lines
2.1 KiB
Go

// Copyright 2026 Hanzo AI, Inc. All rights reserved.
// SPDX-License-Identifier: MIT
package webhook
// The DingTalk message shapes.
//
// These were the only two things used from the dingtalk webhook package —
// pure JSON structs. The rest of that package is an HTTP client that posts them,
// which this forge never called: every webhook goes out through the shared
// deliverer, with its own retries, proxy settings and rate limits. So the
// dependency existed to supply four struct definitions.
//
// Field names and JSON tags are DingTalk's, not ours:
// https://developers.dingtalk.com/document/app/custom-robot-access
// DingtalkLinkMsg is one entry in a feedCard.
type DingtalkLinkMsg struct {
Title string `json:"title"`
MessageURL string `json:"messageURL"`
PicURL string `json:"picURL"`
}
// DingtalkActionCard is a message with buttons.
type DingtalkActionCard struct {
Text string `json:"text"`
Title string `json:"title"`
HideAvatar string `json:"hideAvatar"`
BtnOrientation string `json:"btnOrientation"`
SingleTitle string `json:"singleTitle"`
SingleURL string `json:"singleURL"`
Buttons []struct {
Title string `json:"title"`
ActionURL string `json:"actionURL"`
} `json:"btns"`
}
// DingtalkPayloadMsg is the request body DingTalk accepts. Which member is read
// depends on MsgType, so the unused ones marshal as empty objects — that is the
// API's shape, not an oversight.
type DingtalkPayloadMsg struct {
MsgType string `json:"msgtype"`
Text struct {
Content string `json:"content"`
} `json:"text"`
Link struct {
Text string `json:"text"`
Title string `json:"title"`
PicURL string `json:"picUrl"`
MessageURL string `json:"messageUrl"`
} `json:"link"`
Markdown struct {
Text string `json:"text"`
Title string `json:"title"`
} `json:"markdown"`
ActionCard DingtalkActionCard `json:"actionCard"`
FeedCard struct {
Links []DingtalkLinkMsg `json:"links"`
} `json:"feedCard"`
At struct {
AtMobiles []string `json:"atMobiles"`
IsAtAll bool `json:"isAtAll"`
} `json:"at"`
}