style(dingtalk): fix lint violations
This commit is contained in:
parent
fba80d0596
commit
b6139490eb
3 changed files with 19 additions and 9 deletions
|
|
@ -56,8 +56,10 @@ type Client struct {
|
|||
|
||||
// NewClient creates a new Client instance with the provided client ID, client secret, and optional configurations.
|
||||
func NewClient(clientID, clientSecret string, opts ...ClientOption) *Client {
|
||||
client := &Client{clientID: clientID, clientSecret: clientSecret,
|
||||
client: &http.Client{Timeout: time.Second * 30}}
|
||||
client := &Client{
|
||||
clientID: clientID, clientSecret: clientSecret,
|
||||
client: &http.Client{Timeout: time.Second * 30},
|
||||
}
|
||||
for _, opt := range opts {
|
||||
opt(client)
|
||||
}
|
||||
|
|
@ -206,7 +208,11 @@ func (c *Client) CardCreateAndDeliver(ctx context.Context, chatbot *chatbot.BotC
|
|||
}
|
||||
|
||||
// PrivateChatMessages sends a message to a user in a private chat.
|
||||
func (c *Client) PrivateChatMessages(ctx context.Context, msgType MessageType, openConversationID, content string) error {
|
||||
func (c *Client) PrivateChatMessages(
|
||||
ctx context.Context,
|
||||
msgType MessageType,
|
||||
openConversationID, content string,
|
||||
) error {
|
||||
body := map[string]any{
|
||||
"msgKey": msgType,
|
||||
"msgParam": c.buildSendMessages(msgType, content),
|
||||
|
|
@ -233,7 +239,7 @@ func (c *Client) buildSendMessages(msgType MessageType, content string) string {
|
|||
return string(msg)
|
||||
}
|
||||
|
||||
func (c *Client) httpRequest(ctx context.Context, method, path string, body interface{}, resp interface{}) error {
|
||||
func (c *Client) httpRequest(ctx context.Context, method, path string, body any, resp any) error {
|
||||
var (
|
||||
err error
|
||||
token string
|
||||
|
|
@ -261,7 +267,7 @@ func (c *Client) httpRequest(ctx context.Context, method, path string, body inte
|
|||
}
|
||||
req.Header.Set("Content-Type", "application/json")
|
||||
if token != "" {
|
||||
req.Header.Set("x-acs-dingtalk-access-token", token)
|
||||
req.Header.Set("X-Acs-Dingtalk-Access-Token", token)
|
||||
}
|
||||
res, err = hc.Do(req)
|
||||
if err != nil {
|
||||
|
|
|
|||
|
|
@ -255,7 +255,11 @@ func (c *DingTalkChannel) SendCardReply(ctx context.Context, cardInstanceID, con
|
|||
return c.client.CardStreaming(ctx, cardInstanceID, content)
|
||||
}
|
||||
|
||||
func (c *DingTalkChannel) tryCardCreateAndDeliver(ctx context.Context, chatID string, data *chatbot.BotCallbackDataModel) error {
|
||||
func (c *DingTalkChannel) tryCardCreateAndDeliver(
|
||||
ctx context.Context,
|
||||
chatID string,
|
||||
data *chatbot.BotCallbackDataModel,
|
||||
) error {
|
||||
if c.config.CardTemplateID == "" {
|
||||
return nil
|
||||
}
|
||||
|
|
|
|||
|
|
@ -363,9 +363,9 @@ type DingTalkConfig struct {
|
|||
GroupTrigger GroupTriggerConfig `json:"group_trigger,omitempty"`
|
||||
ReasoningChannelID string `json:"reasoning_channel_id" env:"PICOCLAW_CHANNELS_DINGTALK_REASONING_CHANNEL_ID"`
|
||||
|
||||
RobotCode string `json:"robot_code,omitempty" env:"PICOCLAW_CHANNELS_DINGTALK_ROBOT_CODE"`
|
||||
CardTemplateID string `json:"card_template_id,omitempty" env:"PICOCLAW_CHANNELS_DINGTALK_CARD_TEMPLATE_ID"`
|
||||
CardTemplateContentKey string `json:"card_template_content_key,omitempty" env:"PICOCLAW_CHANNELS_DINGTALK_CARD_TEMPLATE_CONTENT_KEY"`
|
||||
RobotCode string `json:"robot_code,omitempty" env:"PICOCLAW_CHANNELS_DINGTALK_ROBOT_CODE"`
|
||||
CardTemplateID string `json:"card_template_id,omitempty" env:"PICOCLAW_CHANNELS_DINGTALK_CARD_TEMPLATE_ID"`
|
||||
CardTemplateContentKey string `json:"card_template_content_key,omitempty" env:"PICOCLAW_CHANNELS_DINGTALK_CARD_TEMPLATE_CONTENT_KEY"`
|
||||
}
|
||||
|
||||
type SlackConfig struct {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue