### Agent.QrcodeStart Source: https://pkg.go.dev/github.com/deadblue/elevengo Starts a QR code sign-in session for authentication. ```APIDOC ## func (*Agent) QrcodeStart ### Description Starts a QRcode sign-in session. The session is for web by default, but can be configured via options. ### Signature `func (a *Agent) QrcodeStart(session *QrcodeSession, options ...*option.QrcodeOptions) (err error)` ``` -------------------------------- ### QR Code Authentication Source: https://pkg.go.dev/github.com/deadblue/elevengo Starts and polls a QR code sign-in session. ```go func (a *Agent) QrcodePoll(session *QrcodeSession) (done bool, err error) func (a *Agent) QrcodeStart(session *QrcodeSession, options ...*option.QrcodeOptions) (err error) ``` ```go agent := elevengo.Default() session := elevengo.QrcodeSession() agent.QrcodeStart(session, option.Qrcode().LoginTv()) ``` -------------------------------- ### Perform GET Request Source: https://pkg.go.dev/github.com/deadblue/elevengo/internal/impl Executes an HTTP GET request with custom headers and context. ```go func (c *ClientImpl) Get( url string, headers map[string]string, context context.Context, ) (body client.Body, err error) ``` -------------------------------- ### Get User Agent Source: https://pkg.go.dev/github.com/deadblue/elevengo/internal/impl Retrieves the current User-Agent string used by the client. ```go func (c *ClientImpl) GetUserAgent() string ``` -------------------------------- ### ClientImpl.Get Source: https://pkg.go.dev/github.com/deadblue/elevengo/internal/impl Performs an HTTP GET request. ```APIDOC ## func (c *ClientImpl) Get(url string, headers map[string]string, context context.Context) (body client.Body, err error) ### Description Executes a GET request to the specified URL with provided headers and context. ### Parameters - **url** (string) - Required - The target URL. - **headers** (map[string]string) - Required - HTTP headers to include. - **context** (context.Context) - Required - Request context for cancellation and timeouts. ``` -------------------------------- ### Client.Get Source: https://pkg.go.dev/github.com/deadblue/elevengo/lowlevel/client Performs an HTTP GET request. ```APIDOC ## Get(url string, headers map[string]string, context context.Context) (Body, error) ### Description Performs an HTTP GET request to the specified URL with provided headers. ### Parameters - **url** (string) - Required - The target URL. - **headers** (map[string]string) - Required - HTTP headers to include. - **context** (context.Context) - Required - The context for the request. ``` -------------------------------- ### func Get(code int, message string) error Source: https://pkg.go.dev/github.com/deadblue/elevengo/lowlevel/errors Creates a new error instance with the specified error code and message. ```APIDOC ## func Get(code int, message string) error ### Description Creates and returns an error object containing the provided error code and message. ### Parameters - **code** (int) - The error code associated with the API response. - **message** (string) - The descriptive error message. ### Returns - **error** - An error interface implementation. ``` -------------------------------- ### High-level API usage Source: https://pkg.go.dev/github.com/deadblue/elevengo Demonstrates initializing the agent, importing credentials, and iterating through files in a directory. ```go package main import ( "github.com/deadblue/elevengo" "log" ) func main() { // Initialize agent agent := elevengo.Default() // Import credential credential := &elevengo.Credential{ UID: "", CID: "", KID: "", SEID: "", } if err := agent.CredentialImport(credential); err != nil { log.Fatalf("Import credentail error: %s", err) } // Iterate files under specific directory if it, err := agent.FileIterate("dirId"); err != nil { log.Fatalf("Iterate files error: %s", err) } else { log.Printf("Total files: %d", it.Count()) for index, file := range it.Items() { log.Printf("%d => %#v", index, file) } } } ``` -------------------------------- ### Initialize Agent Source: https://pkg.go.dev/github.com/deadblue/elevengo Methods to instantiate an Agent with either default or custom configuration options. ```go func Default() *Agent ``` ```go func New(options ...*option.AgentOptions) *Agent ``` -------------------------------- ### Initialize New Client Source: https://pkg.go.dev/github.com/deadblue/elevengo/internal/impl Creates a new instance of ClientImpl with the provided HTTP client and cooldown parameters. ```go func NewClient(hc plugin.HttpClient, cdMin uint, cdMax uint) *ClientImpl ``` -------------------------------- ### Upload a file using OSS Source: https://pkg.go.dev/github.com/deadblue/elevengo Demonstrates the full flow of uploading a file to 115 cloud storage using the OSS (Object Storage Service) integration. ```go func main() { filePath := "/file/to/upload" var err error file, err := os.Open(filePath) if err != nil { log.Fatalf("Open file failed: %s", err) } defer file.Close() // Create 115 agent agent := elevengo.Default() if err = agent.CredentialImport(&elevengo.Credential{ UID: "", CID: "", SEID: "", }); err != nil { log.Fatalf("Login failed: %s", err) } // Prepare OSS upload ticket ticket := &UploadOssTicket{} if err = agent.UploadCreateOssTicket( "dirId", filepath.Base(file.Name()), file, ticket, ); err != nil { log.Fatalf("Create OSS ticket failed: %s", err) } if ticket.Exist { log.Printf("File has been fast-uploaded!") return } // Create OSS client oc, err := oss.New( ticket.Client.Endpoint, ticket.Client.AccessKeyId, ticket.Client.AccessKeySecret, oss.SecurityToken(ticket.Client.SecurityToken) ) if err != nil { log.Fatalf("Create OSS client failed: %s", err) } bucket, err := oc.Bucket(ticket.Bucket) if err != nil { log.Fatalf("Get OSS bucket failed: %s", err) } // Upload file in multipart. err = bucket.UploadFile( ticket.Object, filePath, 100 * 1024 * 1024, // 100 Megabytes per part oss.Callback(ticket.Callback), oss.CallbackVar(ticket.CallbackVar), ) // Until now (2023-01-29), there is a bug in aliyun-oss-go-sdk: // When set Callback option, the response from CompleteMultipartUpload API // is returned by callback host, which is not the standard XML. But SDK // always tries to parse it as CompleteMultipartUploadResult, and returns // `io.EOF` error, just ignore it! if err != nil && err != io.EOF { log.Fatalf("Upload file failed: %s", err) } else { log.Print("Upload done!") } } ``` -------------------------------- ### Get Error Function Source: https://pkg.go.dev/github.com/deadblue/elevengo/lowlevel/errors Creates an error from a numeric code and a message. ```go func Get(code int, message string) error ``` -------------------------------- ### UploadSampleInitSpec Operations Source: https://pkg.go.dev/github.com/deadblue/elevengo/lowlevel/api Handles initialization for sample file uploads. ```go type UploadSampleInitSpec struct { // contains filtered or unexported fields } ``` ```go func (s *UploadSampleInitSpec) Init( dirId string, fileName string, fileSize int64, common *types.CommonParams, ) *UploadSampleInitSpec ``` ```go func (s *UploadSampleInitSpec) Parse(r io.Reader) (err error) ``` ```go func (s *UploadSampleInitSpec) Payload() client.Payload ``` -------------------------------- ### Low-level API usage Source: https://pkg.go.dev/github.com/deadblue/elevengo Demonstrates using the low-level client to call specific API specs directly. ```go package main import ( "context" "log" "github.com/deadblue/elevengo" "github.com/deadblue/elevengo/lowlevel/api" ) func main() { // Initialize agent agent := elevengo.Default() // Import credential credential := &elevengo.Credential{ UID: "", CID: "", KID: "", SEID: "", } if err := agent.CredentialImport(credential); err != nil { log.Fatalf("Import credentail error: %s", err) } // Get low-level API client llc := agent.LowlevelClient() // Init FileList API spec spec := (&api.FiieListSpec{}).Init("dirId", 0, 32) // Call API if err = llc.CallApi(spec, context.Background()); err != nil { log.Fatalf("Call API error: %s", err) } // Parse API result for index, file := range spec.Result.Files { log.Printf("File: %d => %v", index, file) } } ``` -------------------------------- ### ImageGetSpec Initialization Source: https://pkg.go.dev/github.com/deadblue/elevengo/lowlevel/api Initializes a specification to retrieve image details by pickcode. ```go type ImageGetSpec struct { // contains filtered or unexported fields } ``` ```go func (s *ImageGetSpec) Init(pickcode string) *ImageGetSpec ``` -------------------------------- ### UploadSampleInitResult struct Source: https://pkg.go.dev/github.com/deadblue/elevengo/lowlevel/types Contains configuration for sample uploads. ```go type UploadSampleInitResult struct { Host string Object string Callback string AccessKeyId string Policy string Signature string } ``` -------------------------------- ### New Source: https://pkg.go.dev/github.com/deadblue/elevengo Creates a new Agent instance with customized options. ```APIDOC ## func New(options ...*option.AgentOptions) *Agent ### Description Creates a new Agent instance with customized options. ### Parameters - **options** (...*option.AgentOptions) - Optional - A variadic list of agent configuration options. ``` -------------------------------- ### Define QrcodeSession and methods Source: https://pkg.go.dev/github.com/deadblue/elevengo Handles QRCode login session data and serialization. ```go type QrcodeSession struct { // QRCode image content. Image []byte // contains filtered or unexported fields } ``` ```go func (s *QrcodeSession) Marshal() string ``` ```go func (s *QrcodeSession) Unmarshal(text string) (err error) ``` -------------------------------- ### Set User Agent Source: https://pkg.go.dev/github.com/deadblue/elevengo/internal/impl Configures the User-Agent string for the client. ```go func (c *ClientImpl) SetUserAgent(name string) ``` -------------------------------- ### Agent Initialization Source: https://pkg.go.dev/github.com/deadblue/elevengo Methods to initialize the 115 Cloud Storage API client. ```APIDOC ## func Default() *Agent ### Description Returns a default instance of the Agent. ## func New(options ...*option.AgentOptions) *Agent ### Description Creates a new Agent instance with optional configuration. ``` -------------------------------- ### FileStarSpec Initialization Source: https://pkg.go.dev/github.com/deadblue/elevengo/lowlevel/api Initializes a specification to toggle the star status of a file. ```go type FileStarSpec struct { // contains filtered or unexported fields } ``` ```go func (s *FileStarSpec) Init(fileId string, star bool) *FileStarSpec ``` -------------------------------- ### Shortcut Types Source: https://pkg.go.dev/github.com/deadblue/elevengo/lowlevel/types Structures for shortcut information and lists. ```go type ShortcutInfo struct { FileId string `json:"file_id"` FileName string `json:"file_name"` Sort string `json:"sort"` } ``` ```go type ShortcutListResult struct { List []*ShortcutInfo `json:"list"` } ``` -------------------------------- ### FileSetDescSpec Initialization Source: https://pkg.go.dev/github.com/deadblue/elevengo/lowlevel/api Initializes a specification to update a file description. ```go type FileSetDescSpec struct { // contains filtered or unexported fields } ``` ```go func (s *FileSetDescSpec) Init(fileId string, desc string) *FileSetDescSpec ``` -------------------------------- ### NewClient Source: https://pkg.go.dev/github.com/deadblue/elevengo/internal/impl Initializes a new ClientImpl instance with a provided HTTP client and rate limiting parameters. ```APIDOC ## func NewClient(hc plugin.HttpClient, cdMin uint, cdMax uint) *ClientImpl ### Description Creates a new client instance using the specified HTTP client and cooldown parameters. ### Parameters - **hc** (plugin.HttpClient) - Required - The HTTP client implementation. - **cdMin** (uint) - Required - Minimum cooldown duration. - **cdMax** (uint) - Required - Maximum cooldown duration. ``` -------------------------------- ### Shortcut Management Specifications Source: https://pkg.go.dev/github.com/deadblue/elevengo/lowlevel/api Specifications for adding, deleting, and listing file shortcuts. ```go type ShortcutAddSpec struct { // contains filtered or unexported fields } ``` ```go func (s *ShortcutAddSpec) Init(fileId string) *ShortcutAddSpec ``` ```go type ShortcutDeleteSpec struct { // contains filtered or unexported fields } ``` ```go func (s *ShortcutDeleteSpec) Init(fileId string) *ShortcutDeleteSpec ``` ```go type ShortcutListSpec struct { // contains filtered or unexported fields } ``` ```go func (s *ShortcutListSpec) Init() *ShortcutListSpec ``` -------------------------------- ### Define AppVersionInfo struct Source: https://pkg.go.dev/github.com/deadblue/elevengo/lowlevel/types Structure containing application version details. ```go type AppVersionInfo struct { AppOs int `json:"app_os"` CreatedTime int64 `json:"created_time"` VersionCode string `json:"version_code"` VersionUrl string `json:"version_url"` } ``` -------------------------------- ### File Iteration and Search Source: https://pkg.go.dev/github.com/deadblue/elevengo Methods to list files in directories, search by keyword, or filter by labels and star status. ```go func (a *Agent) FileIterate(dirId string) (it Iterator[File], err error) ``` ```go func (a *Agent) FileSearch( dirId, keyword string, options ...*option.FileListOptions, ) (it Iterator[File], err error) ``` ```go func (a *Agent) FileWithLabel( labelId string, options ...*option.FileListOptions, ) (it Iterator[File], err error) ``` ```go func (a *Agent) FileWithStar(options ...*option.FileListOptions) (it Iterator[File], err error) ``` -------------------------------- ### Initialize Cipher Source: https://pkg.go.dev/github.com/deadblue/elevengo/internal/crypto/ec115 Creates a new instance of the Cipher struct. ```go func New() *Cipher ``` -------------------------------- ### IndexInfoSpec Initialization Source: https://pkg.go.dev/github.com/deadblue/elevengo/lowlevel/api Initializes a specification to retrieve index information. ```go type IndexInfoSpec struct { // contains filtered or unexported fields } ``` ```go func (s *IndexInfoSpec) Init() *IndexInfoSpec ``` -------------------------------- ### Buffer navigation and reading methods Source: https://pkg.go.dev/github.com/deadblue/elevengo/internal/crypto/lz4 Methods for checking buffer status, reading bytes, and parsing LZ4 tokens. ```go func (b *Buffer) AtTheEnd() bool ``` ```go func (b *Buffer) Next(n int) (p []byte, err error) ``` ```go func (b *Buffer) ReadByte() (v byte, err error) ``` ```go func (b *Buffer) ReadExtraLength() (l int, err error) ``` ```go func (b *Buffer) ReadOffset() (offset int, err error) ``` ```go func (b *Buffer) ReadToken() (literalLen, matchLen int, err error) ``` ```go func (b *Buffer) WriteMatchedLiteral(offset, length int) (err error) ``` -------------------------------- ### QrcodeOptions Configuration Source: https://pkg.go.dev/github.com/deadblue/elevengo/option Defines options for QR code login methods. ```go type QrcodeOptions struct { // App Type to login App string } ``` ```go func Qrcode() *QrcodeOptions ``` ```go func (o *QrcodeOptions) LoginAlipayMiniApp() *QrcodeOptions ``` ```go func (o *QrcodeOptions) LoginAndroid() *QrcodeOptions ``` ```go func (o *QrcodeOptions) LoginIos() *QrcodeOptions ``` ```go func (o *QrcodeOptions) LoginQandroid() *QrcodeOptions ``` ```go func (o *QrcodeOptions) LoginTv() *QrcodeOptions ``` ```go func (o *QrcodeOptions) LoginWeb() *QrcodeOptions ``` ```go func (o *QrcodeOptions) LoginWechatMiniApp() *QrcodeOptions ``` -------------------------------- ### FileMoveSpec Initialization Source: https://pkg.go.dev/github.com/deadblue/elevengo/lowlevel/api Initializes a specification for moving files to a target directory. ```go type FileMoveSpec struct { // contains filtered or unexported fields } ``` ```go func (s *FileMoveSpec) Init(dirId string, fileIds []string) *FileMoveSpec ``` -------------------------------- ### Define VideoTicket struct Source: https://pkg.go.dev/github.com/deadblue/elevengo Contains arguments required for playing cloud-hosted videos. ```go type VideoTicket struct { // Play URL, it is normally a m3u8 URL. Url string // Request headers which SHOULD be sent with play URL. Headers map[string]string // File name. FileName string // File size. FileSize int64 // Video duration in seconds. Duration float64 // Video width. Width int // Video height. Height int } ``` -------------------------------- ### Manage Labels Source: https://pkg.go.dev/github.com/deadblue/elevengo Methods for creating, deleting, finding, iterating, ordering, and updating file labels. ```go func (a *Agent) LabelCreate(name string, color LabelColor) (labelId string, err error) func (a *Agent) LabelDelete(labelId string) (err error) func (a *Agent) LabelFind(name string, label *Label) (err error) func (a *Agent) LabelIterate() (it Iterator[Label], err error) func (a *Agent) LabelSetOrder(labelId string, order FileOrder, asc bool) (err error) func (a *Agent) LabelUpdate(label *Label) (err error) ``` -------------------------------- ### LoginInfo Struct Source: https://pkg.go.dev/github.com/deadblue/elevengo/lowlevel/types Contains details about a specific login session. ```go type LoginInfo struct { IsCurrent int `json:"is_current"` LoginTime int64 `json:"utime"` AppFlag string `json:"ssoent"` AppName string `json:"name"` Ip string `json:"ip"` City string `json:"city"` } ``` -------------------------------- ### Directory Creation Response Source: https://pkg.go.dev/github.com/deadblue/elevengo/internal/protocol Structure for directory creation API responses. ```go type DirCreateResp struct { BasicResp FileId string `json:"file_id"` FileName string `json:"file_name"` } ``` -------------------------------- ### Import File via Agent Source: https://pkg.go.dev/github.com/deadblue/elevengo Imports a file to 115 cloud storage using an ImportTicket. ```go func (a *Agent) Import(dirId string, ticket *ImportTicket) (err error) ``` -------------------------------- ### Define Range and helper functions Source: https://pkg.go.dev/github.com/deadblue/elevengo Utilities for creating byte range requests. ```go type Range struct { // contains filtered or unexported fields } ``` ```go func RangeFirst(length int64) Range ``` ```go func RangeLast(length int64) Range ``` ```go func RangeMiddle(offset, length int64) Range ``` -------------------------------- ### AppVersionSpec Type Source: https://pkg.go.dev/github.com/deadblue/elevengo/lowlevel/api Specification for application version handling. ```go type AppVersionSpec struct { // contains filtered or unexported fields } ``` ```go func (s *AppVersionSpec) Init() *AppVersionSpec ``` ```go func (s *AppVersionSpec) Parse(r io.Reader) (err error) ``` ```go func (s *AppVersionSpec) Payload() client.Payload ``` -------------------------------- ### Define UserInfo struct Source: https://pkg.go.dev/github.com/deadblue/elevengo Represents basic information for a signed-in user. ```go type UserInfo struct { // User ID Id int // User name Name string // Is user VIP IsVip bool } ``` -------------------------------- ### SizeInfo Struct Source: https://pkg.go.dev/github.com/deadblue/elevengo/lowlevel/types Represents file or storage size information with formatting. ```go type SizeInfo struct { Size float64 `json:"size"` SizeFormat string `json:"size_format"` } ``` -------------------------------- ### UploadInitResult struct Source: https://pkg.go.dev/github.com/deadblue/elevengo/lowlevel/types Contains parameters for initializing an upload, including OSS configuration and rapid-upload pick codes. ```go type UploadInitResult struct { Exists bool // Upload parameters Oss struct { Bucket string Object string Callback string CallbackVar string } // Check parameters SignKey string SignCheck string // Pickcode is available when rapid-uploaded PickCode string } ``` -------------------------------- ### OSS Utility Functions Source: https://pkg.go.dev/github.com/deadblue/elevengo/internal/oss Functions for calculating request authorization, generating URLs, and manipulating callback strings. ```go func CalculateAuthorization(metadata *RequestMetadata, keyId string, keySecret string) string ``` ```go func Date() string ``` ```go func GetEndpointUrl() string ``` ```go func GetPutObjectUrl(bucket, key string) string ``` ```go func ReplaceCallbackSha1(callback, fileSha1 string) string ``` -------------------------------- ### Callback Configuration Type Source: https://pkg.go.dev/github.com/deadblue/elevengo/internal/oss Structure defining OSS callback parameters. ```go type Callback struct { CallbackUrl string `json:"callbackUrl"` CallbackBody string `json:"callbackBody"` // Optional fields CallbackHost *string `json:"callbackHost,omitempty"` CallbackSNI *bool `json:"callbackSNI,omitempty"` CallbackBodyType *string `json:"callbackBodyType,omitempty"` } ``` -------------------------------- ### Perform POST Request Source: https://pkg.go.dev/github.com/deadblue/elevengo/internal/impl Executes an HTTP POST request with a payload, headers, and context. ```go func (c *ClientImpl) Post( url string, payload client.Payload, headers map[string]string, context context.Context, ) (body client.Body, err error) ``` -------------------------------- ### Utility Functions Source: https://pkg.go.dev/github.com/deadblue/elevengo/internal/util Various helper functions for string manipulation, I/O, and data parsing. ```go func Base64Encode(src string) string ``` ```go func ConsumeReader(r io.ReadCloser) ``` ```go func DetermineMimeType(name string) string ``` ```go func GuessSize(r io.Reader) (size int64) ``` ```go func MarshalCookies(cookies map[string]string) string ``` ```go func NonEmptyString(str ...string) string ``` ```go func NonZero(number ...int) int ``` ```go func NotNull[V any](values ...*V) *V ``` ```go func ParseFileTime(str string) time.Time ``` ```go func ParseInt64(s string, defVal int64) int64 ``` ```go func QuietlyClose(c io.Closer) ``` ```go func SecretUrl(url string) string ``` -------------------------------- ### UploadSampleSpec Operations Source: https://pkg.go.dev/github.com/deadblue/elevengo/lowlevel/api Handles the actual upload process for sample files. ```go type UploadSampleSpec struct { // contains filtered or unexported fields } ``` ```go func (s *UploadSampleSpec) Init( dirId, fileName string, fileSize int64, r io.Reader, initResult *types.UploadSampleInitResult, ) *UploadSampleSpec ``` ```go func (s *UploadSampleSpec) Payload() client.Payload ``` -------------------------------- ### Manage Credentials Source: https://pkg.go.dev/github.com/deadblue/elevengo Methods for exporting and importing user credentials to maintain sessions. ```go func (a *Agent) CredentialExport(cr *Credential) ``` ```go func (a *Agent) CredentialImport(cr *Credential) (err error) ``` -------------------------------- ### Define Label and LabelColor Source: https://pkg.go.dev/github.com/deadblue/elevengo Structures and constants for managing file labels. ```go type Label struct { Id string Name string Color LabelColor } ``` ```go type LabelColor int ``` ```go const ( LabelColorBlank LabelColor = iota LabelColorRed LabelColorOrange LabelColorYellow LabelColorGreen LabelColorBlue LabelColorPurple LabelColorGray ) ``` -------------------------------- ### VideoInfo struct Source: https://pkg.go.dev/github.com/deadblue/elevengo/lowlevel/types Contains metadata for a video stream. ```go type VideoInfo struct { Width int Height int PlayUrl string } ``` -------------------------------- ### Define DownloadInfo struct Source: https://pkg.go.dev/github.com/deadblue/elevengo/lowlevel/types Structure containing file download information. ```go type DownloadInfo struct { FileName string `json:"file_name"` FileSize json.Number `json:"file_size"` PickCode string `json:"pick_code"` Url DownloadUrl `json:"url"` } ``` -------------------------------- ### Define DownloadUrl struct Source: https://pkg.go.dev/github.com/deadblue/elevengo/lowlevel/types Structure containing a download URL. ```go type DownloadUrl struct { Url string } ``` -------------------------------- ### HideHiddenSpec Initialization Source: https://pkg.go.dev/github.com/deadblue/elevengo/lowlevel/api Initializes a specification to hide hidden files. ```go type HideHiddenSpec struct { // contains filtered or unexported fields } ``` ```go func (s *HideHiddenSpec) Init() *HideHiddenSpec ``` -------------------------------- ### Share Types Source: https://pkg.go.dev/github.com/deadblue/elevengo/lowlevel/types Structures for managing shared files and folders. ```go type ShareFileInfo struct { FileId string IsDir bool Name string Size int64 Sha1 string CreateTime int64 IsVideo bool VideoDefinition int MediaDuration int } ``` ```go type ShareInfo struct { ShareCode string `json:"share_code"` ShareState util.IntNumber `json:"share_state"` ShareTitle string `json:"share_title"` ShareUrl string `json:"share_url"` ShareDuration util.IntNumber `json:"share_ex_time"` ReceiveCode string `json:"receive_code"` ReceiveCount util.IntNumber `json:"receive_count"` FileCount int `json:"file_count"` FolderCount int `json:"folder_count"` TotalSize util.IntNumber `json:"total_size"` } ``` ```go type ShareListResult struct { Count int Items []*ShareInfo } ``` ```go type ShareSnapResult struct { SnapId string UserId int ShareTitle string ShareState int ReceiveCount int CreateTime int64 ExpireTime int64 TotalSize int64 FileCount int Files []*ShareFileInfo } ``` -------------------------------- ### File Metadata and Attributes Source: https://pkg.go.dev/github.com/deadblue/elevengo Functions to manage file labels, star status, and image URL retrieval. ```go func (a *Agent) FileSetLabels(fileId string, labelIds ...string) (err error) ``` ```go func (a *Agent) FileSetStar(fileId string, star bool) (err error) ``` ```go func (a *Agent) ImageGetUrl(pickcode string) (imageUrl string, err error) ``` -------------------------------- ### FileListOptions Configuration Source: https://pkg.go.dev/github.com/deadblue/elevengo/option Defines options for filtering file lists by type or extension. ```go type FileListOptions struct { /*Predefined file type: - 0: All - 1: Document - 2: Image - 3: Audio - 4: Video - 5: Archive - 6: Sofrwore */ Type int // File extension with leading-dot, e.g.: mkv ExtName string } ``` ```go func FileList() *FileListOptions ``` ```go func (o *FileListOptions) OnlyArchive() *FileListOptions ``` ```go func (o *FileListOptions) OnlyAudio() *FileListOptions ``` ```go func (o *FileListOptions) OnlyDocument() *FileListOptions ``` ```go func (o *FileListOptions) OnlyExtension(extName string) *FileListOptions ``` ```go func (o *FileListOptions) OnlyImage() *FileListOptions ``` ```go func (o *FileListOptions) OnlySoftware() *FileListOptions ``` ```go func (o *FileListOptions) OnlyVideo() *FileListOptions ``` ```go func (o *FileListOptions) ShowAll() *FileListOptions ``` -------------------------------- ### Calculate Signature Source: https://pkg.go.dev/github.com/deadblue/elevengo/internal/upload Generates a signature string using user credentials and file identifiers. ```go func CalcSignature(userId, userKey, fileId, target string) string ``` -------------------------------- ### Wait for Valve Source: https://pkg.go.dev/github.com/deadblue/elevengo/internal/impl Blocks until the valve allows proceeding. ```go func (v *Valve) Wait() ``` -------------------------------- ### ShareSnapProto and ShareSnapResp Structures Source: https://pkg.go.dev/github.com/deadblue/elevengo/internal/protocol Defines the protocol structures for share snapshots and the corresponding response wrapper. ```go type ShareSnapProto struct { UserInfo struct { UserId util.IntNumber `json:"user_id"` UserName string `json:"user_name"` AvatarUrl string `json:"face"` } `json:"userinfo"` UserAppeal struct { CanAppeal int `json:"can_appeal"` CanShareAppeal int `json:"can_share_appeal"` CanGlobalAppeal int `json:"can_global_appeal"` PopupAppealPage int `json:"popup_appeal_page"` } `json:"user_appeal"` ShareInfo struct { SnapId string `json:"snap_id"` ShareTitle string `json:"share_title"` ShareState util.IntNumber `json:"share_state"` ShareSize util.IntNumber `json:"file_size"` ReceiveCode string `json:"receive_code"` ReceiveCount util.IntNumber `json:"receive_count"` CreateTime util.IntNumber `json:"create_time"` ExpireTime util.IntNumber `json:"expire_time"` AutoRenewal string `json:"auto_renewal"` AutoFillReceiveCode string `json:"auto_fill_recvcode"` CanReport int `json:"can_report"` CanNotice int `json:"can_notice"` HaveVioFile int `json:"have_vio_file"` } `json:"shareinfo"` ShareState util.IntNumber `json:"share_state"` Count int `json:"count"` Files []*ShareFileProto `json:"list"` } ``` ```go type ShareSnapResp struct { BasicResp Data ShareSnapProto `json:"data"` } ``` -------------------------------- ### FormBuilder Constructor Source: https://pkg.go.dev/github.com/deadblue/elevengo/internal/multipart Function to initialize a new FormBuilder. ```go func Builder() FormBuilder ``` -------------------------------- ### IndexInfoResult Struct Source: https://pkg.go.dev/github.com/deadblue/elevengo/lowlevel/types Represents the result of an index information request, containing space usage and login device details. ```go type IndexInfoResult struct { SpaceInfo struct { Total SizeInfo `json:"all_total"` Remain SizeInfo `json:"all_remain"` Used SizeInfo `json:"all_use"` } `json:"space_info"` LoginInfos struct { List []*LoginInfo } `json:"login_devices_info"` } ``` -------------------------------- ### New Source: https://pkg.go.dev/github.com/deadblue/elevengo/internal/crypto/ec115 Creates and returns a new instance of the Cipher struct. ```APIDOC ## func New() ### Description Creates and returns a new instance of the Cipher struct. ### Signature `func New() *Cipher` ``` -------------------------------- ### UserInfoResult struct Source: https://pkg.go.dev/github.com/deadblue/elevengo/lowlevel/types Represents user profile information. ```go type UserInfoResult struct { UserId int `json:"user_id"` UserName string `json:"user_name"` AvatarUrl string `json:"face"` IsVip int `json:"vip"` } ``` -------------------------------- ### Agent.VideoCreateTicket Source: https://pkg.go.dev/github.com/deadblue/elevengo Creates a PlayTicket to play a video stored in the cloud. ```APIDOC ## func (*Agent) VideoCreateTicket ### Description Creates a PlayTicket to play the cloud video. ### Signature `func (a *Agent) VideoCreateTicket(pickcode string, ticket *VideoTicket) (err error)` ``` -------------------------------- ### QrcodeLoginSpec Source: https://pkg.go.dev/github.com/deadblue/elevengo/lowlevel/api Initializes a specification for QR code login. ```APIDOC ## func (*QrcodeLoginSpec) Init ### Description Initializes the specification for QR code login using application and user identifiers. ### Signature `func (s *QrcodeLoginSpec) Init(app, uid string) *QrcodeLoginSpec` ``` -------------------------------- ### UploadInitSpec Operations Source: https://pkg.go.dev/github.com/deadblue/elevengo/lowlevel/api Handles the initialization, parsing, and payload generation for file uploads. ```go type UploadInitSpec struct { // contains filtered or unexported fields } ``` ```go func (s *UploadInitSpec) Init( dirId string, fileSha1 string, fileName string, fileSize int64, signKey string, signValue string, common *types.CommonParams, ) *UploadInitSpec ``` ```go func (s *UploadInitSpec) Parse(r io.Reader) (err error) ``` ```go func (s *UploadInitSpec) Payload() client.Payload ``` -------------------------------- ### AgentOptions Configuration Source: https://pkg.go.dev/github.com/deadblue/elevengo/option Defines the structure and builder methods for configuring an API agent. ```go type AgentOptions struct { // Underlying HTTP client which is used to perform HTTP request. HttpClient plugin.HttpClient // Minimum delay in milliseconds after last API calling. CooldownMinMs uint // Maximum delay in milliseconds after last API calling. CooldownMaxMs uint // Custom user-agent. Name string // Custom app version. Version string } ``` ```go func Agent() *AgentOptions ``` ```go func (o *AgentOptions) WithCooldown(minMs, maxMs uint) *AgentOptions ``` ```go func (o *AgentOptions) WithHttpClient(hc plugin.HttpClient) *AgentOptions ``` ```go func (o *AgentOptions) WithName(name string) *AgentOptions ``` ```go func (o *AgentOptions) WithVersion(version string) *AgentOptions ``` -------------------------------- ### Define Limit Constants Source: https://pkg.go.dev/github.com/deadblue/elevengo/internal/protocol Constants defining limits for file and label lists. ```go const ( FileListLimit = 32 ) ``` ```go const ( LabelListLimit = 11500 ) ``` -------------------------------- ### WriterEx Type Source: https://pkg.go.dev/github.com/deadblue/elevengo/internal/util An enhanced writer implementation providing additional writing capabilities. ```go type WriterEx struct { // contains filtered or unexported fields } ``` ```go func UpgradeWriter(w io.Writer) *WriterEx ``` ```go func (w *WriterEx) MustWriteString(s ...string) ``` ```go func (w *WriterEx) Write(p []byte) (n int, err error) ``` ```go func (w *WriterEx) WriteByte(b byte) (err error) ``` ```go func (w *WriterEx) WriteString(s string) (n int, err error) ``` -------------------------------- ### Define UploadOssTicket struct Source: https://pkg.go.dev/github.com/deadblue/elevengo Contains parameters required for uploading files via the Aliyun OSS SDK. ```go type UploadOssTicket struct { // Expiration time Expiration time.Time // Is file already exists Exist bool // Client parameters Client struct { Region string Endpoint string AccessKeyId string AccessKeySecret string SecurityToken string } // Bucket name Bucket string // Object key Object string // Callback option Callback string // CallbackVar option CallbackVar string } ``` -------------------------------- ### Storage Statistics Source: https://pkg.go.dev/github.com/deadblue/elevengo Retrieves current storage usage information. ```go func (a *Agent) StorageStat(info *StorageInfo) (err error) ``` -------------------------------- ### QrcodeOptions Source: https://pkg.go.dev/github.com/deadblue/elevengo/option Configuration options for QR code login methods. ```APIDOC ## func Qrcode() *QrcodeOptions ### Description Creates a new QrcodeOptions instance. ## Methods - LoginAlipayMiniApp() *QrcodeOptions - LoginAndroid() *QrcodeOptions - LoginIos() *QrcodeOptions - LoginQandroid() *QrcodeOptions - LoginTv() *QrcodeOptions - LoginWeb() *QrcodeOptions - LoginWechatMiniApp() *QrcodeOptions ``` -------------------------------- ### UploadInitResp Structure and Methods Source: https://pkg.go.dev/github.com/deadblue/elevengo/internal/protocol UploadInitResp manages the initialization phase of file uploads, including OSS configuration. ```go type UploadInitResp struct { Request string `json:"request"` Version string `json:"version"` ErrorCode int `json:"statuscode"` ErrorMsg string `json:"statusmsg"` Status int `json:"status"` PickCode string `json:"pickcode"` // New fields in upload v4.0 SignKey string `json:"sign_key"` SignCheck string `json:"sign_check"` // OSS upload fields Bucket string `json:"bucket"` Object string `json:"object"` Callback struct { Callback string `json:"callback"` CallbackVar string `json:"callback_var"` } `json:"callback"` // Useless fields FileId int `json:"fileid"` FileInfo string `json:"fileinfo"` Target string `json:"target"` } ``` ```go func (r *UploadInitResp) Err() error ``` ```go func (r *UploadInitResp) Extract(v *types.UploadInitResult) (err error) ``` -------------------------------- ### Access Low-level Client Source: https://pkg.go.dev/github.com/deadblue/elevengo Provides access to the underlying client and common parameters for direct API interaction. ```go func (a *Agent) LowlevelClient() client.Client func (a *Agent) LowlevelParams() types.CommonParams ``` -------------------------------- ### FileListResp Structure and Methods Source: https://pkg.go.dev/github.com/deadblue/elevengo/internal/protocol Defines the response structure for file listing operations and provides methods for error checking and data extraction. ```go type FileListResp struct { StandardResp AreaId string `json:"aid"` CategoryId util.IntNumber `json:"cid"` Count int `json:"count"` Order string `json:"order"` IsAsc int `json:"is_asc"` Offset int `json:"offset"` Limit int `json:"limit"` } ``` ```go func (r *FileListResp) Err() (err error) ``` ```go func (r *FileListResp) Extract(v *types.FileListResult) (err error) ``` -------------------------------- ### UploadSampleInitResp Structure and Methods Source: https://pkg.go.dev/github.com/deadblue/elevengo/internal/protocol UploadSampleInitResp provides credentials and policy information for sample uploads. ```go type UploadSampleInitResp struct { Host string `json:"host"` Object string `json:"object"` Callback string `json:"callback"` AccessKeyId string `json:"accessid"` Policy string `json:"policy"` Signature string `json:"signature"` Expire int64 `json:"expire"` } ``` ```go func (r *UploadSampleInitResp) Err() error ``` ```go func (r *UploadSampleInitResp) Extract(v *types.UploadSampleInitResult) error ``` -------------------------------- ### QrcodeLoginSpec API Methods Source: https://pkg.go.dev/github.com/deadblue/elevengo/lowlevel/api Methods for handling QR code login authentication flows. ```go type QrcodeLoginSpec struct { // contains filtered or unexported fields } ``` ```go func (s *QrcodeLoginSpec) Init(app, uid string) *QrcodeLoginSpec ``` ```go func (s *QrcodeLoginSpec) Parse(r io.Reader) (err error) ``` ```go func (s *QrcodeLoginSpec) Payload() client.Payload ``` -------------------------------- ### File Ordering Constants Source: https://pkg.go.dev/github.com/deadblue/elevengo/lowlevel/api Constants used to specify sorting criteria for file listings. ```go const ( FileOrderByName = "file_name" FileOrderBySize = "file_size" FileOrderByType = "file_type" FileOrderByCreateTime = "user_ptime" FileOrderByUpdateTime = "user_utime" FileOrderByOpenTime = "user_otime" FileOrderDefault = FileOrderByCreateTime ) ``` -------------------------------- ### ClientImpl Structure Definition Source: https://pkg.go.dev/github.com/deadblue/elevengo/internal/impl The internal client implementation structure containing unexported fields. ```go type ClientImpl struct { // contains filtered or unexported fields } ``` -------------------------------- ### Calculate Token Source: https://pkg.go.dev/github.com/deadblue/elevengo/internal/upload Generates a security token for file uploads using application version, user details, file metadata, and signing keys. ```go func CalcToken( appVer, userId, userHash string, fileId string, fileSize int64, signKey, signValue string, timestamp int64, ) string ``` -------------------------------- ### Create Import Ticket Source: https://pkg.go.dev/github.com/deadblue/elevengo Generates an ImportTicket and pickcode for sharing files between cloud storage accounts. ```go func (a *Agent) ImportCreateTicket(fileId string, ticket *ImportTicket) (pickcode string, err error) ``` -------------------------------- ### Form Content Methods Source: https://pkg.go.dev/github.com/deadblue/elevengo/internal/multipart Methods to retrieve metadata and read data from a Form instance. ```go func (f *Form) ContentLength() int64 ``` ```go func (f *Form) ContentType() string ``` ```go func (f *Form) Read(p []byte) (n int, err error) ``` -------------------------------- ### Upload via OSS Ticket Source: https://pkg.go.dev/github.com/deadblue/elevengo Creates a ticket for uploading large files (over 5GB) using the Aliyun OSS SDK. ```go func (a *Agent) UploadCreateOssTicket( dirId, name string, r io.ReadSeeker, ticket *UploadOssTicket, ) (err error) ``` ```go import ( "github.com/aliyun/aliyun-oss-go-sdk/oss" "github.com/deadblue/elevengo" ) ``` -------------------------------- ### Define FileInfo struct Source: https://pkg.go.dev/github.com/deadblue/elevengo/lowlevel/types Structure containing detailed file metadata. ```go type FileInfo struct { AreaId util.IntNumber `json:"aid"` CategoryId string `json:"cid"` FileId string `json:"fid"` ParentId string `json:"pid"` Name string `json:"n"` Type string `json:"ico"` Size util.IntNumber `json:"s"` Sha1 string `json:"sha"` PickCode string `json:"pc"` IsStar util.Boolean `json:"m"` Labels []*LabelInfo `json:"fl"` CreatedTime string `json:"tp"` UpdatedTime string `json:"te"` ModifiedTime string `json:"t"` // MediaDuration describes duration in seconds for audio/video. MediaDuration float64 `json:"play_long"` // Special fields for video VideoFlag int `json:"iv"` VideoDefinition int `json:"vdi"` } ``` -------------------------------- ### Define StorageInfo structure Source: https://pkg.go.dev/github.com/deadblue/elevengo Represents storage capacity and usage information. ```go type StorageInfo struct { // Total size in bytes. Size int64 // Human-readable total size. FormatSize string // Used size in bytes. Used int64 // Human-readable used size. FormatUsed string ``` -------------------------------- ### Import Cookies Source: https://pkg.go.dev/github.com/deadblue/elevengo/internal/impl Imports cookies into the client for the specified domains. ```go func (c *ClientImpl) ImportCookies(cookies map[string]string, domains ...string) ``` -------------------------------- ### QR Code Login Types Source: https://pkg.go.dev/github.com/deadblue/elevengo/lowlevel/types Data structures for the QR code-based authentication flow. ```go type QrcodeLoginResult struct { Cookie struct { UID string `json:"UID"` CID string `json:"CID"` KID string `json:"KID"` SEID string `json:"SEID"` } `json:"cookie"` UserId int `json:"user_id"` UserName string `json:"user_name"` } ``` ```go type QrcodeStatusResult struct { Status int `json:"status,omitempty"` Message string `json:"msg,omitempty"` Version string `json:"version,omitempty"` } ``` ```go type QrcodeTokenResult struct { Uid string `json:"uid"` Time int64 `json:"time"` Sign string `json:"sign"` } ``` -------------------------------- ### Directory Operations Source: https://pkg.go.dev/github.com/deadblue/elevengo Functions to retrieve directory IDs, create new directories, and manage file ordering within them. ```go func (a *Agent) DirGetId(path string) (dirId string, err error) ``` ```go func (a *Agent) DirMake(parentId string, name string) (dirId string, err error) ``` ```go func (a *Agent) DirSetOrder(dirId string, order FileOrder, asc bool) (err error) ``` -------------------------------- ### Agent.FileIterate Source: https://pkg.go.dev/github.com/deadblue/elevengo Lists files under a specific directory. ```APIDOC ## func (a *Agent) FileIterate(dirId string) (it Iterator[File], err error) ### Description Lists files under the directory specified by dirId. ### Parameters - **dirId** (string) - Required - The ID of the directory to list files from. ``` -------------------------------- ### VideoSubtitleResult struct Source: https://pkg.go.dev/github.com/deadblue/elevengo/lowlevel/types Contains a list of available video subtitles. ```go type VideoSubtitleResult struct { AutoLoad VideoSubtitleInfo `json:"autoload"` List []*VideoSubtitleInfo `json:"list"` } ``` -------------------------------- ### Qrcode Login Configuration Source: https://pkg.go.dev/github.com/deadblue/elevengo/option Methods to configure QR code login parameters for different platforms. ```APIDOC ## func Qrcode() ### Description Returns a new QrcodeOptions instance for login configuration. ### Methods - **LoginAlipayMiniApp()**: Configure for Alipay Mini App login. - **LoginAndroid()**: Configure for Android login. - **LoginIos()**: Configure for iOS login. - **LoginQandroid()**: Configure for Qandroid login. - **LoginTv()**: Configure for TV login. - **LoginWeb()**: Configure for Web login. - **LoginWechatMiniApp()**: Configure for WeChat Mini App login. ``` -------------------------------- ### DirCreateSpec Type Source: https://pkg.go.dev/github.com/deadblue/elevengo/lowlevel/api Specification for creating a new directory. ```go type DirCreateSpec struct { // contains filtered or unexported fields } ``` ```go func (s *DirCreateSpec) Init(parentId, name string) *DirCreateSpec ``` ```go func (s *DirCreateSpec) Parse(r io.Reader) (err error) ``` ```go func (s *DirCreateSpec) Payload() client.Payload ``` -------------------------------- ### Calculate Import Sign Value Source: https://pkg.go.dev/github.com/deadblue/elevengo Calculates the sign value for a file currently on cloud storage. ```go func (a *Agent) ImportCalculateSignValue(pickcode string, signRange string) (value string, err error) ``` -------------------------------- ### Construct Form Payload Source: https://pkg.go.dev/github.com/deadblue/elevengo/internal/impl Creates a payload instance formatted as a www URL-encoded form. ```go func WwwFormPayload(s string) client.Payload ``` -------------------------------- ### Define FileOrder constants Source: https://pkg.go.dev/github.com/deadblue/elevengo Enumeration for sorting files in cloud storage. ```go type FileOrder int ``` ```go const ( FileOrderByName FileOrder = iota FileOrderBySize FileOrderByType FileOrderByCreateTime FileOrderByUpdateTime FileOrderByOpenTime ) ``` -------------------------------- ### Agent.DownloadCreateTicket Source: https://pkg.go.dev/github.com/deadblue/elevengo Creates a download ticket for a file. ```APIDOC ## func (a *Agent) DownloadCreateTicket(pickcode string, ticket *DownloadTicket) (err error) ### Description Creates a ticket containing information required to download a file. The resulting ticket can be used with external tools like curl or wget. ### Parameters - **pickcode** (string) - Required - The pickcode of the file. - **ticket** (*DownloadTicket) - Required - The ticket object to populate. ``` -------------------------------- ### File Description Response Source: https://pkg.go.dev/github.com/deadblue/elevengo/internal/protocol Structure for file description API responses. ```go type FileGetDescResp struct { BasicResp Desc string `json:"desc"` } ``` -------------------------------- ### Execute API Call Source: https://pkg.go.dev/github.com/deadblue/elevengo/internal/impl Performs an API request based on the provided specification and context. ```go func (c *ClientImpl) CallApi(spec client.ApiSpec, context context.Context) (err error) ```