Documentation
¶
Index ¶
- Constants
- Variables
- func BuildAPIURL(cfg *Config, category, endpoint, appToken string, opts ...URLOption) string
- func GetCallbackEventTypes() map[string]string
- func GuessAppMediaType(filePath string) string
- func GuessMediaType(filePath string) int
- func ParseAuthorizeCallback(queryString string) (map[string]string, error)
- func SetDefaultUserID(id string)
- func SetDefaultUserToken(token string)
- func ValidateCallbackState(callbackState, expectedState string) bool
- func VerifyCallbackSignature(timestamp, nonce, signature, encodingKey string, dataEncrypt string, ...) bool
- type APIError
- type AccountMessageResult
- type AppCardParams
- type ApproveCardParams
- type ApproveCardUpdateParams
- type AuthError
- type BotCommandQueryResult
- type BotCommandResult
- type BotMessageResult
- type CalendarPrimaryResult
- type CallbackEvent
- type ChatGroupInfo
- type ChatListResult
- type ChatMessageInfo
- type ChatMessagesResult
- type ChatStaffInfo
- type Config
- type ConfigError
- type CreateGroupResult
- type CredentialStore
- func (cs *CredentialStore) Clear() error
- func (cs *CredentialStore) ClearProfile() error
- func (cs *CredentialStore) DeleteProfileByName(name string) bool
- func (cs *CredentialStore) GetActiveProfile() string
- func (cs *CredentialStore) HasCredentials() bool
- func (cs *CredentialStore) HasFullConfig() bool
- func (cs *CredentialStore) ListProfiles() ([]string, error)
- func (cs *CredentialStore) ListUserTokens() ([]string, error)
- func (cs *CredentialStore) LoadAppToken() (string, error)
- func (cs *CredentialStore) LoadCredentials() (map[string]string, error)
- func (cs *CredentialStore) LoadState() (*storeData, error)
- func (cs *CredentialStore) LoadUserToken(staffID string) (map[string]string, error)
- func (cs *CredentialStore) Path() string
- func (cs *CredentialStore) SaveAppToken(token string, expiresIn int) error
- func (cs *CredentialStore) SaveCallbackConfig(encodingKey, callbackToken string) error
- func (cs *CredentialStore) SaveCredentials(appID, appSecret, apiGatewayURL, passportURL, redirectURI string) error
- func (cs *CredentialStore) SaveUserToken(userToken, refreshToken string, expiresIn int, refreshExpiresIn int, ...) error
- func (cs *CredentialStore) SetActiveProfile(profile string) error
- type DecryptedCallbackPayload
- type DepartmentAncestorsResult
- type DepartmentChildrenResult
- type DepartmentDetailResult
- type DepartmentStaffsResult
- type DownloadMediaResult
- type DynamicCardUpdateParams
- type ExtraFieldIdsResult
- type FileError
- type GroupCreateInfo
- type GroupInfoResult
- type GroupListResult
- type GroupMemberResult
- type IsInGroupResult
- type LansengerClient
- func (c *LansengerClient) AddExecutors(ctx context.Context, executorIDs []string, orgID, todotaskID, userToken string) (*TodoTaskCreateResult, error)
- func (c *LansengerClient) AddScheduleAttendees(ctx context.Context, calendarID, scheduleID string, attendees []string, ...) (*ScheduleCreateResult, error)
- func (c *LansengerClient) BuildAuthorizeURL(redirectURI string, scope string, state string) string
- func (c *LansengerClient) CheckIsInGroup(ctx context.Context, groupID, userToken, staffID string) (*IsInGroupResult, error)
- func (c *LansengerClient) CreateBotCommands(ctx context.Context, scopeType int, commands []map[string]interface{}, ...) (*BotCommandResult, error)
- func (c *LansengerClient) CreateGroup(ctx context.Context, info *GroupCreateInfo, userToken string) (*CreateGroupResult, error)
- func (c *LansengerClient) CreateGroupShareID(ctx context.Context, groupID, creator string, expiresIn int64, ...) (*SendMessageResult, error)
- func (c *LansengerClient) CreatePersonalApp(ctx context.Context, userToken, name, avatarID, description string) (*PersonalAppCreateResult, error)
- func (c *LansengerClient) CreateSchedule(ctx context.Context, calendarID, summary string, ...) (*ScheduleCreateResult, error)
- func (c *LansengerClient) CreateStreamMessage(ctx context.Context, receiverID, receiverType, streamID string) (*StreamMessageResult, error)
- func (c *LansengerClient) CreateTodoTask(ctx context.Context, title string, todoType int, link, pcLink string, ...) (*TodoTaskCreateResult, error)
- func (c *LansengerClient) DeleteBotCommands(ctx context.Context, scopeType int, chatID, chatType, staffID string) (*BotCommandResult, error)
- func (c *LansengerClient) DeleteExecutors(ctx context.Context, executorIDs []string, orgID, todotaskID, userToken string) (*TodoTaskCreateResult, error)
- func (c *LansengerClient) DeletePersonalApp(ctx context.Context, appID, userToken string) (*PersonalAppInfoResult, error)
- func (c *LansengerClient) DeleteSchedule(ctx context.Context, calendarID, scheduleID string, reminderType string, ...) (*ScheduleDeleteResult, error)
- func (c *LansengerClient) DeleteScheduleAttendees(ctx context.Context, calendarID, scheduleID string, attendees []string, ...) (*ScheduleAttendeesDeleteResult, error)
- func (c *LansengerClient) DeleteTodoTask(ctx context.Context, todotaskID, orgID, staffID, userToken string) (*TodoTaskCreateResult, error)
- func (c *LansengerClient) DissolveGroup(ctx context.Context, groupID, userToken string) (*UpdateGroupResult, error)
- func (c *LansengerClient) DownloadMedia(ctx context.Context, mediaID string) (*DownloadMediaResult, error)
- func (c *LansengerClient) DownloadMediaToFile(ctx context.Context, mediaID string, targetPath string) (string, error)
- func (c *LansengerClient) ExchangeCode(ctx context.Context, code string, redirectURI string) (*UserTokenResult, error)
- func (c *LansengerClient) FetchBotCommands(ctx context.Context, scopeType int, chatID, chatType, staffID string) (*BotCommandQueryResult, error)
- func (c *LansengerClient) FetchChatList(ctx context.Context, userToken string, chatType int, keyword string, ...) (*ChatListResult, error)
- func (c *LansengerClient) FetchChatMessages(ctx context.Context, userToken string, pageSize int, baseVersion string, ...) (*ChatMessagesResult, error)
- func (c *LansengerClient) FetchDepartmentAncestors(ctx context.Context, staffID string, userToken string) (*DepartmentAncestorsResult, error)
- func (c *LansengerClient) FetchDepartmentChildren(ctx context.Context, departmentID, userToken string) (*DepartmentChildrenResult, error)
- func (c *LansengerClient) FetchDepartmentDetail(ctx context.Context, departmentID, userToken, tagID string) (*DepartmentDetailResult, error)
- func (c *LansengerClient) FetchDepartmentStaffs(ctx context.Context, departmentID, userToken string, page, pageSize int) (*DepartmentStaffsResult, error)
- func (c *LansengerClient) FetchExecutorList(ctx context.Context, todotaskID, orgID, staffID string, statusList []string, ...) (*TodoTaskExecutorListResult, error)
- func (c *LansengerClient) FetchGroupInfo(ctx context.Context, groupID, userToken string) (*GroupInfoResult, error)
- func (c *LansengerClient) FetchGroupList(ctx context.Context, userToken string, pageOffset, pageSize int) (*GroupListResult, error)
- func (c *LansengerClient) FetchGroupMembers(ctx context.Context, groupID, userToken string, pageOffset, pageSize int) (*GroupMemberResult, error)
- func (c *LansengerClient) FetchMediaPath(ctx context.Context, mediaID string, userToken string) (*MediaPathResult, error)
- func (c *LansengerClient) FetchOrgExtraFieldIDs(ctx context.Context, orgID, userToken string, page, pageSize int) (*ExtraFieldIdsResult, error)
- func (c *LansengerClient) FetchOrgInfo(ctx context.Context, orgID, userToken string) (*OrgInfoResult, error)
- func (c *LansengerClient) FetchPersonalApp(ctx context.Context, appID, userToken string) (*PersonalAppInfoResult, error)
- func (c *LansengerClient) FetchPersonalAppList(ctx context.Context, userToken string) (*PersonalAppListResult, error)
- func (c *LansengerClient) FetchPrimaryCalendar(ctx context.Context, userToken, userID string) (*CalendarPrimaryResult, error)
- func (c *LansengerClient) FetchSchedule(ctx context.Context, calendarID, scheduleID, userToken, userID string) (*ScheduleInfoResult, error)
- func (c *LansengerClient) FetchScheduleAttendees(ctx context.Context, calendarID, scheduleID string, page, pageSize int, ...) (*ScheduleAttendeesResult, error)
- func (c *LansengerClient) FetchScheduleList(ctx context.Context, calendarID string, startTime, endTime int64, ...) (*ScheduleListResult, error)
- func (c *LansengerClient) FetchStaffBasicInfo(ctx context.Context, staffID string, userToken string) (*StaffBasicInfoResult, error)
- func (c *LansengerClient) FetchStaffDetail(ctx context.Context, staffID string, userToken string) (*StaffDetailResult, error)
- func (c *LansengerClient) FetchStaffIdMapping(ctx context.Context, orgID, idType, idValue, userToken string) (*StaffIdMappingResult, error)
- func (c *LansengerClient) FetchStreamMessage(ctx context.Context, msgID string) (*StreamMessageResult, error)
- func (c *LansengerClient) FetchTodoTaskByID(ctx context.Context, todotaskID, orgID, staffID, userToken string) (*TodoTaskInfoResult, error)
- func (c *LansengerClient) FetchTodoTaskBySourceID(ctx context.Context, sourceID, orgID, staffID, userToken string) (*TodoTaskInfoResult, error)
- func (c *LansengerClient) FetchTodoTaskList(ctx context.Context, orgID string, appIDs []string, staffID string, ...) (*TodoTaskListResult, error)
- func (c *LansengerClient) FetchTodoTaskStatusCounts(ctx context.Context, staffID, orgID, appID string, statusList []string, ...) (*TodoTaskStatusCountResult, error)
- func (c *LansengerClient) FetchUserInfo(ctx context.Context, userToken string) (*UserInfoResult, error)
- func (c *LansengerClient) GetToken(ctx context.Context) (string, error)
- func (c *LansengerClient) GetUserToken(ctx context.Context) (string, error)
- func (c *LansengerClient) GetUserTokenWithStaffID(ctx context.Context, staffID string) (string, error)
- func (c *LansengerClient) HealthCheck(ctx context.Context) bool
- func (c *LansengerClient) InvalidateToken()
- func (c *LansengerClient) QueryGroups(ctx context.Context, pageOffset, pageSize int) (*QueryGroupsResult, error)deprecated
- func (c *LansengerClient) RefreshUserToken(ctx context.Context, refreshToken string, scope string) (*UserTokenResult, error)
- func (c *LansengerClient) RevokeMessage(ctx context.Context, messageIDs []string, chatType string, senderID string, ...) (*SendMessageResult, error)
- func (c *LansengerClient) SearchStaff(ctx context.Context, keyword, userToken, userID string, recursive bool, ...) (*StaffSearchResult, error)
- func (c *LansengerClient) SendAccountMessage(ctx context.Context, msgType string, msgData map[string]interface{}, ...) (*AccountMessageResult, error)
- func (c *LansengerClient) SendAppArticles(ctx context.Context, chatID string, articles []map[string]string, isGroup bool, ...) (*SendMessageResult, error)
- func (c *LansengerClient) SendAppCardWithParams(ctx context.Context, params *AppCardParams) (*SendMessageResult, error)
- func (c *LansengerClient) SendApproveCard(ctx context.Context, ...) (*SendMessageResult, error)
- func (c *LansengerClient) SendApproveCardWithParams(ctx context.Context, params *ApproveCardParams) (*SendMessageResult, error)
- func (c *LansengerClient) SendBotMessage(ctx context.Context, msgType string, msgData map[string]interface{}, ...) (*BotMessageResult, error)
- func (c *LansengerClient) SendFile(ctx context.Context, chatID, filePath string, content string, mediaType string, ...) (*SendMessageResult, error)
- func (c *LansengerClient) SendGroupMessage(ctx context.Context, groupID, msgType string, msgData map[string]interface{}, ...) (*SendMessageResult, error)
- func (c *LansengerClient) SendImageURL(ctx context.Context, chatID, imageURL, content string, isGroup bool, ...) (*SendMessageResult, error)
- func (c *LansengerClient) SendLinkCardWithParams(ctx context.Context, params *LinkCardParams) (*SendMessageResult, error)
- func (c *LansengerClient) SendMarkdown(ctx context.Context, chatID, content string, reminderAll bool, ...) (*SendMessageResult, error)
- func (c *LansengerClient) SendOaCardWithParams(ctx context.Context, params *OaCardParams) (*SendMessageResult, error)
- func (c *LansengerClient) SendReminder(ctx context.Context, msgID string, reminderTypes []int, userIDList []string) (*SendMessageResult, error)
- func (c *LansengerClient) SendText(ctx context.Context, chatID, content string, filePath string, mediaType string, ...) (*SendMessageResult, error)
- func (c *LansengerClient) SendUserMessage(ctx context.Context, receiverID, msgType string, ...) (*UserMessageResult, error)
- func (c *LansengerClient) SetUserTokens(userToken, refreshToken string, expiresIn int, staffID string, ...)
- func (c *LansengerClient) UpdateApproveCard(ctx context.Context, params *ApproveCardUpdateParams) (*SendMessageResult, error)
- func (c *LansengerClient) UpdateDynamicCard(ctx context.Context, params *DynamicCardUpdateParams) (*SendMessageResult, error)
- func (c *LansengerClient) UpdateExecutorStatus(ctx context.Context, executorStatusList []map[string]interface{}, ...) (*TodoTaskCreateResult, error)
- func (c *LansengerClient) UpdateGroupInfo(ctx context.Context, groupID string, params map[string]interface{}, ...) (*UpdateGroupResult, error)
- func (c *LansengerClient) UpdateGroupMembers(ctx context.Context, groupID string, ...) (*UpdateGroupMembersResult, error)
- func (c *LansengerClient) UpdatePersonalApp(ctx context.Context, appID, userToken, name, avatarID, description string) (*PersonalAppInfoResult, error)
- func (c *LansengerClient) UpdateSchedule(ctx context.Context, calendarID, scheduleID string, ...) (*ScheduleDeleteResult, error)
- func (c *LansengerClient) UpdateScheduleAttendeeMeta(ctx context.Context, calendarID, scheduleID string, ...) (*SendMessageResult, error)
- func (c *LansengerClient) UpdateScheduleAttendees(ctx context.Context, calendarID, scheduleID string, ...) (*ScheduleAttendeesUpdateResult, error)
- func (c *LansengerClient) UpdateTodoTask(ctx context.Context, ...) (*TodoTaskCreateResult, error)
- func (c *LansengerClient) UpdateTodoTaskStatus(ctx context.Context, todotaskID, status, orgID, staffID, userToken string) (*TodoTaskCreateResult, error)
- func (c *LansengerClient) UploadAppMedia(ctx context.Context, filePath string, mediaType string, ...) (*UploadAppMediaResult, error)
- func (c *LansengerClient) UploadMedia(ctx context.Context, filePath string, mediaType int, userToken string) (*UploadMediaResult, error)
- type LansengerError
- type LinkCardParams
- type MediaPathResult
- type NetworkError
- type OaCardParams
- type OrgInfoResult
- type PersonalAppCreateResult
- type PersonalAppInfoResult
- type PersonalAppListResult
- type QueryGroupsResult
- type ScheduleAttendeesDeleteResult
- type ScheduleAttendeesResult
- type ScheduleAttendeesUpdateResult
- type ScheduleCreateResult
- type ScheduleDeleteResult
- type ScheduleInfoResult
- type ScheduleListResult
- type SendMessageResult
- type StaffBasicInfoResult
- type StaffDetailResult
- type StaffIdMappingResult
- type StaffSearchResult
- type StreamMessageResult
- type SysMsgParams
- type TodoTaskCreateResult
- type TodoTaskExecutorListResult
- type TodoTaskInfoResult
- type TodoTaskListResult
- type TodoTaskStatusCountResult
- type TokenManager
- type URLOption
- func WithAppID(appID string) URLOption
- func WithCode(code string) URLOption
- func WithGrantType(grantType string) URLOption
- func WithIDType(idType string) URLOption
- func WithIDValue(idValue string) URLOption
- func WithIntParam(key string, value int) URLOption
- func WithMediaType(mediaType int) URLOption
- func WithMediaTypeString(mediaType string) URLOption
- func WithOrgID(orgID string) URLOption
- func WithPage(page int) URLOption
- func WithPageOffset(offset int) URLOption
- func WithPageSize(pageSize int) URLOption
- func WithPathVar(key, value string) URLOption
- func WithQueryParam(key, value string) URLOption
- func WithRedirectURI(uri string) URLOption
- func WithRefreshToken(token string) URLOption
- func WithScope(scope string) URLOption
- func WithSecret(secret string) URLOption
- func WithStaffID(staffID string) URLOption
- func WithTagID(tagID string) URLOption
- func WithUserID(id string) URLOption
- func WithUserToken(token string) URLOption
- type UpdateGroupMembersResult
- type UpdateGroupResult
- type UploadAppMediaResult
- type UploadMediaResult
- type UserInfoResult
- type UserMessageResult
- type UserTokenManager
- func (utm *UserTokenManager) GetToken(ctx context.Context) (string, error)
- func (utm *UserTokenManager) Invalidate()
- func (utm *UserTokenManager) RefreshToken() string
- func (utm *UserTokenManager) RefreshTokenExpiry() time.Time
- func (utm *UserTokenManager) SetTokens(userToken, refreshToken string, expiresIn int, staffID string, ...)
- func (utm *UserTokenManager) StaffID() string
- type UserTokenResult
Constants ¶
View Source
const ( DefaultAPIGatewayURL = "" DefaultPassportURL = "" DefaultStateDir = "~/.lansenger" DefaultStateFile = "sdk_state.json" DefaultProfile = "default" TokenRefreshMargin = 300 MediaTypeVideo = 1 MediaTypeImage = 2 MediaTypeAudio = 3 AppMediaTypeFile = "file" AppMediaTypeVideo = "video" AppMediaTypeImage = "image" AppMediaTypeAudio = "audio" MaxMessageLength = 4000 OAuth2ScopeBasicUserInfo = "basic_userinfor" TodoStatusPendingRead = "11" TodoStatusRead = "12" TodoStatusPendingDo = "21" TodoStatusDone = "22" TodoTypeNotification = 1 TodoTypeApproval = 2 )
View Source
const UserTokenRefreshMargin = 300
View Source
const Version = "0.9.29"
Variables ¶
View Source
var APIEndpoints = map[string]map[string]string{
"auth": {
"app_token_create": "/v1/apptoken/create",
"tenant_access_token": "/auth/v3/tenant_access_token/internal",
},
"oauth": {
"user_token_create": "/v2/user_token/create",
"refresh_token_create": "/v1/refresh_token/create",
},
"users": {
"fetch": "/v1/users/fetch",
},
"staffs": {
"basic_info_fetch": "/v1/staffs/{staff_id}/fetch",
"detail_fetch": "/v1/staffs/{staff_id}/infor/fetch",
"department_ancestors_fetch": "/v1/staffs/{staff_id}/departmentancestors/fetch",
"id_mapping_fetch": "/v2/staffs/id_mapping/fetch",
"search": "/v2/staffs/search",
},
"org": {
"extra_field_ids_fetch": "/v1/org/{org_id}/extrafieldids/fetch",
"info_fetch": "/v1/org/{org_id}/fetch",
},
"departments": {
"detail_fetch": "/v1/departments/{department_id}/fetch",
"children_fetch": "/v1/departments/{department_id}/children/fetch",
"staffs_fetch": "/v1/departments/{department_id}/staffs/fetch",
},
"groups": {
"create": "/v2/groups/create",
"info_fetch": "/v2/groups/{group_id}/info/fetch",
"members_fetch": "/v2/groups/{group_id}/members/fetch",
"list_fetch": "/v2/groups/fetch",
"is_in_group": "/v2/groups/{group_id}/members/is_in_group",
"info_update": "/v2/groups/{group_id}/info/update",
"members_update": "/v2/groups/{group_id}/members/update",
"delete": "/v2/groups/{group_id}/delete",
"share_create": "/v2/groups/{group_id}/share/create",
},
"messages": {
"create": "/v1/messages/create",
"chat_create": "/v1/messages/chat/create",
"group_create": "/v1/messages/group/create",
"revoke": "/v1/messages/revoke",
"dynamic_update": "/v1/messages/dynamic/update",
"reminder_create": "/v1/messages/reminder/create",
"fetch": "/v1/messages/fetch",
},
"bot": {
"messages_create": "/v1/bot/messages/create",
},
"sse": {
"msg_create": "/v1/sse/msg/create",
"msg_fetch": "/v1/sse/msg/fetch",
},
"medias": {
"create": "/v1/medias/create",
"fetch": "/v1/medias/{media_id}/fetch",
"path_fetch": "/v1/medias/{media_id}/path/fetch",
},
"app_medias": {
"create": "/v1/app/medias/create",
},
"chats": {
"fetch": "/v1/chats/fetch",
"messages_fetch": "/v1/messages/fetch",
},
"calendars": {
"primary_fetch": "/v1/calendars/primary",
"schedules_create": "/v1/calendars/{calendar_id}/schedules/create",
"schedules_fetch": "/v1/calendars/{calendar_id}/schedules/{schedule_id}/fetch",
"schedules_update": "/v1/calendars/{calendar_id}/schedules/{schedule_id}/update",
"schedules_delete": "/v1/calendars/{calendar_id}/schedules/{schedule_id}/delete",
"schedules_list_fetch": "/v1/calendars/{calendar_id}/schedules/fetch",
"schedules_members_fetch": "/v1/calendars/{calendar_id}/schedules/{schedule_id}/members/fetch",
"schedules_members_create": "/v1/calendars/{calendar_id}/schedules/{schedule_id}/members/create",
"schedules_members_delete": "/v1/calendars/{calendar_id}/schedules/{schedule_id}/members/delete",
"schedules_members_update": "/v1/calendars/{calendar_id}/schedules/{schedule_id}/members/update",
"schedules_members_meta_update": "/v1/calendars/{calendar_id}/schedules/{schedule_id}/members/meta/update",
},
"bot_commands": {
"create": "/v1/bot/commands/create",
"fetch": "/v1/bot/commands/fetch",
"delete": "/v1/bot/commands/delete",
},
"personal_apps": {
"create": "/v1/personal/apps/create",
"update": "/v1/personal/apps/{app_id}/update",
"fetch": "/v1/personal/apps/{app_id}/fetch",
"delete": "/v1/personal/apps/{app_id}/delete",
"list_fetch": "/v1/personal/apps/list/fetch",
},
"todo": {
"create": "/xtra/task/unified/v1/todotask/create",
"info_update": "/xtra/task/unified/v1/todotask/info/update",
"status_update": "/xtra/task/unified/v1/todotask/status/update",
"sender_delete": "/xtra/task/unified/v1/sender/todotask/delete",
"list_fetch": "/xtra/task/unified/v1/todotask/list/fetch",
"info_fetch_by_source_id": "/xtra/task/unified/v1/todotask/info/fetchbysourceid",
"info_fetch": "/xtra/task/unified/v1/todotask/info/fetch",
"status_count_list_fetch": "/xtra/task/unified/v1/todotask/status/countList/fetch",
"executor_status_update": "/xtra/task/unified/v1/todotask/executor/status/update",
"executor_create": "/xtra/task/unified/v1/todotask/executor/create",
"executor_delete": "/xtra/task/unified/v1/todotask/executor/delete",
"executor_list_fetch": "/xtra/task/unified/v1/todotask/executor/list/fetch",
},
"websocket": {
"endpoint": "/v1/ws/endpoint/create",
},
}
View Source
var AppToMsgMediaType = map[string]int{ AppMediaTypeVideo: MediaTypeVideo, AppMediaTypeImage: MediaTypeImage, AppMediaTypeFile: MediaTypeAudio, AppMediaTypeAudio: MediaTypeAudio, }
View Source
var AudioExtensions = map[string]bool{ ".mp3": true, ".wav": true, ".amr": true, ".m4a": true, ".ogg": true, ".flac": true, ".aac": true, }
View Source
var CallbackEventTypes = map[string]string{
"account_subscribe": "public_account",
"account_unsubscribe": "public_account",
"account_message": "public_account",
"staff_info": "staff",
"staff_modify": "staff",
"staff_create": "staff",
"staff_delete": "staff",
"dept_modify": "department",
"dept_create": "department",
"dept_delete": "department",
"tag_member": "tag",
"app_install_org": "app",
"app_uninstall_org": "app",
"bot_private_message": "bot",
"bot_group_message": "bot",
"group_create_approve": "group",
"telephone_track": "notification",
"ua_cert_create": "certificate",
"ua_cert_delete": "certificate",
"report_location": "location",
"user_logout": "auth",
"data_scope": "data_scope",
"wb_visible_config": "workbench",
"schedule_modify": "calendar",
"schedule_delete": "calendar",
}
View Source
var DebugLogger func(format string, args ...interface{})
Functions ¶
func BuildAPIURL ¶
func GetCallbackEventTypes ¶
func GuessAppMediaType ¶ added in v0.9.8
func GuessMediaType ¶
func ParseAuthorizeCallback ¶
func SetDefaultUserID ¶ added in v0.9.27
func SetDefaultUserID(id string)
SetDefaultUserID sets the fallback user ID for API requests where no explicit userID is provided. Thread-safe.
func SetDefaultUserToken ¶ added in v0.9.18
func SetDefaultUserToken(token string)
SetDefaultUserToken sets the fallback user token for API requests where no explicit userToken is provided. Thread-safe.
func ValidateCallbackState ¶
Types ¶
type AccountMessageResult ¶
type AppCardParams ¶
type AppCardParams struct {
BodyTitle string `json:"body_title"`
ChatID string `json:"chat_id"`
HeadTitle string `json:"head_title"`
BodySubTitle string `json:"body_sub_title"`
BodyContent string `json:"body_content"`
Signature string `json:"signature"`
Fields []map[string]interface{} `json:"fields"`
Links []map[string]interface{} `json:"links"`
CardLink string `json:"card_link"`
PcCardLink string `json:"pc_card_link"`
PadCardLink string `json:"pad_card_link"`
IsDynamic bool `json:"is_dynamic"`
HeadStatusInfo map[string]interface{} `json:"head_status_info"`
StaffID string `json:"staff_id"`
HeadIconURL string `json:"head_icon_url"`
IsGroup bool `json:"is_group"`
UserToken string `json:"user_token"`
SenderID string `json:"sender_id"`
}
type ApproveCardParams ¶ added in v0.9.21
type ApproveCardParams struct {
ChatID string `json:"chat_id"`
BodyTitle string `json:"body_title"`
BodyContent string `json:"body_content"`
HeadTitle string `json:"head_title"`
HeadIconLink string `json:"head_icon_link"`
HeadIconID string `json:"head_icon_id"`
HeadStatusDescribe string `json:"head_status_describe"`
HeadStatusIcon int `json:"head_status_icon"`
HeadStatusIconLink string `json:"head_status_icon_link"`
HeadStatusColour string `json:"head_status_colour"`
BodyFormatType int `json:"body_format_type"`
Fields []map[string]string `json:"fields"`
ReminderAll bool `json:"reminder_all"`
ReminderUserIDs []string `json:"reminder_user_ids"`
ReminderBotIDs []string `json:"reminder_bot_ids"`
CardLink string `json:"card_link"`
CardLinkForPC string `json:"card_link_for_pc"`
CardLinkForPad string `json:"card_link_for_pad"`
Buttons []map[string]interface{} `json:"buttons"`
ExpireTime int `json:"expire_time"`
IsGroup bool `json:"is_group"`
UserToken string `json:"user_token"`
SenderID string `json:"sender_id"`
}
type ApproveCardUpdateParams ¶ added in v0.9.21
type ApproveCardUpdateParams struct {
MsgID string `json:"msg_id"`
HeadStatusDescribe string `json:"head_status_describe"`
HeadStatusIcon int `json:"head_status_icon"`
HeadStatusIconLink string `json:"head_status_icon_link"`
HeadStatusColour string `json:"head_status_colour"`
Buttons []map[string]interface{} `json:"buttons"`
}
type BotCommandQueryResult ¶ added in v0.9.21
type BotCommandQueryResult struct {
Success bool `json:"success"`
ScopeType int `json:"scope_type"`
ChatID string `json:"chat_id"`
ChatType string `json:"chat_type"`
StaffID string `json:"staff_id"`
Commands []map[string]interface{} `json:"commands"`
Error string `json:"error"`
RawResponse map[string]interface{} `json:"raw_response"`
}
type BotCommandResult ¶ added in v0.9.21
type BotMessageResult ¶
type CalendarPrimaryResult ¶
type CalendarPrimaryResult struct {
Success bool `json:"success"`
CalendarID string `json:"calendar_id"`
Summary string `json:"summary"`
Description string `json:"description"`
Permissions string `json:"permissions"`
Color string `json:"color"`
Type string `json:"type"`
Role string `json:"role"`
Error string `json:"error"`
RawResponse map[string]interface{} `json:"raw_response"`
}
type CallbackEvent ¶
type CallbackEvent struct {
EventID string
EventType string
Category string
Data map[string]interface{}
RawData map[string]interface{}
AppID string
OrgID string
}
func ParseCallbackPayload ¶
func ParseCallbackPayload(input string) ([]CallbackEvent, error)
type ChatGroupInfo ¶
type ChatListResult ¶
type ChatListResult struct {
Success bool `json:"success"`
StaffInfos []ChatStaffInfo `json:"staff_infos"`
GroupInfos []ChatGroupInfo `json:"group_infos"`
Error string `json:"error"`
RawResponse map[string]interface{} `json:"raw_response"`
}
type ChatMessageInfo ¶
type ChatMessageInfo struct {
SendTime string `json:"send_time"`
Sender string `json:"sender"`
MessageType string `json:"message_type"`
Content map[string]interface{} `json:"content"`
}
func (*ChatMessageInfo) PlainText ¶
func (m *ChatMessageInfo) PlainText() string
type ChatMessagesResult ¶
type ChatMessagesResult struct {
Success bool `json:"success"`
HasMore bool `json:"has_more"`
Total int `json:"total"`
LastVersion string `json:"last_version"`
Name string `json:"name"`
ChatType string `json:"chat_type"`
Messages []ChatMessageInfo `json:"messages"`
Error string `json:"error"`
RawResponse map[string]interface{} `json:"raw_response"`
}
type ChatStaffInfo ¶
type Config ¶
type Config struct {
AppID string
AppSecret string
APIGatewayURL string
PassportURL string
RedirectURI string
HTTPTimeout float64
EncodingKey string
CallbackToken string
AppToken string
UserToken string
}
func ConfigFromEnv ¶
func (*Config) HasPassportURL ¶
func (*Config) IsConfigured ¶
func (*Config) IsExternalMode ¶ added in v0.9.21
type ConfigError ¶
type ConfigError struct {
LansengerError
}
func NewConfigError ¶
func NewConfigError(message string) *ConfigError
type CreateGroupResult ¶
type CreateGroupResult struct {
Success bool `json:"success"`
GroupID string `json:"group_id"`
TotalMembers int `json:"total_members"`
InvalidStaff []string `json:"invalid_staff"`
InvalidDepartment []string `json:"invalid_department"`
Error string `json:"error"`
RawResponse map[string]interface{} `json:"raw_response"`
}
type CredentialStore ¶
type CredentialStore struct {
// contains filtered or unexported fields
}
func NewCredentialStore ¶
func NewCredentialStore(path string, profile string) (*CredentialStore, error)
func (*CredentialStore) Clear ¶
func (cs *CredentialStore) Clear() error
func (*CredentialStore) ClearProfile ¶
func (cs *CredentialStore) ClearProfile() error
func (*CredentialStore) DeleteProfileByName ¶ added in v0.9.18
func (cs *CredentialStore) DeleteProfileByName(name string) bool
DeleteProfileByName deletes a profile by name. If the deleted profile is the active profile, it falls back to "default". Returns true if the profile was found and deleted, false if it did not exist.
func (*CredentialStore) GetActiveProfile ¶
func (cs *CredentialStore) GetActiveProfile() string
func (*CredentialStore) HasCredentials ¶
func (cs *CredentialStore) HasCredentials() bool
func (*CredentialStore) HasFullConfig ¶ added in v0.9.18
func (cs *CredentialStore) HasFullConfig() bool
HasFullConfig returns true if app_id, app_secret, and api_gateway_url are all non-empty for the current profile.
func (*CredentialStore) ListProfiles ¶
func (cs *CredentialStore) ListProfiles() ([]string, error)
func (*CredentialStore) ListUserTokens ¶ added in v0.9.18
func (cs *CredentialStore) ListUserTokens() ([]string, error)
func (*CredentialStore) LoadAppToken ¶
func (cs *CredentialStore) LoadAppToken() (string, error)
func (*CredentialStore) LoadCredentials ¶
func (cs *CredentialStore) LoadCredentials() (map[string]string, error)
func (*CredentialStore) LoadState ¶
func (cs *CredentialStore) LoadState() (*storeData, error)
func (*CredentialStore) LoadUserToken ¶
func (cs *CredentialStore) LoadUserToken(staffID string) (map[string]string, error)
func (*CredentialStore) Path ¶
func (cs *CredentialStore) Path() string
func (*CredentialStore) SaveAppToken ¶
func (cs *CredentialStore) SaveAppToken(token string, expiresIn int) error
func (*CredentialStore) SaveCallbackConfig ¶
func (cs *CredentialStore) SaveCallbackConfig(encodingKey, callbackToken string) error
func (*CredentialStore) SaveCredentials ¶
func (cs *CredentialStore) SaveCredentials(appID, appSecret, apiGatewayURL, passportURL, redirectURI string) error
func (*CredentialStore) SaveUserToken ¶
func (*CredentialStore) SetActiveProfile ¶
func (cs *CredentialStore) SetActiveProfile(profile string) error
type DecryptedCallbackPayload ¶
type DecryptedCallbackPayload struct {
Random string
OrgID string
AppID string
Events []CallbackEvent
Length uint32
}
func DecryptCallbackPayload ¶
func DecryptCallbackPayload(encryptedData, encodingKey string, knownAppID string) (*DecryptedCallbackPayload, error)
type DepartmentDetailResult ¶
type DepartmentDetailResult struct {
Success bool `json:"success"`
ID string `json:"id"`
Name string `json:"name"`
ExternalID string `json:"external_id"`
ParentID string `json:"parent_id"`
Order float64 `json:"order"`
HasChildren bool `json:"has_children"`
NormalMembers int `json:"normal_members"`
InactiveMembers int `json:"inactive_members"`
FrozenMembers int `json:"frozen_members"`
DeletedMembers int `json:"deleted_members"`
NormalMembersUnique int `json:"normal_members_unique"`
InactiveMembersUnique int `json:"inactive_members_unique"`
FrozenMembersUnique int `json:"frozen_members_unique"`
DeletedMembersUnique int `json:"deleted_members_unique"`
Tags []map[string]interface{} `json:"tags"`
AncestorDepartments []map[string]interface{} `json:"ancestor_departments"`
Leaders []map[string]interface{} `json:"leaders"`
Emails []string `json:"emails"`
Phones []string `json:"phones"`
Addresses []string `json:"addresses"`
Introductions []string `json:"introductions"`
DeptType int `json:"dept_type"`
Error string `json:"error"`
RawResponse map[string]interface{} `json:"raw_response"`
}
type DepartmentStaffsResult ¶
type DownloadMediaResult ¶
type DynamicCardUpdateParams ¶
type ExtraFieldIdsResult ¶
type GroupCreateInfo ¶
type GroupCreateInfo struct {
Name string `json:"name"`
OrgID int `json:"org_id"`
OwnerID string `json:"owner_id"`
Description string `json:"description"`
AvatarID string `json:"avatar_id"`
StaffIDList []string `json:"staff_id_list"`
DepartmentIDList []string `json:"department_id_list"`
ApplyRequestID string `json:"apply_request_id"`
ApplyNotes string `json:"apply_notes"`
ApplyGlobalUniqueID string `json:"apply_global_unique_id"`
ApplySessionUniqueID string `json:"apply_session_unique_id"`
I18nApplyNotes map[string]interface{} `json:"i18n_apply_notes"`
}
type GroupInfoResult ¶
type GroupInfoResult struct {
Success bool `json:"success"`
Name string `json:"name"`
Description string `json:"description"`
AvatarID string `json:"avatar_id"`
AvatarURL string `json:"avatar_url"`
OwnerStaffID string `json:"owner_staff_id"`
OwnerName string `json:"owner_name"`
CreatorStaffID string `json:"creator_staff_id"`
CreatorName string `json:"creator_name"`
State string `json:"state"`
ManageMode string `json:"manage_mode"`
NeedsConfirm bool `json:"needs_confirm"`
IsPublic bool `json:"is_public"`
MaxMembers int `json:"max_members"`
MaxHistoryMsgCount int `json:"max_history_msg_count"`
TotalMembers int `json:"total_members"`
RemindAll bool `json:"remind_all"`
SendMsgStatus bool `json:"send_msg_status"`
Error string `json:"error"`
RawResponse map[string]interface{} `json:"raw_response"`
}
type GroupListResult ¶
type GroupMemberResult ¶
type IsInGroupResult ¶
type LansengerClient ¶
type LansengerClient struct {
// contains filtered or unexported fields
}
func NewClient ¶
func NewClient(appID, appSecret string) *LansengerClient
func NewClientFromEnv ¶
func NewClientFromEnv() (*LansengerClient, error)
func NewClientFromStore ¶
func NewClientFromStore(store *CredentialStore) (*LansengerClient, error)
func NewClientWithConfig ¶
func NewClientWithConfig(cfg *Config) *LansengerClient
func (*LansengerClient) AddExecutors ¶
func (c *LansengerClient) AddExecutors(ctx context.Context, executorIDs []string, orgID, todotaskID, userToken string) (*TodoTaskCreateResult, error)
func (*LansengerClient) AddScheduleAttendees ¶
func (c *LansengerClient) AddScheduleAttendees(ctx context.Context, calendarID, scheduleID string, attendees []string, reminderType string, operationType, currentTime string, userToken, userID string) (*ScheduleCreateResult, error)
func (*LansengerClient) BuildAuthorizeURL ¶
func (c *LansengerClient) BuildAuthorizeURL(redirectURI string, scope string, state string) string
func (*LansengerClient) CheckIsInGroup ¶
func (c *LansengerClient) CheckIsInGroup(ctx context.Context, groupID, userToken, staffID string) (*IsInGroupResult, error)
func (*LansengerClient) CreateBotCommands ¶ added in v0.9.21
func (c *LansengerClient) CreateBotCommands(ctx context.Context, scopeType int, commands []map[string]interface{}, chatID, chatType, staffID string) (*BotCommandResult, error)
func (*LansengerClient) CreateGroup ¶
func (c *LansengerClient) CreateGroup(ctx context.Context, info *GroupCreateInfo, userToken string) (*CreateGroupResult, error)
func (*LansengerClient) CreateGroupShareID ¶
func (c *LansengerClient) CreateGroupShareID(ctx context.Context, groupID, creator string, expiresIn int64, userToken string) (*SendMessageResult, error)
func (*LansengerClient) CreatePersonalApp ¶ added in v0.9.21
func (c *LansengerClient) CreatePersonalApp(ctx context.Context, userToken, name, avatarID, description string) (*PersonalAppCreateResult, error)
func (*LansengerClient) CreateSchedule ¶
func (c *LansengerClient) CreateSchedule(ctx context.Context, calendarID, summary string, startTime, endTime map[string]interface{}, attendees []map[string]interface{}, description string, allDay string, repeatType string, rule map[string]interface{}, expireDateType, reminderType, attendeePermissions string, userToken, userID string) (*ScheduleCreateResult, error)
func (*LansengerClient) CreateStreamMessage ¶
func (c *LansengerClient) CreateStreamMessage(ctx context.Context, receiverID, receiverType, streamID string) (*StreamMessageResult, error)
func (*LansengerClient) CreateTodoTask ¶
func (c *LansengerClient) CreateTodoTask(ctx context.Context, title string, todoType int, link, pcLink string, executorIDs []string, orgID, sourceID, desc, senderID, userToken string) (*TodoTaskCreateResult, error)
func (*LansengerClient) DeleteBotCommands ¶ added in v0.9.21
func (c *LansengerClient) DeleteBotCommands(ctx context.Context, scopeType int, chatID, chatType, staffID string) (*BotCommandResult, error)
func (*LansengerClient) DeleteExecutors ¶
func (c *LansengerClient) DeleteExecutors(ctx context.Context, executorIDs []string, orgID, todotaskID, userToken string) (*TodoTaskCreateResult, error)
func (*LansengerClient) DeletePersonalApp ¶ added in v0.9.21
func (c *LansengerClient) DeletePersonalApp(ctx context.Context, appID, userToken string) (*PersonalAppInfoResult, error)
func (*LansengerClient) DeleteSchedule ¶
func (c *LansengerClient) DeleteSchedule(ctx context.Context, calendarID, scheduleID string, reminderType string, operationType string, currentTime string, userToken, userID string) (*ScheduleDeleteResult, error)
func (*LansengerClient) DeleteScheduleAttendees ¶
func (c *LansengerClient) DeleteScheduleAttendees(ctx context.Context, calendarID, scheduleID string, attendees []string, reminderType string, operationType, currentTime string, userToken, userID string) (*ScheduleAttendeesDeleteResult, error)
func (*LansengerClient) DeleteTodoTask ¶
func (c *LansengerClient) DeleteTodoTask(ctx context.Context, todotaskID, orgID, staffID, userToken string) (*TodoTaskCreateResult, error)
func (*LansengerClient) DissolveGroup ¶
func (c *LansengerClient) DissolveGroup(ctx context.Context, groupID, userToken string) (*UpdateGroupResult, error)
func (*LansengerClient) DownloadMedia ¶
func (c *LansengerClient) DownloadMedia(ctx context.Context, mediaID string) (*DownloadMediaResult, error)
func (*LansengerClient) DownloadMediaToFile ¶
func (*LansengerClient) ExchangeCode ¶
func (c *LansengerClient) ExchangeCode(ctx context.Context, code string, redirectURI string) (*UserTokenResult, error)
func (*LansengerClient) FetchBotCommands ¶ added in v0.9.21
func (c *LansengerClient) FetchBotCommands(ctx context.Context, scopeType int, chatID, chatType, staffID string) (*BotCommandQueryResult, error)
func (*LansengerClient) FetchChatList ¶
func (c *LansengerClient) FetchChatList(ctx context.Context, userToken string, chatType int, keyword string, startTime, endTime int64) (*ChatListResult, error)
func (*LansengerClient) FetchChatMessages ¶
func (*LansengerClient) FetchDepartmentAncestors ¶
func (c *LansengerClient) FetchDepartmentAncestors(ctx context.Context, staffID string, userToken string) (*DepartmentAncestorsResult, error)
func (*LansengerClient) FetchDepartmentChildren ¶
func (c *LansengerClient) FetchDepartmentChildren(ctx context.Context, departmentID, userToken string) (*DepartmentChildrenResult, error)
func (*LansengerClient) FetchDepartmentDetail ¶
func (c *LansengerClient) FetchDepartmentDetail(ctx context.Context, departmentID, userToken, tagID string) (*DepartmentDetailResult, error)
func (*LansengerClient) FetchDepartmentStaffs ¶
func (c *LansengerClient) FetchDepartmentStaffs(ctx context.Context, departmentID, userToken string, page, pageSize int) (*DepartmentStaffsResult, error)
func (*LansengerClient) FetchExecutorList ¶
func (c *LansengerClient) FetchExecutorList(ctx context.Context, todotaskID, orgID, staffID string, statusList []string, userToken string) (*TodoTaskExecutorListResult, error)
func (*LansengerClient) FetchGroupInfo ¶
func (c *LansengerClient) FetchGroupInfo(ctx context.Context, groupID, userToken string) (*GroupInfoResult, error)
func (*LansengerClient) FetchGroupList ¶
func (c *LansengerClient) FetchGroupList(ctx context.Context, userToken string, pageOffset, pageSize int) (*GroupListResult, error)
func (*LansengerClient) FetchGroupMembers ¶
func (c *LansengerClient) FetchGroupMembers(ctx context.Context, groupID, userToken string, pageOffset, pageSize int) (*GroupMemberResult, error)
func (*LansengerClient) FetchMediaPath ¶
func (c *LansengerClient) FetchMediaPath(ctx context.Context, mediaID string, userToken string) (*MediaPathResult, error)
func (*LansengerClient) FetchOrgExtraFieldIDs ¶
func (c *LansengerClient) FetchOrgExtraFieldIDs(ctx context.Context, orgID, userToken string, page, pageSize int) (*ExtraFieldIdsResult, error)
func (*LansengerClient) FetchOrgInfo ¶
func (c *LansengerClient) FetchOrgInfo(ctx context.Context, orgID, userToken string) (*OrgInfoResult, error)
func (*LansengerClient) FetchPersonalApp ¶ added in v0.9.21
func (c *LansengerClient) FetchPersonalApp(ctx context.Context, appID, userToken string) (*PersonalAppInfoResult, error)
func (*LansengerClient) FetchPersonalAppList ¶ added in v0.9.21
func (c *LansengerClient) FetchPersonalAppList(ctx context.Context, userToken string) (*PersonalAppListResult, error)
func (*LansengerClient) FetchPrimaryCalendar ¶
func (c *LansengerClient) FetchPrimaryCalendar(ctx context.Context, userToken, userID string) (*CalendarPrimaryResult, error)
func (*LansengerClient) FetchSchedule ¶
func (c *LansengerClient) FetchSchedule(ctx context.Context, calendarID, scheduleID, userToken, userID string) (*ScheduleInfoResult, error)
func (*LansengerClient) FetchScheduleAttendees ¶
func (c *LansengerClient) FetchScheduleAttendees(ctx context.Context, calendarID, scheduleID string, page, pageSize int, userToken, userID string) (*ScheduleAttendeesResult, error)
func (*LansengerClient) FetchScheduleList ¶
func (c *LansengerClient) FetchScheduleList(ctx context.Context, calendarID string, startTime, endTime int64, userToken, userID string) (*ScheduleListResult, error)
func (*LansengerClient) FetchStaffBasicInfo ¶
func (c *LansengerClient) FetchStaffBasicInfo(ctx context.Context, staffID string, userToken string) (*StaffBasicInfoResult, error)
func (*LansengerClient) FetchStaffDetail ¶
func (c *LansengerClient) FetchStaffDetail(ctx context.Context, staffID string, userToken string) (*StaffDetailResult, error)
func (*LansengerClient) FetchStaffIdMapping ¶
func (c *LansengerClient) FetchStaffIdMapping(ctx context.Context, orgID, idType, idValue, userToken string) (*StaffIdMappingResult, error)
func (*LansengerClient) FetchStreamMessage ¶
func (c *LansengerClient) FetchStreamMessage(ctx context.Context, msgID string) (*StreamMessageResult, error)
func (*LansengerClient) FetchTodoTaskByID ¶
func (c *LansengerClient) FetchTodoTaskByID(ctx context.Context, todotaskID, orgID, staffID, userToken string) (*TodoTaskInfoResult, error)
func (*LansengerClient) FetchTodoTaskBySourceID ¶
func (c *LansengerClient) FetchTodoTaskBySourceID(ctx context.Context, sourceID, orgID, staffID, userToken string) (*TodoTaskInfoResult, error)
func (*LansengerClient) FetchTodoTaskList ¶
func (c *LansengerClient) FetchTodoTaskList(ctx context.Context, orgID string, appIDs []string, staffID string, statusList []string, userToken string) (*TodoTaskListResult, error)
func (*LansengerClient) FetchTodoTaskStatusCounts ¶
func (c *LansengerClient) FetchTodoTaskStatusCounts(ctx context.Context, staffID, orgID, appID string, statusList []string, userToken string) (*TodoTaskStatusCountResult, error)
func (*LansengerClient) FetchUserInfo ¶
func (c *LansengerClient) FetchUserInfo(ctx context.Context, userToken string) (*UserInfoResult, error)
func (*LansengerClient) GetToken ¶
func (c *LansengerClient) GetToken(ctx context.Context) (string, error)
func (*LansengerClient) GetUserToken ¶
func (c *LansengerClient) GetUserToken(ctx context.Context) (string, error)
func (*LansengerClient) GetUserTokenWithStaffID ¶ added in v0.9.18
func (*LansengerClient) HealthCheck ¶
func (c *LansengerClient) HealthCheck(ctx context.Context) bool
func (*LansengerClient) InvalidateToken ¶
func (c *LansengerClient) InvalidateToken()
func (*LansengerClient) QueryGroups
deprecated
func (c *LansengerClient) QueryGroups(ctx context.Context, pageOffset, pageSize int) (*QueryGroupsResult, error)
Deprecated: Use FetchGroupList from groups.go instead.
func (*LansengerClient) RefreshUserToken ¶
func (c *LansengerClient) RefreshUserToken(ctx context.Context, refreshToken string, scope string) (*UserTokenResult, error)
func (*LansengerClient) RevokeMessage ¶
func (c *LansengerClient) RevokeMessage(ctx context.Context, messageIDs []string, chatType string, senderID string, sysMsg *SysMsgParams) (*SendMessageResult, error)
func (*LansengerClient) SearchStaff ¶
func (c *LansengerClient) SearchStaff(ctx context.Context, keyword, userToken, userID string, recursive bool, sectorIDs []string, page, pageSize int) (*StaffSearchResult, error)
func (*LansengerClient) SendAccountMessage ¶
func (c *LansengerClient) SendAccountMessage(ctx context.Context, msgType string, msgData map[string]interface{}, chatIDs, departmentIDs []string, accountID, entryID, attach, userToken string) (*AccountMessageResult, error)
func (*LansengerClient) SendAppArticles ¶
func (c *LansengerClient) SendAppArticles(ctx context.Context, chatID string, articles []map[string]string, isGroup bool, userToken, senderID string) (*SendMessageResult, error)
func (*LansengerClient) SendAppCardWithParams ¶
func (c *LansengerClient) SendAppCardWithParams(ctx context.Context, params *AppCardParams) (*SendMessageResult, error)
func (*LansengerClient) SendApproveCard ¶ added in v0.9.21
func (c *LansengerClient) SendApproveCard(ctx context.Context, chatID, bodyTitle, bodyContent, headTitle, headIconLink, headIconID, headStatusDescribe string, headStatusIcon int, headStatusIconLink, headStatusColour string, bodyFormatType int, fields []map[string]string, reminderAll bool, reminderUserIDs, reminderBotIDs []string, cardLink, cardLinkForPC, cardLinkForPad string, buttons []map[string]interface{}, expireTime int, isGroup bool, userToken, senderID string) (*SendMessageResult, error)
func (*LansengerClient) SendApproveCardWithParams ¶ added in v0.9.21
func (c *LansengerClient) SendApproveCardWithParams(ctx context.Context, params *ApproveCardParams) (*SendMessageResult, error)
func (*LansengerClient) SendBotMessage ¶
func (c *LansengerClient) SendBotMessage(ctx context.Context, msgType string, msgData map[string]interface{}, chatIDs, departmentIDs []string, userToken, entryID, refMsgID string) (*BotMessageResult, error)
func (*LansengerClient) SendGroupMessage ¶
func (c *LansengerClient) SendGroupMessage(ctx context.Context, groupID, msgType string, msgData map[string]interface{}, userToken, senderID string, outlines, uuid, entryID, refMsgID string) (*SendMessageResult, error)
func (*LansengerClient) SendImageURL ¶
func (c *LansengerClient) SendImageURL(ctx context.Context, chatID, imageURL, content string, isGroup bool, userToken, senderID string) (*SendMessageResult, error)
func (*LansengerClient) SendLinkCardWithParams ¶
func (c *LansengerClient) SendLinkCardWithParams(ctx context.Context, params *LinkCardParams) (*SendMessageResult, error)
func (*LansengerClient) SendMarkdown ¶
func (c *LansengerClient) SendMarkdown(ctx context.Context, chatID, content string, reminderAll bool, reminderUserIDs, reminderBotIDs []string, isGroup bool, userToken, senderID, refMsgID string) (*SendMessageResult, error)
func (*LansengerClient) SendOaCardWithParams ¶
func (c *LansengerClient) SendOaCardWithParams(ctx context.Context, params *OaCardParams) (*SendMessageResult, error)
func (*LansengerClient) SendReminder ¶
func (c *LansengerClient) SendReminder(ctx context.Context, msgID string, reminderTypes []int, userIDList []string) (*SendMessageResult, error)
func (*LansengerClient) SendUserMessage ¶
func (c *LansengerClient) SendUserMessage(ctx context.Context, receiverID, msgType string, msgData map[string]interface{}, common map[string]interface{}, userToken, uuid string) (*UserMessageResult, error)
func (*LansengerClient) SetUserTokens ¶
func (c *LansengerClient) SetUserTokens(userToken, refreshToken string, expiresIn int, staffID string, refreshExpiresIn int)
func (*LansengerClient) UpdateApproveCard ¶ added in v0.9.21
func (c *LansengerClient) UpdateApproveCard(ctx context.Context, params *ApproveCardUpdateParams) (*SendMessageResult, error)
func (*LansengerClient) UpdateDynamicCard ¶
func (c *LansengerClient) UpdateDynamicCard(ctx context.Context, params *DynamicCardUpdateParams) (*SendMessageResult, error)
func (*LansengerClient) UpdateExecutorStatus ¶
func (c *LansengerClient) UpdateExecutorStatus(ctx context.Context, executorStatusList []map[string]interface{}, orgID, todotaskID, userToken string) (*TodoTaskCreateResult, error)
func (*LansengerClient) UpdateGroupInfo ¶
func (c *LansengerClient) UpdateGroupInfo(ctx context.Context, groupID string, params map[string]interface{}, userToken string) (*UpdateGroupResult, error)
func (*LansengerClient) UpdateGroupMembers ¶
func (c *LansengerClient) UpdateGroupMembers(ctx context.Context, groupID string, addUserList, delUserList, addDepartmentIDList []string, userToken string) (*UpdateGroupMembersResult, error)
func (*LansengerClient) UpdatePersonalApp ¶ added in v0.9.21
func (c *LansengerClient) UpdatePersonalApp(ctx context.Context, appID, userToken, name, avatarID, description string) (*PersonalAppInfoResult, error)
func (*LansengerClient) UpdateSchedule ¶
func (c *LansengerClient) UpdateSchedule(ctx context.Context, calendarID, scheduleID string, params map[string]interface{}, userToken, userID string) (*ScheduleDeleteResult, error)
func (*LansengerClient) UpdateScheduleAttendeeMeta ¶
func (c *LansengerClient) UpdateScheduleAttendeeMeta(ctx context.Context, calendarID, scheduleID string, params map[string]interface{}, userToken, userID string) (*SendMessageResult, error)
func (*LansengerClient) UpdateScheduleAttendees ¶ added in v0.9.21
func (c *LansengerClient) UpdateScheduleAttendees(ctx context.Context, calendarID, scheduleID string, addAttendees, deleteAttendees []string, reminderType, operationType string, currentTime int, userToken, userID string) (*ScheduleAttendeesUpdateResult, error)
func (*LansengerClient) UpdateTodoTask ¶
func (c *LansengerClient) UpdateTodoTask(ctx context.Context, todotaskID, title, link, pcLink, orgID, desc, userToken string) (*TodoTaskCreateResult, error)
func (*LansengerClient) UpdateTodoTaskStatus ¶
func (c *LansengerClient) UpdateTodoTaskStatus(ctx context.Context, todotaskID, status, orgID, staffID, userToken string) (*TodoTaskCreateResult, error)
func (*LansengerClient) UploadAppMedia ¶
func (c *LansengerClient) UploadAppMedia(ctx context.Context, filePath string, mediaType string, width, height, duration int) (*UploadAppMediaResult, error)
func (*LansengerClient) UploadMedia ¶
func (c *LansengerClient) UploadMedia(ctx context.Context, filePath string, mediaType int, userToken string) (*UploadMediaResult, error)
type LansengerError ¶
func (*LansengerError) Error ¶
func (e *LansengerError) Error() string
type LinkCardParams ¶
type LinkCardParams struct {
ChatID string `json:"chat_id"`
Title string `json:"title"`
Link string `json:"link"`
Description string `json:"description"`
IconLink string `json:"icon_link"`
PcLink string `json:"pc_link"`
PadLink string `json:"pad_link"`
FromName string `json:"from_name"`
FromIconLink string `json:"from_icon_link"`
IsGroup bool `json:"is_group"`
UserToken string `json:"user_token"`
SenderID string `json:"sender_id"`
}
type MediaPathResult ¶
type NetworkError ¶
type NetworkError struct {
LansengerError
}
func NewNetworkError ¶
func NewNetworkError(message string) *NetworkError
type OaCardParams ¶
type OaCardParams struct {
ChatID string `json:"chat_id"`
Head string `json:"head"`
Title string `json:"title"`
SubTitle string `json:"sub_title"`
StaffID string `json:"staff_id"`
Fields []map[string]interface{} `json:"fields"`
Link string `json:"link"`
PcLink string `json:"pc_link"`
PadLink string `json:"pad_link"`
CardAction map[string]interface{} `json:"card_action"`
IsGroup bool `json:"is_group"`
UserToken string `json:"user_token"`
SenderID string `json:"sender_id"`
}
type OrgInfoResult ¶
type OrgInfoResult struct {
Success bool `json:"success"`
OrgID string `json:"org_id"`
OrgName string `json:"org_name"`
IconURL string `json:"icon_url"`
OrgMaxMemberLimit int `json:"org_max_member_limit"`
OrgOrderType string `json:"org_order_type"`
OrgDaysLimit int `json:"org_days_limit"`
OrgBillingDate string `json:"org_billing_date"`
Error string `json:"error"`
RawResponse map[string]interface{} `json:"raw_response"`
}
type PersonalAppCreateResult ¶ added in v0.9.21
type PersonalAppInfoResult ¶ added in v0.9.21
type PersonalAppInfoResult struct {
Success bool `json:"success"`
AppID string `json:"app_id"`
Name string `json:"name"`
AvatarID string `json:"avatar_id"`
Description string `json:"description"`
APIGWAddr string `json:"apigw_addr"`
PassportAddr string `json:"passport_addr"`
Error string `json:"error"`
RawResponse map[string]interface{} `json:"raw_response"`
}
type PersonalAppListResult ¶ added in v0.9.21
type QueryGroupsResult ¶
type ScheduleAttendeesResult ¶
type ScheduleAttendeesUpdateResult ¶ added in v0.9.21
type ScheduleCreateResult ¶
type ScheduleDeleteResult ¶
type ScheduleInfoResult ¶
type ScheduleInfoResult struct {
Success bool `json:"success"`
ScheduleID string `json:"schedule_id"`
Summary string `json:"summary"`
Description string `json:"description"`
RepeatType string `json:"repeat_type"`
AllDay string `json:"all_day"`
StartTime map[string]interface{} `json:"start_time"`
EndTime map[string]interface{} `json:"end_time"`
Creator map[string]interface{} `json:"creator"`
RsvpStatus string `json:"rsvp_status"`
PrimaryScheduleID string `json:"primary_schedule_id"`
ExpireDateType string `json:"expire_date_type"`
AttendeePermissions string `json:"attendee_permissions"`
Color string `json:"color"`
Error string `json:"error"`
RawResponse map[string]interface{} `json:"raw_response"`
}
type ScheduleListResult ¶
type SendMessageResult ¶
type SendMessageResult struct {
Success bool `json:"success"`
MessageID string `json:"message_id"`
Error string `json:"error"`
Platform string `json:"platform"`
MsgType string `json:"msg_type"`
Operation string `json:"operation"`
RawResponse map[string]interface{} `json:"raw_response"`
Retryable bool `json:"retryable"`
}
type StaffBasicInfoResult ¶
type StaffBasicInfoResult struct {
Success bool `json:"success"`
OrgID string `json:"org_id"`
OrgName string `json:"org_name"`
Name string `json:"name"`
Gender string `json:"gender"`
Signature string `json:"signature"`
AvatarURL string `json:"avatar_url"`
AvatarID string `json:"avatar_id"`
Status string `json:"status"`
Departments []map[string]interface{} `json:"departments"`
Error string `json:"error"`
RawResponse map[string]interface{} `json:"raw_response"`
}
type StaffDetailResult ¶
type StaffDetailResult struct {
Success bool `json:"success"`
Name string `json:"name"`
Signature string `json:"signature"`
AvatarID string `json:"avatar_id"`
AvatarURL string `json:"avatar_url"`
Status string `json:"status"`
Departments []map[string]interface{} `json:"departments"`
Gender string `json:"gender"`
OrgID string `json:"org_id"`
OrgName string `json:"org_name"`
LoginName string `json:"login_name"`
EmployeeNumber string `json:"employee_number"`
Email string `json:"email"`
ExternalID string `json:"external_id"`
Nationality string `json:"nationality"`
Birthdate string `json:"birthdate"`
IDNumber string `json:"id_number"`
NativePlace string `json:"native_place"`
Duties []map[string]interface{} `json:"duties"`
Parties []map[string]interface{} `json:"parties"`
Address string `json:"address"`
MobilePhone string `json:"mobile_phone"`
MobilePhoneCountryCode string `json:"mobile_phone_country_code"`
ExtraPhones []string `json:"extra_phones"`
Introduction string `json:"introduction"`
Education []map[string]interface{} `json:"education"`
Career []map[string]interface{} `json:"career"`
LoginWays []map[string]interface{} `json:"login_ways"`
Tags []map[string]interface{} `json:"tags"`
ExtraFieldSet []map[string]interface{} `json:"extra_field_set"`
Leaders []map[string]interface{} `json:"leaders"`
JoinDate string `json:"join_date"`
Error string `json:"error"`
RawResponse map[string]interface{} `json:"raw_response"`
}
type StaffIdMappingResult ¶
type StaffSearchResult ¶
type StreamMessageResult ¶
type SysMsgParams ¶
type TodoTaskCreateResult ¶
type TodoTaskInfoResult ¶
type TodoTaskInfoResult struct {
Success bool `json:"success"`
TodotaskID string `json:"todotask_id"`
SourceID string `json:"source_id"`
Title string `json:"title"`
Desc string `json:"desc"`
Status string `json:"status"`
Type int `json:"type"`
Link string `json:"link"`
PcLink string `json:"pc_link"`
SenderID string `json:"sender_id"`
ExecutorIDs []string `json:"executor_ids"`
CreateTime string `json:"create_time"`
AppID string `json:"app_id"`
Error string `json:"error"`
RawResponse map[string]interface{} `json:"raw_response"`
}
type TodoTaskListResult ¶
type TokenManager ¶
type TokenManager struct {
// contains filtered or unexported fields
}
func NewTokenManager ¶
func NewTokenManager(cfg *Config, httpClient *http.Client) *TokenManager
func (*TokenManager) GetToken ¶
func (tm *TokenManager) GetToken(ctx context.Context) (string, error)
func (*TokenManager) Invalidate ¶
func (tm *TokenManager) Invalidate()
type URLOption ¶
func WithGrantType ¶
func WithIDType ¶
func WithIDValue ¶
func WithIntParam ¶
func WithMediaType ¶
func WithMediaTypeString ¶
func WithPageOffset ¶
func WithPageSize ¶
func WithPathVar ¶
func WithQueryParam ¶
func WithRedirectURI ¶
func WithRefreshToken ¶
func WithSecret ¶
func WithStaffID ¶
func WithUserID ¶
func WithUserToken ¶
type UpdateGroupMembersResult ¶
type UpdateGroupMembersResult struct {
Success bool `json:"success"`
TotalMembers int `json:"total_members"`
AddedStaffCount int `json:"added_staff_count"`
DeletedStaffCount int `json:"deleted_staff_count"`
InvalidStaff []string `json:"invalid_staff"`
InvalidDepartment []string `json:"invalid_department"`
Error string `json:"error"`
RawResponse map[string]interface{} `json:"raw_response"`
}
type UpdateGroupResult ¶
type UploadAppMediaResult ¶
type UploadMediaResult ¶
type UserInfoResult ¶
type UserInfoResult struct {
Success bool `json:"success"`
StaffID string `json:"staff_id"`
Name string `json:"name"`
OrgID string `json:"org_id"`
OrgName string `json:"org_name"`
AvatarID string `json:"avatar_id"`
AvatarURL string `json:"avatar_url"`
Email string `json:"email"`
EmployeeNumber string `json:"employee_number"`
LoginName string `json:"login_name"`
ExternalID string `json:"external_id"`
Departments []map[string]interface{} `json:"department"`
Error string `json:"error"`
RawResponse map[string]interface{} `json:"raw_response"`
}
type UserMessageResult ¶
type UserTokenManager ¶
type UserTokenManager struct {
// contains filtered or unexported fields
}
func NewUserTokenManager ¶
func NewUserTokenManager(client *LansengerClient, store *CredentialStore) *UserTokenManager
func (*UserTokenManager) GetToken ¶
func (utm *UserTokenManager) GetToken(ctx context.Context) (string, error)
func (*UserTokenManager) Invalidate ¶
func (utm *UserTokenManager) Invalidate()
func (*UserTokenManager) RefreshToken ¶
func (utm *UserTokenManager) RefreshToken() string
func (*UserTokenManager) RefreshTokenExpiry ¶
func (utm *UserTokenManager) RefreshTokenExpiry() time.Time
func (*UserTokenManager) SetTokens ¶
func (utm *UserTokenManager) SetTokens(userToken, refreshToken string, expiresIn int, staffID string, refreshExpiresIn int)
func (*UserTokenManager) StaffID ¶
func (utm *UserTokenManager) StaffID() string
type UserTokenResult ¶
type UserTokenResult struct {
Success bool `json:"success"`
UserToken string `json:"user_token"`
ExpiresIn int `json:"expires_in"`
RefreshToken string `json:"refresh_token"`
RefreshExpiresIn int `json:"refresh_expires_in"`
StaffID string `json:"staff_id"`
Scope string `json:"scope"`
State string `json:"state"`
Error string `json:"error"`
RawResponse map[string]interface{} `json:"raw_response"`
}
Source Files
¶
- account_messages.go
- auth.go
- bot_commands.go
- bot_messages.go
- calendars.go
- callbacks.go
- chats.go
- client.go
- config.go
- constants.go
- contacts.go
- departments.go
- errors.go
- group_messages.go
- groups.go
- media.go
- messaging.go
- models.go
- oauth.go
- persistence.go
- personal_apps.go
- streaming.go
- todos.go
- url_helpers.go
- user_messages.go
- user_token_manager.go
- users.go
- version.go
Click to show internal directories.
Click to hide internal directories.