Documentation ¶
Overview ¶
Package design contains the generic API machinery code of our adder API generated using goa framework. This generated API accepts HTTP GET/POST/PATCH/PUT/DELETE requests from multiple clients.
Index ¶
- Variables
- func JSONList(name, description string, data *d.UserTypeDefinition, ...) *d.MediaTypeDefinition
- func JSONResourceObject(name string, attributes *d.UserTypeDefinition, ...) *d.UserTypeDefinition
- func JSONSingle(name, description string, data *d.UserTypeDefinition, ...) *d.MediaTypeDefinition
Constants ¶
This section is empty.
Variables ¶
var AuthStatus = a.MediaType("application/vnd.status+json", func() { a.Description("The status of the current running instance") a.Attributes(func() { a.Attribute("commit", d.String, "Commit SHA this build is based on") a.Attribute("buildTime", d.String, "The time when built") a.Attribute("startTime", d.String, "The time when started") a.Attribute("devMode", d.Boolean, "'True' if the Developer Mode is enabled") a.Attribute("databaseStatus", d.String, "The status of Database connection. 'OK' or an error message is displayed.") a.Attribute("configurationStatus", d.String, "The status of the used configuration. 'OK' or an error message if there is something wrong with the configuration used by service.") a.Required("commit", "buildTime", "startTime", "databaseStatus", "configurationStatus") }) a.View("default", func() { a.Attribute("commit") a.Attribute("buildTime") a.Attribute("startTime") a.Attribute("devMode") a.Attribute("databaseStatus") a.Attribute("configurationStatus") }) })
AuthStatus defines the status of the current running Auth instance
var AuthToken = a.MediaType("application/vnd.authtoken+json", func() { a.TypeName("AuthToken") a.Description("JWT Token") a.Attributes(func() { a.Attribute("token", tokenData) a.Required("token") }) a.View("default", func() { a.Attribute("token") }) })
AuthToken represents an authentication JWT Token
var CreateInvitationRequestMedia = a.MediaType("application/vnd.create_invitation_request+json", func() { a.Description("Request payload required to create new invitations") a.Attributes(func() { a.Attribute("data", a.ArrayOf(invitee), "An array of users invited to become members or to accept a role") a.Attribute("links", redirectURL, "links to redirect after accepting invitation sucessfully or in case of error") }) a.Required("data") a.View("default", func() { a.Attribute("data") a.Attribute("links") }) })
var CreateOrganizationRequestMedia = a.MediaType("application/vnd.create_organization_request+json", func() { a.Description("Request payload required to create a new organization") a.Attributes(func() { a.Attribute("name", d.String, "The name of the new organization") }) a.View("default", func() { a.Attribute("name") }) })
var CreateOrganizationResponseMedia = a.MediaType("application/vnd.create_organization_response+json", func() { a.Description("Response returned when creating a new organization") a.Attributes(func() { a.Attribute("organization_id", d.String, "The identifier of the new organization") }) a.View("default", func() { a.Attribute("organization_id") }) })
var CreateTeamRequestMedia = a.MediaType("application/vnd.create_team_request+json", func() { a.Description("Request payload required to create a new team") a.Attributes(func() { a.Attribute("space_id", d.String, "The identifier of the space in which to create the team") a.Attribute("name", d.String, "The name of the new team") }) a.View("default", func() { a.Attribute("space_id") a.Attribute("name") }) })
var CreateTeamResponseMedia = a.MediaType("application/vnd.create_team_response+json", func() { a.Description("Response returned when creating a new team") a.Attributes(func() { a.Attribute("team_id", d.String, "The identifier of the new team") }) a.View("default", func() { a.Attribute("team_id") }) })
var JSONAPIError = a.Type("JSONAPIError", func() { a.Description(`Error objects provide additional information about problems encountered while performing an operation. Error objects MUST be returned as an array keyed by errors in the top level of a JSON API document. See. also http://jsonapi.org/format/#error-objects.`) a.Attribute("id", d.String, "a unique identifier for this particular occurrence of the problem.") a.Attribute("links", a.HashOf(d.String, JSONAPILink), `a links object containing the following members: * about: a link that leads to further details about this particular occurrence of the problem.`) a.Attribute("status", d.String, "the HTTP status code applicable to this problem, expressed as a string value.") a.Attribute("code", d.String, "an application-specific error code, expressed as a string value.") a.Attribute("title", d.String, `a short, human-readable summary of the problem that SHOULD NOT change from occurrence to occurrence of the problem, except for purposes of localization.`) a.Attribute("detail", d.String, `a human-readable explanation specific to this occurrence of the problem. Like title, this field’s value can be localized.`) a.Attribute("source", a.HashOf(d.String, d.Any), `an object containing references to the source of the error, optionally including any of the following members * pointer: a JSON Pointer [RFC6901] to the associated entity in the request document [e.g. "/data" for a primary data object, or "/data/attributes/title" for a specific attribute]. * parameter: a string indicating which URI query parameter caused the error.`) a.Attribute("meta", a.HashOf(d.String, d.Any), "a meta object containing non-standard meta-information about the error") a.Required("detail") })
JSONAPIError represents a JSONAPI error object (see http://jsonapi.org/format/#error-objects)
var JSONAPIErrors = a.MediaType("application/vnd.jsonapierrors+json", func() { a.UseTrait("jsonapi-media-type") a.TypeName("JSONAPIErrors") a.Description(``) a.Attributes(func() { a.Attribute("errors", a.ArrayOf(JSONAPIError)) a.Required("errors") }) a.View("default", func() { a.Attribute("errors") a.Required("errors") }) })
JSONAPIErrors is an array of JSONAPI error objects
var JSONAPILink = a.Type("JSONAPILink", func() { a.Description(`See also http://jsonapi.org/format/#document-links.`) a.Attribute("href", d.String, "a string containing the link's URL.", func() { a.Example("http://example.com/articles/1/comments") }) a.Attribute("meta", a.HashOf(d.String, d.Any), "a meta object containing non-standard meta-information about the link.") })
JSONAPILink represents a JSONAPI link object (see http://jsonapi.org/format/#document-links)
var OauthToken = a.MediaType("application/vnd.oauthtoken+json", func() { a.TypeName("OauthToken") a.Description("Oauth 2.0 token payload") a.Attributes(func() { a.Attribute("access_token", d.String, "Access token") a.Attribute("expires_in", d.String, "Access token expires in seconds") a.Attribute("refresh_token", d.String, "RefreshToken") a.Attribute("token_type", d.String, "Token type") }) a.View("default", func() { a.Attribute("access_token") a.Attribute("expires_in") a.Attribute("refresh_token") a.Attribute("token_type") }) })
OauthToken represents an Oauth 2.0 token payload
var PublicKeys = a.MediaType("application/vnd.publickeys+json", func() { a.TypeName("PublicKeys") a.Description("Public Keys") a.Attributes(func() { a.Attribute("keys", a.ArrayOf(d.Any)) a.Required("keys") }) a.View("default", func() { a.Attribute("keys") }) })
PublicKeys represents an public keys payload
var RPTToken = a.MediaType("application/vnd.rpttoken+json", func() { a.TypeName("RPTToken") a.Description("JWT Token") a.Attributes(func() { a.Attribute("rpt_token", d.String, "RPT token") }) a.View("default", func() { a.Attribute("rpt_token") }) })
var RegisterResourceMedia = a.MediaType("application/vnd.register_resource+json", func() { a.Description("Payload for registering a resource") a.Attributes(func() { a.Attribute("type", d.String, "The type of resource") a.Attribute("parent_resource_id", d.String, "The parent resource (of the same type) to which this resource belongs") a.Attribute("resource_id", d.String, "The identifier for this resource. If left blank, one will be generated") a.Attribute("identity_id", d.String, "The identity who would be provided the scope to manage this resource, If left blank, nobody would be assigned the scope to manage this resource") a.Required("type") }) a.View("default", func() { a.Attribute("type") a.Attribute("parent_resource_id") a.Attribute("resource_id") }) })
var RegisterResourceResponseMedia = a.MediaType("application/vnd.register_resource_response+json", func() { a.Description("Response returned when a resource is registered") a.Attributes(func() { a.Attribute("resource_id", d.String, "The identifier for the registered resource") }) a.View("default", func() { a.Attribute("resource_id") }) })
var ResourceMedia = a.MediaType("application/vnd.resource+json", func() { a.Description("A Protected Resource") a.Attributes(func() { a.Attribute("resource_scopes", a.ArrayOf(d.String), "The valid scopes for this resource") a.Attribute("type", d.String, "The type of resource") a.Attribute("parent_resource_id", d.String, "The parent resource (of the same type) to which this resource belongs") a.Attribute("resource_id", d.String, "The identifier for this resource. If left blank, one will be generated") }) a.View("default", func() { a.Attribute("resource_scopes") a.Attribute("type") a.Attribute("parent_resource_id") a.Attribute("resource_id") }) })
ResourceMedia represents a protected resource
var ResourceScopesData = a.MediaType("application/vnd.resource_scopes_data+json", func() { a.Description("Resource scopes data wrapper") a.Attributes(func() { a.Attribute("data", a.ArrayOf(ResourceScopesMedia), "The data wrapper for the response") a.Required("data") }) a.View("default", func() { a.Attribute("data") }) })
var ResourceScopesMedia = a.MediaType("application/vnd.resource_scopes+json", func() { a.Description("Resource scopes payload") a.Attributes(func() { a.Attribute("id", d.String, "Name of the scope") a.Attribute("type", d.String, "Type of resource") a.Required("id", "type") }) a.View("default", func() { a.Attribute("id") a.Attribute("type") }) })
Functions ¶
func JSONList ¶
func JSONList(name, description string, data *d.UserTypeDefinition, links *d.UserTypeDefinition, meta *d.UserTypeDefinition) *d.MediaTypeDefinition
JSONList creates a UserTypeDefinition
func JSONResourceObject ¶
func JSONResourceObject(name string, attributes *d.UserTypeDefinition, relationships *d.UserTypeDefinition) *d.UserTypeDefinition
JSONResourceObject creates a single resource object
func JSONSingle ¶
func JSONSingle(name, description string, data *d.UserTypeDefinition, links *d.UserTypeDefinition) *d.MediaTypeDefinition
JSONSingle creates a Single
Types ¶
This section is empty.