Skip to content

Commit

Permalink
refactor: youdu 2.x (#6)
Browse files Browse the repository at this point in the history
  • Loading branch information
flc1125 committed Aug 3, 2023
1 parent 8b6db8b commit 5936096
Show file tree
Hide file tree
Showing 27 changed files with 746 additions and 2,017 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,5 @@
vendor/
.idea
youdu_test.go
client_test.go
_example
45 changes: 23 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<p>Youdu Go SDK</p>
<p>
<a target="_blank" href="https://github.com/addcnos/youdu/actions/workflows/lint.yml"><img src="https://github.com/addcnos/youdu/actions/workflows/lint.yml/badge.svg" alt="Lint"></a>
<a target="_blank" href="https://pkg.go.dev/github.com/addcnos/youdu"><img src="https://pkg.go.dev/badge/github.com/addcnos/youdu" alt="GoDoc"></a>
<a target="_blank" href="https://pkg.go.dev/github.com/addcnos/youdu/v2"><img src="https://pkg.go.dev/badge/github.com/addcnos/youdu/v2" alt="GoDoc"></a>
<a target="_blank" href="https://goreportcard.com/report/github.com/addcnos/youdu"><img src="https://goreportcard.com/badge/github.com/addcnos/youdu" alt="Go Report Card"></a>
<img src="https://img.shields.io/badge/Language-Golang-blue.svg" alt="Language">
<a target="_blank" href="https://opensource.org/licenses/MIT"><img src="https://img.shields.io/badge/license-MIT-brightgreen.svg" alt="MIT license"></a>
Expand All @@ -16,14 +16,10 @@

[Features](./feature.md)

### Prerequisites

- Golang Version >= 1.16

### Installation

```bash
go get github.com/addcnos/youdu
go get github.com/addcnos/youdu/v2
```

### Usage
Expand All @@ -34,27 +30,32 @@ Please refer to the [Documentation](./docs)
package main

import (
"github.com/addcnos/youdu"
"github.com/addcnos/youdu/message"
)
"context"
"fmt"

func main() {
"github.com/addcnos/youdu/v2"
)

yd := youdu.New(&youdu.Config{
Api: "http://domain.com/api", // youdu api host
Buin: 1111111, // 企业 buin 码
AppId: "22222222222222", // 应用 appId
AesKey: "3444444444444444444444444444444444", // 应用 AesKey
func main() {
client := youdu.NewClient(&youdu.Config{
Addr: "http://examaple",
Buin: 111222333,
AppId: "111222333",
AesKey: "111333445",
})

yd.Message().Send(&message.TextMessage{
ToUser: "user1|user2", // 指定用户
ToDept: "dep1|dep2", // 指定部门
MsgType: message.MsgTypeText,
Text: &message.TextItem{
Content: "content",
resp, err := client.SendTextMessage(context.Background(), youdu.TextMessageRequest{
ToUser: "11111",
MsgType: youdu.MsgTypeText,
Text: youdu.MessageText{
Content: "hello",
},
})
if err != nil {
panic(err)
}

fmt.Println(resp)
}
```

Expand All @@ -66,4 +67,4 @@ Very welcome to join us! Raise an [Issue](https://github.com/addcnos/youdu/issue

## License

[MIT License](LICENSE) © 2022 addcnos
[MIT License](LICENSE) © 2022-2023 addcnos
90 changes: 0 additions & 90 deletions access_token.go

This file was deleted.

121 changes: 0 additions & 121 deletions auth.go

This file was deleted.

Loading

0 comments on commit 5936096

Please sign in to comment.