Documentation
¶
Index ¶
- Constants
- type API
- func (api *API) AddUsersToChat(chatId string, userIds []string) (err error)
- func (api *API) CreateChat(name, userOpenId string) (chatId string, err error)
- func (api *API) DestroyChat(chatId string) (err error)
- func (api *API) GetChatInfo(chatId string) (group Group, err error)
- func (api *API) GetUserInfo(userId string) (userInfo UserInfo, err error)
- func (api *API) ListAllChats() (groups Groups, err error)
- func (api *API) NewRequest(method, path string, reqBody interface{}, respData interface{}) (err error)
- func (api *API) RemoveUsersFromChat(chatId string, userIds []string) (err error)
- func (api *API) SendCard(target string, card Card) (err error)
- func (api *API) SendImageMessage(target, imageKey string) (err error)
- func (api *API) SendMessage(target, content string) (err error)
- func (api *API) SendPost(target string, post Post) (err error)
- func (api *API) UpdateChat(chatId string, update map[string]interface{}) (err error)
- func (api *API) UploadAvatarImage(file io.Reader) (key string, err error)
- func (api *API) UploadMessageImage(file io.Reader) (key string, err error)
- type APIResponse
- type AccessTokenResponse
- type Card
- type CardConfig
- type CardHeader
- type CardHeaderTitle
- type EventResponse
- type Group
- type GroupInfoResponse
- type GroupResponse
- type Groups
- type GroupsResponse
- type MessageResponse
- type Post
- type PostLine
- type PostLines
- type PostOfLocale
- type PostTag
- type Protected
- type UploadResponse
- type UserInfo
- type UserInfoResponse
Examples ¶
Constants ¶
const (
Prefix = "https://open.feishu.cn/open-apis"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type API ¶
type API struct {
AppId string
AppSecret string
Timeout time.Duration
Debugger func(args ...interface{})
// contains filtered or unexported fields
}
func (*API) AddUsersToChat ¶
func (*API) CreateChat ¶
func (*API) DestroyChat ¶
func (*API) ListAllChats ¶
func (*API) NewRequest ¶
func (*API) RemoveUsersFromChat ¶
func (*API) SendImageMessage ¶
func (*API) SendMessage ¶
func (*API) UpdateChat ¶ added in v1.1.1
List of parameters to update:
| Parameter | Type | Required | Description |-----------------------------|--------|----------|--------------------------------------------------- | owner_open_id | string | Optional | Group owner's open_id (When transferring group | | | | ownership, either owner_open_id or owner_user_id | | | | can be filled in) | owner_user_id | string | Optional | Group owner's user_id (When transferring group | | | | ownership, either owner_open_id or owner_user_id | | | | can be filled in) | name | string | Optional | Default display group name | i18n_names | map | Optional | Internationalized group name | description | string | Optional | Group description | only_owner_add | bool | Optional | Whether only the group owner can add people | share_allowed | bool | Optional | Whether group sharing is allowed | add_member_verify | bool | Optional | Whether to enable group join verification | only_owner_at_all | bool | Optional | Whether only the group owner can @all | only_owner_edit | bool | Optional | Whether only the group owner can edit group | | | | information, including avatar, name, description, | | | | and announcement | send_message_permission | string | Optional | Who is allowed to send messages. all: everyone, | | | | owner: only group owner | join_message_visibility | string | Optional | Member join group notification. all: notify | | | | everyone, owner: notify only owner, not_anyone: | | | | notify no one | leave_message_visibility | string | Optional | Member leave group notification. all: notify | | | | everyone, owner: notify only owner, not_anyone: | | | | notify no one | group_email_enabled | bool | Optional | Whether to enable group email | send_group_email_permission | string | Optional | Permission to send group emails. owner: only | | | | group owner, group_member: group members, | | | | tenant_member: team members, all: everyone
func (*API) UploadAvatarImage ¶
type APIResponse ¶
type AccessTokenResponse ¶
type AccessTokenResponse struct {
APIResponse
Expire int `json:"expire"`
Token string `json:"tenant_access_token"`
}
type Card ¶
type Card struct {
Config CardConfig `json:"config"`
Header CardHeader `json:"header"`
Elements []interface{} `json:"elements"`
}
type CardConfig ¶
type CardHeader ¶
type CardHeader struct {
Title CardHeaderTitle `json:"title"`
Template string `json:"template"`
}
https://open.feishu.cn/document/ukTMukTMukTM/ukTNwUjL5UDM14SO1ATN
type CardHeaderTitle ¶
type EventResponse ¶
type EventResponse struct {
Type string `json:"type"`
Token string `json:"token"`
// type == "url_verification"
Challenge string `json:"challenge"`
// type == "event_callback"
Event struct {
ChatId string `json:"open_chat_id"`
Type string `json:"type"`
MsgType string `json:"msg_type"`
Text string `json:"text"`
TextWithoutAtBot string `json:"text_without_at_bot"`
OpenId string `json:"open_id"`
UserOpenId string `json:"user_open_id"`
} `json:"event"`
}
type Group ¶
type Group struct {
Avatar string `json:"avatar"`
ChatId string `json:"chat_id"`
Description string `json:"description"`
Name string `json:"name"`
OwnerOpenId string `json:"owner_open_id"`
OwnerUserId string `json:"owner_user_id"`
Members []struct {
OpenId string `json:"open_id"`
} `json:"members"`
}
type GroupInfoResponse ¶
type GroupInfoResponse struct {
APIResponse
Data Group `json:"data"`
}
type GroupResponse ¶
type GroupResponse struct {
APIResponse
Data struct {
ChatId string `json:"chat_id"`
} `json:"data"`
}
type GroupsResponse ¶
type GroupsResponse struct {
APIResponse
Data struct {
Groups Groups `json:"groups"`
} `json:"data"`
}
type MessageResponse ¶
type MessageResponse struct {
APIResponse
Data struct {
MessageId string `json:"message_id"`
} `json:"data"`
}
type Post ¶
type Post map[string]PostOfLocale
Example ¶
package main
import (
"encoding/json"
"os"
"github.com/caiguanhao/larkslim"
)
func main() {
post := larkslim.Post{
"zh_cn": larkslim.PostOfLocale{
Title: "post",
Content: larkslim.PostLines{
{
{
Tag: "text",
Text: "Name: ",
},
{
Tag: "a",
Text: "Hello",
Href: "https://www.google.com",
},
},
},
},
}
enc := json.NewEncoder(os.Stdout)
enc.SetIndent("", "\t")
enc.Encode(post)
}
Output: { "zh_cn": { "title": "post", "content": [ [ { "tag": "text", "text": "Name: " }, { "tag": "a", "text": "Hello", "href": "https://www.google.com" } ] ] } }
type PostOfLocale ¶
type PostTag ¶
type PostTag struct {
Tag string `json:"tag,omitempty"`
Unescape bool `json:"un_escape,omitempty"`
Text string `json:"text,omitempty"`
Href string `json:"href,omitempty"`
UserId string `json:"user_id,omitempty"`
ImageKey string `json:"image_key,omitempty"`
Width int `json:"width,omitempty"`
Height int `json:"height,omitempty"`
}
type UploadResponse ¶
type UploadResponse struct {
APIResponse
Data struct {
ImageKey string `json:"image_key"`
} `json:"data"`
}
type UserInfoResponse ¶
type UserInfoResponse struct {
APIResponse
Data struct {
UserInfo UserInfo `json:"user"`
} `json:"data"`
}