Documentation ¶
Overview ¶
docs 库封装了飞书开放平台的接口,提供便捷的飞书云文档操作能力。
Example (CreateSheet) ¶
spreadSheets := NewClient("", "").RootFolder().CreateSpreadSheet("sheet title") spreadSheets.Share(PermEdit, false, NewMemberWithEmail("aa.com")) err := spreadSheets.SheetIndex(1).WriteRows( [][]interface{}{ {"name", "age"}, {"Ace", 10}, {"Bob", 11}, }, ).Err if err != nil { fmt.Println("err: ", err.Error()) }
Output:
Example (NewClient) ¶
client := NewClient("", "") folder := client.RootFolder() fmt.Println("root folder: ", folder.GetToken())
Output:
Index ¶
- func NewCellName(name string) *cellName
- func SetLogLevel(level logrus.Level)
- func SheetCellTypeDocument(docType FileType, docToken string) interface{}
- func SheetCellTypeDropdown(text []interface{}) interface{}
- func SheetCellTypeFormula(text string) interface{}
- func SheetCellTypeLink(title, link string) interface{}
- func SheetCellTypeMentionEmail(email string, notify, grantReadPermission bool) interface{}
- func SheetCellTypeMentionOpenID(openID string, notify, grantReadPermission bool) interface{}
- func SheetCellTypeMentionUnionID(unionID string, notify, grantReadPermission bool) interface{}
- type AddPermissionResp
- type AddPermissionRespFailMembers
- type AddRecordResp
- type Attachment
- type Bitable
- type Children
- type ChildrenInfo
- type Client
- func (c *Client) CommonReq(_req *http.Request, dst interface{}) ([]byte, error)
- func (c *Client) DoRequest(_req *http.Request, dst interface{}) ([]byte, error)
- func (c *Client) GetMeta(token, typ, userIDType string) (*MetaRespMetas, error)
- func (c *Client) OpenBitable(token string) *Bitable
- func (c *Client) OpenDoc(token string) *Doc
- func (c *Client) OpenDocx(token string) *Docx
- func (c *Client) OpenFolder(token string) *Folder
- func (c *Client) OpenSpreadSheets(spreadSheetToken string) *SpreadSheets
- func (c *Client) OpenWiki(token string) *Wiki
- func (c *Client) RootFolder() *Folder
- type ClientOption
- type DimensionRangeDeleteResp
- type DimensionRangePutResp
- type DimensionRangeResp
- type Doc
- func (d *Doc) AddWholeComment(content string) (*RespComment, error)
- func (d *Doc) ChangeOwner(newOwner *Member, removeOldOwner, notify bool) *Doc
- func (d *Doc) GetContent() ([]byte, *DocContent, int, error)
- func (d *Doc) GetMeta() (*DocMeta, error)
- func (t *Doc) GetToken() string
- func (d *Doc) SetAccessPermission(per string) *Doc
- func (d *Doc) Share(perm Perm, notify bool, members ...*Member) *Doc
- func (d *Doc) Statistics() (*FileStatistics, error)
- type DocContent
- type DocDeleteFlag
- type DocMeta
- type Docx
- type Err
- type Field
- type File
- func (f *File) Copy(srcFileToken string, srcFileType FileType, dstFolderToken, dstTitle string, ...) ([]byte, *RespCopyFile, error)
- func (f *File) Create(folderToken, title string, fileType FileType) (*RespCreateFile, error)
- func (f *File) UpdateAll(parentType ParentType, parentNode, filename string, fileData []byte) (string, error)
- func (f *File) UpdateResumed(parentType ParentType, parentNode, filename string, fileSize int64, ...) (string, error)
- type FileStatistics
- type FileType
- type Folder
- func (f *Folder) Children(fileTypes []FileType) (*ChildrenInfo, error)
- func (f *Folder) CreateDoc(title *doctypes.Title, body *doctypes.Body) (doc *Doc)
- func (f *Folder) CreateSpreadSheet(title string) (ss *SpreadSheets)
- func (f *Folder) CreateSubFolder(title string) *Folder
- func (f *Folder) GetMeta() (*FolderMeta, error)
- func (t *Folder) GetToken() string
- func (f *Folder) UpdateFileResumed(filename string, fileSize int64, fileData io.Reader, processChan chan int64) (string, error)
- func (f *Folder) UploadFile(filename string, fileData []byte) (string, error)
- type FolderMeta
- type GetValuesByRangeMultiResp
- type GetValuesByRangeMultiRespValueRanges
- type GetValuesByRangeResp
- type GetValuesByRangeRespValueRange
- type InheritStyleType
- type InseartDataOptionType
- type MajorDimensionType
- type Member
- type Meta
- type MetaInfoResp
- type MetaResp
- type MetaRespFailedList
- type MetaRespMetas
- type ModifyProperties
- type ModifyProtect
- type ModifySheet
- type ModifySheetType
- type ParentType
- type Perm
- type PublicSet
- type Range
- type Record
- type RespComment
- type RespCopyFile
- type RespCreateDoc
- type RespCreateFile
- type RespCreateFoler
- type RootFolderResp
- type Sheet
- func (s *Sheet) FrozenColumn(column int) *Sheet
- func (s *Sheet) FrozenRow(row int) *Sheet
- func (s *Sheet) GetContentByRange(startCellname, endCellname string) (*SheetContent, error)
- func (s *Sheet) GetContentByRangeV2(startCellname, endCellname string, render SheetRenderOption, ...) (*SheetContent, error)
- func (s *Sheet) GetID() string
- func (s *Sheet) Hidden(hidden bool) *Sheet
- func (s *Sheet) MoveColumns(start, end, target int) *Sheet
- func (s *Sheet) MoveRows(start, end, target int) *Sheet
- func (s *Sheet) NewRangeFull(startCellName, endCellName string) *SheetRange
- func (s *Sheet) Protect(info string, userIDs []string) *Sheet
- func (s *Sheet) ReadRows() ([]SheetRow, error)
- func (s *Sheet) TrimBlankTail(rows []SheetRow) []SheetRow
- func (s *Sheet) UpdateIndex(index int) *Sheet
- func (s *Sheet) UpdateTitle(title string) *Sheet
- func (s *Sheet) WriteRows(data [][]interface{}, batchCount ...int) *Sheet
- func (s *Sheet) WriteRowsByStartCell(startCell string, title []string, data [][]interface{}, batchCount ...int) *Sheet
- type SheetBatchUpdateResp
- type SheetBatchUpdateRespAddSheet
- type SheetBatchUpdateRespCopySheet
- type SheetBatchUpdateRespDeleteSheet
- type SheetBatchUpdateRespProperties
- type SheetBatchUpdateRespReplies
- type SheetBatchUpdateRespUpdateSheet
- type SheetBatchUpdateRespUpdateSheetProperties
- type SheetBatchUpdateRespUpdateSheetProtect
- type SheetBatchUpdateRespUpdateSheetUpdateSheet
- type SheetCell
- type SheetCellStyle
- type SheetContent
- type SheetDateTimeRenderOption
- type SheetRange
- type SheetRenderOption
- type SheetRow
- type SheetStyleResp
- type SheetStyleRespUpdate
- type SpreadSheetMeta
- type SpreadSheetOrigin
- func (so *SpreadSheetOrigin) DimensionRangeDelete(sheetID string, majorDimension MajorDimensionType, startIndex, endIndex int) ([]byte, *DimensionRangeDeleteResp, error)
- func (so *SpreadSheetOrigin) DimensionRangePost(sheetID string, majorDimension MajorDimensionType, length int) ([]byte, *DimensionRangeResp, error)
- func (so *SpreadSheetOrigin) DimensionRangePut(sheetID string, majorDimension MajorDimensionType, startIndex, endIndex int, ...) ([]byte, *DimensionRangePutResp, error)
- func (so *SpreadSheetOrigin) Import(filepath string, filename string, folderToken string) ([]byte, string, error)
- func (so *SpreadSheetOrigin) InsertDimensionRange(sheetID string, startIndex, endIndex int, majorDimension MajorDimensionType, ...) error
- func (so *SpreadSheetOrigin) MetaInfo() (b []byte, result *MetaInfoResp, err error)
- func (so *SpreadSheetOrigin) Properties(prop *SpreadSheetProperties) (b []byte, err error)
- func (so *SpreadSheetOrigin) ReadValuesByRange(_range Range, valueRender string, dateTimeRender string) ([]byte, *GetValuesByRangeResp, error)
- func (so *SpreadSheetOrigin) ReadValuesByRangeMulti(ranges []Range, valueRender string, dateTimeRender string) ([]byte, *GetValuesByRangeMultiResp, error)
- func (so *SpreadSheetOrigin) SheetBatchUpdate(args map[ModifySheetType]interface{}) (b []byte, resp *SheetBatchUpdateResp, err error)
- func (so *SpreadSheetOrigin) Style(_range Range, style *SheetCellStyle) (*SheetStyleResp, error)
- func (so *SpreadSheetOrigin) ValuesAppend(_range Range, data [][]interface{}, inseartDataOption InseartDataOptionType) ([]byte, *ValuesPrependResp, error)
- func (so *SpreadSheetOrigin) ValuesPrepend(_range SheetRange, data [][]interface{}) ([]byte, *ValuesPrependResp, error)
- func (so *SpreadSheetOrigin) WriteValuesByRange(_range Range, data [][]interface{}) ([]byte, *WriteValuesByRangeResp, error)
- func (so *SpreadSheetOrigin) WriteValuesByRangeMulti(rangeDatas []*WriteValuesByRangeMultiArgs) ([]byte, *WriteValuesByRangeMultiResp, error)
- type SpreadSheetProperties
- type SpreadSheets
- func (ss *SpreadSheets) AddSheet(title string, index int) *Sheet
- func (ss *SpreadSheets) ChangeOwner(newOwner *Member, removeOldOwner, notify bool) *SpreadSheets
- func (ss *SpreadSheets) CopySheet(sourceSheetID string, title string) (sheet *Sheet)
- func (ss *SpreadSheets) DeleteSheet(sheetID string) *SpreadSheets
- func (ss *SpreadSheets) GetMeta() (res *SpreadSheetMeta, err error)
- func (ss *SpreadSheets) GetOrigin() *SpreadSheetOrigin
- func (t *SpreadSheets) GetToken() string
- func (ss *SpreadSheets) ModifyProperties(args *ModifyProperties) *SpreadSheets
- func (ss *SpreadSheets) SetAccessPermission(per string) *SpreadSheets
- func (ss *SpreadSheets) Share(perm Perm, notify bool, members ...*Member) *SpreadSheets
- func (ss *SpreadSheets) SheetID(sheetID string) *Sheet
- func (ss *SpreadSheets) SheetIndex(index int) *Sheet
- func (ss *SpreadSheets) SheetName(name string) *Sheet
- func (ss *SpreadSheets) Statistics() (*FileStatistics, error)
- func (ss *SpreadSheets) UpdateTitle(title string) *SpreadSheets
- type Stats
- type Table
- type TransferOwnerResp
- type TransferOwnerRespOwner
- type UpdateFileResp
- type ValuesPrependResp
- type ValuesPrependUpdates
- type Wiki
- type WriteValuesByRangeMultiArgs
- type WriteValuesByRangeMultiResp
- type WriteValuesByRangeMultiRespResponses
- type WriteValuesByRangeResp
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewCellName ¶
func NewCellName(name string) *cellName
func SetLogLevel ¶
func SheetCellTypeDocument ¶
func SheetCellTypeDropdown ¶
func SheetCellTypeDropdown(text []interface{}) interface{}
func SheetCellTypeFormula ¶
func SheetCellTypeFormula(text string) interface{}
func SheetCellTypeLink ¶
func SheetCellTypeLink(title, link string) interface{}
SheetCellTypeLink ...
Types ¶
type AddPermissionResp ¶
type AddPermissionResp struct { IsAllSuccess bool `json:"is_all_success"` FailMembers []AddPermissionRespFailMembers `json:"fail_members"` }
type AddRecordResp ¶
type AddRecordResp struct {
Records []Record `json:"records"`
}
type Attachment ¶
type Attachment struct {
// contains filtered or unexported fields
}
func (*Attachment) UpdateAll ¶
func (a *Attachment) UpdateAll(attachmentType doctypes.AttachmentType, token, filename string, fileData []byte) (string, error)
func (*Attachment) UpdateResuming ¶
func (a *Attachment) UpdateResuming(attachmentType doctypes.AttachmentType, token, filename string, fileSize int64, fileData io.Reader, processChan chan int64) (string, error)
type Bitable ¶
type Bitable struct { Err error // contains filtered or unexported fields }
Doc represent a doc file
type ChildrenInfo ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client for docs sdk, support sheet, doc and so on
func NewClient ¶
func NewClient(appID, appSecret string, ops ...ClientOption) *Client
NewClient create a client with app id and app secret.
func (*Client) GetMeta ¶
func (c *Client) GetMeta(token, typ, userIDType string) (*MetaRespMetas, error)
func (*Client) OpenBitable ¶
func (*Client) OpenDoc ¶
Doc for doc operation Note
in a doc url, for example: https://abc.feishu.cn/docs/doccnuqdJJqnJ0LLWOjxoTS2Rld, doccnuqdJJqnJ0LLWOjxoTS2Rld is the token
func (*Client) OpenDocx ¶
Docx for doc operation Note
in a docx url, for example: https://abc.feishu.cn/docs/doccnuqdJJqnJ0LLWOjxoTS2Rld, doccnuqdJJqnJ0LLWOjxoTS2Rld is the token
func (*Client) OpenFolder ¶
Folder for folder operation Note
in a folder url, for example: https://abc.feishu.cn/drive/folder/fldcnNhbqOyI0PVEPCuKa0acocdb, fldcnNhbqOyI0PVEPCuKa0acocdb is the token
func (*Client) OpenSpreadSheets ¶
func (c *Client) OpenSpreadSheets(spreadSheetToken string) *SpreadSheets
SpreadSheets is for Sheets use Parameter
spreadSheetToken: token of a spreadsheets.
Note
in a spreadsheets url, for example: https://abc.feishu.cn/sheets/shtcnjvusYPizPzZ8JqIWyCP7ca, shtcnjvusYPizPzZ8JqIWyCP7ca is the token
func (*Client) RootFolder ¶
RootFolder get root folder of the bot/user
type ClientOption ¶
type ClientOption func(c *Client)
ClientOption Client option parameters
func WithDomain ¶
func WithDomain(domain string) ClientOption
WithDomain set domain for api, default is https://open.feishu.cn
func WithProxy ¶
func WithProxy(proxyURL *url.URL, insecureSkipVerify bool) ClientOption
WithProxy add http proxy
func WithTimeout ¶
func WithTimeout(timeout time.Duration) ClientOption
WithTimeout set http request timeout
func WithTokenGetter ¶
func WithTokenGetter(f func() (token string, expireTime int64, err error)) ClientOption
WithTokenGetter set a function to getting the token.
type DimensionRangeDeleteResp ¶
type DimensionRangeDeleteResp struct { DelCount int `json:"delCount"` MajorDimension MajorDimensionType `json:"majorDimension"` }
type DimensionRangePutResp ¶
type DimensionRangePutResp = interface{} // there is no document, for future use.
type DimensionRangeResp ¶
type Doc ¶
type Doc struct { Err error // contains filtered or unexported fields }
Doc represent a doc file
func (*Doc) AddWholeComment ¶
func (d *Doc) AddWholeComment(content string) (*RespComment, error)
func (*Doc) ChangeOwner ¶
func (*Doc) GetContent ¶
func (d *Doc) GetContent() ([]byte, *DocContent, int, error)
func (*Doc) SetAccessPermission ¶
func (*Doc) Statistics ¶ added in v0.2.8
func (d *Doc) Statistics() (*FileStatistics, error)
type DocContent ¶
type DocDeleteFlag ¶
type DocDeleteFlag int
var ( DocDeleteFlagNormal DocDeleteFlag = 0 DocDeleteFlagTrashed DocDeleteFlag = 1 DocDeleteFlagDeleted DocDeleteFlag = 2 )
func (DocDeleteFlag) MarshalJSON ¶
func (d DocDeleteFlag) MarshalJSON() ([]byte, error)
func (*DocDeleteFlag) UnmarshalJSON ¶
func (d *DocDeleteFlag) UnmarshalJSON(data []byte) error
type DocMeta ¶
type DocMeta struct { CreateDate string `json:"create_date"` CreateTime int `json:"create_time"` CreateUID string `json:"create_uid"` CreateUserName string `json:"create_user_name"` DeleteFlag DocDeleteFlag `json:"delete_flag"` EditTime int64 `json:"edit_time,string"` EditUserName string `json:"edit_user_name"` IsExternal bool `json:"is_external"` IsPined bool `json:"is_pined"` IsStared bool `json:"is_stared"` ObjType string `json:"obj_type"` OwnerID string `json:"owner_id"` OwnerUserName string `json:"owner_user_name"` ServerTime int `json:"server_time"` TenantID string `json:"tenant_id"` Title string `json:"title"` Type int `json:"type"` URL string `json:"url"` }
type Docx ¶
type Docx struct { Err error // contains filtered or unexported fields }
Docx represent a doc file
func (*Docx) GetMeta ¶
func (d *Docx) GetMeta() (*MetaRespMetas, error)
func (*Docx) Statistics ¶ added in v0.2.8
func (d *Docx) Statistics() (*FileStatistics, error)
type File ¶
type File struct {
// contains filtered or unexported fields
}
func (*File) Copy ¶
func (f *File) Copy(srcFileToken string, srcFileType FileType, dstFolderToken, dstTitle string, copyComment bool) ([]byte, *RespCopyFile, error)
Copy a file reference https://open.larksuite.com/document/uMzMyEjLzMjMx4yMzITM/uYTN5UjL2UTO14iN1kTN 复制一个文档 参考 https://open.feishu.cn/document/ukTMukTMukTM/uYTNzUjL2UzM14iN1MTN
func (*File) Create ¶
func (f *File) Create(folderToken, title string, fileType FileType) (*RespCreateFile, error)
Create a doc or sheet reference https://open.larksuite.com/document/uMzMyEjLzMjMx4yMzITM/uUTN5UjL1UTO14SN1kTN 创建一个文件 参考 https://open.feishu.cn/document/ukTMukTMukTM/uQTNzUjL0UzM14CN1MTN
type FileStatistics ¶ added in v0.2.8
type Folder ¶
type Folder struct { Err error // used for save error information // contains filtered or unexported fields }
Folder represent a folder instance
func (*Folder) CreateSpreadSheet ¶
func (f *Folder) CreateSpreadSheet(title string) (ss *SpreadSheets)
CreateSpreadSheet ...
func (*Folder) CreateSubFolder ¶
CreateSubFolder to create a child folder in the current folder Return
1: the child folder instance
func (*Folder) GetMeta ¶
func (f *Folder) GetMeta() (*FolderMeta, error)
GetMeta to get the meta information of folder
type FolderMeta ¶
type GetValuesByRangeMultiResp ¶
type GetValuesByRangeMultiResp struct { Revision int `json:"revision"` SpreadsheetToken string `json:"spreadsheetToken"` TotalCells int `json:"totalCells"` ValueRanges []GetValuesByRangeMultiRespValueRanges `json:"valueRanges"` }
type GetValuesByRangeResp ¶
type GetValuesByRangeResp struct { Revision int `json:"revision"` SpreadsheetToken string `json:"spreadsheetToken"` ValueRange GetValuesByRangeRespValueRange `json:"valueRange"` }
type InheritStyleType ¶
type InheritStyleType = string
var ( InheritStyleBefore InheritStyleType = "BEFORE" InheritStyleAfter InheritStyleType = "AFTER" )
type InseartDataOptionType ¶
type InseartDataOptionType = string
var ( InseartDataOptionOverwrite InseartDataOptionType = "OVERWRITE" InseartDataOptionInsertRows InseartDataOptionType = "INSERT_ROWS" )
type MajorDimensionType ¶
type MajorDimensionType = string
var ( MajorDimensionRows MajorDimensionType = "ROWS" MajorDimensionColumns MajorDimensionType = "COLUMNS" )
type Member ¶
func NewMemberWithEmail ¶
func NewMemberWithOpenChatID ¶
func NewMemberWithOpenID ¶
NewMemberWithOpenID Parameter
openID: is open user id. you can get it here(https://open.feishu.cn/document/home/user-identity-introduction/how-to-get)
func NewMemberWithUserID ¶
func Newopendepartmentid ¶
type MetaInfoResp ¶
type MetaInfoResp struct { Properties metaProp `json:"properties"` Sheets []sheetMeta `json:"sheets"` SpreadsheetToken string `json:"spreadsheetToken"` }
type MetaResp ¶
type MetaResp struct { Metas []*MetaRespMetas `json:"metas"` FailedList []*MetaRespFailedList `json:"failed_list"` }
type MetaRespFailedList ¶
type MetaRespMetas ¶
type MetaRespMetas struct { DocToken string `json:"doc_token"` DocType string `json:"doc_type"` Title string `json:"title"` OwnerID string `json:"owner_id"` CreateTime int64 `json:"create_time,string"` LatestModifyUser string `json:"latest_modify_user"` LatestModifyTime int64 `json:"latest_modify_time,string"` URL string `json:"url"` SecLabelName string `json:"sec_label_name"` }
type ModifyProperties ¶
type ModifyProperties struct { SheetID *string `json:"sheetId,omitempty"` Title *string `json:"title,omitempty"` Index *int `json:"index,omitempty"` Hidden *bool `json:"hidden,omitempty"` Protect *ModifyProtect `json:"protect,omitempty"` }
type ModifyProtect ¶
type ModifySheet ¶
type ModifySheet struct {
Properties *ModifyProperties `json:"properties,omitempty"`
}
type ModifySheetType ¶
type ModifySheetType = string
var ( ModifySheetAdd ModifySheetType = "addSheet" ModifySheetCopy ModifySheetType = "copySheet" ModifySheetDelete ModifySheetType = "deleteSheet" ModifySheetUpdate ModifySheetType = "updateSheet" )
type PublicSet ¶
type PublicSet struct { Token string `json:"token"` Type string `json:"type"` SecurityEntity *string `json:"security_entity,omitempty"` CommentEntity *string `json:"comment_entity,omitempty"` ExternalAccess *bool `json:"external_access,omitempty"` InviteExternal *bool `json:"invite_external,omitempty"` }
type Range ¶
type Range = string
Range reference https://open.feishu.cn/document/ukTMukTMukTM/uczNzUjL3czM14yN3MTN#bae19f77
type RespComment ¶
type RespCopyFile ¶
type RespCreateDoc ¶
type RespCreateFile ¶
type RespCreateFile = RespCreateFoler
type RespCreateFoler ¶
type RootFolderResp ¶
type Sheet ¶
type Sheet struct { Err error // contains filtered or unexported fields }
Sheet represent a sheet tab in spread sheets(SpreadSheets)
func (*Sheet) FrozenColumn ¶
FrozenColumn Parameter
column: number of column that want to frezen. 0 represent unfrozen
func (*Sheet) FrozenRow ¶
FrozenRow Parameter
row: number of row that want to frezen. 0 represent unfrozen
func (*Sheet) GetContentByRange ¶
func (s *Sheet) GetContentByRange(startCellname, endCellname string) (*SheetContent, error)
func (*Sheet) GetContentByRangeV2 ¶
func (s *Sheet) GetContentByRangeV2(startCellname, endCellname string, render SheetRenderOption, dateTime SheetDateTimeRenderOption) (*SheetContent, error)
GetContentByRangeV2 Reference https://open.feishu.cn/document/ukTMukTMukTM/ugTMzUjL4EzM14COxMTN
func (*Sheet) MoveColumns ¶
MoveColumns start with 1
func (*Sheet) NewRangeFull ¶
func (s *Sheet) NewRangeFull(startCellName, endCellName string) *SheetRange
!A1:D5
func (*Sheet) TrimBlankTail ¶
func (*Sheet) WriteRowsByStartCell ¶
func (s *Sheet) WriteRowsByStartCell(startCell string, title []string, data [][]interface{}, batchCount ...int) *Sheet
WriteRowsByStartCell Parameter
title: title of every columns. batchCount: max insert line coune once.
Example
s.WriteRowsByStartCell("A1",[]string{"name", "age"}, [][]interface{}{ {"Ace",15}, {"Bob",16}, },10)
type SheetBatchUpdateResp ¶
type SheetBatchUpdateResp struct {
Replies []SheetBatchUpdateRespReplies `json:"replies"`
}
type SheetBatchUpdateRespAddSheet ¶
type SheetBatchUpdateRespAddSheet struct {
Properties SheetBatchUpdateRespProperties `json:"properties"`
}
type SheetBatchUpdateRespCopySheet ¶
type SheetBatchUpdateRespCopySheet struct {
Properties SheetBatchUpdateRespProperties `json:"properties"`
}
type SheetBatchUpdateRespReplies ¶
type SheetBatchUpdateRespReplies struct { AddSheet SheetBatchUpdateRespAddSheet `json:"addSheet"` CopySheet SheetBatchUpdateRespCopySheet `json:"copySheet"` UpdateSheet SheetBatchUpdateRespUpdateSheet `json:"updateSheet"` DeleteSheet SheetBatchUpdateRespDeleteSheet `json:"deleteSheet"` }
type SheetBatchUpdateRespUpdateSheet ¶
type SheetBatchUpdateRespUpdateSheet struct {
UpdateSheet SheetBatchUpdateRespUpdateSheetUpdateSheet `json:"updateSheet"`
}
type SheetBatchUpdateRespUpdateSheetProperties ¶
type SheetBatchUpdateRespUpdateSheetProperties struct { SheetID string `json:"sheetId"` Title string `json:"title"` Index int `json:"index"` Hidden bool `json:"hidden"` FrozenColCount int `json:"frozenColCount"` FrozenRowCount int `json:"frozenRowCount"` Protect SheetBatchUpdateRespUpdateSheetProtect `json:"protect"` }
type SheetBatchUpdateRespUpdateSheetUpdateSheet ¶
type SheetBatchUpdateRespUpdateSheetUpdateSheet struct {
Properties SheetBatchUpdateRespUpdateSheetProperties `json:"properties"`
}
type SheetCell ¶
type SheetCell struct {
// contains filtered or unexported fields
}
SheetCell represent for a cell of sheet
func NewSheetCell ¶
func NewSheetCell(i interface{}) *SheetCell
func (SheetCell) MarshalJSON ¶
type SheetCellStyle ¶
type SheetCellStyle struct { Font struct { Bold bool `json:"bold,omitempty"` Italic bool `json:"italic,omitempty"` FontSize string `json:"fontSize,omitempty"` Clean bool `json:"clean,omitempty"` } `json:"font,omitempty"` TextDecoration int `json:"textDecoration,omitempty"` Formatter string `json:"formatter,omitempty"` HAlign int `json:"hAlign,omitempty"` VAlign int `json:"vAlign,omitempty"` ForeColor string `json:"foreColor,omitempty"` BackColor string `json:"backColor,omitempty"` BorderType string `json:"borderType,omitempty"` BorderColor string `json:"borderColor,omitempty"` Clean bool `json:"clean,omitempty"` }
type SheetContent ¶
type SheetContent struct {
ValueRange struct {
Values [][]interface{} `json:"values"`
} `json:"valueRange"`
}
func (*SheetContent) ToRows ¶
func (sc *SheetContent) ToRows() []SheetRow
type SheetDateTimeRenderOption ¶
type SheetDateTimeRenderOption string
var (
SheetDateTimeRenderFormattedString SheetDateTimeRenderOption = "FormattedString"
)
type SheetRange ¶
type SheetRange struct { Err error // contains filtered or unexported fields }
Range reference https://open.feishu.cn/document/ukTMukTMukTM/uczNzUjL3czM14yN3MTN#bae19f77
func (*SheetRange) RowsParseMerge ¶
func (s *SheetRange) RowsParseMerge() ([]SheetRow, error)
RowsParseMerge parse cell from merged cell. if a cell is merged, like below, we only get value at the first cell, others are nil. so we should fill a to every cell of the merged cell. | a | | | | | | | | | | |
func (*SheetRange) Scan ¶
func (s *SheetRange) Scan(ptr interface{}) error
func (*SheetRange) SetDropdown ¶
func (s *SheetRange) SetDropdown(values []string, multiple bool, colors []string) error
SetDropdown Parameter:
colors: set highlight color of values, could be nil. values like #1FB6C1
Reference:
https://open.feishu.cn/document/ukTMukTMukTM/uATMzUjLwEzM14CMxMTN/datavalidation/set-dropdown
type SheetRenderOption ¶
type SheetRenderOption string
var ( SheetRenderToString SheetRenderOption = "ToString" SheetRenderFormattedValue SheetRenderOption = "FormattedValue" SheetRenderFormula SheetRenderOption = "Formula" SheetRenderUnformattedValue SheetRenderOption = "UnformattedValue" )
type SheetStyleResp ¶
type SheetStyleResp struct {
Updates SheetStyleRespUpdate `json:"updates"`
}
type SheetStyleRespUpdate ¶
type SpreadSheetOrigin ¶
type SpreadSheetOrigin struct {
// contains filtered or unexported fields
}
SpreadSheetOrigin represent for origin open API. 这个客户端的方法使用了原始的开放平台 API,没有做任何封装。
func (*SpreadSheetOrigin) DimensionRangeDelete ¶
func (so *SpreadSheetOrigin) DimensionRangeDelete(sheetID string, majorDimension MajorDimensionType, startIndex, endIndex int) ([]byte, *DimensionRangeDeleteResp, error)
DimensionRangeDelete for delete rows or columns reference https://open.larksuite.com/document/uMzMyEjLzMjMx4yMzITM/uATO2UjLwkjN14CM5YTN 删除行列 参考 https://open.feishu.cn/document/ukTMukTMukTM/ucjMzUjL3IzM14yNyMTN
func (*SpreadSheetOrigin) DimensionRangePost ¶
func (so *SpreadSheetOrigin) DimensionRangePost(sheetID string, majorDimension MajorDimensionType, length int) ([]byte, *DimensionRangeResp, error)
func (*SpreadSheetOrigin) DimensionRangePut ¶
func (so *SpreadSheetOrigin) DimensionRangePut(sheetID string, majorDimension MajorDimensionType, startIndex, endIndex int, visible bool, fixedSize int) ([]byte, *DimensionRangePutResp, error)
DimensionRangePut for update rows or columns reference https://open.larksuite.com/document/uMzMyEjLzMjMx4yMzITM/uETO2UjLxkjN14SM5YTN 更新行列 参考 https://open.feishu.cn/document/ukTMukTMukTM/uYjMzUjL2IzM14iNyMTN
func (*SpreadSheetOrigin) Import ¶
func (so *SpreadSheetOrigin) Import(filepath string, filename string, folderToken string) ([]byte, string, error)
Import represent import excel from local reference https://open.larksuite.com/document/ukTMukTMukTM/uATO2YjLwkjN24CM5YjN
func (*SpreadSheetOrigin) InsertDimensionRange ¶
func (so *SpreadSheetOrigin) InsertDimensionRange(sheetID string, startIndex, endIndex int, majorDimension MajorDimensionType, inheritStyle InheritStyleType) error
func (*SpreadSheetOrigin) MetaInfo ¶
func (so *SpreadSheetOrigin) MetaInfo() (b []byte, result *MetaInfoResp, err error)
MetaInfo api: /open-apis/sheet/v2/spreadsheets/:spreadsheetToken/metainfo reference: https://open.feishu.cn/document/ukTMukTMukTM/uETMzUjLxEzM14SMxMTN
func (*SpreadSheetOrigin) Properties ¶
func (so *SpreadSheetOrigin) Properties(prop *SpreadSheetProperties) (b []byte, err error)
Properties reference: https://open.feishu.cn/document/ukTMukTMukTM/ucTMzUjL3EzM14yNxMTN
func (*SpreadSheetOrigin) ReadValuesByRange ¶
func (so *SpreadSheetOrigin) ReadValuesByRange(_range Range, valueRender string, dateTimeRender string) ([]byte, *GetValuesByRangeResp, error)
ReadValuesByRange read data by range reference https://open.larksuite.com/document/uMzMyEjLzMjMx4yMzITM/ukzN2UjL5cjN14SO3YTN 读取单个范围的数据 参考 https://open.feishu.cn/document/ukTMukTMukTM/ugTMzUjL4EzM14COxMTN
func (*SpreadSheetOrigin) ReadValuesByRangeMulti ¶
func (so *SpreadSheetOrigin) ReadValuesByRangeMulti(ranges []Range, valueRender string, dateTimeRender string) ([]byte, *GetValuesByRangeMultiResp, error)
ReadValuesByRangeMulti for reading multiple ranges reference https://open.larksuite.com/document/uMzMyEjLzMjMx4yMzITM/uADO2UjLwgjN14CM4YTN 读取多个范围的数据 参考 https://open.feishu.cn/document/ukTMukTMukTM/ukTMzUjL5EzM14SOxMTN
func (*SpreadSheetOrigin) SheetBatchUpdate ¶
func (so *SpreadSheetOrigin) SheetBatchUpdate(args map[ModifySheetType]interface{}) (b []byte, resp *SheetBatchUpdateResp, err error)
SheetBatchUpdate for update properties of a sheet reference https://open.larksuite.com/document/uMzMyEjLzMjMx4yMzITM/uQDO2UjL0gjN14CN4YTN 更新 sheet 的属性 参考 https://open.feishu.cn/document/ukTMukTMukTM/ugjMzUjL4IzM14COyMTN
func (*SpreadSheetOrigin) Style ¶
func (so *SpreadSheetOrigin) Style(_range Range, style *SheetCellStyle) (*SheetStyleResp, error)
Style ...
func (*SpreadSheetOrigin) ValuesAppend ¶
func (so *SpreadSheetOrigin) ValuesAppend(_range Range, data [][]interface{}, inseartDataOption InseartDataOptionType) ([]byte, *ValuesPrependResp, error)
ValuesAppend reference https://open.feishu.cn/document/ukTMukTMukTM/uMjMzUjLzIzM14yMyMTN
func (*SpreadSheetOrigin) ValuesPrepend ¶
func (so *SpreadSheetOrigin) ValuesPrepend(_range SheetRange, data [][]interface{}) ([]byte, *ValuesPrependResp, error)
ValuesPrepend reference https://open.feishu.cn/document/ukTMukTMukTM/uIjMzUjLyIzM14iMyMTN
func (*SpreadSheetOrigin) WriteValuesByRange ¶
func (so *SpreadSheetOrigin) WriteValuesByRange(_range Range, data [][]interface{}) ([]byte, *WriteValuesByRangeResp, error)
WriteValuesByRange for writing data to a single range reference https://open.larksuite.com/document/uMzMyEjLzMjMx4yMzITM/uMDO2UjLzgjN14yM4YTN 向单个范围写入数据 参考 https://open.feishu.cn/document/ukTMukTMukTM/uAjMzUjLwIzM14CMyMTN
func (*SpreadSheetOrigin) WriteValuesByRangeMulti ¶
func (so *SpreadSheetOrigin) WriteValuesByRangeMulti(rangeDatas []*WriteValuesByRangeMultiArgs) ([]byte, *WriteValuesByRangeMultiResp, error)
WriteValuesByRangeMulti for writing data to multiple ranges reference https://open.larksuite.com/document/uMzMyEjLzMjMx4yMzITM/uIDO2UjLygjN14iM4YTN 向多个范围写入数据 参考 https://open.feishu.cn/document/ukTMukTMukTM/uEjMzUjLxIzM14SMyMTN
type SpreadSheetProperties ¶
type SpreadSheetProperties struct {
Title *string `json:"title,omitempty"`
}
type SpreadSheets ¶
type SpreadSheets struct { Err error // contains filtered or unexported fields }
SpreadSheets represent a group of sheet
func (*SpreadSheets) AddSheet ¶
func (ss *SpreadSheets) AddSheet(title string, index int) *Sheet
AddSheet Parameter
index: first position is 0
func (*SpreadSheets) ChangeOwner ¶
func (ss *SpreadSheets) ChangeOwner(newOwner *Member, removeOldOwner, notify bool) *SpreadSheets
func (*SpreadSheets) CopySheet ¶
func (ss *SpreadSheets) CopySheet(sourceSheetID string, title string) (sheet *Sheet)
func (*SpreadSheets) DeleteSheet ¶
func (ss *SpreadSheets) DeleteSheet(sheetID string) *SpreadSheets
DeleteSheet Note:
Sheet id can be found in url, for example in the url https://laily.feishu.cn/sheets/shtcnLML6348M7ujOaYd1EsUe9f?sheet=5d8cef
sheet id is 5d8cef
func (*SpreadSheets) GetMeta ¶
func (ss *SpreadSheets) GetMeta() (res *SpreadSheetMeta, err error)
GetMeta get spread sheet meta information. 获取这个表格的元信息。
func (*SpreadSheets) GetOrigin ¶
func (ss *SpreadSheets) GetOrigin() *SpreadSheetOrigin
GetOrigin get origin client, with is use origin open API. 获取原始客户端,这个客户端直接使用开放平台文档上的 API,没有做任何封装
func (*SpreadSheets) ModifyProperties ¶
func (ss *SpreadSheets) ModifyProperties(args *ModifyProperties) *SpreadSheets
func (*SpreadSheets) SetAccessPermission ¶
func (ss *SpreadSheets) SetAccessPermission(per string) *SpreadSheets
func (*SpreadSheets) Share ¶
func (ss *SpreadSheets) Share(perm Perm, notify bool, members ...*Member) *SpreadSheets
Share to other user or group.
func (*SpreadSheets) SheetID ¶
func (ss *SpreadSheets) SheetID(sheetID string) *Sheet
SheetID get sheet by sheet id 根据 sheet id 获取 sheet 实例。
func (*SpreadSheets) SheetIndex ¶
func (ss *SpreadSheets) SheetIndex(index int) *Sheet
SheetIndex get a sheet instance by index. Index start from 1
func (*SpreadSheets) SheetName ¶
func (ss *SpreadSheets) SheetName(name string) *Sheet
SheetName get sheet by sheet name
func (*SpreadSheets) Statistics ¶ added in v0.2.8
func (ss *SpreadSheets) Statistics() (*FileStatistics, error)
func (*SpreadSheets) UpdateTitle ¶
func (ss *SpreadSheets) UpdateTitle(title string) *SpreadSheets
UpdateTitle Parameter
title: tile of spreadsheet
type TransferOwnerResp ¶
type TransferOwnerResp struct { IsSuccess bool `json:"is_success"` Token string `json:"token"` Type string `json:"type"` Owner TransferOwnerRespOwner `json:"owner"` }
type TransferOwnerRespOwner ¶
type UpdateFileResp ¶
type UpdateFileResp struct {
FileToken string `json:"file_token"`
}
type ValuesPrependResp ¶
type ValuesPrependResp struct { Revision int `json:"revision"` SpreadsheetToken string `json:"spreadsheetToken"` TableRange string `json:"tableRange"` Updates ValuesPrependUpdates `json:"updates"` }
type ValuesPrependUpdates ¶
type Wiki ¶ added in v0.2.8
type Wiki struct { Err error // contains filtered or unexported fields }
Docx represent a doc file
func (*Wiki) GetMeta ¶ added in v0.2.8
func (w *Wiki) GetMeta() (*MetaRespMetas, error)
func (*Wiki) Statistics ¶ added in v0.2.8
func (w *Wiki) Statistics() (*FileStatistics, error)
type WriteValuesByRangeMultiArgs ¶
type WriteValuesByRangeMultiArgs struct { Range Range `json:"range"` Values [][]interface{} `json:"values"` }
type WriteValuesByRangeMultiResp ¶
type WriteValuesByRangeMultiResp struct { Responses []WriteValuesByRangeMultiRespResponses `json:"responses"` Revision int `json:"revision"` SpreadsheetToken string `json:"spreadsheetToken"` }