Documentation ¶
Index ¶
- Constants
- Variables
- type ActivateSuiteResponse
- type Biz16Data
- type Biz2Data
- type Biz4Data
- type Biz7Data
- type BizAgent
- type BizAuthCorpInfo
- type BizAuthInfo
- type BizAuthOrgScopes
- type BizAuthScope
- type BizAuthUserInfo
- type BizItem
- type Cache
- type ClientType
- type CorpConfig
- type DeptLeader
- type DeptOrder
- type DingTalkClient
- func (dtc *DingTalkClient) Decrypt(signature, timestamp, nonce, secretMsg string) (string, error)
- func (dtc *DingTalkClient) DecryptAndUnmarshalPushNotification(signature, timestamp, nonce, secretMsg string) (*PushNotification, error)
- func (dtc *DingTalkClient) Encrypt(msg, timestamp, nonce string) (string, string, error)
- func (dtc *DingTalkClient) GetAccessToken(ctx context.Context) (GetAccessTokenResponse, error)
- func (dtc *DingTalkClient) GetAndRefreshSuiteAccessToken(ctx context.Context) (string, error)
- func (dtc *DingTalkClient) GetCorpAccessToken(ctx context.Context) (GetCorpAccessTokenResponse, error)
- func (dtc *DingTalkClient) GetCorpUserByUnionId(ctx context.Context, authCorpId, unionId string) (GetCorpUserByUnionIdResponse, error)
- func (dtc *DingTalkClient) GetCorpUserDetailByUserId(ctx context.Context, authCorpId, userId string, languages ...string) (GetCorpUserDetailByUserIdResponse, error)
- func (dtc *DingTalkClient) GetCorpUserInfoByCode(ctx context.Context, authCorpId, code string) (GetCorpUserInfoByCodeResponse, error)
- func (dtc *DingTalkClient) GetSuiteAccessToken(ctx context.Context) (SuiteAccessTokenResponse, error)
- func (dtc *DingTalkClient) GetSuiteTicket(ctx context.Context) string
- func (dtc *DingTalkClient) IsvActivateSuite(ctx context.Context, authCorpId string, permanentCode string) (ActivateSuiteResponse, error)
- func (dtc *DingTalkClient) IsvGetAndRefreshCorpAccessToken(ctx context.Context, authCorpId string) (string, error)
- func (dtc *DingTalkClient) IsvGetCorpAccessToken(ctx context.Context, authCorpId string) (GetCorpAccessTokenResponse, error)
- func (dtc *DingTalkClient) IsvListUnactivateSuites(ctx context.Context) (ListUnactivateSuitesResponse, error)
- func (dtc *DingTalkClient) MediaDownloadFile(ctx context.Context, mediaID string, write io.Writer) error
- func (dtc *DingTalkClient) MediaUpload(ctx context.Context, mediaType string, fileName string, reader io.Reader) (MediaUploadResponse, error)
- func (dtc *DingTalkClient) SNSGetUserInfoByCode(ctx context.Context, tmpAuthCode string) (SNSGetUserInfoByCodeResponse, error)
- func (dtc *DingTalkClient) SendMessageByTemplate(ctx context.Context, authCorpId string, req SendMessageByTemplateRequest) (SendMessageByTemplateResponse, error)
- func (dtc *DingTalkClient) SetSuiteTicket(ctx context.Context, suiteTicket string) error
- type FileCache
- type GetAccessTokenResponse
- type GetCorpAccessTokenResponse
- type GetCorpUserByUnionIdResponse
- type GetCorpUserByUnionIdResult
- type GetCorpUserDetailByUserIdResponse
- type GetCorpUserDetailByUserIdResult
- type GetCorpUserInfoByCodeResponse
- type GetCorpUserInfoByCodeResult
- type ISVConfig
- type KVExpirable
- type ListUnactivateSuitesResponse
- type MediaDownloadFileResponse
- type MediaUploadResponse
- type OpenAPIResponse
- type Option
- type Persist
- type PersonConfig
- type PushCryptoSuit
- type PushNotification
- type SNSGetUserInfoByCode
- type SNSGetUserInfoByCodeResponse
- type SendMessageByTemplateRequest
- type SendMessageByTemplateResponse
- type SuiteAccessTokenResponse
- type UnionEmpExt
- type UnionEmpMap
- type Unmarshallable
- type UserRole
Constants ¶
View Source
const ( SyncActionOrgMicroAppRestore = "org_micro_app_restore" SyncActionOrgMicroAppStop = "org_micro_app_stop" SyncActionOrgMicroAppRemove = "org_micro_app_remove" SyncActionOrgMicroAppScopeUpdate = "org_micro_app_scope_update" SyncActionOrgUpdate = "org_update" SyncActionOrgRemove = "org_remove" )
View Source
const ( KeySuiteAccessToken = "suite_access_token" KeySuiteTicket = "suite_ticket" )
View Source
const ( OAPIURL = "https://oapi.dingtalk.com/" TOPAPIURL = "https://oapi.dingtalk.com/topapi/" )
View Source
const ( MessageTypeText = "text" MessageTypeActionCard = "action_card" MessageTypeImage = "image" MessageTypeVoice = "voice" MessageTypeFile = "file" MessageTypeLink = "link" MessageTypeOA = "oa" MessageTypeMarkdown = "markdown" )
View Source
const ( CheckCreateSuiteURLEventType = "check_create_suite_url" CheckUpdateSuiteUrlEventType = "check_update_suite_url" CheckUrlEventType = "check_url" SyncHTTPPushHighEventType = "SYNC_HTTP_PUSH_HIGH" SyncHTTPPushMediumEventType = "SYNC_HTTP_PUSH_MEDIUM" )
Variables ¶
View Source
var (
ErrAlreadyExpired = errors.New("Data already expired")
)
Functions ¶
This section is empty.
Types ¶
type ActivateSuiteResponse ¶
type ActivateSuiteResponse struct {
OpenAPIResponse
}
type Biz16Data ¶
type Biz16Data struct { SyncAction string `json:"syncAction"` Errcode int `json:"errcode"` Errmsg string `json:"errmsg"` Corpid string `json:"corpid"` CorpName string `json:"corp_name"` AuthLevel int `json:"auth_level"` Industry string `json:"industry"` IsAuthenticated bool `json:"is_authenticated"` CorpLogoUrl string `json:"corp_logo_url"` }
type Biz4Data ¶
type Biz4Data struct { AuthUserInfo BizAuthUserInfo `json:"auth_user_info"` AuthCorpInfo BizAuthCorpInfo `json:"auth_corp_info"` PermanentCode string `json:"permanent_code"` SyncAction string `json:"syncAction"` SyncSeq string `json:"syncSeq"` AuthInfo BizAuthInfo `json:"auth_info"` AuthScope BizAuthScope `json:"auth_scope"` }
type BizAuthCorpInfo ¶
type BizAuthCorpInfo struct { CorpLogoURL string `json:"corp_logo_url"` CorpType int `json:"corp_type"` CorpName string `json:"corp_name"` FullCorpName string `json:"full_corp_name"` CorpID string `json:"corpid"` Industry string `json:"industry"` InviteCode string `json:"invite_code"` LicenseCode string `json:"license_code"` AuthChannel string `json:"auth_channel"` AuthChannelType string `json:"auth_channel_type"` IsAuthenticated bool `json:"is_authenticated"` AuthLevel int `json:"auth_level"` InviteURL string `json:"invite_url"` }
type BizAuthInfo ¶
type BizAuthInfo struct {
Agents []BizAgent `json:"agent"`
}
type BizAuthOrgScopes ¶
type BizAuthScope ¶
type BizAuthScope struct { ErrCode int `json:""` ErrMsg string `json:""` ConditionFields []string `json:"condition_field"` AuthUserFields []string `json:"auth_user_field"` AuthOrgScopes BizAuthOrgScopes `json:"auth_org_scopes"` }
type BizAuthUserInfo ¶
type BizAuthUserInfo struct {
UserId string `json:"userId"`
}
type BizItem ¶
type BizItem struct { BizType int `json:"biz_type"` GmtCreate int `json:"gmt_create"` OpenCursor int `json:"open_cursor"` SubscribeId string `json:"subscribe_id"` Id int `json:"id"` GmtModified int `json:"gmt_modified"` BizId string `json:"biz_id"` CorpId string `json:"corp_id"` Status int `json:"status"` BizData interface{} `json:"biz_data"` }
func (*BizItem) UnmarshalJSON ¶
UnmarshalJSON unmarshals a biz item.
type Cache ¶
type Cache interface { Set(ctx context.Context, data *KVExpirable) error Get(ctx context.Context, key string) (*KVExpirable, error) }
type ClientType ¶
type ClientType int32
const ( CORP ClientType = 0 ISV ClientType = 1 PERSON ClientType = 2 )
type CorpConfig ¶
type DeptLeader ¶
type DingTalkClient ¶
type DingTalkClient struct {
// contains filtered or unexported fields
}
func NewCorpClient ¶
func NewCorpClient(cfg CorpConfig, opts ...Option) *DingTalkClient
func NewISVClient ¶
func NewISVClient(cfg ISVConfig, opts ...Option) *DingTalkClient
func NewPersonClient ¶
func NewPersonClient(cfg PersonConfig, opts ...Option) *DingTalkClient
func (*DingTalkClient) Decrypt ¶
func (dtc *DingTalkClient) Decrypt(signature, timestamp, nonce, secretMsg string) (string, error)
func (*DingTalkClient) DecryptAndUnmarshalPushNotification ¶
func (dtc *DingTalkClient) DecryptAndUnmarshalPushNotification(signature, timestamp, nonce, secretMsg string) (*PushNotification, error)
func (*DingTalkClient) Encrypt ¶
func (dtc *DingTalkClient) Encrypt(msg, timestamp, nonce string) (string, string, error)
func (*DingTalkClient) GetAccessToken ¶
func (dtc *DingTalkClient) GetAccessToken(ctx context.Context) (GetAccessTokenResponse, error)
获取微应用后台免登的access_token
func (*DingTalkClient) GetAndRefreshSuiteAccessToken ¶
func (dtc *DingTalkClient) GetAndRefreshSuiteAccessToken(ctx context.Context) (string, error)
刷新并获取第三方企业应用的suite_access_token
func (*DingTalkClient) GetCorpAccessToken ¶
func (dtc *DingTalkClient) GetCorpAccessToken(ctx context.Context) (GetCorpAccessTokenResponse, error)
获取企业内部应用的access_token
func (*DingTalkClient) GetCorpUserByUnionId ¶
func (dtc *DingTalkClient) GetCorpUserByUnionId(ctx context.Context, authCorpId, unionId string) (GetCorpUserByUnionIdResponse, error)
根据unionid获取组织用户userid
func (*DingTalkClient) GetCorpUserDetailByUserId ¶
func (dtc *DingTalkClient) GetCorpUserDetailByUserId(ctx context.Context, authCorpId, userId string, languages ...string) (GetCorpUserDetailByUserIdResponse, error)
根据userId获取组织用户详情
func (*DingTalkClient) GetCorpUserInfoByCode ¶
func (dtc *DingTalkClient) GetCorpUserInfoByCode(ctx context.Context, authCorpId, code string) (GetCorpUserInfoByCodeResponse, error)
通过免登码获取用户信息
func (*DingTalkClient) GetSuiteAccessToken ¶
func (dtc *DingTalkClient) GetSuiteAccessToken(ctx context.Context) (SuiteAccessTokenResponse, error)
获取第三方企业应用的suite_access_token
func (*DingTalkClient) GetSuiteTicket ¶
func (dtc *DingTalkClient) GetSuiteTicket(ctx context.Context) string
get suite ticket
func (*DingTalkClient) IsvActivateSuite ¶
func (dtc *DingTalkClient) IsvActivateSuite(ctx context.Context, authCorpId string, permanentCode string) (ActivateSuiteResponse, error)
激活套件
func (*DingTalkClient) IsvGetAndRefreshCorpAccessToken ¶
func (dtc *DingTalkClient) IsvGetAndRefreshCorpAccessToken(ctx context.Context, authCorpId string) (string, error)
刷新并获取企业授权的凭证
func (*DingTalkClient) IsvGetCorpAccessToken ¶
func (dtc *DingTalkClient) IsvGetCorpAccessToken(ctx context.Context, authCorpId string) (GetCorpAccessTokenResponse, error)
获取企业授权的凭证
func (*DingTalkClient) IsvListUnactivateSuites ¶
func (dtc *DingTalkClient) IsvListUnactivateSuites(ctx context.Context) (ListUnactivateSuitesResponse, error)
获取应用未激活的企业列表
func (*DingTalkClient) MediaDownloadFile ¶
func (dtc *DingTalkClient) MediaDownloadFile(ctx context.Context, mediaID string, write io.Writer) error
获取媒体文件
func (*DingTalkClient) MediaUpload ¶
func (dtc *DingTalkClient) MediaUpload(ctx context.Context, mediaType string, fileName string, reader io.Reader) (MediaUploadResponse, error)
上传媒体文件
func (*DingTalkClient) SNSGetUserInfoByCode ¶
func (dtc *DingTalkClient) SNSGetUserInfoByCode(ctx context.Context, tmpAuthCode string) (SNSGetUserInfoByCodeResponse, error)
func (*DingTalkClient) SendMessageByTemplate ¶
func (dtc *DingTalkClient) SendMessageByTemplate(ctx context.Context, authCorpId string, req SendMessageByTemplateRequest) (SendMessageByTemplateResponse, error)
使用模板发送工作通知消息
func (*DingTalkClient) SetSuiteTicket ¶
func (dtc *DingTalkClient) SetSuiteTicket(ctx context.Context, suiteTicket string) error
set suite ticket
type FileCache ¶
type FileCache struct { Path string // contains filtered or unexported fields }
func NewFileCache ¶
type GetAccessTokenResponse ¶
type GetAccessTokenResponse struct { OpenAPIResponse AccessToken string `json:"access_token"` }
type GetCorpAccessTokenResponse ¶
type GetCorpAccessTokenResponse struct { OpenAPIResponse AccessToken string `json:"access_token"` ExpiresIn int `json:"expires_in"` }
type GetCorpUserByUnionIdResponse ¶
type GetCorpUserByUnionIdResponse struct { OpenAPIResponse RequestId string `json:"request_id"` UserInfo GetCorpUserByUnionIdResult `json:"result"` }
type GetCorpUserDetailByUserIdResponse ¶
type GetCorpUserDetailByUserIdResponse struct { OpenAPIResponse RequestId string `json:"request_id"` UserInfo GetCorpUserDetailByUserIdResult `json:"result"` }
type GetCorpUserDetailByUserIdResult ¶
type GetCorpUserDetailByUserIdResult struct { UserId string `json:"userid"` Unionid string `json:"unionid"` Name string `json:"name"` Avatar string `json:"avatar"` StateCode string `json:"state_code"` ManagerUserid string `json:"manager_userid"` Mobile string `json:"mobile"` HideMobile bool `json:"hide_mobile"` Telephone string `json:"telephone"` Job_number string `json:"job_number"` Title string `json:"title"` Email string `json:"email"` WorkPlace string `json:"work_place"` Remark string `json:"remark"` LoginId string `json:"login_id"` ExclusiveAccountType string `json:"exclusive_account_type"` ExclusiveAccount bool `json:"exclusive_account"` Extension string `json:"extension"` HiredDate int `json:"hired_date"` Active bool `json:"active"` RealAuthed bool `json:"real_authed"` OrgEmail string `json:"org_email"` OrgEmailType string `json:"org_email_type"` Nickname string `json:"nickname"` Senior bool `json:"senior"` Admin bool `json:"admin"` Boss bool `json:"boss"` CorpId string `json:"corp_id"` DeptIdList []int `json:"dept_id_list"` DeptOrderList []DeptOrder `json:"dept_order_list"` LeaderInDept []DeptLeader `json:"leader_in_dept"` RoleList []UserRole `json:"role_list"` UnionEmpExt UnionEmpExt `json:"union_emp_ext"` }
type GetCorpUserInfoByCodeResponse ¶
type GetCorpUserInfoByCodeResponse struct { OpenAPIResponse RequestId string `json:"request_id"` UserInfo GetCorpUserInfoByCodeResult `json:"result"` }
type KVExpirable ¶
type KVExpirable struct { Key string `json:"key"` Value string `json:"value"` ExpiresIn int `json:"expires_in"` Created int64 `json:"created"` }
func NewKVExpirable ¶
func NewKVExpirable(key, value string, expiresIn int) *KVExpirable
func (*KVExpirable) IsExpired ¶
func (e *KVExpirable) IsExpired() bool
type ListUnactivateSuitesResponse ¶
type ListUnactivateSuitesResponse struct { OpenAPIResponse AppId int `json:""` CorpList []string `json:"corp_list"` HasMore bool `json:"has_more"` }
type MediaDownloadFileResponse ¶
type MediaDownloadFileResponse struct { OpenAPIResponse MediaID string Writer io.Writer }
type MediaUploadResponse ¶
type MediaUploadResponse struct { OpenAPIResponse Type string MediaID string `json:"media_id"` CreatedAt int64 `json:"created_at"` }
type OpenAPIResponse ¶
type PersonConfig ¶
type PushCryptoSuit ¶
type PushCryptoSuit struct {
// contains filtered or unexported fields
}
func NewPushCryptoSuit ¶
func NewPushCryptoSuit(token, aesKey, suiteKey string) (*PushCryptoSuit, error)
type PushNotification ¶
type SNSGetUserInfoByCode ¶
type SNSGetUserInfoByCodeResponse ¶
type SNSGetUserInfoByCodeResponse struct { OpenAPIResponse UserInfo SNSGetUserInfoByCode `json:"user_info"` }
type SendMessageByTemplateResponse ¶
type SendMessageByTemplateResponse struct { OpenAPIResponse TaskId int `json:"task_id"` RequestId string `json:"request_id"` }
type SuiteAccessTokenResponse ¶
type SuiteAccessTokenResponse struct { OpenAPIResponse SuiteAccessToken string `json:"suite_access_token"` ExpiresIn int `json:"expires_in"` }
type UnionEmpExt ¶
type UnionEmpExt struct { UserId string `json:"userid"` UnionEmpMapList []UnionEmpMap `json:"union_emp_map_list"` CorpId string `json:"corp_id"` }
type UnionEmpMap ¶
type Unmarshallable ¶
type Unmarshallable interface {
// contains filtered or unexported methods
}
Click to show internal directories.
Click to hide internal directories.