aliyundrive

package
v0.0.0-...-f76bd4e Latest Latest
Warning

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

Go to latest
Published: Mar 6, 2023 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Authorization = "authorization"
	ContentType   = "content-type"
	UserAgent     = "User-Agent"

	ContentTypeJSON = "application/json"

	Bearer = "bearer"

	BaseURL = "https://auth.aliyundrive.com"
	ApiURL  = "https://api.aliyundrive.com"

	AccessTokenPrefix  = "at:"
	RefreshTokenPrefix = "rt:"

	V2AccountToken                 = BaseURL + "/v2/account/token"
	V2ShareLinkGetShareToken       = BaseURL + "/v2/share_link/get_share_token"
	V2FileGetShareLinkDownloadUrl  = ApiURL + "/v2/file/get_share_link_download_url"
	V3FileList                     = ApiURL + "/adrive/v3/file/list"
	V2ShareLinkGetShareByAnonymous = ApiURL + "/adrive/v2/share_link/get_share_by_anonymous"
	V3ShareLinkGetShareByAnonymous = ApiURL + "/adrive/v3/share_link/get_share_by_anonymous"
)

Variables

This section is empty.

Functions

func HcHook

func HcHook(_ *resty.Client, req *http.Request) error

Types

type AliYunDrive

type AliYunDrive struct {
	Client       *resty.Client
	RefreshToken string
	Cache        map[string]string
}

func (AliYunDrive) GetAnonymousShare

func (ali AliYunDrive) GetAnonymousShare(shareId string) (*GetShareInfoResponse, error)

func (AliYunDrive) GetAuthorizationToken

func (ali AliYunDrive) GetAuthorizationToken() string

func (AliYunDrive) GetFileDownloadUrl

func (ali AliYunDrive) GetFileDownloadUrl(shareToken string, shareId string, fileId string) (string, error)

func (AliYunDrive) GetShare

func (ali AliYunDrive) GetShare(shareId string, shareToken string) (data chan *BaseShareFile, err error)

func (AliYunDrive) GetShareToken

func (ali AliYunDrive) GetShareToken(shareId string, sharePwd string) (*GetShareTokenResponse, error)

type BaseShareFile

type BaseShareFile struct {
	ShareId       string   `json:"share_id"`
	Name          string   `json:"name"`
	Size          int      `json:"size"`
	Creator       string   `json:"creator"`
	Description   string   `json:"description"`
	Category      string   `json:"category"`
	DownloadUrl   int      `json:"download_url"`
	Url           int      `json:"url"`
	FileExtension string   `json:"file_extension"`
	FileId        string   `json:"file_id"`
	Thumbnail     string   `json:"thumbnail"`
	ParentFileId  string   `json:"parent_file_id"`
	FileType      string   `json:"type"`
	UpdatedAt     string   `json:"updated_at"`
	CreatedAt     string   `json:"created_at"`
	Selected      string   `json:"selected"`
	MimeExtension string   `json:"mime_extension"`
	MimeType      string   `json:"mime_type"`
	PunishFlag    int      `json:"punish_flag"`
	ActionList    []string `json:"action_list"`
	DriveId       string   `json:"drive_id"`
	DomainId      string   `json:"domain_id"`
	RevisionId    string   `json:"revision_id"`
}

type ErrorResponse

type ErrorResponse struct {
	Code    string `json:"code"`
	Message string `json:"message"`
}

type FileListParam

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

type GetShareFileListRequest

type GetShareFileListRequest struct {
	ShareId               string `json:"share_id"`
	Starred               bool   `json:"starred"`
	All                   bool   `json:"all"`
	Category              string `json:"category"`
	Fields                string `json:"fields"`
	ImageThumbnailProcess string `json:"image_thumbnail_process"`
	Limit                 int    `json:"limit"`
	Marker                string `json:"marker"`
	OrderBy               string `json:"order_by"`
	OrderDirection        string `json:"order_direction"`
	ParentFileId          string `json:"parent_file_id"`
	Status                string `json:"status"`
	FileType              string `json:"type"`
	UrlExpireSec          int    `json:"url_expire_sec"`
	VideoThumbnailProcess string `json:"video_thumbnail_process"`
}

type GetShareFileListResponse

type GetShareFileListResponse struct {
	Items      []*BaseShareFile `json:"items"`
	NextMarker string           `json:"next_marker"`
}

type GetShareInfoRequest

type GetShareInfoRequest struct {
	ShareId string `json:"share_id"`
}

type GetShareInfoResponse

type GetShareInfoResponse struct {
	Avatar             string          `json:"avatar"`
	CreatorId          string          `json:"creator_id"`
	CreatorName        string          `json:"creator_name"`
	CreatorPhone       string          `json:"creator_phone"`
	Expiration         string          `json:"expiration"`
	UpdatedAt          string          `json:"updated_at"`
	ShareName          string          `json:"share_name"`
	FileCount          int             `json:"file_count"`
	FileInfos          []ShareItemInfo `json:"file_infos"`
	Vip                string          `json:"vip"`
	DisplayName        string          `json:"display_name"`
	IsFollowingCreator bool            `json:"is_following_creator"`
}

type GetShareLinkDownloadUrlRequest

type GetShareLinkDownloadUrlRequest struct {
	ShareId   string `json:"share_id"`
	FileId    string `json:"file_id"`
	ExpireSec int    `json:"expire_sec"`
}

type GetShareLinkDownloadUrlResponse

type GetShareLinkDownloadUrlResponse struct {
	DownloadUrl string `json:"download_url"`
	Url         string `json:"url"`
	Thumbnail   string `json:"thumbnail"`
}

type GetShareTokenRequest

type GetShareTokenRequest struct {
	ShareId  string `json:"share_id"`
	SharePwd string `json:"share_pwd"`
}

type GetShareTokenResponse

type GetShareTokenResponse struct {
	ShareToken string `json:"share_token"`
	ExpireTime string `json:"expire_time"`
	ExpiresIn  int    `json:"expires_in"`
}

type ShareItemInfo

type ShareItemInfo struct {
	Category      string `json:"category"`
	FileExtension string `json:"file_extension"`
	FileId        string `json:"file_id"`
	Thumbnail     string `json:"thumbnail"`
	FileType      string `json:"type"`
}

type TokenRequest

type TokenRequest struct {
	GrantType    string `json:"grant_type"`
	RefreshToken string `json:"refresh_token"`
}

type TokenResponse

type TokenResponse struct {
	DefaultSboxDriveId string    `json:"default_sbox_drive_id"`
	Role               string    `json:"role"`
	DeviceId           string    `json:"device_id"`
	UserName           string    `json:"user_name"`
	NeedLink           bool      `json:"need_link"`
	ExpireTime         time.Time `json:"expire_time"`
	PinSetup           bool      `json:"pin_setup"`
	NeedRpVerify       bool      `json:"need_rp_verify"`
	Avatar             string    `json:"avatar"`
	TokenType          string    `json:"token_type"`
	AccessToken        string    `json:"access_token"`
	DefaultDriveId     string    `json:"default_drive_id"`
	DomainId           string    `json:"domain_id"`
	RefreshToken       string    `json:"refresh_token"`
	IsFirstLogin       bool      `json:"is_first_login"`
	UserId             string    `json:"user_id"`
	NickName           string    `json:"nick_name"`
	State              string    `json:"state"`
	ExpiresIn          int       `json:"expires_in"`
	Status             string    `json:"status"`
}

Jump to

Keyboard shortcuts

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