Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Endpoint ¶
An Endpoint encodes what method, status return code, and REST resource that that Endpoint responds to.
The pattern that implementors will see is that of declaring a struct that both implements this interface and can be JSON serialized to the expected input of that endpoint (if any).
An example implementation may be...
type UpdateBug struct { BugId int `json:"-"` // This is not in the Bugzilla API, it is for building the resource api.Update api.Ok Assignee string `json:"assignee"` Status string `json:"status"` Resolution string `json:"resolution"` ... } func (u *UpdateBug) Resource() string { return fmt.Sprintf("/bug/%d", u.BugId) }
type Expecter ¶
type Expecter interface {
Expect() int
}
An Expecter returns the HTTP status code that signifies an successful response.
It is intended that consumers of this API embed the provided types in a declarative fashion. For example:
type GetBug struct { ... api.Ok }
type Methoder ¶
type Methoder interface {
Method() string
}
A Methoder returns the HTTP method that the target endpoint is listening on.
It is intended that consumers of this API embed the provided types in a declarative fashion. For example:
type UpdateBug struct { ... api.Update }
type Resourcer ¶
type Resourcer interface {
Resource() string
}
A Resourcer returns the REST API resource for accessing a given endpoint. The returned string should fulfill all paths BEYOND the base path and "rest" resource (proto>://<hostname>/rest).
E.G. If we are accessing a bug at "https://bugzilla-dev.allizom.org" then this method should return "/bug/<id>"