exwechat

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Feb 5, 2020 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrEmptyCorp  = errors.New("empty corpID or corpSecret")
	ErrEmptyArg   = errors.New("empty argument")
	ErrNotFound   = errors.New("not found")
	ErrOutofRange = errors.New("out of range")
)

Functions

This section is empty.

Types

type API

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

func New

func New(corpId, corpSecret string) *API

func NewAPI

func NewAPI() *API

func (*API) AddUser

func (a *API) AddUser(user *User) (err error)

func (*API) CorpID

func (a *API) CorpID() string

func (*API) DeleteUser

func (a *API) DeleteUser(userId string) (err error)

func (*API) GetOAuth2User

func (a *API) GetOAuth2User(agentID int, code string) (ou *OAuth2UserInfo, err error)

func (*API) GetUser

func (a *API) GetUser(userId string) (*User, error)

func (*API) ListDepartment

func (a *API) ListDepartment(id int) (data Departments, err error)

func (*API) ListUser

func (a *API) ListUser(deptId int, incChild bool) (data []User, err error)

type CAPI

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

func NewCAPI

func NewCAPI() *CAPI

func (*CAPI) ListCheckin

func (a *CAPI) ListCheckin(days int, userIDs ...string) (result *CheckInResult, err error)

type CheckInData

type CheckInData struct {
	UserID         string   `json:"userid,omitempty"`
	GroupName      string   `json:"groupname,omitempty"`
	CheckInType    string   `json:"checkin_type,omitempty"`
	ExceptionType  string   `json:"exception_type,omitempty"`
	CheckInTime    int64    `json:"checkin_time,omitempty"`
	LocationTitle  string   `json:"location_title,omitempty"`
	LocationDetail string   `json:"location_detail,omitempty"`
	WifiName       string   `json:"wifiname,omitempty"`
	Notes          string   `json:"notes,omitempty"`
	WifiMac        string   `json:"wifimac,omitempty"`
	Mediaids       []string `json:"mediaids,omitempty"`
}

type CheckInReq

type CheckInReq struct {
	OpenCheckInDataType int      `json:"opencheckindatatype,omitempty"`
	StartTime           int64    `json:"starttime,omitempty"`
	EndTime             int64    `json:"endtime,omitempty"`
	UserIdList          []string `json:"useridlist,omitempty"`
}

type CheckInResult

type CheckInResult struct {
	ErrCode     int           `json:"errcode,omitempty"`
	ErrMsg      string        `json:"errmsg,omitempty"`
	CheckInData []CheckInData `json:"checkindata,omitempty"`
}

type Department

type Department struct {
	Id       int    `json:"id"`       // 部门id,32位整型,指定时必须大于1。若不填该参数,将自动生成id
	Name     string `json:"name"`     // 部门名称。长度限制为1~32个字符
	ParentId int    `json:"parentid"` // 父部门id,32位整型
	Order    int    `json:"order"`    // 在父部门中的次序值。order值大的排序靠前。有效的值范围是[0, 2^32)
}

部门

func FilterDepartment

func FilterDepartment(data []Department, id int) (*Department, error)

FilterDepartment Deprecated with Departments.WithID()

type Departments

type Departments []Department

func (Departments) Len

func (z Departments) Len() int

default sort

func (Departments) Less

func (z Departments) Less(i, j int) bool

func (Departments) Swap

func (z Departments) Swap(i, j int)

func (Departments) WithID

func (z Departments) WithID(id int) *Department

type OAuth2UserInfo

type OAuth2UserInfo struct {
	UserID     string `json:"UserId,omitempty"`
	DeviceID   string `json:"DeviceId,omitempty"`
	UserTicket string `json:"user_ticket,omitempty"`
	OpenId     string `json:"OpenId,omitempty"` // 非企业成员
	client.Error
}

OAuth2UserInfo 为用户 OAuth2 验证登录后的简单信息

type Status

type Status uint8
const (
	SNone     Status = 0
	SActived  Status = 1
	SInactive Status = 2
	SUnlit    Status = 4
)

func (Status) String

func (s Status) String() string

type User

type User struct {
	UID           string         `json:"userid"`
	Name          string         `json:"name,omitempty"`
	Alias         string         `json:"alias,omitempty"`
	EnglishName   string         `json:"english_name,omitempty"`
	DepartmentIds []int          `json:"department,omitempty"`
	Title         string         `json:"position,omitempty"`
	Mobile        string         `json:"mobile,omitempty"`
	Email         string         `json:"email,omitempty"`
	Tel           string         `json:"telephone,omitempty"`
	Gender        gender.Gender  `json:"gender,omitempty"`
	Status        Status         `json:"status,omitempty"`
	Enabled       int8           `json:"enable,emitempty"`
	Avatar        string         `json:"avatar,omitempty"`
	IsLeader      uint8          `json:"isleader,omitempty"`
	LeaderDepts   []int          `json:"is_leader_in_dept,omitempty"`
	ExtAttr       UserAttributes `json:"extattr,omitempty"`

	ExternalPosition string `json:"external_position,omitempty"`

	client.Error
}

User 为企业用户信息

func (User) IsActived

func (u User) IsActived() bool

func (User) IsEnabled

func (u User) IsEnabled() bool

type UserAttribute

type UserAttribute struct {
	Name  string `json:"name"`
	Value string `json:"value"`
}

UserAttribute 为用户扩展信息

type UserAttributes

type UserAttributes struct {
	Attrs []*UserAttribute `json:"attrs,omitempty"`
}

UserAttributes 为用户扩展信息列表

Jump to

Keyboard shortcuts

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