Skip to content

Commit 61e276b

Browse files
committed
fix
1 parent 469f628 commit 61e276b

File tree

6 files changed

+75
-3
lines changed

6 files changed

+75
-3
lines changed

README.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ https://godoc.org/github.com/chyroc/lark
3838

3939
## Support APIs
4040

41-
API Count: 1016, Event Count: 148
41+
API Count: 1017, Event Count: 148
4242

4343
<details>
4444
<summary>
@@ -496,6 +496,7 @@ API Count: 1016, Event Count: 148
496496
- DeleteCoreHRDepartment
497497
- UpdateCoreHRDepartment
498498
- GetCoreHRDepartment
499+
- BatchGetCoreHRDepartment
499500
- GetCoreHRDepartmentList
500501
- BatchGetCoreHRLocation
501502
- CreateCoreHRLocation

README_CN.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ https://godoc.org/github.com/chyroc/lark
3838

3939
## 支持的接口
4040

41-
API 总数: 1016, 事件总数: 148
41+
API 总数: 1017, 事件总数: 148
4242

4343
<details>
4444
<summary>
@@ -496,6 +496,7 @@ API 总数: 1016, 事件总数: 148
496496
- DeleteCoreHRDepartment
497497
- UpdateCoreHRDepartment
498498
- GetCoreHRDepartment
499+
- BatchGetCoreHRDepartment
499500
- GetCoreHRDepartmentList
500501
- BatchGetCoreHRLocation
501502
- CreateCoreHRLocation

larkext/docx.go

+9-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ type Docx struct {
2929
typ string
3030
}
3131

32-
// NewDoc new Docx client
32+
// NewDocx new Docx client
3333
func NewDocx(larkClient *lark.Lark, token string) *Docx {
3434
return newDocx(larkClient, token, "")
3535
}
@@ -54,3 +54,11 @@ func (r *Docx) Move(ctx context.Context, folderToken string) (*Task, error) {
5454
func (r *Docx) Delete(ctx context.Context) (*Task, error) {
5555
return deleteFile(ctx, r.larkClient, r.token, r.typ)
5656
}
57+
58+
func (r *Docx) RawContent(ctx context.Context) (string, error) {
59+
return r.rawContent(ctx)
60+
}
61+
62+
func (r *Docx) Blocks(ctx context.Context) ([]*lark.DocxBlock, error) {
63+
return r.blocks(ctx)
64+
}

larkext/docx_impl.go

+35
Original file line numberDiff line numberDiff line change
@@ -37,3 +37,38 @@ func (r *Docx) copy(ctx context.Context, folderToken, name string) (*Docx, error
3737
}
3838
return newDocx(r.larkClient, res.Token, res.URL), nil
3939
}
40+
41+
func (r *Docx) rawContent(ctx context.Context) (string, error) {
42+
resp, _, err := r.larkClient.Drive.GetDocxDocumentRawContent(ctx, &lark.GetDocxDocumentRawContentReq{
43+
DocumentID: r.token,
44+
Lang: nil,
45+
})
46+
if err != nil {
47+
return "", err
48+
}
49+
return resp.Content, nil
50+
}
51+
52+
func (r *Docx) blocks(ctx context.Context) ([]*lark.DocxBlock, error) {
53+
token := ""
54+
size := int64(200)
55+
blocks := []*lark.DocxBlock{}
56+
for {
57+
resp, _, err := r.larkClient.Drive.GetDocxBlockListOfDocument(ctx, &lark.GetDocxBlockListOfDocumentReq{
58+
DocumentID: r.token,
59+
PageSize: &size,
60+
PageToken: &token,
61+
DocumentRevisionID: nil,
62+
UserIDType: nil,
63+
})
64+
if err != nil {
65+
return nil, err
66+
}
67+
blocks = append(blocks, resp.Items...)
68+
if !resp.HasMore {
69+
break
70+
}
71+
token = resp.PageToken
72+
}
73+
return blocks, nil
74+
}

mock.go

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

test/CoreHR_sample_test.go

+26
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)