-
-
Notifications
You must be signed in to change notification settings - Fork 71
/
Copy pathapi_drive_docx_get.go
105 lines (92 loc) · 5.69 KB
/
api_drive_docx_get.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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
// Code generated by lark_sdk_gen. DO NOT EDIT.
/**
* Copyright 2022 chyroc
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package lark
import (
"context"
)
// GetDocxDocument 获取文档标题和最新版本 ID。
//
// 应用频率限制: 单个应用调用频率上限为每秒 5 次, 超过该频率限制, 接口将返回 HTTP 状态码 400 及错误码 99991400。当请求被限频, 应用需要处理限频状态码, 并使用指数退避算法或其它一些频控策略降低对 API 的调用速率。
//
// doc: https://open.feishu.cn/document/ukTMukTMukTM/uUDN04SN0QjL1QDN/document-docx/docx-v1/document/get
// new doc: https://open.feishu.cn/document/server-docs/docs/docs/docx-v1/document/get
func (r *DriveService) GetDocxDocument(ctx context.Context, request *GetDocxDocumentReq, options ...MethodOptionFunc) (*GetDocxDocumentResp, *Response, error) {
if r.cli.mock.mockDriveGetDocxDocument != nil {
r.cli.Log(ctx, LogLevelDebug, "[lark] Drive#GetDocxDocument mock enable")
return r.cli.mock.mockDriveGetDocxDocument(ctx, request, options...)
}
req := &RawRequestReq{
Scope: "Drive",
API: "GetDocxDocument",
Method: "GET",
URL: r.cli.openBaseURL + "/open-apis/docx/v1/documents/:document_id",
Body: request,
MethodOption: newMethodOption(options),
NeedTenantAccessToken: true,
NeedUserAccessToken: true,
}
resp := new(getDocxDocumentResp)
response, err := r.cli.RawRequest(ctx, req, resp)
return resp.Data, response, err
}
// MockDriveGetDocxDocument mock DriveGetDocxDocument method
func (r *Mock) MockDriveGetDocxDocument(f func(ctx context.Context, request *GetDocxDocumentReq, options ...MethodOptionFunc) (*GetDocxDocumentResp, *Response, error)) {
r.mockDriveGetDocxDocument = f
}
// UnMockDriveGetDocxDocument un-mock DriveGetDocxDocument method
func (r *Mock) UnMockDriveGetDocxDocument() {
r.mockDriveGetDocxDocument = nil
}
// GetDocxDocumentReq ...
type GetDocxDocumentReq struct {
DocumentID string `path:"document_id" json:"-"` // 文档的唯一标识。点击[这里](https://open.feishu.cn/document/ukTMukTMukTM/uUDN04SN0QjL1QDN/document-docx/docx-overview)了解如何获取文档的 `document_id`, 示例值: "doxcnePuYufKa49ISjhD8Iabcef", 长度范围: `27` ~ `27` 字符
}
// GetDocxDocumentResp ...
type GetDocxDocumentResp struct {
Document *GetDocxDocumentRespDocument `json:"document,omitempty"` // 文档信息
}
// GetDocxDocumentRespDocument ...
type GetDocxDocumentRespDocument struct {
DocumentID string `json:"document_id,omitempty"` // 文档的唯一标识。点击[这里](https://open.feishu.cn/document/ukTMukTMukTM/uUDN04SN0QjL1QDN/document-docx/docx-overview)了解如何获取文档的 `document_id`
RevisionID int64 `json:"revision_id,omitempty"` // 文档版本 ID。起始值为 1
Title string `json:"title,omitempty"` // 文档标题
DisplaySetting *GetDocxDocumentRespDocumentDisplaySetting `json:"display_setting,omitempty"` // 文档展示设置
Cover *GetDocxDocumentRespDocumentCover `json:"cover,omitempty"` // 文档封面
}
// GetDocxDocumentRespDocumentCover ...
type GetDocxDocumentRespDocumentCover struct {
Token string `json:"token,omitempty"` // 图片 token
OffsetRatioX float64 `json:"offset_ratio_x,omitempty"` // 视图在水平方向的偏移比例。其值为距离原图中心的水平方向偏移值 px / 原图宽度 px, 视图在原图中心时, 该值为 0;, 视图在原图右部分时, 该值为正数;, 视图在原图左部分时, 该值为负数。
OffsetRatioY float64 `json:"offset_ratio_y,omitempty"` // 视图在垂直方向的偏移比例。其值为距离原图中心的垂直方向偏移值 px / 原图高度 px, 视图在原图中心时, 该值为 0;, 视图在原图上部分时, 该值为正数;, 视图在原图下部分时, 该值为负数。
}
// GetDocxDocumentRespDocumentDisplaySetting ...
type GetDocxDocumentRespDocumentDisplaySetting struct {
ShowAuthors bool `json:"show_authors,omitempty"` // 文档信息中是否展示文档作者
ShowCreateTime bool `json:"show_create_time,omitempty"` // 文档信息中是否展示文档创建时间
ShowPv bool `json:"show_pv,omitempty"` // 文档信息中是否展示文档访问次数
ShowUv bool `json:"show_uv,omitempty"` // 文档信息中是否展示文档访问人数
ShowLikeCount bool `json:"show_like_count,omitempty"` // 文档信息中是否展示点赞总数
ShowCommentCount bool `json:"show_comment_count,omitempty"` // 文档信息中是否展示评论总数
ShowRelatedMatters bool `json:"show_related_matters,omitempty"` // 文档信息中是否展示关联事项。暂未支持
}
// getDocxDocumentResp ...
type getDocxDocumentResp struct {
Code int64 `json:"code,omitempty"` // 错误码, 非 0 表示失败
Msg string `json:"msg,omitempty"` // 错误描述
Data *GetDocxDocumentResp `json:"data,omitempty"`
Error *ErrorDetail `json:"error,omitempty"`
}