nmrshll / google-photos-api-client-go

Google photos api client in go

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Go Report Card

Google photos API client (Go library)

The official google photos client doesn't have upload functionality, this repo aims to complete it with upload functionality and improve ease of use for classic use cases.

It contains three packages, github.com/nmrshll/google-photos-api-client-go/lib-gphotos simply wraps the official library to offer the same functionality plus upload, the two other packages try to make it easier to use in classic cases:

Quick start

Download using go get github.com/nmrshll/google-photos-api-client-go

Then use this way:

In a CLI tool or desktop/mobile app (when your app is fully client-side and doesn't have its own server-side part):

func main() {
	// ask the user to authenticate on google in the browser
	photosClient, err := gphotosclient.NewClient(
		gphotosclient.AuthenticateUser(
			gphotoslib.NewOAuthConfig(gphotoslib.APIAppCredentials{
				ClientID:     "________________",
				ClientSecret: "____________________"},
			),
		),
	)
	if err != nil {
		log.Fatal(err)
	}

	_, err = photosClient.UploadFile("/path/to/file")
	if err != nil {
		log.Fatal(err)
	}
}

on the server side:

func main() {
	fmt.Println("Hello world !")
}

More Examples

server-side:

no server, all client side (desktop,cli,mobile,...):

About

Google photos api client in go


Languages

Language:Go 99.7%Language:Makefile 0.3%