Documentation
¶
Index ¶
Constants ¶
const ( // PathParameterJobNumber is the name of the job number path parameter. PathParameterJobNumber = "job_number" // QueryParameterLimit is the name of the limit query parameter. QueryParameterLimit = "limit" // QueryParameterOffset is the name of the offset query parameter. QueryParameterOffset = "offset" // QueryParameterSort is the name of the sort query parameter. QueryParameterSort = "sort" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type MigrationAPI ¶ added in v0.4.0
type MigrationAPI struct {
JobService application.JobService
Migrator migrator.Migrator
Paginator *Paginator
Router *mux.Router
AuthMiddleware auth.Middleware
}
MigrationAPI provides a struct to wrap the api around
func Setup ¶
func Setup(_ context.Context, cfg *config.Config, router *mux.Router, jobService application.JobService, authMiddleware auth.Middleware) *MigrationAPI
Setup function sets up the api and returns an api context has been blanked here for now in anticipation of future use
type PaginatedHandler ¶ added in v0.10.0
type PaginatedHandler func(w http.ResponseWriter, r *http.Request, limit int, offset int) (items interface{}, totalCount int, err error)
PaginatedHandler defines a handler function signature for paginated endpoints
type PaginatedResponse ¶ added in v0.10.0
type PaginatedResponse struct {
Items interface{} `json:"items"`
PaginationFields // embedded, flattening fields into JSON
}
PaginatedResponse represents a paginated API response
type PaginationFields ¶ added in v0.10.0
type PaginationFields struct {
Count int `json:"count"`
Limit int `json:"limit"`
Offset int `json:"offset"`
TotalCount int `json:"total_count"`
}
PaginationFields represents the generic fields used to describe pagination in an API response
type Paginator ¶ added in v0.10.0
Paginator handles pagination logic for API endpoints
func NewPaginator ¶ added in v0.10.0
NewPaginator creates a new Paginator with specified default values
func (*Paginator) Paginate ¶ added in v0.10.0
func (p *Paginator) Paginate(paginatedHandler PaginatedHandler) func(w http.ResponseWriter, r *http.Request)
Paginate is a middleware function that handles pagination for API endpoints
type StateChangeRequest ¶ added in v0.20.0
StateChangeRequest represents the payload used to request a job state change.