githubapi

package
v0.0.0-...-c314ab1 Latest Latest
Warning

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

Go to latest
Published: May 16, 2012 License: GPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const GET_GIST = `` /* 1678-byte string literal not displayed */

Variables

This section is empty.

Functions

func EscapeNLs

func EscapeNLs(input string) string

Types

type File

type File struct {
	Filename string
	Size     int
	Raw_Url  string
	Content  string
}

Provides content of individual files that make up a gist

func NewFile

func NewFile(fname, content string) File

Create a new File, which is compatible with github's JSON representation of a file within a gist.

type Fork

type Fork struct {
	User       User
	Url        string
	Created_At string
}

A structure compatible with github's fork representation inside of a gist JSON structure

type GistResponse

type GistResponse struct {
	Url          string
	Id           string
	Description  string
	Public       bool
	UserMap      map[string]User
	Files        map[string]File
	Comments     int
	Html_Url     string
	Git_Pull_Url string
	Git_Push_Url string
	Created_At   string
	Forks        []Fork
	History      []History
}

A GistResponse is designed to be a compatible representation with github's JSON representation of a Gist. Go's builtin encoding/json package makes use of this struct when unpacking data recieved from github.

func GetGistResponse

func GetGistResponse(id int) GistResponse

Returns a gist response (unpacked from JSON reply) that is associated with id.

func ListUserGists

func ListUserGists(user string) []GistResponse

Returns a list of gist responses (unpacked from JSON reply) that is associated with a user login.

func PushGist

func PushGist(description string, files ...File) GistResponse

Push a file (or multiple files) to gist.github.com. This is just a convenience function that wraps PushMultiGist, which does the work.

func PushMultiGist

func PushMultiGist(description string, files []File) GistResponse

Push a file (or multiple files) to gist.github.com. Currently only creating anonymous gists is supported. One possible workaround for now is to just fork the anonymous gist into your own account.

func (*GistResponse) GetFile

func (g *GistResponse) GetFile(filename string) File

The specific file associated with filename that is provided in a JSON response from github.

func (*GistResponse) GetFiles

func (g *GistResponse) GetFiles() []File

The list of files provided in a JSON response from github.

func (GistResponse) String

func (g GistResponse) String() string

A String representation of a JSON response from github.

func (*GistResponse) UserAvatarUrl

func (g *GistResponse) UserAvatarUrl() string

The user avatar url provided in a JSON response from github.

func (*GistResponse) UserGravatarId

func (g *GistResponse) UserGravatarId() string

The user gravatar id provided in a JSON response from github.

func (*GistResponse) UserId

func (g *GistResponse) UserId() int

The user id provided in a JSON response from github.

func (*GistResponse) UserLogin

func (g *GistResponse) UserLogin() string

The user login provided in a JSON response from github.

func (*GistResponse) UserUrl

func (g *GistResponse) UserUrl() string

The user url provided in a JSON response from github.

type History

type History struct {
	Url           string
	Version       string
	User          User
	Change_Status changestatus
	Committed_At  string
}

Provides the content of a History of a Gist

type User

type User struct {
	Login       string
	Id          int
	Avatar_Url  string
	Gravatar_Id string
	Url         string
}

Provides content of user type

Jump to

Keyboard shortcuts

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