Documentation ¶
Index ¶
- func EncodeErrorResponse(err error, w http.ResponseWriter) error
- func EncodeJSONResponse(i interface{}, status *int, w http.ResponseWriter) error
- func Logger(inner http.Handler) http.Handler
- func NewRouter(c *Controller) *mux.Router
- type ApiError
- type ApiService
- func (s *ApiService) DeleteAsset(assetId string) (interface{}, error)
- func (s *ApiService) GetAsset(assetId string) (interface{}, error)
- func (s *ApiService) GetAssets() (interface{}, error)
- func (s *ApiService) GetJob(jobId string) (interface{}, error)
- func (s *ApiService) PostAsset(assetCreate AssetCreate) (interface{}, error)
- func (s *ApiService) PostJob(jobCreate JobCreate) (interface{}, error)
- func (s *ApiService) PutAsset(assetId string, assetUpdate AssetUpdate) (interface{}, error)
- type ApiServicer
- type AssetCreate
- type AssetUpdate
- type Controller
- func (c *Controller) DeleteAsset(w http.ResponseWriter, r *http.Request)
- func (c *Controller) GetAsset(w http.ResponseWriter, r *http.Request)
- func (c *Controller) GetAssets(w http.ResponseWriter, r *http.Request)
- func (c *Controller) GetJob(w http.ResponseWriter, r *http.Request)
- func (c *Controller) PostAsset(w http.ResponseWriter, r *http.Request)
- func (c *Controller) PostJob(w http.ResponseWriter, r *http.Request)
- func (c *Controller) PutAsset(w http.ResponseWriter, r *http.Request)
- type JobCreate
- type Task
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EncodeErrorResponse ¶
func EncodeErrorResponse(err error, w http.ResponseWriter) error
EncodeErrorResponse writes the error response for any error that occurred during the request
func EncodeJSONResponse ¶
func EncodeJSONResponse(i interface{}, status *int, w http.ResponseWriter) error
EncodeJSONResponse uses the json encoder to write an interface to the http response with an optional status code
func NewRouter ¶
func NewRouter(c *Controller) *mux.Router
NewRouter creates a new router for any number of api routers
Types ¶
type ApiService ¶
type ApiService struct {
// contains filtered or unexported fields
}
ApiService is a service that implents the logic for the ApiServicer This service should implement the business logic for every endpoint for the API. Include any external packages or services that will be required by this service.
func (*ApiService) DeleteAsset ¶
func (s *ApiService) DeleteAsset(assetId string) (interface{}, error)
DeleteAsset -
func (*ApiService) GetAsset ¶
func (s *ApiService) GetAsset(assetId string) (interface{}, error)
GetAsset -
func (*ApiService) PostAsset ¶
func (s *ApiService) PostAsset(assetCreate AssetCreate) (interface{}, error)
PostAsset -
func (*ApiService) PostJob ¶
func (s *ApiService) PostJob(jobCreate JobCreate) (interface{}, error)
PostJob -
func (*ApiService) PutAsset ¶
func (s *ApiService) PutAsset(assetId string, assetUpdate AssetUpdate) (interface{}, error)
PutAsset -
type ApiServicer ¶
type ApiServicer interface { GetAssets() (interface{}, error) PostAsset(AssetCreate) (interface{}, error) GetAsset(string) (interface{}, error) PutAsset(string, AssetUpdate) (interface{}, error) DeleteAsset(string) (interface{}, error) GetJob(string) (interface{}, error) PostJob(JobCreate) (interface{}, error) }
ApiServicer defines the api actions for the API
type AssetCreate ¶
type AssetUpdate ¶
type AssetUpdate struct { Kind string `json:"kind,omitempty"` File opendam.File `json:"file,omitempty"` // additional assets/files associated with the asset Formats []opendam.Asset `json:"formats,omitempty"` // A list of metadata tags associated with the asset Tags []string `json:"tags,omitempty"` // Any user supplied metadata for the asset Metadata map[string]interface{} `json:"metadata,omitempty"` }
AssetUpdate - A limited view of an asset with only editable fields. Formats, tags, and metadata are merged with any existing values
type Controller ¶
type Controller struct {
// contains filtered or unexported fields
}
A Controller binds http requests to an api service and writes the service results to the http response
func NewController ¶
func NewController(s ApiServicer) *Controller
NewController creates an api controller
func (*Controller) DeleteAsset ¶
func (c *Controller) DeleteAsset(w http.ResponseWriter, r *http.Request)
DeleteAsset -
func (*Controller) GetAsset ¶
func (c *Controller) GetAsset(w http.ResponseWriter, r *http.Request)
GetAsset -
func (*Controller) GetAssets ¶
func (c *Controller) GetAssets(w http.ResponseWriter, r *http.Request)
GetAssets -
func (*Controller) GetJob ¶
func (c *Controller) GetJob(w http.ResponseWriter, r *http.Request)
GetJob -
func (*Controller) PostAsset ¶
func (c *Controller) PostAsset(w http.ResponseWriter, r *http.Request)
PostAsset -
func (*Controller) PostJob ¶
func (c *Controller) PostJob(w http.ResponseWriter, r *http.Request)
PostJob -
func (*Controller) PutAsset ¶
func (c *Controller) PutAsset(w http.ResponseWriter, r *http.Request)
PutAsset -