googleapigo

command module
v0.0.0-...-ae10f35 Latest Latest
Warning

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

Go to latest
Published: Mar 12, 2019 License: BSD-3-Clause Imports: 2 Imported by: 0

README

googleapigo

Easy to implement minimalistic golang package for Google APIs

Example
package main

import (
	"fmt"

	GoogleAPI "github.com/Glitchfix/googleapigo/googleapi"
)

func main() {
	//Google API Configuration
	apiConf := GoogleAPI.ClientConfig{
		Email:      "YOUR CONFIG EMAIL",
		PrivateKey: "YOUR RSA KEY",
	}

	//OAuth configured Google client
	googleClient := GoogleAPI.GetClient(apiConf)

	//AudioConfig for Google Speech-to-Text
	audioConf := GoogleAPI.AudioConfig{
		FilePath: "brooklyn.flac",
	}

	textResponse, err := GoogleAPI.SpeechToText(googleClient, audioConf) //Returns the resulting transcript inside json
	if err != nil {
		fmt.Println(err)
	}
	fmt.Println(textResponse)

	textConf := GoogleAPI.TextConfig{
		Text: "Hello, darkness my old friend!",
	}

	voiceResponse, err := GoogleAPI.TextToSpeech(googleClient, textConf) //Returns the resulting base64 of the audio file inside json
	if err != nil {
		fmt.Println(err)
	}
	fmt.Println(voiceResponse)
}
Currently supported cloud APIs
  1. Speech-to-Text
  2. Text-to-Speech

Please feel free to contribute or as issues. In case you need any help please feel free to contact me.

Contact

GitHub LinkedIn Email: schakravorty846@gmail.com Phone: +919658965891, +917978129659

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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