예제 #1
0
	commentListMeta,
)

var commentSingle = JSONSingle(
	"Comment", "Holds the response of a single comment",
	comment,
	nil,
)
var createSingleComment = JSONSingle(
	"CreateSingle", "Holds the create data for a comment",
	createComment,
	nil,
)

var _ = a.Resource("comments", func() {
	a.BasePath("/comments")

	a.Action("show", func() {
		a.Routing(
			a.GET("/:commentId"),
		)
		a.Params(func() {
			a.Param("commentId", d.UUID, "commentId")
		})
		a.Description("Retrieve comment with given commentId.")
		a.Response(d.OK, func() {
			a.Media(commentSingle)
		})
		a.Response(d.BadRequest, JSONAPIErrors)
		a.Response(d.InternalServerError, JSONAPIErrors)
		a.Response(d.NotFound, JSONAPIErrors)
var workItemLinkCategoryList = JSONList(
	"WorkItemLinkCategory",
	"Holds the paginated response to a work item link category list request",
	workItemLinkCategoryData,
	nil, //pagingLinks,
	workItemLinkCategoryListMeta,
)

// ############################################################################
//
//  Resource Definition
//
// ############################################################################

var _ = a.Resource("work-item-link-category", func() {
	a.BasePath("/workitemlinkcategories")

	a.Action("show", func() {
		a.Routing(
			a.GET("/:id"),
		)
		a.Description("Retrieve work item link category (as JSONAPI) for the given ID.")
		a.Params(func() {
			a.Param("id", d.String, "ID of the work item link category")
		})
		a.Response(d.OK, func() {
			a.Media(workItemLinkCategory)
		})
		a.Response(d.BadRequest, JSONAPIErrors)
		a.Response(d.InternalServerError, JSONAPIErrors)
		a.Response(d.NotFound, JSONAPIErrors)
예제 #3
0
파일: api.go 프로젝트: Ritsyy/almighty-core
package design

import (
	d "github.com/goadesign/goa/design"
	a "github.com/goadesign/goa/design/apidsl"
)

var _ = a.API("alm", func() {
	a.Title("ALMighty: One to rule them all")
	a.Description("The next big thing")
	a.Version("1.0")
	a.Host("almighty.io")
	a.Scheme("http")
	a.BasePath("/api")
	a.Consumes("application/json")
	a.Produces("application/json")

	a.License(func() {
		a.Name("Apache License Version 2.0")
		a.URL("http://www.apache.org/licenses/LICENSE-2.0")
	})
	a.Origin("/[.*almighty.io|localhost]/", func() {
		a.Methods("GET", "POST", "PUT", "PATCH", "DELETE")
		a.Headers("X-Request-Id", "Content-Type", "Authorization")
		a.MaxAge(600)
		a.Credentials()
	})

	a.Trait("jsonapi-media-type", func() {
		a.ContentType("application/vnd.api+json")
	})
예제 #4
0
)

var searchWorkItemList = JSONList(
	"SearchWorkItem", "Holds the paginated response to a search request",
	workItem2,
	pagingLinks,
	meta)

var searchSpaceList = JSONList(
	"SearchSpace", "Holds the paginated response to a search request",
	space,
	pagingLinks,
	spaceListMeta)

var _ = a.Resource("search", func() {
	a.BasePath("/search")

	a.Action("show", func() {
		a.Routing(
			a.GET(""),
		)
		a.Description("Search by ID, URL, full text capability")
		a.Params(func() {
			a.Param("q", d.String,
				`Following are valid input for search query
				1) "id:100" :- Look for work item hainvg id 100
				2) "url:http://demo.almighty.io/details/500" :- Search on WI having id 500 and check 
					if this URL is mentioned in searchable columns of work item
				3) "simple keywords separated by space" :- Search in Work Items based on these keywords.`)
			a.Param("page[offset]", d.String, "Paging start position") // #428
			a.Param("page[limit]", d.Integer, "Paging size")
예제 #5
0
package design

import (
	d "github.com/goadesign/goa/design"
	a "github.com/goadesign/goa/design/apidsl"
)

var _ = a.Resource("login", func() {

	a.BasePath("/login")

	a.Action("authorize", func() {
		a.Routing(
			a.GET("authorize"),
		)
		a.Description("Authorize with the ALM")
		a.Response(d.Unauthorized, JSONAPIErrors)
		a.Response(d.TemporaryRedirect)
	})

	a.Action("generate", func() {
		a.Routing(
			a.GET("generate"),
		)
		a.Description("Generates a set of Tokens for different Auth levels. NOT FOR PRODUCTION. Only available if server is running in dev mode")
		a.Response(d.OK, func() {
			a.Media(a.CollectionOf(AuthToken))
		})
		a.Response(d.Unauthorized, JSONAPIErrors)
		a.Response(d.InternalServerError, JSONAPIErrors)
	})
예제 #6
0
	a.UseTrait("jsonapi-media-type")
	a.TypeName("UserArray")
	a.Description("User Array")
	a.Attributes(func() {
		a.Attribute("data", a.ArrayOf(identityData))
		a.Required("data")

	})
	a.View("default", func() {
		a.Attribute("data")
		a.Required("data")
	})
})

var _ = a.Resource("user", func() {
	a.BasePath("/user")

	a.Action("show", func() {
		a.Security("jwt")
		a.Routing(
			a.GET(""),
		)
		a.Description("Get the authenticated user")
		a.Response(d.OK, func() {
			a.Media(identity)
		})
		a.Response(d.BadRequest, JSONAPIErrors)
		a.Response(d.InternalServerError, JSONAPIErrors)
		a.Response(d.Unauthorized, JSONAPIErrors)
	})
예제 #7
0
package design

import (
	d "github.com/goadesign/goa/design"
	a "github.com/goadesign/goa/design/apidsl"
)

var _ = a.Resource("workitemtype", func() {

	a.BasePath("/workitemtypes")

	a.Action("show", func() {

		a.Routing(
			a.GET("/:name"),
		)
		a.Description("Retrieve work item type with given name.")
		a.Params(func() {
			a.Param("name", d.String, "name")
		})
		a.Response(d.OK, func() {
			a.Media(workItemType)
		})
		a.Response(d.NotFound, JSONAPIErrors)
		a.Response(d.InternalServerError, JSONAPIErrors)
	})

	a.Action("create", func() {
		a.Security("jwt")
		a.Routing(
			a.POST(""),
예제 #8
0
})

var iterationList = JSONList(
	"Iteration", "Holds the list of iterations",
	iteration,
	pagingLinks,
	meta)

var iterationSingle = JSONSingle(
	"Iteration", "Holds the list of iterations",
	iteration,
	nil)

// new version of "list" for migration
var _ = a.Resource("iteration", func() {
	a.BasePath("/iterations")
	a.Action("show", func() {
		a.Routing(
			a.GET("/:iterationID"),
		)
		a.Description("Retrieve iteration with given id.")
		a.Params(func() {
			a.Param("iterationID", d.String, "Iteration Identifier")
		})
		a.Response(d.OK, func() {
			a.Media(iterationSingle)
		})
		a.Response(d.BadRequest, JSONAPIErrors)
		a.Response(d.InternalServerError, JSONAPIErrors)
		a.Response(d.NotFound, JSONAPIErrors)
	})
예제 #9
0
	a.Required("totalCount")
})

var spaceList = JSONList(
	"Space", "Holds the paginated response to a space list request",
	space,
	pagingLinks,
	spaceListMeta)

var spaceSingle = JSONSingle(
	"Space", "Holds a single response to a space request",
	space,
	nil)

var _ = a.Resource("space", func() {
	a.BasePath("/spaces")

	a.Action("show", func() {
		a.Routing(
			a.GET("/:id"),
		)
		a.Description("Retrieve space (as JSONAPI) for the given ID.")
		a.Params(func() {
			a.Param("id", d.String, "ID of the space")
		})
		a.Response(d.OK, func() {
			a.Media(spaceSingle)
		})
		a.Response(d.BadRequest, JSONAPIErrors)
		a.Response(d.InternalServerError, JSONAPIErrors)
		a.Response(d.NotFound, JSONAPIErrors)
예제 #10
0
})

var areaList = JSONList(
	"area", "Holds the list of Areas",
	area,
	pagingLinks,
	meta)

var areaSingle = JSONSingle(
	"area", "Holds the list of Areas",
	area,
	nil)

// new version of "list" for migration
var _ = a.Resource("area", func() {
	a.BasePath("/areas")
	a.Action("show", func() {
		a.Routing(
			a.GET("/:id"),
		)
		a.Description("Retrieve area with given id.")
		a.Params(func() {
			a.Param("id", d.String, "id")
		})
		a.Response(d.OK, func() {
			a.Media(areaSingle)
		})
		a.Response(d.BadRequest, JSONAPIErrors)
		a.Response(d.InternalServerError, JSONAPIErrors)
		a.Response(d.NotFound, JSONAPIErrors)
	})
예제 #11
0
var workItemLinkTypeList = JSONList(
	"WorkItemLinkType",
	"Holds the paginated response to a work item link type list request",
	workItemLinkTypeData,
	nil, //pagingLinks,
	workItemLinkTypeListMeta,
)

// ############################################################################
//
//  Resource Definition
//
// ############################################################################

var _ = a.Resource("work-item-link-type", func() {
	a.BasePath("/workitemlinktypes")

	a.Action("show", func() {
		a.Routing(
			a.GET("/:id"),
		)
		a.Description("Retrieve work item link type (as JSONAPI) for the given link ID.")
		a.Params(func() {
			a.Param("id", d.String, "ID of the work item link type")
		})
		a.Response(d.OK, func() {
			a.Media(workItemLinkType)
		})
		a.Response(d.BadRequest, JSONAPIErrors)
		a.Response(d.InternalServerError, JSONAPIErrors)
		a.Response(d.NotFound, JSONAPIErrors)
예제 #12
0
// workItemList contains paged results for listing work items and paging links
var workItemList = JSONList(
	"WorkItem2", "Holds the paginated response to a work item list request",
	workItem2,
	pagingLinks,
	meta)

// workItemSingle is the media type for work items
var workItemSingle = JSONSingle(
	"WorkItem2", "A work item holds field values according to a given field type in JSONAPI form",
	workItem2,
	workItemLinks)

// new version of "list" for migration
var _ = a.Resource("workitem", func() {
	a.BasePath("/workitems")
	a.Action("show", func() {
		a.Routing(
			a.GET("/:id"),
		)
		a.Description("Retrieve work item with given id.")
		a.Params(func() {
			a.Param("id", d.String, "id")
		})
		a.Response(d.OK, func() {
			a.Media(workItemSingle)
		})
		a.Response(d.BadRequest, JSONAPIErrors)
		a.Response(d.InternalServerError, JSONAPIErrors)
		a.Response(d.NotFound, JSONAPIErrors)
	})
예제 #13
0
package design

import (
	d "github.com/goadesign/goa/design"
	a "github.com/goadesign/goa/design/apidsl"
)

var _ = a.Resource("userspace", func() {
	a.BasePath("/userspace")

	a.Action("create", func() {
		a.Routing(
			a.PUT("/*"),
		)
		a.Description("Data dump endpoint ")
		a.Payload(a.HashOf(d.String, d.Any))
		a.Response(d.NoContent)
		a.Response(d.InternalServerError)
	})
	a.Action("show", func() {
		a.Routing(
			a.GET("/*"),
		)
		a.Description("Data dump endpoint ")
		a.Response(d.OK, a.HashOf(d.String, d.Any))
		a.Response(d.InternalServerError)
		a.Response(d.NotFound)
	})
})
예제 #14
0
var workItemLinkList = JSONList(
	"WorkItemLink",
	"Holds the paginated response to a work item link list request",
	workItemLinkData,
	nil, //pagingLinks,
	workItemLinkListMeta,
)

// ############################################################################
//
//  Resource Definition
//
// ############################################################################

var _ = a.Resource("work-item-link", func() {
	a.BasePath("/workitemlinks")
	a.Action("show", showWorkItemLink)
	a.Action("list", listWorkItemLinks)
	a.Action("create", createWorkItemLink)
	a.Action("delete", deleteWorkItemLink)
	a.Action("update", updateWorkItemLink)
})

var _ = a.Resource("work-item-relationships-links", func() {
	a.BasePath("/relationships/links")
	a.Parent("workitem")
	a.Action("list", func() {
		listWorkItemLinks()
		a.Description("List work item links associated with the given work item (either as source or as target work item).")
		a.Response(d.NotFound, JSONAPIErrors, func() {
			a.Description("This error arises when the given work item does not exist.")
예제 #15
0
	})
	a.Attribute("type", d.String, func() {
		a.Enum("rendering")
	})
	a.Attribute("attributes", markupRenderingMediaTypeDataAttributes)
	a.Required("id")
	a.Required("type")
	a.Required("attributes")
})

// MarkupRenderingMediaType is the data included in the rendering result response.
var markupRenderingMediaTypeDataAttributes = a.Type("MarkupRenderingDataAttributes", func() {
	a.Attribute("renderedContent", d.String, "The rendered content", func() {
		a.Example("<h1>foo</h1>")
	})
	a.Required("renderedContent")
})

var _ = a.Resource("render", func() {
	a.BasePath("/render")
	a.Security("jwt")
	a.Action("render", func() {
		a.Description("Render some content using the markup language")
		a.Routing(a.POST(""))
		a.Payload(markupRenderingPayload)
		a.Response(d.OK, markupRenderingMediaType)
		a.Response(d.BadRequest, JSONAPIErrors)
		a.Response(d.InternalServerError, JSONAPIErrors)
	})
})