Documentation
¶
Index ¶
- func IsErrorResponse(err error) bool
- func NewRetryableHTTPClient(opts ...RetryableHTTPClientOption) *http.Client
- func Ptr[T any](v T) *Tdeprecated
- type AccessType
- type Book
- type BookType
- type Client
- type ClientOption
- type CreateDocRequest
- type Doc
- type DocFormat
- type DocTag
- type DocType
- type ErrorResponse
- type GetDocsRequest
- type GetDocsResponse
- type GetGroupStatisticsResponse
- type HelloResponse
- type Meta
- type RawBody
- type RequestOption
- func WithRequestBasicAuth(username, password string) RequestOption
- func WithRequestHeader(name, value string) RequestOption
- func WithRequestHeaderFunc(fn func(http.Header)) RequestOption
- func WithRequestHeaders(headers map[string]string) RequestOption
- func WithRequestUserAgent(userAgent string) RequestOption
- type Response
- type RetryableHTTPClientOption
- func WithRetryableHTTPClientBackoff(backoff retryablehttp.Backoff) RetryableHTTPClientOption
- func WithRetryableHTTPClientCheckRetry(checkRetry retryablehttp.CheckRetry) RetryableHTTPClientOption
- func WithRetryableHTTPClientLogger(logger retryablehttp.Logger) RetryableHTTPClientOption
- func WithRetryableHTTPClientRetryMax(retryMax int) RetryableHTTPClientOption
- func WithRetryableHTTPClientRetryWaitMax(waitMax time.Duration) RetryableHTTPClientOption
- func WithRetryableHTTPClientRetryWaitMin(waitMin time.Duration) RetryableHTTPClientOption
- type TOC
- type TOCType
- type User
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsErrorResponse ¶
func NewRetryableHTTPClient ¶
func NewRetryableHTTPClient(opts ...RetryableHTTPClientOption) *http.Client
Types ¶
type AccessType ¶
type AccessType int
AccessType 文档/知识库公开性:公开性 (0:私密, 1:公开, 2:企业内公开)
const ( AccessTypePrivate AccessType = 0 // 私密 AccessTypePublic AccessType = 1 // 公开 AccessTypeInner AccessType = 2 // 企业内公开 )
type Book ¶
type Book struct {
ID int `json:"id"`
Type BookType `json:"type"`
Slug string `json:"slug"`
Name string `json:"name"`
UserID int `json:"user_id"`
Description string `json:"description"`
TocYML string `json:"toc_yml"`
CreatorID int `json:"creator_id"`
Public AccessType `json:"public"`
ItemsCount int `json:"items_count"`
LikesCount int `json:"likes_count"`
WatchesCount int `json:"watches_count"`
ContentUpdatedAt time.Time `json:"content_updated_at"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
Namespace string `json:"namespace"`
User *User `json:"user"`
}
type Client ¶
type Client struct {
// services used for talking to different parts of the Tapd API.
UserService *userService
DocService *docService
StatisticService *statisticService
// contains filtered or unexported fields
}
type ClientOption ¶
func WithBaseURL ¶
func WithBaseURL(urlStr string) ClientOption
WithBaseURL sets the baseURL for the client
func WithHTTPClient ¶
func WithHTTPClient(httpClient *http.Client) ClientOption
func WithUserAgent ¶
func WithUserAgent(userAgent string) ClientOption
type CreateDocRequest ¶
type CreateDocRequest struct {
Slug *string `json:"slug,omitempty"` // 路径
Title *string `json:"title,omitempty"` // 标题,默认:无标题
Public *AccessType `json:"public,omitempty"` // 公开性 (0:私密, 1:公开, 2:企业内公开) 不填则继承知识库的公开性
Format *DocFormat `json:"format,omitempty"` // 内容格式 (markdown:Markdown 格式, html:HTML 标准格式, lake:语雀 Lake 格式) 不填则默认为 markdown
Body *string `json:"body,omitempty"` // 正文内容
}
type Doc ¶
type Doc struct {
ID int `json:"id,omitempty"`
Type DocType `json:"type,omitempty"`
Slug string `json:"slug,omitempty"`
Title string `json:"title,omitempty"`
Description string `json:"description,omitempty"`
Cover string `json:"cover,omitempty"`
UserID int `json:"user_id,omitempty"`
BookID int `json:"book_id,omitempty"`
LastEditorID int `json:"last_editor_id,omitempty"`
Public AccessType `json:"public,omitempty"`
Status int `json:"status,omitempty"`
LikesCount *int `json:"likes_count,omitempty"`
ReadCount int `json:"read_count,omitempty"`
CommentsCount *int `json:"comments_count,omitempty"`
WordCount int `json:"word_count,omitempty"`
CreatedAt time.Time `json:"created_at,omitzero"`
UpdatedAt time.Time `json:"updated_at,omitzero"`
ContentUpdatedAt time.Time `json:"content_updated_at,omitzero"`
PublishedAt time.Time `json:"published_at,omitzero"`
FirstPublishedAt time.Time `json:"first_published_at,omitzero"`
User *User `json:"user,omitempty"`
LastEditor *User `json:"last_editor,omitempty"`
Hits int `json:"hits,omitempty"`
// 以下字段是创建文档、获取文档详情等时才有的字段
Format *DocFormat `json:"format,omitempty"`
BodyDraft *string `json:"body_draft,omitempty"`
Body *string `json:"body,omitempty"`
BodySheet *string `json:"body_sheet,omitempty"`
BodyTable *string `json:"body_table,omitempty"`
BodyHTML *string `json:"body_html,omitempty"`
BodyLake *string `json:"body_lake,omitempty"`
Book *Book `json:"book,omitempty"`
Creator *User `json:"creator,omitempty"`
Tags []*DocTag `json:"tags,omitempty"`
LatestVersionID int `json:"latest_version_id,omitempty"`
}
type DocFormat ¶
type DocFormat string
DocFormat 内容格式 (markdown:Markdown 格式, html:HTML 标准格式, lake:语雀 Lake 格式,lakesheet:语雀表格)
type DocType ¶
type DocType string
DocType 文档类型 (Doc:普通文档, Sheet:表格, Thread:话题, Board:图集, Table:数据表)
type ErrorResponse ¶
type ErrorResponse struct {
// contains filtered or unexported fields
}
ErrorResponse represents a yuque error response.
func (*ErrorResponse) Error ¶
func (e *ErrorResponse) Error() string
func (*ErrorResponse) Unwrap ¶
func (e *ErrorResponse) Unwrap() error
type GetDocsRequest ¶
type GetDocsRequest struct {
// 偏移量 [分页参数]
Offset *int `url:"offset,omitempty"`
// 每页数量 [分页参数]
Limit *int `url:"limit,omitempty"`
// 获取的额外字段, 多个字段以逗号分隔
//
// 注意: 每页数量超过 100 本字段会失效
//
// 支持的字段有:
//
// hits: 文档阅读数
// tags: 标签
// latest_version_id: 最新已发版本 ID
OptionalProperties *string `url:"optional_properties,omitempty"`
}
type GetDocsResponse ¶
type GetGroupStatisticsResponse ¶ added in v0.2.0
type GetGroupStatisticsResponse struct {
BizDate string `json:"bizdate,omitempty"`
UserID int `json:"user_id,omitempty"`
OrganizationID int `json:"organization_id,omitempty"`
MemberCount int `json:"member_count,omitempty"` // 成员数
CollaboratorCount int `json:"collaborator_count,omitempty"` // 协作者数
DayReadCount int `json:"day_read_count,omitempty"` // 当日阅读量
DayWriteCount int `json:"day_write_count,omitempty"` // 当日编辑次数
WriteCount int `json:"write_count,omitempty"` // 编辑次数
ReadCount int `json:"read_count,omitempty"` // 阅读量
ReadCount30 int `json:"read_count_30,omitempty"` // 阅读量 (30天)
ReadCount365 int `json:"read_count_365,omitempty"` // 阅读量 (一年)
CommentCount int `json:"comment_count,omitempty"` // 评论量
CommentCount30 int `json:"comment_count_30,omitempty"` // 评论量 (30天)
CommentCount365 int `json:"comment_count_365,omitempty"` // 评论量 (一年)
LikeCount int `json:"like_count,omitempty"` // 点赞量
LikeCount30 int `json:"like_count_30,omitempty"` // 点赞量 (30天)
LikeCount365 int `json:"like_count_365,omitempty"` // 点赞量 (一年)
FollowCount int `json:"follow_count,omitempty"` // 关注量
CollectCount int `json:"collect_count,omitempty"` // 收藏量
DocCount int `json:"doc_count,omitempty"` // 文档数量
SheetCount int `json:"sheet_count,omitempty"` // 表格数量
BoardCount int `json:"board_count,omitempty"` // 画板数量
ShowCount int `json:"show_count,omitempty"` // 演示文稿数量
ResourceCount int `json:"resource_count,omitempty"` // 资源数量
ArtBoardCount int `json:"artboard_count,omitempty"` // 图集数量
AttachmentCount int `json:"attachment_count,omitempty"` // 附件数量
BookCount int `json:"book_count,omitempty"` // 知识库总数量
PublicBookCount int `json:"public_book_count,omitempty"` // 公开知识库数量
PrivateBookCount int `json:"private_book_count,omitempty"` // 私密知识库数量
BookBookCount int `json:"book_book_count,omitempty"` // 文档知识库数量
BookResourceCount int `json:"book_resource_count,omitempty"` // 资源知识库数量
BookDesignCount int `json:"book_design_count,omitempty"` // 图片知识库数量
BookThreadCount int `json:"book_thread_count,omitempty"` // 话题知识库数量
DataUsage int `json:"data_usage,omitempty"` // 流量使用量
GrainsCount int `json:"grains_count,omitempty"` // 当前稻谷数
GrainsCountSum int `json:"grains_count_sum,omitempty"` // 累计获得稻谷数
GrainsCountConsume int `json:"grains_count_consume,omitempty"` // 已消耗稻谷数
InteractionPeopleCount int `json:"interaction_people_count,omitempty"` // 知识交流人数
ContentCount int `json:"content_count,omitempty"` // 知识财富数
CollaborationCount int `json:"collaboration_count,omitempty"` // 知识协同次数
WorkingHours int `json:"working_hours,omitempty"` // 协同提效时长 (小时)
Baike float64 `json:"baike,omitempty"` // 百科全书卷数
TableCount int `json:"table_count,omitempty"`
}
type HelloResponse ¶
type HelloResponse struct {
Message string `json:"message,omitempty"`
}
type RawBody ¶
type RawBody struct {
Status int `json:"status,omitempty"`
Meta *Meta `json:"meta,omitempty"`
Data json.RawMessage `json:"data,omitempty"`
Message string `json:"info,omitempty"`
}
RawBody represents a raw body.
type RequestOption ¶
func WithRequestBasicAuth ¶
func WithRequestBasicAuth(username, password string) RequestOption
func WithRequestHeader ¶
func WithRequestHeader(name, value string) RequestOption
func WithRequestHeaderFunc ¶
func WithRequestHeaderFunc(fn func(http.Header)) RequestOption
func WithRequestHeaders ¶
func WithRequestHeaders(headers map[string]string) RequestOption
func WithRequestUserAgent ¶
func WithRequestUserAgent(userAgent string) RequestOption
type RetryableHTTPClientOption ¶
type RetryableHTTPClientOption func(client *retryablehttp.Client)
func WithRetryableHTTPClientBackoff ¶
func WithRetryableHTTPClientBackoff(backoff retryablehttp.Backoff) RetryableHTTPClientOption
func WithRetryableHTTPClientCheckRetry ¶
func WithRetryableHTTPClientCheckRetry(checkRetry retryablehttp.CheckRetry) RetryableHTTPClientOption
func WithRetryableHTTPClientLogger ¶
func WithRetryableHTTPClientLogger(logger retryablehttp.Logger) RetryableHTTPClientOption
func WithRetryableHTTPClientRetryMax ¶
func WithRetryableHTTPClientRetryMax(retryMax int) RetryableHTTPClientOption
func WithRetryableHTTPClientRetryWaitMax ¶
func WithRetryableHTTPClientRetryWaitMax(waitMax time.Duration) RetryableHTTPClientOption
func WithRetryableHTTPClientRetryWaitMin ¶
func WithRetryableHTTPClientRetryWaitMin(waitMin time.Duration) RetryableHTTPClientOption
type TOC ¶ added in v0.2.0
type TOC struct {
UUID string `json:"uuid,omitempty"` // 节点唯一 ID
Type TOCType `json:"type,omitempty"` // Enum: "DOC" "LINK" "TITLE" 节点类型 (DOC:文档, LINK:外链, TITLE:分组)
Title string `json:"title,omitempty"` // 节点名称
URL string `json:"url,omitempty"` // 节点 URL
Slug string `json:"slug,omitempty"` // Deprecated 节点 URL
ID int `json:"id,omitempty"` // Deprecated 文档 ID
DocID int `json:"doc_id,omitempty"` // 文档 ID
Level int `json:"level,omitempty"` // 节点层级
Depth int `json:"depth,omitempty"` // Deprecated 节点层级
OpenWindow int `json:"open_window,omitempty"` // 是否在新窗口打开 (0:当前页打开, 1:新窗口打开)
Visible int `json:"visible,omitempty"` // 是否可见 (0:不可见, 1:可见)
PrevUUID string `json:"prev_uuid,omitempty"` // 同级前一个节点 uuid
SiblingUUID string `json:"sibling_uuid,omitempty"` // 同级后一个节点 uuid
ChildUUID string `json:"child_uuid,omitempty"` // 子级第一个节点 uuid
ParentUUID string `json:"parent_uuid,omitempty"` // 父级节点 uuid
}
type User ¶
type User struct {
ID int `json:"id,omitempty"`
Type string `json:"type,omitempty"`
Login string `json:"login,omitempty"`
Name string `json:"name,omitempty"`
AvatarURL string `json:"avatar_url,omitempty"`
BooksCount int `json:"books_count,omitempty"`
PublicBooksCount int `json:"public_books_count,omitempty"`
FollowersCount int `json:"followers_count,omitempty"`
FollowingCount int `json:"following_count,omitempty"`
Public int `json:"public,omitempty"`
Description string `json:"description,omitempty"`
CreatedAt time.Time `json:"created_at,omitzero"`
UpdatedAt time.Time `json:"updated_at,omitzero"`
WorkID string `json:"work_id,omitempty"`
}
Click to show internal directories.
Click to hide internal directories.