GitBook API client in GO (golang)
See for automatically generated API documentation.
Check out the examples below for quick and simple ways to start.
package main
import (
"fmt"
"github.com/GitbookIO/go-gitbook-api"
)
func main() {
// Make API client
api := gitbook.NewAPI(gitbook.APIOptions{})
// Get book
book, err := api.Book.Get("gitbookio/javascript")
// Print results
fmt.Printf("book = %q\n", book)
fmt.Printf("error = %q\n", err)
}
package main
import (
"fmt"
"github.com/GitbookIO/go-gitbook-api"
)
func main() {
// Make API client
api := gitbook.NewAPI(gitbook.APIOptions{
// Custom host instead of "https://api.gitbook.com"
Host: "http://localhost:5000/api/",
// Hit API with a specific user
Username: "username",
Password: "token or password",
})
// Get book
book, err := api.Book.Get("gitbookio/javascript")
// Print results
fmt.Printf("book = %q\n", book)
fmt.Printf("error = %q\n", err)
}