endpoints

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2016 License: Apache-2.0 Imports: 12 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Endpoints

type Endpoints struct {
	// contains filtered or unexported fields
}

Endpoints represents all endpoints of the http server

func NewEndpoints

func NewEndpoints(oauthCfg *oauth2.Config, client *elastic.Client, a *ga.Client) *Endpoints

NewEndpoints is just below the http handlers

func (Endpoints) CreateSnippet

func (e Endpoints) CreateSnippet(snipp *types.Problem, userId string) error

CreateSnippet saves a snippet, generates id

func (*Endpoints) GetLatestSnippets

func (e *Endpoints) GetLatestSnippets() ([]types.Problem, error)

GetLatestSnippets in reverse chronological order

func (Endpoints) GetSnippet

func (e Endpoints) GetSnippet(id string) (*types.Problem, error)

GetSnippet by id

func (*Endpoints) GetUser

func (e *Endpoints) GetUser(token string) (*User, error)

GetUser by token

func (*Endpoints) GithubAuth

func (e *Endpoints) GithubAuth(code string) (*User, error)

GithubAuth exchanges a github code for a token, registers and returns a User

func (*Endpoints) Query

func (e *Endpoints) Query(q string, size int, private bool) ([]types.Problem, error)

Query the borg

func (Endpoints) UpdateSnippet

func (e Endpoints) UpdateSnippet(snipp *types.Problem, userId string) error

UpdateSnippet saves a snippet

func (Endpoints) Worked

func (e Endpoints) Worked(id, query string) error

Worked tells the borg server that a result works for a given query

type User

type User struct {
	Id       string
	Login    string
	Email    string
	Name     string
	SourceId string
	Token    string
}

User represents a borg user

Jump to

Keyboard shortcuts

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