rest

package
v0.0.0-...-9a8ef1a Latest Latest
Warning

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

Go to latest
Published: Jun 10, 2018 License: GPL-3.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Time the session cookie should be valid when remember
	// me option is used during login.
	SESSION_TIMEOUT_REMEBERME = 7 * 24 * time.Hour
	SESSION_TIMEOUT_NORMAL    = 15 * time.Minute
)
View Source
const (
	// groups
	GROUP_QUERYALL = "queryall"
	GROUP_QUERYONE = "one"

	// custom headerfields
	HEADER_TIMESTAMP = "X-Timestamp"

	// HTTP GET query parameters for paging
	GET_QUERY_LIMIT = "limit"
	GET_QUERY_SKIP  = "skip"

	// flags
	QUERY_REVERSE = iota
)
View Source
const (
	CONTENT_TYPE_JSON   = "application/json"
	CONTENT_TYPE_SVG    = "image/svg+xml"
	CONTENT_TYPE_TEXT   = "text/plain"
	CONTENT_TYPE_STREAM = "application/octet-stream"
)
View Source
const (
	TOKEN_QUERY_NAME = "token"
)

Variables

View Source
var (
	ErrEmptyJson = errors.New("empty json object")
)
View Source
var (
	ErrInvalidRef = errors.New("ref must be struct or slice")
)

Functions

func BuildArtifacts

func BuildArtifacts(w http.ResponseWriter, r *http.Request)

Gets the tar.gz archive of the build artifacts.

func BuildPurge

func BuildPurge(r *http.Request)

Callback when build history purging was successfull.

func BuildRawLog

func BuildRawLog(w http.ResponseWriter, r *http.Request)

Gets the whole raw log of a build.

func BuildStageLog

func BuildStageLog(w http.ResponseWriter, r *http.Request)

Gets the raw log of a specific stage of a build.

func DeleteAll

func DeleteAll(r *mux.Router, path string, ref interface{}, success func(*http.Request)) error

Deletes all url field matching entries. The success function is called afterwards.

func GetCookie

func GetCookie(r *http.Request, name string) (string, error)

Gets the value of a cookie.

func InvalidateCookie

func InvalidateCookie(path, name string) *http.Cookie

Invalidates the given cookie.

func JsonBody

func JsonBody(r *http.Request) (*jsonq.JsonQuery, error)

Reads the body of the request an parses the JSON data.

func Jsonify

func Jsonify(w http.ResponseWriter, v interface{})

Writes the JSON representation of v to the supplied http.ResposeWriter. If an error occours while marshalling the object the http response will be an internal server error.

func Login

func Login(w http.ResponseWriter, r *http.Request)

Try to login the user with provided credentials.

func Logout

func Logout(w http.ResponseWriter, r *http.Request)

Logout the user.

func NoCaching

func NoCaching(w http.ResponseWriter)

Applies necessary headers to disable caching.

func ProjectBadge

func ProjectBadge(w http.ResponseWriter, r *http.Request)

Badge (failing / passing) for the project.

func ProjectLatestBuild

func ProjectLatestBuild(w http.ResponseWriter, r *http.Request)

Queries on project by its id.

func ProjectList

func ProjectList(w http.ResponseWriter, r *http.Request)

Gets the project short list.

func ProjectTrigger

func ProjectTrigger(w http.ResponseWriter, r *http.Request)

func ProjectUpdate

func ProjectUpdate(r *http.Request)

Success Handler: Update Project

func QueryAll

func QueryAll(router *mux.Router, path string, ref interface{}, flags ...int) error

Queries all entries by one ore more fields. The entries are matched against the url routing parameters.

func QueryOne

func QueryOne(r *mux.Router, path string, ref interface{}) error

Queries just on entry by one ore more fields. The entries are matched against the url routing parameters.

func ServeFile

func ServeFile(w http.ResponseWriter, path string, contentType string)

Serves a file from the global assetfs.

func UpdateOne

func UpdateOne(r *mux.Router, path string, ref interface{}, success func(*http.Request)) error

Registers an update handler for one instance, matching the url fields.

Types

This section is empty.

Jump to

Keyboard shortcuts

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