This is a Google Photos API client based on the official Google Photos API client library, that was removed from Google API client library for Go and it was mirrored here.
Contains two packages:
lib-gphotos: simply wraps the official library to offer the same functionality plus uploads.
noserver-gphotosclient for being used in a CLI tool.
Download using go get github.com/gphotosuploader/google-photos-api-client-go
Then use this way:
import "github.com/gphotosuploader/google-photos-api-client-go/noserver-gphotos"
func main() {
// ask the user to authenticate on google in the browser
photosClient, err := gphotosclient.NewClient(
gphotosclient.AuthenticateUser(
gphotoslib.NewOAuthConfig(gphotoslib.APIAppCredentials{
ClientID: "your-google-client-id",
ClientSecret: "very_secret",
}),
),
)
if err != nil {
log.Fatal(err)
}
_, err = photosClient.UploadFile("/path/to/file")
if err != nil {
log.Fatal(err)
}
}