From 82559627321c496bcb3da5e2e18763ec0c9493b5 Mon Sep 17 00:00:00 2001 From: Alomerry Wu Date: Tue, 30 Apr 2024 23:37:59 +0800 Subject: [PATCH] chore: remove go pusher by qiniu kodo --- modules/pusher/impl/aliyun.go | 44 +++++++++++++++++++++++++++++++++++ modules/pusher/pusher.go | 6 +++++ 2 files changed, 50 insertions(+) create mode 100644 modules/pusher/impl/aliyun.go create mode 100644 modules/pusher/pusher.go diff --git a/modules/pusher/impl/aliyun.go b/modules/pusher/impl/aliyun.go new file mode 100644 index 0000000..6027da1 --- /dev/null +++ b/modules/pusher/impl/aliyun.go @@ -0,0 +1,44 @@ +package impl + +import ( + "fmt" + open "github.com/tickstep/aliyunpan-api/aliyunpan_open" + "github.com/tickstep/aliyunpan-api/aliyunpan_open/openapi" +) + +type AliyunPan struct { + openPanClient *open.OpenPanClient +} + +func (a *AliyunPan) Init() error { + openPanClient := open.NewOpenPanClient(openapi.ApiConfig{ + TicketId: "", + UserId: "", + ClientId: "", + ClientSecret: "", + }, openapi.ApiToken{ + AccessToken: "eyJraWQiOiJLcU8iLC...jIUeqP9mZGZDrFLN--h1utcyVc", + ExpiredAt: 1709527182, + }, nil) + + // get user info + ui, err := openPanClient.GetUserInfo() + if err != nil { + fmt.Println("get user info error") + return err + } + fmt.Println("当前登录用户:" + ui.Nickname) + + // do some file operation + fi, _ := openPanClient.FileInfoByPath(ui.FileDriveId, "/我的文档") + fmt.Println("\n我的文档 信息:") + fmt.Println(fi) + + //openPanClient.CreateUploadFile() + return nil +} + +func (a *AliyunPan) Push(filePath string, remotePath string) error { + //a.openPanClient.CompleteUploadFile() + return nil +} diff --git a/modules/pusher/pusher.go b/modules/pusher/pusher.go new file mode 100644 index 0000000..b8d7f0f --- /dev/null +++ b/modules/pusher/pusher.go @@ -0,0 +1,6 @@ +package pusher + +type Pusher interface { + Init() error + Push(filePath string, remotePath string) error +}