alist

package
v0.3.4 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	FsOtherReqMethodVideoPreview = "video_preview"
)

Variables

This section is empty.

Functions

func Login

func Login(ctx context.Context, host string, data LoginReq, opts ...LoginOpt) (string, error)

Types

type Client

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

func NewClient

func NewClient(host, token string, conf ...ClientConfig) (*Client, error)

func (*Client) Do added in v0.3.3

func (c *Client) Do(req *http.Request) (*http.Response, error)

func (*Client) FsGet

func (c *Client) FsGet(fSGetReq *FsGetReq) (*FsGetRespData, error)

func (*Client) FsList

func (c *Client) FsList(fSListReq *FsListReq) (*fsListResp, error)

func (*Client) FsMkdir

func (c *Client) FsMkdir(fSMkdirReq *FsMkdirReq) error

func (*Client) FsOther

func (c *Client) FsOther(fSOtherReq *FsOtherReq) (*fsOtherResp, error)

func (*Client) FsRemove

func (c *Client) FsRemove(fSRemoveReq *FsRemoveReq) error

func (*Client) FsRename

func (c *Client) FsRename(fSRenameReq *FsRenameReq) error

func (*Client) FsSearch added in v0.3.2

func (c *Client) FsSearch(fSSearchReq *FsSearchReq) (*fsSearchResp, error)

func (*Client) Login

func (c *Client) Login(data LoginReq, opts ...LoginOpt) error

func (*Client) Me

func (c *Client) Me() (*meResp, error)

func (*Client) NewRequest

func (c *Client) NewRequest(method, relative string, data any) (req *http.Request, err error)

func (*Client) SetToken

func (c *Client) SetToken(token string)

type ClientConfig

type ClientConfig func(*Client)

func WithContext

func WithContext(ctx context.Context) ClientConfig

func WithUserAgent added in v0.3.3

func WithUserAgent(userAgent string) ClientConfig

type FsGetRelated added in v0.3.3

type FsGetRelated struct {
	Modified time.Time `json:"modified"`
	Created  time.Time `json:"created"`
	Name     string    `json:"name"`
	Sign     string    `json:"sign"`
	Thumb    string    `json:"thumb"`
	Hashinfo string    `json:"hashinfo"`
	Size     uint64    `json:"size"`
	Type     uint64    `json:"type"`
	IsDir    bool      `json:"is_dir"`
}

type FsGetReq

type FsGetReq struct {
	Path     string `json:"path"`
	Password string `json:"password"`
}

type FsGetResp

type FsGetResp = Resp[FsGetRespData]

type FsGetRespData added in v0.3.3

type FsGetRespData struct {
	Modified time.Time       `json:"modified"`
	Created  time.Time       `json:"created"`
	HashInfo any             `json:"hash_info"`
	Sign     string          `json:"sign"`
	Thumb    string          `json:"thumb"`
	Hashinfo string          `json:"hashinfo"`
	Name     string          `json:"name"`
	RawURL   string          `json:"raw_url"`
	Readme   string          `json:"readme"`
	Provider string          `json:"provider"`
	Related  []*FsGetRelated `json:"related"`
	Size     uint64          `json:"size"`
	Type     uint64          `json:"type"`
	IsDir    bool            `json:"is_dir"`
}

type FsListReq

type FsListReq struct {
	Path     string `json:"path"`
	Password string `json:"password"`
	Page     uint64 `json:"page"`
	PerPage  uint64 `json:"per_page"`
	Refresh  bool   `json:"refresh"`
}

type FsListResp

type FsListResp = Resp[fsListResp]

type FsMkdirReq

type FsMkdirReq struct {
	Path string `json:"path"`
}

type FsMkdirResp

type FsMkdirResp = Resp[any]

type FsOtherReq

type FsOtherReq struct {
	Path     string `json:"path"`
	Method   string `json:"method"`
	Password string `json:"password"`
}

type FsOtherResp

type FsOtherResp = Resp[fsOtherResp]

type FsRemoveReq

type FsRemoveReq struct {
	Names []string `json:"names"`
	Dir   bool     `json:"dir"`
}

type FsRemoveResp

type FsRemoveResp = Resp[any]

type FsRenameReq

type FsRenameReq struct {
	Path string `json:"path"`
	Name string `json:"name"`
}

type FsRenameResp

type FsRenameResp = Resp[any]

type FsSearchReq added in v0.3.2

type FsSearchReq struct {
	Parent   string `json:"parent"`
	Keywords string `json:"keywords"`
	Password string `json:"password"`
	Scope    uint64 `json:"scope"`
	Page     uint64 `json:"page"`
	PerPage  uint64 `json:"per_page"`
}

type FsSearchResp added in v0.3.2

type FsSearchResp = Resp[fsSearchResp]

type LoginOpt

type LoginOpt func(*LoginOptions)

func WithHashed

func WithHashed() LoginOpt

type LoginOptions

type LoginOptions struct {
	Hashed bool
}

type LoginReq

type LoginReq struct {
	Username string `json:"username"`
	Password string `json:"password"`
}

type LoginResp

type LoginResp = Resp[loginResp]

type MeResp

type MeResp = Resp[meResp]

type Resp added in v0.3.4

type Resp[T any] struct {
	Data    T      `json:"data"`
	Message string `json:"message"`
	Code    uint64 `json:"code"`
}

Jump to

Keyboard shortcuts

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