Documentation ¶
Overview ¶
Package api implements the REST API for the scrap exchange service.
See also the Scrap Exchange Design Doc http://go/scrap-exchange.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Api ¶
type Api struct {
// contains filtered or unexported fields
}
Api supplies the handlers for the scrap exchange REST API.
func (*Api) AddHandlers ¶
AddHandlers hooks up the Scrap Exchange REST API to the given router.
The value of 'option' controls if Protected endpoints, such as the one for creating scraps, are added to the router.
+----------------------------------------+--------+---------+---------------+-----------------------------------+------+ | URL | Method | Request | Response | Description | Prot | +----------------------------------------+--------+---------+---------------+-----------------------------------+------+ | /_/scraps/ | POST | Scrap | ScrapID | Creates a new scrap. | Y | +----------------------------------------+--------+---------+---------------+-----------------------------------+------+ | /_/scraps/{type}/({hash}|{name}) | GET | | ScrapBody | Returns the scrap. | | +----------------------------------------+--------+---------+---------------+-----------------------------------+------+ | /_/scraps/{type}/({hash}|{name}) | DELETE | | | Removes the scrap. | Y | +----------------------------------------+--------+---------+---------------+-----------------------------------+------+ | /_/raw/{type}/({hash}|{name}) | GET | | text/plain | Returns the raw scrap. | | | | | | image/svg+xml | | | +----------------------------------------+--------+---------+---------------+-----------------------------------+------+ | /_/tmpl/{type}/({hash}|{name})/{lang} | GET | | text/plain | Templated scrap. | | +----------------------------------------+--------+---------+---------------+-----------------------------------+------+ | /_/names/{type}/{name} | PUT | Name | | Creates/Updates a named scrap. | Y | +----------------------------------------+--------+---------+---------------+-----------------------------------+------+ | /_/names/{type}/{name} | GET | | Name | Retrieves a single named scrap | | +----------------------------------------+--------+---------+---------------+-----------------------------------+------+ | /_/names/{type}/{name} | DELETE | | | Deletes the scrap name. | Y | +----------------------------------------+--------+---------+---------------+-----------------------------------+------+ | /_/_names/{type}/ | GET | | []string | Returns all named scraps of type. | | +----------------------------------------+--------+---------+---------------+-----------------------------------+------+
Click to show internal directories.
Click to hide internal directories.