cloudpan189-api

command module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 5, 2023 License: Apache-2.0 Imports: 5 Imported by: 0

README

cloudpan189-api

GO语言封装的 cloud 189 天翼云盘接口API。可以基于该接口库实现对天翼云盘的二次开发。

go.dev reference License

快速使用

导入包

import "github.com/tickstep/cloudpan189-api/cloudpan"

先调用登录接口,获取APP端cookie和WEB端cookie

	appToken, e := cloudpan.AppLogin("193xxxxxx@189.cn", "123xxxxx")
	if e != nil {
		fmt.Println(e)
		return
	}

	webToken := &cloudpan.WebLoginToken{}
	webTokenStr := cloudpan.RefreshCookieToken(appToken.SessionKey)
	if webTokenStr != "" {
		webToken.CookieLoginUser = webTokenStr
	}
	fmt.Println("login success")

使用获取到的cookie创建PanClient实例

	// pan client
	panClient := cloudpan.NewPanClient(*webToken, *appToken)

调用PanClient相关方法可以实现对cloud189云盘的相关操作

	// do get file info action
	fi, err1 := panClient.FileInfoByPath("/我的文档")
	if err1 != nil {
		fmt.Println("get file info error")
		return
	}
	fmt.Printf("name = %s, size = %d, path = %s", fi.FileName, fi.FileSize, fi.Path)

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
电脑手机客户端API,例如MAC客户端
电脑手机客户端API,例如MAC客户端

Jump to

Keyboard shortcuts

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