alist

package
v0.3.3 Latest Latest
Warning

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

Go to latest
Published: May 31, 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 AlistResp

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

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 {
	Name     string    `json:"name"`
	Size     uint64    `json:"size"`
	IsDir    bool      `json:"is_dir"`
	Modified time.Time `json:"modified"`
	Created  time.Time `json:"created"`
	Sign     string    `json:"sign"`
	Thumb    string    `json:"thumb"`
	Type     uint64    `json:"type"`
	Hashinfo string    `json:"hashinfo"`
}

type FsGetReq

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

type FsGetResp

type FsGetResp = AlistResp[FsGetRespData]

type FsGetRespData added in v0.3.3

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

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 = AlistResp[fsListResp]

type FsMkdirReq

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

type FsMkdirResp

type FsMkdirResp = AlistResp[any]

type FsOtherReq

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

type FsOtherResp

type FsOtherResp = AlistResp[fsOtherResp]

type FsRemoveReq

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

type FsRemoveResp

type FsRemoveResp = AlistResp[any]

type FsRenameReq

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

type FsRenameResp

type FsRenameResp = AlistResp[any]

type FsSearchReq added in v0.3.2

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

type FsSearchResp added in v0.3.2

type FsSearchResp = AlistResp[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 = AlistResp[loginResp]

type MeResp

type MeResp = AlistResp[meResp]

Jump to

Keyboard shortcuts

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