| 1 |
package resource |
| 2 |
|
| 3 |
// The Response struct implements api2go.Responder |
| 4 |
type Response struct { |
| 5 |
Res interface{} |
| 6 |
Code int |
| 7 |
} |
| 8 |
|
| 9 |
// Metadata returns additional meta data |
| 10 |
func (r Response) Metadata() map[string]interface{} { |
| 11 |
return map[string]interface{}{ |
| 12 |
"author": "The api2go examples crew", |
| 13 |
"license": "wtfpl", |
| 14 |
"license-url": "http://www.wtfpl.net", |
| 15 |
} |
| 16 |
} |
| 17 |
|
| 18 |
// Result returns the actual payload |
| 19 |
func (r Response) Result() interface{} { |
| 20 |
return r.Res |
| 21 |
} |
| 22 |
|
| 23 |
// StatusCode sets the return status code |
| 24 |
func (r Response) StatusCode() int { |
| 25 |
return r.Code |
| 26 |
} |