doubao_new

package
v4.2.10 Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2026 License: AGPL-3.0 Imports: 34 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	BaseURL         = "https://my.feishu.cn"
	DownloadBaseURL = "https://internal-api-drive-stream.feishu.cn"
	DoubaoURL       = "https://www.doubao.com"
)

Variables

This section is empty.

Functions

func GenerateDPoPKeyPair

func GenerateDPoPKeyPair() (*ecdsa.PrivateKey, error)

func ParseJWTPayload

func ParseJWTPayload(token string, out any) error

Types

type Addition

type Addition struct {
	// Usually one of two
	driver.RootID
	// define other
	Cookie         string `json:"cookie" required:"true" help:"Web Cookie"`
	AppID          string `json:"app_id" required:"true" default:"497858" help:"Doubao App ID"`
	DPoPKeySecret  string `json:"dpop_key_secret" help:"DPoP Key Secret for generating DPoP token"`
	AuthClientID   string `json:"auth_client_id" help:"Doubao Biz Auth Client ID"`
	AuthClientType string `json:"auth_client_type" help:"Doubao Biz Auth Client Type"`
	AuthScope      string `json:"auth_scope" help:"Doubao Biz Auth Scope"`
	AuthSDKSource  string `json:"auth_sdk_source" help:"Doubao Biz Auth SDK Source"`
	AuthSDKVersion string `json:"auth_sdk_version" help:"Doubao Biz Auth SDK Version"`
	ShareLink      bool   `json:"share_link" help:"Whether to use share link for download"`
	IgnoreJWTCheck bool   `json:"ignore_jwt_check" help:"Whether to ignore JWT check to prevent time issue"`
}

type BaseResp

type BaseResp struct {
	Code    int    `json:"code"`
	Msg     string `json:"msg,omitempty"`
	Message string `json:"message,omitempty"`
}

type Clock

type Clock interface {
	Now() (int64, error)
}

type CreateFolderResp

type CreateFolderResp struct {
	BaseResp
	Data struct {
		Entities struct {
			Nodes map[string]Node `json:"nodes"`
		} `json:"entities"`
		NodeList []string `json:"node_list"`
	} `json:"data"`
}

type DPoPTokenInput

type DPoPTokenInput struct {
	KeyPair   *ecdsa.PrivateKey
	ExpiresIn int64 // 默认 15

	JTI   string
	HTM   string
	HTU   string
	IAT   int64
	Nonce string
	Clock Clock
}

type DPoPTokenOutput

type DPoPTokenOutput struct {
	DPoPToken   string `json:"dpopToken"`
	ExpiredTime int64  `json:"expiredTime"`
	ExpiresIn   int64  `json:"expiresIn"`
}

func GenerateDPoPToken

func GenerateDPoPToken(in DPoPTokenInput) (*DPoPTokenOutput, error)

type DoubaoNew

type DoubaoNew struct {
	model.Storage
	Addition
	TtLogid string

	// DPoP access token (Authorization header value, without DPoP prefix)
	Authorization       string
	AuthorizationPublic string
	// DPoP header value
	DPoP       string
	DPoPPublic string
	// DPoP key pair for generating DPoP
	DPoPKeyPairStr string
	DPoPKeyPair    *ecdsa.PrivateKey
	// contains filtered or unexported fields
}

func (*DoubaoNew) Config

func (d *DoubaoNew) Config() driver.Config

func (*DoubaoNew) Copy

func (d *DoubaoNew) Copy(ctx context.Context, srcObj, dstDir model.Obj) (model.Obj, error)

func (*DoubaoNew) Drop

func (d *DoubaoNew) Drop(ctx context.Context) error

func (*DoubaoNew) GetAddition

func (d *DoubaoNew) GetAddition() driver.Additional

func (*DoubaoNew) GetDetails

func (d *DoubaoNew) GetDetails(ctx context.Context) (*model.StorageDetails, error)

func (*DoubaoNew) Init

func (d *DoubaoNew) Init(ctx context.Context) error
func (d *DoubaoNew) Link(ctx context.Context, file model.Obj, args model.LinkArgs) (*model.Link, error)

func (*DoubaoNew) List

func (d *DoubaoNew) List(ctx context.Context, dir model.Obj, args model.ListArgs) ([]model.Obj, error)

func (*DoubaoNew) MakeDir

func (d *DoubaoNew) MakeDir(ctx context.Context, parentDir model.Obj, dirName string) (model.Obj, error)

func (*DoubaoNew) Move

func (d *DoubaoNew) Move(ctx context.Context, srcObj, dstDir model.Obj) (model.Obj, error)

func (*DoubaoNew) Other

func (d *DoubaoNew) Other(ctx context.Context, args model.OtherArgs) (interface{}, error)

func (*DoubaoNew) Put

func (*DoubaoNew) Remove

func (d *DoubaoNew) Remove(ctx context.Context, obj model.Obj) error

func (*DoubaoNew) Rename

func (d *DoubaoNew) Rename(ctx context.Context, srcObj model.Obj, newName string) (model.Obj, error)

type FileInfo

type FileInfo struct {
	Name        string      `json:"name"`
	NumBlocks   int         `json:"num_blocks"`
	Version     string      `json:"version"`
	MimeType    string      `json:"mime_type"`
	MountPoint  string      `json:"mount_point"`
	PreviewMeta PreviewMeta `json:"preview_meta"`
}

type FileInfoResp

type FileInfoResp struct {
	Code    int      `json:"code"`
	Message string   `json:"message"`
	Data    FileInfo `json:"data"`
}

type JWTPayload

type JWTPayload struct {
	Exp   int64  `json:"exp,omitempty"`
	Iat   int64  `json:"iat,omitempty"`
	Nbf   int64  `json:"nbf,omitempty"`
	Jti   string `json:"jti,omitempty"`
	Htm   string `json:"htm,omitempty"`
	Htu   string `json:"htu,omitempty"`
	Nonce string `json:"nonce,omitempty"`
	Sub   string `json:"sub,omitempty"`
}

type ListData

type ListData struct {
	HasMore   bool     `json:"has_more"`
	LastLabel string   `json:"last_label"`
	NodeList  []string `json:"node_list"`
	Entities  struct {
		Nodes map[string]Node `json:"nodes"`
		Users map[string]User `json:"users"`
	} `json:"entities"`
}

type ListResp

type ListResp struct {
	BaseResp
	Data ListData `json:"data"`
}

type Node

type Node struct {
	Token      string `json:"token"`
	NodeToken  string `json:"node_token"`
	ObjToken   string `json:"obj_token"`
	Name       string `json:"name"`
	Type       int    `json:"type"`
	NodeType   int    `json:"node_type"`
	OwnerID    string `json:"owner_id"`
	EditUID    string `json:"edit_uid"`
	CreateTime int64  `json:"create_time"`
	EditTime   int64  `json:"edit_time"`
	URL        string `json:"url"`
	Extra      struct {
		Size string `json:"size"`
	} `json:"extra"`
}

type Object

type Object struct {
	model.Object
	ObjToken string
	NodeType int
	ObjType  int
	URL      string
}

type PreviewImageExtra

type PreviewImageExtra struct {
	ImgExt   string `json:"img_ext"`
	PageNums int    `json:"page_nums"`
}

type PreviewMeta

type PreviewMeta struct {
	Data map[string]PreviewMetaEntry `json:"data"`
}

type PreviewMetaEntry

type PreviewMetaEntry struct {
	Status          int    `json:"status"`
	Extra           string `json:"extra"`
	PreviewFileSize int64  `json:"preview_file_size"`
}

type RemoveResp

type RemoveResp struct {
	BaseResp
	Data struct {
		TaskID string `json:"task_id"`
	} `json:"data"`
}

type SystemClock

type SystemClock struct{}

func (SystemClock) Now

func (SystemClock) Now() (int64, error)

type TaskStatusData

type TaskStatusData struct {
	IsFinish bool `json:"is_finish"`
	IsFail   bool `json:"is_fail"`
}

type TaskStatusResp

type TaskStatusResp struct {
	BaseResp
	Data TaskStatusData `json:"data"`
}

type UploadBlock

type UploadBlock struct {
	Hash       string `json:"hash"`
	Seq        int    `json:"seq"`
	Size       int64  `json:"size"`
	Checksum   string `json:"checksum"`
	IsUploaded bool   `json:"isUploaded"`
}

type UploadBlockNeed

type UploadBlockNeed struct {
	Seq      int    `json:"seq"`
	Size     int64  `json:"size"`
	Checksum string `json:"checksum"`
	Hash     string `json:"hash"`
}

type UploadBlocksData

type UploadBlocksData struct {
	NeededUploadBlocks []UploadBlockNeed `json:"needed_upload_blocks"`
}

type UploadBlocksResp

type UploadBlocksResp struct {
	BaseResp
	Data UploadBlocksData `json:"data"`
}

type UploadFinishData

type UploadFinishData struct {
	Version     string `json:"version"`
	DataVersion string `json:"data_version"`
	Extra       struct {
		NodeToken string `json:"node_token"`
	} `json:"extra"`
	FileToken string `json:"file_token"`
}

type UploadFinishResp

type UploadFinishResp struct {
	BaseResp
	Data UploadFinishData `json:"data"`
}

type UploadMergeData

type UploadMergeData struct {
	SuccessSeqList []int `json:"success_seq_list"`
}

type UploadMergeResp

type UploadMergeResp struct {
	BaseResp
	Data UploadMergeData `json:"data"`
}

type UploadPrepareData

type UploadPrepareData struct {
	BlockSize       int64  `json:"block_size"`
	NumBlocks       int    `json:"num_blocks"`
	OptionBlockSize int64  `json:"option_block_size"`
	DedupeSupport   bool   `json:"dedupe_support"`
	UploadID        string `json:"upload_id"`
}

type UploadPrepareResp

type UploadPrepareResp struct {
	BaseResp
	Data UploadPrepareData `json:"data"`
}

type User

type User struct {
	ID   string `json:"id"`
	Name string `json:"name"`
}

type UserStorageData

type UserStorageData struct {
	ShowSizeLimit       bool  `json:"show_size_limit"`
	TotalSizeLimitBytes int64 `json:"total_size_limit_bytes"`
	UsedSizeBytes       int64 `json:"used_size_bytes"`
}

type UserStorageResp

type UserStorageResp struct {
	BaseResp
	Data UserStorageData `json:"data"`
}

Jump to

Keyboard shortcuts

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