Skip to content

Commit

Permalink
up:更新文件说明
Browse files Browse the repository at this point in the history
  • Loading branch information
zhaoyunxing92 committed Nov 28, 2021
1 parent 891050e commit 08777d6
Showing 1 changed file with 42 additions and 0 deletions.
42 changes: 42 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,48 @@ token, _ := client.GetAccessToken()
fmt.Println(token)
```

## 一个api的诞生过程
> `dingtalk.go`文件里面已经对网络请求封装好了所以写起来会方便很多,下面从简单的 [创建用户](https://developers.dingtalk.com/document/app/user-information-creation) 说起
### 安装工具

#### 格式import的

```shell
go get -u github.com/dubbogo/tools/cmd/imports-formatter@v1.0.7
```
#### 添加license

```shell
go get -u github.com/lsm-dev/license-header-checker/cmd/license-header-checker@v1.2.0
```
### `request`目录下创建一个文件`create_user.go`

### 按照文档写参数,注意如果遇到参数校验可以使用[validate](https://github.com/go-playground/validator) tag标记

### `response`目录里面也创建一个文件`create_user.go`必须包含`Response`结构体

```go
type CreateUser struct {
Response
createUserResponse `json:"result"`
}

type createUserResponse struct {
UserId string `json:"userid"`
}
```
### 文件添加`license`

```shell
license-header-checker -v -a -r -i vendor,license-header-checker,tools ./header/license_header.txt . go
```
### import格式化

```shell
imports-formatter
```

## 参考文档

[dingtalk-callback-Crypto](https://github.com/open-dingtalk/dingtalk-callback-Crypto)
Expand Down

0 comments on commit 08777d6

Please sign in to comment.