Documentation
¶
Index ¶
- Constants
- Variables
- func AccessTokenFor(c *Credentials) string
- func GetReqParams(req any) (query string, body io.Reader, file io.Reader)
- func GetReqParamsWithCreds(req any, creds *Credentials) (query string, body io.Reader, file io.Reader)
- type BoolInt
- type CreateMode
- type Credentials
- type Error
- type FileCategory
- type FileCreateRType
- type ListOrder
- type OndupMode
- type SizeB
- type SizeGB
- type SizeKB
- type SizeMB
- type SizePB
- type SizeTB
- type Time
- type VipType
Constants ¶
const ( AuthRoute = "/oauth/2.0/authorize" TokenRoute = "/oauth/2.0/token" FileRoute = "/rest/2.0/xpan/file" MultimediaRoute = "/rest/2.0/xpan/multimedia" NasRoute = "/rest/2.0/xpan/nas" QuotaRoute = "/api/quota" UploadRoute = "/rest/2.0/pcs/file" SuperFileRoute = "/rest/2.0/pcs/superfile2" )
Variables ¶
var ( ClientId string ClientSecret string RedirectUri = "oob" AccessToken string RefreshToken string AuthBaseURL = "https://openapi.baidu.com" PanBaseURL = "https://pan.baidu.com" PCSBaseURL = "https://d.pcs.baidu.com" )
Functions ¶
func AccessTokenFor ¶ added in v0.1.6
func AccessTokenFor(c *Credentials) string
AccessTokenFor returns the per-credentials access token, or the global if nil.
func GetReqParamsWithCreds ¶ added in v0.1.6
func GetReqParamsWithCreds(req any, creds *Credentials) (query string, body io.Reader, file io.Reader)
GetReqParamsWithCreds is like GetReqParams but resolves $-prefixed default placeholders against the per-account Credentials when non-nil.
Types ¶
type CreateMode ¶
type CreateMode int
const ( CreateModeUserUpload CreateMode = 1 // 手动上传 CreateModeUserMultiUpload CreateMode = 2 // 批量上传 CreateModeAutoBackupFile CreateMode = 3 // 文件自动备份 CreateModeAutoBackupPhoto CreateMode = 4 // 相册自动备份 CreateModeAutoBackupVideo CreateMode = 5 // 视频自动备份 )
type Credentials ¶ added in v0.1.6
type Credentials struct {
ClientId string
ClientSecret string
RedirectUri string
AccessToken string
RefreshToken string
}
Credentials holds per-account SDK secrets. When non-nil it takes precedence over the package-level globals below, enabling concurrent multi-account use.
type Error ¶
type FileCategory ¶
type FileCategory int
1 视频、2 音频、3 图片、4 文档、5 应用、6 其他、7 种子
const ( FileCategoryVideo FileCategory = 1 FileCategoryAudio FileCategory = 2 FileCategoryImage FileCategory = 3 FileCategoryDocument FileCategory = 4 FileCategoryApp FileCategory = 5 FileCategoryOther FileCategory = 6 FileCategoryTorrent FileCategory = 7 )
type FileCreateRType ¶
type FileCreateRType int
const ( FileCreateRTypePathRename FileCreateRType = 1 FileCreateRTypePathBlockListRename FileCreateRType = 2 FileCreateRTypePathMove FileCreateRType = 3 )