-
Notifications
You must be signed in to change notification settings - Fork 0
/
media_types.go
78 lines (68 loc) · 2.58 KB
/
media_types.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
// Code generated by goagen v1.3.0, DO NOT EDIT.
//
// API "celler": Application Media Types
//
// Command:
// $ goagen
// --design=github.com/ReSTARTR/goa-gorm-sample/design
// --out=$(GOPATH)/src/github.com/ReSTARTR/goa-gorm-sample
// --version=v1.3.0
package client
import (
"github.com/goadesign/goa"
"net/http"
)
// user media type (default view)
//
// Identifier: application.vnd.user+json; view=default
type ApplicationVndUser struct {
// description
Description *string `form:"description,omitempty" json:"description,omitempty" xml:"description,omitempty"`
// id
ID *int `form:"id,omitempty" json:"id,omitempty" xml:"id,omitempty"`
// title
Title *string `form:"title,omitempty" json:"title,omitempty" xml:"title,omitempty"`
}
// DecodeApplicationVndUser decodes the ApplicationVndUser instance encoded in resp body.
func (c *Client) DecodeApplicationVndUser(resp *http.Response) (*ApplicationVndUser, error) {
var decoded ApplicationVndUser
err := c.Decoder.Decode(&decoded, resp.Body, resp.Header.Get("Content-Type"))
return &decoded, err
}
// ApplicationVndUserCollection is the media type for an array of ApplicationVndUser (default view)
//
// Identifier: application.vnd.user+json; type=collection; view=default
type ApplicationVndUserCollection []*ApplicationVndUser
// DecodeApplicationVndUserCollection decodes the ApplicationVndUserCollection instance encoded in resp body.
func (c *Client) DecodeApplicationVndUserCollection(resp *http.Response) (ApplicationVndUserCollection, error) {
var decoded ApplicationVndUserCollection
err := c.Decoder.Decode(&decoded, resp.Body, resp.Header.Get("Content-Type"))
return decoded, err
}
// A bottle of wine (default view)
//
// Identifier: application/vnd.goa.example.com+json; view=default
type GoaExampleCom struct {
// API href for making requests on the bottle
Href string `form:"href" json:"href" xml:"href"`
// Unique bottle ID
ID int `form:"id" json:"id" xml:"id"`
// Name of wine
Name string `form:"name" json:"name" xml:"name"`
}
// Validate validates the GoaExampleCom media type instance.
func (mt *GoaExampleCom) Validate() (err error) {
if mt.Href == "" {
err = goa.MergeErrors(err, goa.MissingAttributeError(`response`, "href"))
}
if mt.Name == "" {
err = goa.MergeErrors(err, goa.MissingAttributeError(`response`, "name"))
}
return
}
// DecodeGoaExampleCom decodes the GoaExampleCom instance encoded in resp body.
func (c *Client) DecodeGoaExampleCom(resp *http.Response) (*GoaExampleCom, error) {
var decoded GoaExampleCom
err := c.Decoder.Decode(&decoded, resp.Body, resp.Header.Get("Content-Type"))
return &decoded, err
}