Go API Documentation

github.com/semaphoreui/semaphore/api/helpers

No package summary is available.

Package

Files: 4. Third party imports: 3. Imports from organisation: 0. Tests: 0. Benchmarks: 0.

Constants

Types

EventLogItem

This type doesn't have documentation.

Field name Field type Comment
IntegrationID

int

No comment on field.
UserID

int

No comment on field.
ProjectID

int

No comment on field.
ObjectType

db.EventObjectType

No comment on field.
ObjectID

int

No comment on field.
Description

string

No comment on field.

EventLogType

This type doesn't have documentation.

Field name Field type Comment
type

string

No comment on field.

H

H just a string-to-anything map

Field name Field type Comment
type

map[string]any

No comment on field.

Functions

func Bind

Bind decodes json into object

Uses: http.StatusBadRequest, json.NewDecoder.

func EventLog

Uses: db.Event, log.WithFields, util.Config, util.EventLogRecord.

func GetIntParam

GetIntParam fetches a parameter from the route variables as an integer redirects to a 404 or writes bad request state depending on error state

Uses: http.Redirect, http.StatusBadRequest, http.StatusFound, mux.Vars, strconv.Atoi.

func GetStrParam

GetStrParam fetches a parameter from the route variables as an integer redirects to a 404 or writes bad request state depending on error state

Uses: fmt.Errorf, http.Redirect, http.StatusBadRequest, http.StatusFound, mux.Vars.

func QueryParams

Uses: db.RetrieveQueryParams.

func QueryParamsForProps

Uses: db.RetrieveQueryParams, slices.Index.

func QueryParamsWithOwner

Uses: strconv.Atoi.

func Store

Uses: context.Get, db.Store.

func TaskPool

Uses: context.Get, tasks.TaskPool.

func UserFromContext

Uses: context.Get, db.User.

func WriteError

Uses: db.ErrInvalidOperation, db.ErrNotFound, db.ValidationError, debug.PrintStack, errors.As, errors.Is, http.StatusBadRequest, http.StatusConflict, http.StatusForbidden, http.StatusNotFound, log.Error, tasks.ErrInvalidSubscription.

func WriteErrorStatus

func WriteJSON

WriteJSON writes object as JSON

Uses: debug.PrintStack, json.NewEncoder, log.Error.

Private functions

func appendEventToLog

AppendEventToLog opens (or creates) the log file in append mode and writes the Event in key=value format.

func isXHR

References: strings.Contains.


Tests

Files: 1. Third party imports: 1. Imports from organisation: 0. Tests: 1. Benchmarks: 0.

Test functions

TestGetIntParam

References: http.NewRequest, httptest.NewRecorder, mux.NewRouter.