gitbook

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

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

Go to latest
Published: Mar 24, 2016 License: Apache-2.0 Imports: 2 Imported by: 0

README

go-gitbook-api

GitBook API client in GO (golang)

Documentation

See GoDoc for automatically generated API documentation.

Check out the examples below for quick and simple ways to start.

Simple Example
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)
}
Advanced Example
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)
}

Documentation

Index

Constants

View Source
const (
	VERSION = "1.0.2"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type API

type API struct {
	// Author API client
	Author *api.Author
	// Authentication API client
	Account *api.Account
	// Individual book API client
	Book *api.Book
	// Book listing API client
	Books *api.Books
	// Builds API client
	Builds *api.Builds

	// Internal client
	Client *client.Client
}

func NewAPI

func NewAPI(opts APIOptions) *API

func NewAPIFromClient

func NewAPIFromClient(c *client.Client) *API

func (*API) AuthFork

func (a *API) AuthFork(username, password string) *API

func (*API) Fork

func (a *API) Fork(opts APIOptions) *API

type APIOptions

type APIOptions client.ClientOptions

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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