design

package
v0.0.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 24, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var APIKeyAuth = APIKeySecurity("api_key", func() {
	Description("Secures endpoint by requiring an API key.")
})

APIKeyAuth defines a security scheme that uses API keys.

View Source
var AppVersion = Type("version", func() {
	Description("Application version information")
	Attribute("version", String, "Application version", func() {
		Example("1.0")
	})
	Attribute("build_time", String, "Application build time", func() {
		Example("")
	})
})
View Source
var BadRequest = Type("bad-request", func() {
	Description("bad-request indicates the values provided are invalid")
	Attribute("name", String, "Name of error", func() { Example("bad request") })
	Attribute("message", String, "Error message", func() {
		Example("bad request")
	})
	Attribute("detail", String, "Error details", func() {
		Example("Failed to validate information. Cannot continue.")
	})
	Required("message", "detail", "name")
})
View Source
var Forbidden = Type("forbidden", func() {
	Description("forbidden indicates access to a resource was denied")
	Attribute("name", String, "Name of error", func() { Example("forbidden") })
	Attribute("message", String, "Error message", func() {
		Example("bad request")
	})
	Attribute("detail", String, "Error details", func() {
		Example("Failed to determine machine information. Cannot continue.")
	})
	Required("message", "detail", "name")
})
View Source
var NotFound = Type("not-found", func() {
	Description("not-found indicates the resource matching the id does not exist.")
	Attribute("id", String, "ID of device", func() {
		Example("resource_1234567")
	})
	Attribute("name", String, "Name of error", func() { Example("not found") })
	Attribute("message", String, "Error message", func() {
		Example("bad request")
	})
	Attribute("detail", String, "Error details", func() {
		Example("Resource not found")
	})
	Required("message", "detail", "name")

})
View Source
var Origins = []string{
	"/127.0.0.1:\\d+/",
	"/localhost:\\d+/",
	"/192.168.(\\d+).(\\d+):\\d+/",
}
View Source
var PaginationMetadata = Type("PaginationMetadata", func() {
	Attribute("total", Int32, func() { Example(25) })
	Attribute("current_page", Int32, func() { Example(1) })
	Attribute("first_page", Int32, func() { Example(1) })
	Attribute("last_page", Int32, func() { Example(10) })
	Attribute("page_size", Int32, func() { Example(20) })
	Required("total", "page_size", "first_page", "current_page", "last_page")
})
View Source
var ServerError = Type("server-error", func() {
	Description("server-error indicates the server encountered an error.")
	Attribute("name", String, "Name of error", func() { Example("internal server error") })
	Attribute("message", String, "Error message", func() {
		Example("bad request")
	})
	Attribute("detail", String, "Error details", func() {
		Example("Failed to determine machine information. Cannot continue.")
	})
	Required("message", "detail", "name")
})
View Source
var TeamIn = Type("Team", func() {
	Description("Team object")
	Attribute("name", String, "Name", func() { Example("Dream Team") })
	Required("name")
})
View Source
var TeamResult = ResultType("application/vnd.tawny.team", func() {
	TypeName("Team")
	Description("A single team")
	Attribute("uuid", String, "Team ID", func() {
		Pattern(teamRx)
		Example("team_1234567")
	})
	Attribute("name", String, "Name", func() { Example("Dream Team") })
	Attribute("personal_team", Boolean, "personal_team", func() { Example(false) })
	createdAndUpdateAtResult()
	Required("uuid", "name", "personal_team")

	View(viewDefault, func() {
		Attribute("uuid")
		Attribute("name")
		Attribute("personal_team")
	})
})
View Source
var Unauthorized = Type("unauthorized", func() {
	Description("unauthorized indicates authentication failed")
	Attribute("message", String, "Message of the error", func() {
		Example("unauthorized")
	})
	Required("message")
})
View Source
var UserIn = Type("User", func() {
	Description("User object")
	Attribute("name", String, "Name of the user", func() { Example("Daniel") })
	Attribute("password", String, "ID of the user", func() { Example("fakePassword") })
	Attribute("email", String, "Email of the user", func() { Example("email@example.com") })
	Required("name", "password", "email")
})
View Source
var UserResult = ResultType("application/vnd.tawny.user", func() {
	TypeName("UserResult")
	Description("A single user")

	Attribute("user_uuid", String, "User ID", func() { Example("user_1234567") })
	Attribute("name", String, "name", func() { Example("Daniel") })
	Attribute("email", String, "Email", func() { Example("me@gmail.com") })
	Attribute("role", String, "Role", func() { Example("admin") })
	createdAndUpdateAtResult()
	Required("name", "email", "role")

	View(viewDefault, func() {
		Attribute("user_uuid")
		Attribute("name")
		Attribute("email")
		Attribute("role")
		Attribute("created_at")
		Attribute("updated_at")
	})
})
View Source
var UsersResult = ResultType("application/vnd.tawny.users", func() {
	TypeName("Users")
	Attributes(func() {
		Attribute("users", CollectionOf(UserResult))
		Attribute("metadata", PaginationMetadata)
		Required("users", "metadata")
	})
})

Functions

func PaginationQueryParams added in v0.0.3

func PaginationQueryParams(page, pageSize int) (int32, int32)

PaginationQueryParams returns the current_page and page_size values

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL