コード例 #1
0
ファイル: comments.go プロジェクト: Ritsyy/almighty-core
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)
	})
	a.Action("update", func() {
		a.Security("jwt")
		a.Routing(
			a.PATCH("/:commentId"),
		)
		a.Description("update the comment with the given commentId.")
		a.Params(func() {
			a.Param("commentId", d.UUID, "commentId")
		})
		a.Payload(commentSingle)
		a.Response(d.OK, func() {
			a.Media(commentSingle)
		})
		a.Response(d.BadRequest, JSONAPIErrors)
		a.Response(d.InternalServerError, JSONAPIErrors)
		a.Response(d.NotFound, JSONAPIErrors)
		a.Response(d.Unauthorized, JSONAPIErrors)
		a.Response(d.Forbidden, JSONAPIErrors)
	})
	a.Action("delete", func() {
		a.Security("jwt")
		a.Routing(
			a.DELETE("/:commentId"),
		)
		a.Description("Delete work item with given id.")
		a.Params(func() {
			a.Param("commentId", d.UUID, "commentId")
		})
		a.Response(d.OK)
		a.Response(d.BadRequest, JSONAPIErrors)
		a.Response(d.InternalServerError, JSONAPIErrors)
		a.Response(d.NotFound, JSONAPIErrors)
		a.Response(d.Unauthorized, JSONAPIErrors)
		a.Response(d.Forbidden, JSONAPIErrors)
	})

})
コード例 #2
0
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)
	})

	a.Action("list", func() {
		a.Routing(
			a.GET(""),
		)
		a.Description("List work item link categories.")
		a.Response(d.OK, func() {
			a.Media(workItemLinkCategoryList)
		})
		a.Response(d.BadRequest, JSONAPIErrors)
		a.Response(d.InternalServerError, JSONAPIErrors)
	})

	a.Action("create", func() {
		a.Security("jwt")
		a.Routing(
			a.POST(""),
		)
		a.Description("Create a work item link category")
		a.Payload(createWorkItemLinkCategoryPayload)
		a.Response(d.Created, "/workitemlinkcategories/.*", func() {
			a.Media(workItemLinkCategory)
		})
		a.Response(d.BadRequest, JSONAPIErrors)
		a.Response(d.InternalServerError, JSONAPIErrors)
		a.Response(d.Unauthorized, JSONAPIErrors)
	})

	a.Action("delete", func() {
		a.Security("jwt")
		a.Routing(
			a.DELETE("/:id"),
		)
		a.Description("Delete work item link category with given id.")
		a.Params(func() {
			a.Param("id", d.String, "id")
		})
		a.Response(d.OK)
		a.Response(d.BadRequest, JSONAPIErrors)
		a.Response(d.InternalServerError, JSONAPIErrors)
		a.Response(d.NotFound, JSONAPIErrors)
		a.Response(d.Unauthorized, JSONAPIErrors)
	})

	a.Action("update", func() {
		a.Security("jwt")
		a.Routing(
			a.PATCH("/:id"),
		)
		a.Description("Update the given work item link category with given id.")
		a.Params(func() {
			a.Param("id", d.String, "id")
		})
		a.Payload(updateWorkItemLinkCategoryPayload)
		a.Response(d.OK, func() {
			a.Media(workItemLinkCategory)
		})
		a.Response(d.BadRequest, JSONAPIErrors)
		a.Response(d.InternalServerError, JSONAPIErrors)
		a.Response(d.NotFound, JSONAPIErrors)
		a.Response(d.Unauthorized, JSONAPIErrors)
	})
})
コード例 #3
0
ファイル: account.go プロジェクト: Ritsyy/almighty-core
	})
	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)
	})

})

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

	a.Action("list", func() {
		a.Routing(
			a.GET(""),
コード例 #4
0
ファイル: search.go プロジェクト: Ritsyy/almighty-core
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")
			a.Required("q")
		})
		a.Response(d.OK, func() {
			a.Media(searchWorkItemList)
		})
		a.Response(d.BadRequest, JSONAPIErrors)
		a.Response(d.InternalServerError, JSONAPIErrors)
	})
	a.Action("spaces", func() {
		a.Routing(
			a.GET("spaces"),
		)
		a.Description("Search for spaces by name or description")
		a.Params(func() {
			a.Param("q", d.String, "Text to match against Name or description")
			a.Param("page[offset]", d.String, "Paging start position")
			a.Param("page[limit]", d.Integer, "Paging size")
			a.Required("q")
		})
		a.Response(d.OK, func() {
			a.Media(searchSpaceList)
		})
		a.Response(d.BadRequest, JSONAPIErrors)
		a.Response(d.InternalServerError, JSONAPIErrors)
	})
})
コード例 #5
0
ファイル: iterations.go プロジェクト: Ritsyy/almighty-core
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)
	})
	a.Action("create-child", func() {
		a.Security("jwt")
		a.Routing(
			a.POST("/:iterationID"),
		)
		a.Params(func() {
			a.Param("iterationID", d.String, "Iteration Identifier")
		})
		a.Description("create child iteration.")
		a.Payload(iterationSingle)
		a.Response(d.Created, "/iterations/.*", func() {
			a.Media(iterationSingle)
		})
		a.Response(d.BadRequest, JSONAPIErrors)
		a.Response(d.NotFound, JSONAPIErrors)
		a.Response(d.InternalServerError, JSONAPIErrors)
		a.Response(d.Unauthorized, JSONAPIErrors)
	})
	a.Action("update", func() {
		a.Security("jwt")
		a.Routing(
			a.PATCH("/:iterationID"),
		)
		a.Description("update the iteration for the given id.")
		a.Params(func() {
			a.Param("iterationID", d.String, "Iteration Identifier")
		})
		a.Payload(iterationSingle)
		a.Response(d.OK, func() {
			a.Media(iterationSingle)
		})
		a.Response(d.BadRequest, JSONAPIErrors)
		a.Response(d.InternalServerError, JSONAPIErrors)
		a.Response(d.NotFound, JSONAPIErrors)
		a.Response(d.Unauthorized, JSONAPIErrors)
	})
})
コード例 #6
0
ファイル: auth.go プロジェクト: Ritsyy/almighty-core
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)
	})

	a.Action("refresh", func() {
		a.Routing(
			a.POST("refresh"),
		)
		a.Payload(refreshToken)
		a.Description("Refreshes access token")
		a.Response(d.OK, func() {
			a.Media(AuthToken)
		})
		a.Response(d.Unauthorized, JSONAPIErrors)
		a.Response(d.BadRequest, JSONAPIErrors)
		a.Response(d.InternalServerError, JSONAPIErrors)
	})
})
コード例 #7
0
ファイル: areas.go プロジェクト: Ritsyy/almighty-core
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)
	})
	a.Action("show-child", func() {
		a.Routing(
			a.GET("/:id/children"),
		)
		a.Description("Retrieve child areas of given id.")
		a.Params(func() {
			a.Param("id", d.String, "id")
		})
		a.Response(d.OK, func() {
			a.Media(areaList)
		})
		a.Response(d.BadRequest, JSONAPIErrors)
		a.Response(d.InternalServerError, JSONAPIErrors)
		a.Response(d.NotFound, JSONAPIErrors)
	})
	a.Action("create-child", func() {
		a.Security("jwt")
		a.Routing(
			a.POST("/:id"),
		)
		a.Params(func() {
			a.Param("id", d.String, "id")
		})
		a.Description("create child area.")
		a.Payload(areaSingle)
		a.Response(d.Created, "/areas/.*", func() {
			a.Media(areaSingle)
		})
		a.Response(d.BadRequest, JSONAPIErrors)
		a.Response(d.NotFound, JSONAPIErrors)
		a.Response(d.InternalServerError, JSONAPIErrors)
		a.Response(d.Unauthorized, JSONAPIErrors)
	})
})
コード例 #8
0
ファイル: resources.go プロジェクト: Ritsyy/almighty-core
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(""),
		)
		a.Description("Create work item type.")
		a.Payload(CreateWorkItemTypePayload)
		a.Response(d.Created, "/workitemtypes/.*", func() {
			a.Media(workItemType)
		})
		a.Response(d.BadRequest, JSONAPIErrors)
		a.Response(d.InternalServerError, JSONAPIErrors)
		a.Response(d.Unauthorized, JSONAPIErrors)
	})

	a.Action("list", func() {
		a.Routing(
			a.GET(""),
		)
		a.Description("List work item types.")
		a.Params(func() {
			a.Param("page", d.String, "Paging in the format <start>,<limit>")
		})
		a.Response(d.OK, func() {
			a.Media(a.CollectionOf(workItemType))
		})
		a.Response(d.BadRequest, JSONAPIErrors)
		a.Response(d.InternalServerError, JSONAPIErrors)
	})

	a.Action("list-source-link-types", func() {
		a.Routing(
			a.GET("/:name/source-link-types"),
		)
		a.Params(func() {
			a.Param("name", d.String, "name")
		})
		a.Description(`Retrieve work item link types where the
given work item type can be used in the source of the link.`)
		a.Response(d.OK, func() {
			a.Media(workItemLinkTypeList)
		})
		a.Response(d.NotFound, JSONAPIErrors)
		a.Response(d.InternalServerError, JSONAPIErrors)
	})

	a.Action("list-target-link-types", func() {
		a.Routing(
			a.GET("/:name/target-link-types"),
		)
		a.Params(func() {
			a.Param("name", d.String, "name")
		})
		a.Description(`Retrieve work item link types where the
given work item type can be used in the target of the link.`)
		a.Response(d.OK, func() {
			a.Media(workItemLinkTypeList)
		})
		a.Response(d.NotFound, JSONAPIErrors)
		a.Response(d.InternalServerError, JSONAPIErrors)
	})
})
コード例 #9
0
ファイル: spaces.go プロジェクト: Ritsyy/almighty-core
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)
	})

	a.Action("list", func() {
		a.Routing(
			a.GET(""),
		)
		a.Description("List spaces.")
		a.Params(func() {
			a.Param("page[offset]", d.String, "Paging start position")
			a.Param("page[limit]", d.Integer, "Paging size")
		})

		a.Response(d.OK, func() {
			a.Media(spaceList)
		})
		a.Response(d.BadRequest, JSONAPIErrors)
		a.Response(d.InternalServerError, JSONAPIErrors)
	})

	a.Action("create", func() {
		a.Security("jwt")
		a.Routing(
			a.POST(""),
		)
		a.Description("Create a space")
		a.Payload(spaceSingle)
		a.Response(d.Created, "/spaces/.*", func() {
			a.Media(spaceSingle)
		})
		a.Response(d.BadRequest, JSONAPIErrors)
		a.Response(d.InternalServerError, JSONAPIErrors)
		a.Response(d.Unauthorized, JSONAPIErrors)
	})

	a.Action("delete", func() {
		a.Security("jwt")
		a.Routing(
			a.DELETE("/:id"),
		)
		a.Description("Delete a space with given id.")
		a.Params(func() {
			a.Param("id", d.String, "id")
		})
		a.Response(d.OK)
		a.Response(d.BadRequest, JSONAPIErrors)
		a.Response(d.InternalServerError, JSONAPIErrors)
		a.Response(d.NotFound, JSONAPIErrors)
		a.Response(d.Unauthorized, JSONAPIErrors)
	})
	a.Action("update", func() {
		a.Security("jwt")
		a.Routing(
			a.PATCH("/:id"),
		)
		a.Description("Update the space with given id.")
		a.Params(func() {
			a.Param("id", d.String, "id")
		})
		a.Payload(spaceSingle)
		a.Response(d.OK, func() {
			a.Media(spaceSingle)
		})
		a.Response(d.BadRequest, JSONAPIErrors)
		a.Response(d.InternalServerError, JSONAPIErrors)
		a.Response(d.NotFound, JSONAPIErrors)
		a.Response(d.Unauthorized, JSONAPIErrors)
	})
})
コード例 #10
0
ファイル: workitems.go プロジェクト: Ritsyy/almighty-core
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)
	})
	a.Action("list", func() {
		a.Routing(
			a.GET(""),
		)
		a.Description("List work items.")
		a.Params(func() {
			a.Param("filter", d.String, "a query language expression restricting the set of found work items")
			a.Param("page[offset]", d.String, "Paging start position")
			a.Param("page[limit]", d.Integer, "Paging size")
			a.Param("filter[assignee]", d.String, "Work Items assigned to the given user")
			a.Param("filter[iteration]", d.String, "IterationID to filter work items")
			a.Param("filter[workitemtype]", d.String, "work item type to filter work items by")
			a.Param("filter[area]", d.String, "AreaID to filter work items")

		})
		a.Response(d.OK, func() {
			a.Media(workItemList)
		})
		a.Response(d.BadRequest, JSONAPIErrors)
		a.Response(d.InternalServerError, JSONAPIErrors)
	})
	a.Action("create", func() {
		a.Security("jwt")
		a.Routing(
			a.POST(""),
		)
		a.Description("create work item with type and id.")
		a.Payload(workItemSingle)
		a.Response(d.Created, "/workitems/.*", func() {
			a.Media(workItemSingle)
		})
		a.Response(d.BadRequest, JSONAPIErrors)
		a.Response(d.InternalServerError, JSONAPIErrors)
		a.Response(d.Unauthorized, JSONAPIErrors)
	})
	a.Action("delete", func() {
		a.Security("jwt")
		a.Routing(
			a.DELETE("/:id"),
		)
		a.Description("Delete work item with given id.")
		a.Params(func() {
			a.Param("id", d.String, "id")
		})
		a.Response(d.OK)
		a.Response(d.BadRequest, JSONAPIErrors)
		a.Response(d.InternalServerError, JSONAPIErrors)
		a.Response(d.NotFound, JSONAPIErrors)
		a.Response(d.Unauthorized, JSONAPIErrors)
	})
	a.Action("update", func() {
		a.Security("jwt")
		a.Routing(
			a.PATCH("/:id"),
		)
		a.Description("update the work item with the given id.")
		a.Params(func() {
			a.Param("id", d.String, "id")
		})
		a.Payload(workItemSingle)
		a.Response(d.OK, func() {
			a.Media(workItemSingle)
		})
		a.Response(d.BadRequest, JSONAPIErrors)
		a.Response(d.InternalServerError, JSONAPIErrors)
		a.Response(d.NotFound, JSONAPIErrors)
		a.Response(d.Unauthorized, JSONAPIErrors)
	})
})
コード例 #11
0
ファイル: userspace.go プロジェクト: Ritsyy/almighty-core
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)
	})
})
コード例 #12
0
	"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.")
		})
	})
	a.Action("create", func() {
コード例 #13
0
ファイル: render.go プロジェクト: Ritsyy/almighty-core
	})
	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)
	})
})