welink

package
v0.0.0-...-e82b790 Latest Latest
Warning

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

Go to latest
Published: Jun 6, 2020 License: MIT Imports: 8 Imported by: 1

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

New ...

func NewAPI

func NewAPI() *API

func (*API) CorpID

func (a *API) CorpID() string

func (*API) GetUser

func (a *API) GetUser(uid, at string) (*User, error)

GetUser get user with uid,mobile,cuid

func (*API) ListDepartment

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

func (*API) ListUser

func (a *API) ListUser(deptID int) (data []User, err error)

ListUser ...

func (*API) StatusDepartment

func (a *API) StatusDepartment(data []DepartmentUp) (res []DeptRespItem, err error)

StatusDepartment ...

func (*API) StatusUser

func (a *API) StatusUser(data []UserUp) (res []UserRespItem, err error)

StatusUser ...

func (*API) SyncDepartment

func (a *API) SyncDepartment(data []DepartmentUp) (res []DeptRespItem, err error)

SyncDepartment ...

func (*API) SyncUser

func (a *API) SyncUser(data []UserUp) (res []UserRespItem, err error)

SyncUser ...

type Department

type Department struct {
	CorpDeptID   int    `json:"corpDeptCode,string,omitempty"`
	CorpParentID int    `json:"corpParentCode,string,omitempty"`
	ID           int    `json:"deptCode,string"`
	ParentID     int    `json:"fatherCode,string"`
	NameCN       string `json:"deptNameCn"`
	NameEN       string `json:"deptNameEn"`
	Level        int    `json:"deptLevel,string"`
	Leader       string `json:"managerId,omitempty"`
	OrderNo      int    `json:"orderNo,string,omitempty"`
	HasChild     int    `json:"hasChildDept,omitempty"`
}

Department 部门 "deptCode": "1", "deptNameCn": "产品销售部", "deptNameEn": "Sales Dept", "fatherCode": "0", "deptLevel": "2", "orderNo": 1

func FilterDepartment

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

FilterDepartment Deprecated with Departments.WithID()

type DepartmentUp

type DepartmentUp struct {
	CorpDeptID   int    `json:"corpDeptCode,string"`
	CorpParentID int    `json:"corpParentCode,string"`
	NameCN       string `json:"deptNameCn"`
	NameEN       string `json:"deptNameEn"`
	Level        int    `json:"deptLevel,string"`
	Leader       string `json:"managerId"`
	OrderNo      int    `json:"orderNo,string"`
	Valid        int    `json:"valid,string"`
}

DepartmentUp 部门更新请求对象 "corpDeptCode": "dddddd", "corpParentCode": "ddfd", "deptNameCn": "生产部门", "deptNameEn": "produce dept", "deptLevel": "1", "managerId": "", "valid": "1", "orderNo": "1000"

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 DeptRespItem

type DeptRespItem struct {
	client.Error

	CorpDeptID int `json:"corpDeptCode,string"`
}

DeptRespItem ...

type Status

type Status uint8

Status 状态

const (
	SNone     Status = 0
	SInactive Status = 1
	SActiving Status = 2
	SActived  Status = 3
	SClosed   Status = 4
)

状态, 1:未开户 2:开户中 3:已开户 4:已销户

func (Status) String

func (s Status) String() string

type User

type User struct {
	CorpUID      string        `json:"corpUserId"`                // required
	CorpDeptID   int           `json:"corpDeptCode,string"`       // required
	UserID       string        `json:"userId"`                    // required
	NameCN       string        `json:"userNameCn"`                // required
	NameEN       string        `json:"userNameEn"`                // required
	DepartmentID int           `json:"deptCode,string,omitempty"` // deptCode at welink
	Mobile       string        `json:"mobileNumber"`              // required
	Phone        string        `json:"phoneNumber,omitempty"`     // required
	Email        string        `json:"userEmail"`                 // required
	Gender       gender.Gender `json:"sex,string,omitempty"`
	Status       Status        `json:"userStatus,omitempty"`
	Remark       string        `json:"remark,emitempty"`
	Address      string        `json:"address,emitempty"`
	Activated    uint8         `json:"isActivated,omitempty"`
	Createds     string        `json:"creationTime,omitempty"`
	Updateds     string        `json:"lastUpdatedTime,omitempty"`

	IsOpenAccount      int `json:"isOpenAccount,string,omitempty"`      // required
	Valid              int `json:"valid,string,string"`                 // required
	IsHideMobileNumber int `json:"isHideMobileNumber,string,omitempty"` // 1 public default, 2 hide
	OrderInDepts       int `json:"orderInDepts,string"`
}

User 用户 "code": "0", "message": "ok", "userStatus": "1", "userId": "zhangshan2@welink", "deptCode": "10001", "mobileNumber": "+86-15811847236", "userNameCn": "张三", "userNameEn": "zhangshan", "sex": "M", "corpUserId": "36188", "userEmail": "zhangshan4@126.com", "secretary": "zhangshan@welink", "phoneNumber": "0755-88888888", "address": "广东省深圳", "remark": "欢迎加入WeLink", "isActivated": 1, "creationTime": "2018-05-03 13:58:02", "lastUpdatedTime": "2018-05-03 13:58:02"

func (User) IsActived

func (u User) IsActived() bool

func (User) IsEnabled

func (u User) IsEnabled() bool

type UserRespItem

type UserRespItem struct {
	client.Error

	CorpUID string `json:"corpUserId"`
}

UserRespItem ...

type UserUp

type UserUp = User

Jump to

Keyboard shortcuts

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