const.go 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. // Copyright 2019 Yunion
  2. //
  3. // Licensed under the Apache License, Version 2.0 (the "License");
  4. // you may not use this file except in compliance with the License.
  5. // You may obtain a copy of the License at
  6. //
  7. // http://www.apache.org/licenses/LICENSE-2.0
  8. //
  9. // Unless required by applicable law or agreed to in writing, software
  10. // distributed under the License is distributed on an "AS IS" BASIS,
  11. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. // See the License for the specific language governing permissions and
  13. // limitations under the License.
  14. package sender
  15. import (
  16. "yunion.io/x/pkg/errors"
  17. )
  18. var (
  19. ErrIPWhiteList = errors.Error("Need to add ip to whtelist")
  20. ErrNoSupportSecSetting = errors.Error("Only the IP address option in the security Settings is supported")
  21. ErrNoSuchMobile = errors.Error("No such mobile")
  22. ErrIncompleteConfig = errors.Error("Incomplete config")
  23. ErrDuplicateConfig = errors.Error("Duplicate config for a domain")
  24. )
  25. const (
  26. ApiWebhookRobotV2SendMessage = "https://open.feishu.cn/open-apis/bot/v2/hook/"
  27. // 钉钉发送消息
  28. ApiDingtalkSendMessage = "https://oapi.dingtalk.com/topapi/message/corpconversation/asyncsend_v2?"
  29. // 钉钉获取token
  30. ApiDingtalkGetToken = "https://oapi.dingtalk.com/gettoken?"
  31. // 钉钉使用手机号获取用户ID
  32. ApiDingtalkGetUserByMobile = "https://oapi.dingtalk.com/topapi/v2/user/getbymobile?"
  33. // 钉钉获取消息发送结果
  34. ApiDingtalkGetSendResult = "https://oapi.dingtalk.com/topapi/message/corpconversation/getsendresult?"
  35. // 企业微信获取token
  36. ApiWorkwxGetToken = "https://qyapi.weixin.qq.com/cgi-bin/gettoken?"
  37. // 企业微信使用手机号获取用户ID
  38. ApiWorkwxGetUserByMobile = "https://qyapi.weixin.qq.com/cgi-bin/user/getuserid?"
  39. // 企业微信发送消息
  40. ApiWorkwxSendMessage = "https://qyapi.weixin.qq.com/cgi-bin/message/send?"
  41. // 飞书使用手机号或邮箱获取用户ID
  42. ApiFetchUserID = "https://open.feishu.cn/open-apis/user/v1/batch_get_id?"
  43. )
  44. var (
  45. FAIL_KEY = []string{"失败", "fail ", "failed"}
  46. )
  47. const EVENT_HEADER = "X-Yunion-Event"