googleclient

package module
v0.0.0-...-ea9fdf6 Latest Latest
Warning

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

Go to latest
Published: Aug 31, 2017 License: Apache-2.0 Imports: 12 Imported by: 0

README

googleclient

Go library to attain google api clients for quick cli tools

usage:


import (
  "golang.org/x/net/context"
  "github.com/jazzboME/googleclient"
)

ctx := context.Background()
client := googleclient.GetClient(ctx, scope, credentialsFileName)

Where scope is the intended scopes required by your application, and the credentialsFileName is the name of the filename that will be placed in the ~/credentials directory. Multiple scopes can be indicated by separating each scope with a space. The credentialsFileName should be unique for each application.

This code is just a quick hack of the sample google code from pages like https://developers.google.com/gmail/api/quickstart/go and placed in a Go package.

This assumes that the OAuth2 credentials for the application have been downloaded into a client_secret.json file local to the application.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetClient

func GetClient(ctx context.Context, scope string, file string) *http.Client

GetClient uses a Context and Config to retrieve a Token then generate a Client. It returns the generated Client.

Types

This section is empty.

Jump to

Keyboard shortcuts

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