-
Notifications
You must be signed in to change notification settings - Fork 0
/
service.go
51 lines (44 loc) · 1.24 KB
/
service.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
package lark
import (
"time"
lark_core "github.com/zzzzer91/lark-go/core"
lark_docx "github.com/zzzzer91/lark-go/service/docx/v1"
lark_driver "github.com/zzzzer91/lark-go/service/driver/v1"
lark_im "github.com/zzzzer91/lark-go/service/im/v1"
lark_wiki "github.com/zzzzer91/lark-go/service/wiki/v2"
)
type LarkService interface {
lark_im.ImService
lark_docx.DocxService
lark_wiki.WikiService
lark_driver.DriverService
}
type larkServiceImpl struct {
lark_im.ImService
lark_docx.DocxService
lark_wiki.WikiService
lark_driver.DriverService
}
func NewService(appID, appSecret string, timeout time.Duration) LarkService {
cli := lark_core.NewClient(appID, appSecret, timeout)
return &larkServiceImpl{
ImService: lark_im.NewService(cli),
DocxService: lark_docx.NewService(cli),
WikiService: lark_wiki.NewService(cli),
DriverService: lark_driver.NewService(cli),
}
}
type larkServiceMock struct {
lark_im.ImService
lark_docx.DocxService
lark_wiki.WikiService
lark_driver.DriverService
}
func NewServiceMock() LarkService {
return &larkServiceMock{
ImService: lark_im.NewServiceMock(),
DocxService: lark_docx.NewServiceMock(),
WikiService: lark_wiki.NewServiceMock(),
DriverService: lark_driver.NewServiceMock(),
}
}