alist

package
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: Jan 6, 2024 License: MIT Imports: 7 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) FsGet

func (c *Client) FsGet(fSGetReq *FsGetReq) (*fsGetResp, 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 WithHttpClient

func WithHttpClient(httpClient *http.Client) ClientConfig

type FsGetReq

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

type FsGetResp

type FsGetResp = AlistResp[fsGetResp]

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