95 lines
3.2 KiB
Go
95 lines
3.2 KiB
Go
package api_acladmin
|
|
|
|
/*******************************************************************/
|
|
// used in getResources()
|
|
type getResourcesResponse []struct {
|
|
ID uint `json:"id" example:"1"`
|
|
Key string `json:"key" example:"html.view"`
|
|
}
|
|
|
|
/*******************************************************************/
|
|
// used in getResource()
|
|
type getResourceResponse struct {
|
|
ID uint `json:"id" example:"1"`
|
|
Key string `json:"key" example:"html.view"`
|
|
}
|
|
|
|
type getResourceErrorInvalidResourceID struct {
|
|
Error string `json:"error" example:"INVALID_RESOURCE_ID"`
|
|
Details string `json:"details" example:"Resource ID must be positive integer"`
|
|
}
|
|
|
|
type getResourceErrorResourceNotFound struct {
|
|
Error string `json:"error" example:"RESOURCE_NOT_FOUND"`
|
|
Details string `json:"details" example:"No resource with ID 123"`
|
|
}
|
|
|
|
/*******************************************************************/
|
|
// used in createResource()
|
|
type createResourceRequest struct {
|
|
Key string `json:"key" example:"html.view"`
|
|
}
|
|
|
|
type createResourceResponse struct {
|
|
ID uint `json:"id" example:"1"`
|
|
Key string `json:"key" example:"html.view"`
|
|
}
|
|
|
|
type createResourceErrorResourceAlreadyExists struct {
|
|
Error string `json:"error" example:"FAILED_TO_CREATE_RESOURCE"`
|
|
Details string `json:"details" example:"Resource with key 'html.view' already exists"`
|
|
}
|
|
|
|
type createResourceErrorInvalidResourceKey struct {
|
|
Error string `json:"error" example:"FAILED_TO_CREATE_RESOURCE"`
|
|
Details string `json:"details" example:"Invalid resource key"`
|
|
}
|
|
|
|
/*******************************************************************/
|
|
// used in updateResource()
|
|
type updateResourceRequest struct {
|
|
Key string `json:"key" example:"html.view"`
|
|
}
|
|
|
|
type updateResourceResponse struct {
|
|
ID uint `json:"id" example:"1"`
|
|
Key string `json:"key" example:"html.view"`
|
|
}
|
|
|
|
type updateResourceErrorResourceNotFound struct {
|
|
Error string `json:"error" example:"RESOURCE_NOT_FOUND"`
|
|
Details string `json:"details" example:"No resource with ID 123"`
|
|
}
|
|
|
|
type updateResourceErrorInvalidResourceID struct {
|
|
Error string `json:"error" example:"INVALID_RESOURCE_ID"`
|
|
Details string `json:"details" example:"Resource ID must be positive integer"`
|
|
}
|
|
|
|
type updateResourceErrorInvalidResourceKey struct {
|
|
Error string `json:"error" example:"FAILED_TO_UPDATE_RESOURCE"`
|
|
Details string `json:"details" example:"Invalid resource key"`
|
|
}
|
|
|
|
type updateResourceErrorResourceKeyAlreadyExists struct {
|
|
Error string `json:"error" example:"FAILED_TO_UPDATE_RESOURCE"`
|
|
Details string `json:"details" example:"Resource with key 'html.view' already exists"`
|
|
}
|
|
|
|
/*******************************************************************/
|
|
// used in deleteResource()
|
|
type deleteResourceErrorResourceNotFound struct {
|
|
Error string `json:"error" example:"RESOURCE_NOT_FOUND"`
|
|
Details string `json:"details" example:"No resource with ID 123"`
|
|
}
|
|
|
|
type deleteResourceErrorInvalidResourceID struct {
|
|
Error string `json:"error" example:"INVALID_RESOURCE_ID"`
|
|
Details string `json:"details" example:"Resource ID must be positive integer"`
|
|
}
|
|
|
|
type deleteResourceErrorResourceInUse struct {
|
|
Error string `json:"error" example:"FAILED_TO_DELETE_RESOURCE"`
|
|
Details string `json:"details" example:"Resource with ID 123 is used and cannot be deleted"`
|
|
}
|