Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var Account = MediaType("application/vnd.account+json", func() {
Description("A tenant account")
Attributes(func() {
Attribute("id", Integer, "ID of account")
Attribute("href", String, "API href of account")
Attribute("name", String, "Name of account")
Attribute("created_at", String, "Date of creation", func() {
Format("date-time")
})
Attribute("created_by", String, "Email of account owner", func() {
Format("email")
})
})
View("default", func() {
Attribute("id")
Attribute("href")
Attribute("name")
Attribute("created_at")
Attribute("created_by")
})
View("link", func() {
Attribute("id")
Attribute("href")
Attribute("name")
})
})
Account is the account resource media type.
View Source
var Bottle = MediaType("application/vnd.bottle+json", func() { Description("A bottle of wine") Reference(BottlePayload) Attributes(func() { Attribute("id", Integer, "ID of bottle") Attribute("href", String, "API href of bottle") Attribute("rating", Integer, "Rating of bottle between 1 and 5", func() { Minimum(1) Maximum(5) }) Attribute("account", Account, "Account that owns bottle") Attribute("created_at", String, "Date of creation", func() { Format("date-time") }) Attribute("updated_at", String, "Date of last update", func() { Format("date-time") }) Attribute("name") Attribute("vineyard") Attribute("varietal") Attribute("vintage") Attribute("color") Attribute("sweetness") Attribute("country") Attribute("region") Attribute("review") Links(func() { Link("account") }) View("default", func() { Attribute("id") Attribute("href") Attribute("name") Attribute("rating") Attribute("vineyard") Attribute("varietal") Attribute("vintage") Attribute("links") }) View("tiny", func() { Attribute("id") Attribute("href") Attribute("name") Attribute("rating") Attribute("links") }) View("full", func() { Attribute("id") Attribute("href") Attribute("name") Attribute("account", func() { View("full") }) Attribute("rating") Attribute("vineyard") Attribute("varietal") Attribute("vintage") Attribute("color") Attribute("sweetness") Attribute("country") Attribute("region") Attribute("review") Attribute("created_at") Attribute("updated_at") Attribute("links") }) }) })
Bottle is the bottle resource media type.
View Source
var BottlePayload = Type("BottlePayload", func() {
Attribute("name", func() {
MinLength(2)
})
Attribute("vineyard", func() {
MinLength(2)
})
Attribute("varietal", func() {
MinLength(4)
})
Attribute("vintage", Integer, func() {
Minimum(1900)
Maximum(2020)
})
Attribute("color", func() {
Enum("red", "white", "rose", "yellow", "sparkling")
})
Attribute("sweetness", Integer, func() {
Minimum(1)
Maximum(5)
})
Attribute("country", func() {
MinLength(2)
})
Attribute("region")
Attribute("review", func() {
MinLength(10)
MaxLength(300)
})
})
BottlePayload defines the data structure used in the create bottle request body. It is also the base type for the bottle media type used to render bottles.
Functions ¶
This section is empty.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.