Documentation ¶
Index ¶
- Constants
- Variables
- func DELETECreation(c *gin.Context)
- func DELETEPackage(c *gin.Context)
- func DELETEUser(c *gin.Context)
- func GETCreationCode(c *gin.Context)
- func GETCreations(c *gin.Context)
- func GETPackages(c *gin.Context)
- func GETPlans(c *gin.Context)
- func GETTags(c *gin.Context)
- func GETUser(c *gin.Context)
- func GenerateToken(c *gin.Context)
- func HandleErrors(c *gin.Context)
- func PATCHCreation(c *gin.Context)
- func PATCHPackage(c *gin.Context)
- func PATCHUser(c *gin.Context)
- func POSTCreation(c *gin.Context)
- func POSTCreationVersion(c *gin.Context)
- func POSTFile(c *gin.Context)
- func POSTPackage(c *gin.Context)
- func POSTUser(c *gin.Context)
- func POSTUserBank(c *gin.Context)
- func POSTWebhooks(c *gin.Context)
- func PUTCreation(c *gin.Context)
- func PUTPackage(c *gin.Context)
- func PUTPackageCreation(c *gin.Context)
- func PushCreation(c *gin.Context)
- func RefreshToken(c *gin.Context)
- func RemovePackageCreation(c *gin.Context)
- func SaveVersion(c *gin.Context)
- type APIError
- type APIErrors
- type JSONRes
Constants ¶
const ( Created int = http.StatusCreated OK int = http.StatusOK NoContent int = http.StatusNoContent )
Http status
Variables ¶
var ( ErrActivation = NewAPIError(activationFail, "Activation failed", "The token might be wrong", http.StatusConflict) ErrAliasRequired = NewAPIError(aliasRequired, "Alias required", "Creation name should be unique in a package : creation %s should have an alias", http.StatusBadRequest) ErrBadCreds = NewAPIError(badCreds, "Wrong credentials", "Unknown email or password invalid", http.StatusUnauthorized) ErrBadFileFormat = NewAPIError(badFileFormat, "Server can't handle this file", "Allowed formats are : %s", http.StatusBadRequest) ErrBadForm = NewAPIError(badForm, "Form invalid", "", http.StatusBadRequest) ErrBadScriptDoc = NewAPIError(badScriptDoc, "Missing document initializer", "Document initializer is required and shloud be in the constructor : %s", http.StatusBadRequest) ErrBadScriptClass = NewAPIError(badScriptClass, "Missing class", "Class Woobly is mandatory", http.StatusBadRequest) ErrBadScriptConst = NewAPIError(badScriptConst, "Missing constructor", "A constructor is mandatory : %s", http.StatusBadRequest) ErrBetterPlan = NewAPIError(betterPlan, "Already has a better plan", "Current plan %s and requested plan is %s", http.StatusConflict) ErrCreaNotAvail = NewAPIError(creaNotAvail, "Creation not available", "The creation %s is not available", http.StatusConflict) ErrCreaVersion = NewAPIError(creaVersion, "Bad version", "Version %s can't be created", http.StatusBadRequest) ErrDB = NewAPIError(dbFail, "Database error", "Database failed to process the request", http.StatusConflict) ErrIntServ = NewAPIError(servIntErr, "Internal server error", "Something wrong happened", http.StatusInternalServerError) ErrPlanLimit = NewAPIError(planLimit, "Plan limit exceeded", "Number of %s limited by actual plan %s", http.StatusUnauthorized) ErrResNotFound = NewAPIError(resNotFound, "Resource not found", "%s %v not found", http.StatusNotFound) ErrServ = NewAPIError(servErr, "Internal server error", "Something wrong happened while processing %s", http.StatusInternalServerError) )
API errors
Functions ¶
func DELETECreation ¶
DELETECreation delete the creation of the authenticated user
func GETCreations ¶
GETCreations is a handler that returns one or more creations
func GETPackages ¶
GETPackages is a handler that returns one or more packages
func GETUser ¶
GETUser returns one users with private infos if authenticated, with public infos if not
func POSTCreationVersion ¶
POSTCreationVersion creates a new version
func POSTPackage ¶
POSTPackage is a handler that create am empty Wooble package
func POSTUserBank ¶
POSTUserBank creates bank info for customer (only for funds)
func PUTPackageCreation ¶
PUTPackageCreation updates a package creation
func PushCreation ¶
PushCreation is an handler that pushes one or more creations in a package
func RefreshToken ¶
RefreshToken refreshes a token (lifetime is given in the server conf file $CONFPATH)
func RemovePackageCreation ¶
RemovePackageCreation remove a creation from a package
func SaveVersion ¶
SaveVersion save the current code for a version (must be in draft state)
Types ¶
type APIError ¶
type APIError struct { Code errCode `json:"code"` Title string `json:"title"` Details string `json:"details,omitempty"` Status int `json:"status"` Params map[string]interface{} `json:"params,omitempty"` }
APIError is a struct that standardize a Wooble error
func NewAPIError ¶
NewAPIError creates an APIError
func (APIError) SetParams ¶
SetParams adds params to APIError, parameters must be in as the following : key(string), value(interface) ...
func (APIError) ValidationError ¶
func (e APIError) ValidationError(ve validator.FieldError) APIError
ValidationError builds and sets validation errors
type APIErrors ¶
type APIErrors struct {
Errors []APIError `json:"errors,omitempty"`
}
APIErrors wrap all API errors
func (*APIErrors) HTTPStatus ¶
HTTPStatus returns the HTTP status of errors