# wxe-api
微信企业号API

## 示例

```js
import WxeApi from 'wxe-api';

const wxeapi = new WxeApi({
  corpId: process.env.WXE_CORPID,
  secret: process.env.WXE_SECRET,
});

const na57 = await wxeapi.getUser('na57');
```

## API

### constructor({ corpId, secret, async getToken, async setToken })
构造函数

- 参数
  - corpId 必须，微信企业号的CorpId；
  - secret 必须，企业号管理组的secret；
  - `async getToken` AccessToken的缓存方法，默认使用内存缓存；
  - `async setToken` 从缓存读取AccessToken的方法，默认由内存缓存中读取；

### getAuthorizeURL(redirectUri, state)

### getToken()

### getUserIdByCode(code)

### getUser(userid)

### getJsApiTicket()

### getJsConfig({ debug, jsApiList, url })

### getGroupConfig(url)

### getContactTicket()

### sendMessage(to, message)

### sendText(to, agentid, content)

### sendNews(to, agentid, articles)

### sendTextCard(to, agentid, textcard)

### async getTagList()
获取标签列表

- 返回值

  ```javascript
  [
    {"tagid":1,"tagname":"a"},
    {"tagid":2,"tagname":"b"}
   ]
  ```

### getTag(tagid)


## CHANGELOG

### 1.0.0
- 加入debug组件，名称：`wxe-api:error`，`wxe-api:info`;
- getTagList 直接返回taglist。(BREAKING CHANGE);
