https://github.com/guneyin/disgo
Simple cloud disk library for Go
https://github.com/guneyin/disgo
cloud-drive google-drive yandex-disk
Last synced: 5 months ago
JSON representation
Simple cloud disk library for Go
- Host: GitHub
- URL: https://github.com/guneyin/disgo
- Owner: guneyin
- Created: 2024-11-26T20:12:34.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-12-21T13:47:32.000Z (over 1 year ago)
- Last Synced: 2025-01-20T06:28:16.554Z (over 1 year ago)
- Topics: cloud-drive, google-drive, yandex-disk
- Language: Go
- Homepage:
- Size: 43 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Current Status: W.I.P
Please DO NOT use in production
# disgo: A very basic cloud disk manager.
Add cloud disk capability to your golang applications
## Usage
```go
gc := provider.GoogleConfig{
ApiKey: os.Getenv("DSG_GOOGLE_API_KEY"),
ClientID: os.Getenv("DSG_GOOGLE_CLIENT_ID"),
ClientSecret: os.Getenv("DSG_GOOGLE_SECRET"),
CallBackUrl: "http://localhost:8080/auth/google/callback",
}
accessToken := os.Getenv("DSG_GOOGLE_OAUTH2_TOKEN")
gp := provider.NewGoogle(gc, []byte(accessToken))
user, err := gp.GetAuthorizedUser()
if err != nil {
log.Fatal(err)
}
userData, _ := json.MarshalIndent(user, "", " ")
_ = fmt.Sprintf("%-v", string(userData))
dirs, err := gp.GetDirectoryList("")
if err != nil {
log.Fatal(err)
}
dirsData, _ := json.MarshalIndent(dirs, "", " ")
_ = fmt.Sprintf("%-v", string(dirsData))
```