feishu

package
v0.0.0-...-d9a425f Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 3, 2022 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	UserOpenIdApiAddr  = "https://open.feishu.cn/open-apis/contact/v3/users/batch_get_id"
	AccessTokenApiAddr = "https://open.feishu.cn/open-apis/auth/v3/tenant_access_token/internal"
)

Variables

View Source
var (
	CustomUserAgent = "tt-agent"
)

Functions

This section is empty.

Types

type AccessTokenReq

type AccessTokenReq struct {
	AppId     string `json:"app_id"`
	AppSecret string `json:"app_secret"`
}

AccessTokenReq define request body when fetch access token

type AccessTokenRsp

type AccessTokenRsp struct {
	Code              int    `json:"code"`
	Msg               string `json:"msg"`
	TenantAccessToken string `json:"tenant_access_token"`
	Expire            int    `json:"expire"`
}

AccessTokenRsp define response body when fetch access token

type Api

type Api struct {
	// contains filtered or unexported fields
}

func NewApi

func NewApi(config Config) *Api

func (*Api) DumpAccessToken

func (a *Api) DumpAccessToken() string

DumpAccessToken for debug

func (*Api) FetchAccessToken

func (a *Api) FetchAccessToken() error

func (*Api) FetchUserOpenId

func (a *Api) FetchUserOpenId(mobile string) (string, error)

type Config

type Config struct {
	Host      string // feishu api server addr
	AppId     string // app id for fetch user info
	AppSecret string //
}

type User

type User struct {
	UserId string `json:"user_id"`
	Mobile string `json:"mobile"`
	Email  string `json:"email"`
}

type UserData

type UserData struct {
	UserList []User `json:"user_list"`
}

type UserOpenIdReq

type UserOpenIdReq struct {
	Emails  []string `json:"emails"`
	Mobiles []string `json:"mobiles"`
}

UserOpenIdReq define request body when fetch user open id

type UserOpenIdRsp

type UserOpenIdRsp struct {
	Code int      `json:"code"`
	Msg  string   `json:"msg"`
	Data UserData `json:"data"`
}

UserOpenIdRsp define response body when fetch user open id

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL