larkext

package
v1.0.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 23, 2022 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

*

  • 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.

*

  • 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.

*

  • 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.

*

  • 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.

*

  • 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.

*

  • 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.

*

  • 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.

*

  • 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.

*

  • 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.

*

  • 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.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CellRange

func CellRange(sheetID string, x1, y1, x2, y2 int) string

CellRange 将两个坐标 (x1, y1) 和 (x2, y2) 转成 sheet!A1:D5 的形式

https://open.feishu.cn/document/ukTMukTMukTM/uATMzUjLwEzM14CMxMTN/overview https://open.feishu.cn/document/ukTMukTMukTM/uATMzUjLwEzM14CMxMTN/conditionformat/condition-format-guide

a. sheetId :表示整表应用 b. sheetId!1:2 :表示整行应用 c. sheetId!A:B :表示整列应用 d. sheetId!A1:C :省略结束行,会使用表格的最后行作为结束行 e. sheetId!A1:B2 :表示普通的range

func ItoCol

func ItoCol(index int) string

ItoCol int to col index >= 1

Types

type Bitable

type Bitable struct {
	// contains filtered or unexported fields
}

Bitable Bitable client

func NewBitable

func NewBitable(larkClient *lark.Lark, appToken string) *Bitable

NewBitable new Bitable client

func (*Bitable) Meta

Meta get bitable meta

type BitableTable

type BitableTable struct {
	// contains filtered or unexported fields
}

BitableTable is a table that can be used to store bitable data.

func NewBitableTable

func NewBitableTable(larkClient *lark.Lark, appToken string, tableID string) *BitableTable

NewBitableTable new a bitable table.

type Doc

type Doc struct {
	// contains filtered or unexported fields
}

Doc is doc client

func NewDoc

func NewDoc(larkClient *lark.Lark, docToken string) *Doc

NewDoc new doc client

func (*Doc) Content

func (r *Doc) Content(ctx context.Context) (*lark.DocContent, error)

RawContent get doc rich content

func (*Doc) Delete

func (r *Doc) Delete(ctx context.Context) error

Delete delete doc

func (*Doc) DocToken

func (r *Doc) DocToken() string

DocToken get doc Token

func (*Doc) Meta

func (r *Doc) Meta(ctx context.Context) (*lark.GetDriveDocMetaResp, error)

Meta get doc meta

func (*Doc) RawContent

func (r *Doc) RawContent(ctx context.Context) (string, error)

RawContent get doc raw content

type Folder

type Folder struct {
	// contains filtered or unexported fields
}

Folder is folder client

func NewFolder

func NewFolder(larkClient *lark.Lark, folderToken string) *Folder

NewFolder new folder client

func NewRootFolder

func NewRootFolder(ctx context.Context, larkClient *lark.Lark) (*Folder, error)

NewRootFolder new root folder client

func (*Folder) DeleteDoc

func (r *Folder) DeleteDoc(ctx context.Context, docToken string) error

DeleteDoc delete doc in folder

func (*Folder) DeleteSheet

func (r *Folder) DeleteSheet(ctx context.Context, sheetToken string) error

DeleteSheet delete sheet in folder

func (*Folder) ListFiles

ListFiles list files in folder

func (*Folder) Meta

func (r *Folder) Meta(ctx context.Context) (*FolderMeta, error)

Meta get folder meta

func (*Folder) NewDoc

func (r *Folder) NewDoc(ctx context.Context, title string) (*Doc, error)

NewDoc new doc in folder

func (*Folder) NewFolder

func (r *Folder) NewFolder(ctx context.Context, title string) (*Folder, error)

NewFolder create new another folder in folder

func (*Folder) NewSheet

func (r *Folder) NewSheet(ctx context.Context, title string) (*Sheet, error)

NewSheet new sheet in folder

type FolderMeta

type FolderMeta struct {
	ID        string `json:"id,omitempty"`        // 文件夹的 id
	Name      string `json:"name,omitempty"`      // 文件夹的标题
	Token     string `json:"token,omitempty"`     // 文件夹的 token
	CreateUid string `json:"createUid,omitempty"` // 文件夹的创建者 id
	EditUid   string `json:"editUid,omitempty"`   // 文件夹的最后编辑者 id
	ParentID  string `json:"parentId,omitempty"`  // 文件夹的上级目录 id
	OwnUid    string `json:"ownUid,omitempty"`    // 文件夹为个人文件夹时,为文件夹的所有者 id;文件夹为共享文件夹时,为文件夹树id
}

FolderMeta is folder meta

type Sheet

type Sheet struct {
	// contains filtered or unexported fields
}

Sheet is sheet client

func NewSheet

func NewSheet(larkClient *lark.Lark, sheetToken string) *Sheet

NewSheet new sheet client

func (*Sheet) AddCols

func (r *Sheet) AddCols(ctx context.Context, sheetID string, count int64) error

AddCols 增加列

func (*Sheet) AddRows

func (r *Sheet) AddRows(ctx context.Context, sheetID string, count int64) error

AddRows 增加行

func (*Sheet) Append

func (r *Sheet) Append(ctx context.Context, cellRange string, values [][]lark.SheetContent, option *string) error

Append 追加数据

option 是追加数据模式,默认 OVERWRITE,还可以传入 INSERT_ROWS 当 option == OVERWRITE 的时候,sheet 会找到 range 范围内左上角第一个空白的格子,然后将 values 写入该范围,如果除了「左上角第一个空白的格子」外有其他非空格子,这些格子会被覆盖。 当 option == INSERT_ROWS 的时候,sheet 会找到 range 范围内左上角第一个空白的格子,尝试然后将 values 写入该范围,如果除了「左上角第一个空白的格子」外有其他非空格子,会先将这些格子整体下移几格,知道空间够放下 values

func (*Sheet) BatchCleanCellStyle

func (r *Sheet) BatchCleanCellStyle(ctx context.Context, cellRanges []string) error

BatchCleanCellStyle 批量清除单元格样式

func (*Sheet) BatchSetCellStyle

func (r *Sheet) BatchSetCellStyle(ctx context.Context, styles []*lark.BatchSetSheetStyleReqData) error

BatchSetCellStyle 批量设置单元格样式

func (*Sheet) BatchSetSheetValue

func (r *Sheet) BatchSetSheetValue(ctx context.Context, values []*lark.BatchSetSheetValueReqValueRange) error

BatchSetSheetValue 批量将内容写入单元格

func (*Sheet) CleanCellStyle

func (r *Sheet) CleanCellStyle(ctx context.Context, cellRange string) error

CleanCellStyle 清除单元格样式

func (*Sheet) CopySheet

func (r *Sheet) CopySheet(ctx context.Context, fromSheetID string, toTitle *string) (string, error)

CopySheet copy sheet

func (*Sheet) Delete

func (r *Sheet) Delete(ctx context.Context) error

Delete delete sheet

func (*Sheet) DeleteCols

func (r *Sheet) DeleteCols(ctx context.Context, sheetID string, startIndex, count int64) error

DeleteCols 删除列

func (*Sheet) DeleteRows

func (r *Sheet) DeleteRows(ctx context.Context, sheetID string, startIndex, count int64) error

DeleteRows 删除行

func (*Sheet) DeleteSheet

func (r *Sheet) DeleteSheet(ctx context.Context, sheetID string) error

DeleteSheet delete sheet

func (*Sheet) FrozenSheet

func (r *Sheet) FrozenSheet(ctx context.Context, sheetID string, rowCount, colCount int64) error

FrozenSheet freeze worksheet, 0 means unfreeze

func (*Sheet) Get

func (r *Sheet) Get(ctx context.Context, cellRange string, option *lark.GetSheetValueReq) (*lark.GetSheetValueResp, error)

获取单元格内容

func (*Sheet) HideSheet

func (r *Sheet) HideSheet(ctx context.Context, sheetID string, hidden bool) error

SetSheetTitle hide sheet

func (*Sheet) InsertCols

func (r *Sheet) InsertCols(ctx context.Context, sheetID string, startIndex, count int64) error

InsertCols 插入列,表示从 startIndex 开始插入数量为 count 的列

func (*Sheet) InsertRows

func (r *Sheet) InsertRows(ctx context.Context, sheetID string, startIndex, count int64) error

InsertRows 插入行,表示从 startIndex 开始插入数量为 count 的行

func (*Sheet) LockSheet

func (r *Sheet) LockSheet(ctx context.Context, sheetID string, lockInfo string, editableUserIDs []string) error

LockSheet lock worksheet

func (*Sheet) MergeCell

func (r *Sheet) MergeCell(ctx context.Context, cellRange, mergeType string) error

MergeCell 合并单元格

mergeType 支持三种格式 当 mergeType == MERGE_ALL,合并所选区域 当 mergeType == MERGE_ROWS,按行合并 当 mergeType == MERGE_COLUMNS,按列合并

func (*Sheet) Meta

func (r *Sheet) Meta(ctx context.Context) (*lark.GetSheetMetaResp, error)

Meta get sheet meta

func (*Sheet) MoveCols

func (r *Sheet) MoveCols(ctx context.Context, sheetID string, startIndex, count, diff int64) error

MoveCols 移动列,将 sheetID 表中,从 startIndex 列后,数量为 count 的列,移动 diff 列,diff 小于 0 表示左移,diff 大于 0 ,表示右移

func (*Sheet) MoveRows

func (r *Sheet) MoveRows(ctx context.Context, sheetID string, startIndex, count, diff int64) error

MoveRows 移动行,将 sheetID 表中,从 startIndex 行后,数量为 count 的行,移动 diff 行,diff 小于 0 表示上移,diff 大于 0 ,表示下移

func (*Sheet) NewSheet

func (r *Sheet) NewSheet(ctx context.Context, title string) (string, error)

NewSheet create new sheet

func (*Sheet) Replace

func (r *Sheet) Replace(ctx context.Context, sheetID, old, new string, condition *lark.ReplaceSheetReqFindCondition) (*lark.ReplaceSheetRespReplaceResult, error)

Replace 替换

func (*Sheet) Search

func (r *Sheet) Search(ctx context.Context, sheetID, value string, condition *lark.FindSheetReqFindCondition) (*lark.FindSheetRespFindResult, error)

Search 搜索

func (*Sheet) SetCellStyle

func (r *Sheet) SetCellStyle(ctx context.Context, cellRange string, style *lark.SetSheetStyleReqAppendStyleStyle) error

SetCellStyle 设置单元格样式

func (*Sheet) SetColsSize

func (r *Sheet) SetColsSize(ctx context.Context, sheetID string, startIndex, count, size int64) error

SetColsSize 设置列的宽度

func (*Sheet) SetColsVisible

func (r *Sheet) SetColsVisible(ctx context.Context, sheetID string, startIndex, count int64, visible bool) error

SetColsVisible 设置列的可见性

func (*Sheet) SetRowsSize

func (r *Sheet) SetRowsSize(ctx context.Context, sheetID string, startIndex, count, size int64) error

SetRowsSize 设置行的高度

func (*Sheet) SetRowsVisible

func (r *Sheet) SetRowsVisible(ctx context.Context, sheetID string, startIndex, count int64, visible bool) error

SetRowsVisible 设置行的可见性

func (*Sheet) SetSheetIndex

func (r *Sheet) SetSheetIndex(ctx context.Context, sheetID string, index int64) error

SetSheetIndex set sheet index

func (*Sheet) SetSheetTitle

func (r *Sheet) SetSheetTitle(ctx context.Context, sheetID string, title string) error

SetSheetTitle set sheet title

func (*Sheet) SetSheetValue

func (r *Sheet) SetSheetValue(ctx context.Context, cellRange string, contents [][]lark.SheetContent) error

SetSheetValue 将内容写入单元格

func (*Sheet) SetSheetValueImage

func (r *Sheet) SetSheetValueImage(ctx context.Context, cellRange string, image []byte) error

SetSheetValueImage 将图片写入单元格

func (*Sheet) SetTitle

func (r *Sheet) SetTitle(ctx context.Context, title string) error

SetTitle set sheet title

func (*Sheet) SheetToken

func (r *Sheet) SheetToken() string

SheetToken get sheet token

func (*Sheet) UnlockSheet

func (r *Sheet) UnlockSheet(ctx context.Context, sheetID string) error

UnlockSheet unlock worksheet

func (*Sheet) UnmergeCell

func (r *Sheet) UnmergeCell(ctx context.Context, cellRange string) error

UnmergeCell 取消合并单元格

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL