work on README

This commit is contained in:
Sam Woodard 2015-07-13 10:07:12 -07:00
parent c82586a2bb
commit 1514449cab
1 changed files with 30 additions and 1 deletions

View File

@ -95,11 +95,37 @@ type Comment struct {
## Handler Examples
Now you have your structs prepared to be seralized or materialized.
Now you have your structs are prepared to be seralized or materialized.
What about the rest?
### Create
You can Unmarshal a jsonapi payload using `jsonapi.UnmarshalPayload`; convert an io
into a struct instance using jsonapi tags on struct fields. Method supports single
request payloads only, at the moment. Bulk creates and updates are not supported yet.
#### `UnmarshalPayload`
```go
UnmarshalPayload(in io.Reader, model interface{})
```
Visit [godoc](http://godoc.org/github.com/shwoodard/jsonapi#UnmarshalPayload)
#### `MarshalOnePayload`
This method encodes a response for a single record only. If you want to serialize many
records, see, [MarshalManyPayload](#MarshalManyPayload). Wrties a jsonapi response, with
related records sideloaded, into `included` array.
```go
MarshalOnePayloadEmbedded(w io.Writer, model interface{}) error
```
Visit [godoc](http://godoc.org/github.com/shwoodard/jsonapi#MarshalOnePayload)
#### Example
```go
func CreateBlog(w http.ResponseWriter, r *http.Request) {
blog := new(Blog)
@ -120,3 +146,6 @@ func CreateBlog(w http.ResponseWriter, r *http.Request) {
}
```
### List
#### `MarshalManyPayload`
#### Example