gitactivity

package
v0.0.0-...-55fbde6 Latest Latest
Warning

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

Go to latest
Published: Feb 21, 2017 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Run

func Run(conf *config.Server, dstore *datastore.Datastore, queue *lifecycle.Queue) (*http.ServeMux, error)

Run starts a server

Types

type ErrorHandler

type ErrorHandler struct{}

ErrorHandler handles HTTP errors

type ErrorResp

type ErrorResp struct {
	Error  string `json:"error"`
	Status uint   `json:"status"`
}

ErrorResp is the default response for errors

type IndexSubHandler

type IndexSubHandler struct {
	SubHandler
	Error ErrorHandler
}

IndexSubHandler is the SubHandler for the index route

func (IndexSubHandler) Delete

func (i IndexSubHandler) Delete(res http.ResponseWriter, req *http.Request)

Delete is the Delete method for /

func (IndexSubHandler) Get

func (i IndexSubHandler) Get(res http.ResponseWriter, req *http.Request)

Get is the get method for /

func (IndexSubHandler) Patch

func (i IndexSubHandler) Patch(res http.ResponseWriter, req *http.Request)

Patch is the Patch method for /

func (IndexSubHandler) Post

func (i IndexSubHandler) Post(res http.ResponseWriter, req *http.Request)

Post is the post method for /

func (IndexSubHandler) Put

func (i IndexSubHandler) Put(res http.ResponseWriter, req *http.Request)

Put is the put method for /

type PRPayload

type PRPayload struct {
	Action      string    `json:"action"`
	Number      int       `json:"number"`
	PullRequest prPayload `json:"pull_request"`
}

PRPayload is the Github api's Pull Request Event Object

type PRSubHandler

type PRSubHandler struct {
	SubHandler
	Error ErrorHandler
	Queue *lifecycle.Queue
}

PRSubHandler is the subhandler for Pull Request events

func (PRSubHandler) Delete

func (pr PRSubHandler) Delete(res http.ResponseWriter, req *http.Request)

Delete is PRSubHandler's HTTP DELETE action

func (PRSubHandler) Get

func (pr PRSubHandler) Get(res http.ResponseWriter, req *http.Request)

Get is PRSubHandler's HTTP GET action

func (PRSubHandler) Patch

func (pr PRSubHandler) Patch(res http.ResponseWriter, req *http.Request)

Patch is PRSubHandler's HTTP PATCH action

func (PRSubHandler) Post

func (pr PRSubHandler) Post(res http.ResponseWriter, req *http.Request)

Post is PRSubHandler's HTTP POST action

func (PRSubHandler) Put

func (pr PRSubHandler) Put(res http.ResponseWriter, req *http.Request)

Put is PRSubHandler's HTTP PUT action

type PostResp

type PostResp struct {
	Status  uint   `json:"status"`
	Message string `json:"message"`
}

PostResp is the standard response on a HTTP POST

type ProjectSubHandler

type ProjectSubHandler struct {
	SubHandler
	Error ErrorHandler
}

ProjectSubHandler handles creating and deleting projects

func (ProjectSubHandler) Delete

func (p ProjectSubHandler) Delete(res http.ResponseWriter, req *http.Request)

Delete removes a projects metadata

func (ProjectSubHandler) Get

Get returns metadata on a project

func (ProjectSubHandler) Patch

func (p ProjectSubHandler) Patch(res http.ResponseWriter, req *http.Request)

Patch does nothing

func (ProjectSubHandler) Post

func (p ProjectSubHandler) Post(res http.ResponseWriter, req *http.Request)

Post creates a project's metadata

func (ProjectSubHandler) Put

Put edits a project's metadata

type PushSubHandler

type PushSubHandler struct {
	SubHandler
	Error ErrorHandler
	Queue *lifecycle.Queue
}

PushSubHandler is the subhandler for handling push hooks

func (PushSubHandler) Delete

func (p PushSubHandler) Delete(res http.ResponseWriter, req *http.Request)

Delete is PushSubHandler's HTTP DELETE action

func (PushSubHandler) Get

func (p PushSubHandler) Get(res http.ResponseWriter, req *http.Request)

Get is PushSubHandler's HTTP GET action

func (PushSubHandler) Patch

func (p PushSubHandler) Patch(res http.ResponseWriter, req *http.Request)

Patch is PushSubHandler's HTTP PATCH action

func (PushSubHandler) Post

func (p PushSubHandler) Post(res http.ResponseWriter, req *http.Request)

Post is PushSubHandler's HTTP POST action

func (PushSubHandler) Put

func (p PushSubHandler) Put(res http.ResponseWriter, req *http.Request)

Put is PushSubHandler's HTTP PUT action

type RepoPayload

type RepoPayload struct {
	ID          uint        `json:"id"`
	Name        string      `json:"name"`
	FullName    string      `json:"full_name"`
	Owner       UserPayload `json:"owner"`
	Description string      `json:"description"`
	Private     bool        `json:"private"`
	Fork        bool        `json:"fork"`
	HTMLURL     string      `json:"html_url"`
	URL         string      `json:"url"`
	CreatedAt   string      `json:"created_at"`
	UpdatedAt   string      `json:"updated_at"`
	PushedAt    string      `json:"pushed_at"`
}

RepoPayload is the struct for Github's api repo object

type RouteHandler

type RouteHandler struct {
	http.Handler
	Route string
	// contains filtered or unexported fields
}

RouteHandler is a HTTP Handler for the server

func NewIndexHandler

func NewIndexHandler() *RouteHandler

NewIndexHandler returns a pointer to a new IndexHandler instance

func NewPRHandler

func NewPRHandler(queue *lifecycle.Queue) *RouteHandler

NewPRHandler returns a pointer to a RouteHandler for Pull Request Events

func NewProjectHandler

func NewProjectHandler() *RouteHandler

NewProjectHandler returns a pointer to a RouteHandler for ProjectSubHandler

func NewPushHandler

func NewPushHandler(queue *lifecycle.Queue) *RouteHandler

NewPushHandler returns a pointer to a RouteHandler for pushes

func (RouteHandler) ServeHTTP

func (rh RouteHandler) ServeHTTP(res http.ResponseWriter, req *http.Request)

ServeHTTP serves http responses

type RouteResp

type RouteResp struct {
	Routes []string `json:"routes"`
}

RouteResp is a struct representing the response to a get on a route that displays subroutes

type SubHandler

type SubHandler interface {
	Get(res http.ResponseWriter, req *http.Request)
	Post(res http.ResponseWriter, req *http.Request)
	Put(res http.ResponseWriter, req *http.Request)
	Patch(res http.ResponseWriter, req *http.Request)
	Delete(res http.ResponseWriter, req *http.Request)
}

SubHandler is an interface to handle http within a RouteHandler

type UserPayload

type UserPayload struct {
	Login     string `json:"login"`
	ID        uint   `json:"id"`
	AvatarURL string `json:"avatar_url"`
	URL       string `json:"url"`
	HTMLURL   string `json:"html_url"`
	Type      string `json:"type"`
	SiteAdmin bool   `json:"site_admin"`
}

UserPayload is the struct for Github's api user object

Jump to

Keyboard shortcuts

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