示例#1
0
func createWorkItemLink() {
	a.Description("Create a work item link")
	a.Security("jwt")
	a.Routing(
		a.POST(""),
	)
	a.Payload(createWorkItemLinkPayload)
	a.Response(d.Created, "/workitemlinks/.*", func() {
		a.Media(workItemLink)
	})
	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 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"),
示例#3
0
		a.Description("List comments associated with the given work item")
		a.Params(func() {
			a.Param("page[offset]", d.String, `Paging start position is a string pointing to
				the beginning of pagination.  The value starts from 0 onwards.`)
			a.Param("page[limit]", d.Integer, `Paging size is the number of items in a page`)
		})
		a.Response(d.OK, func() {
			a.Media(commentRelationshipsArray)
		})
		a.Response(d.BadRequest, JSONAPIErrors)
		a.Response(d.InternalServerError, JSONAPIErrors)
		a.Response(d.NotFound, JSONAPIErrors)
	})

	a.Action("create", func() {
		a.Security("jwt")
		a.Routing(
			a.POST("comments"),
		)
		a.Description("List comments associated with the given work item")
		a.Response(d.OK, func() {
			a.Media(commentSingle)
		})
		a.Payload(createSingleComment)
		a.Response(d.BadRequest, JSONAPIErrors)
		a.Response(d.Unauthorized, JSONAPIErrors)
		a.Response(d.InternalServerError, JSONAPIErrors)
		a.Response(d.NotFound, JSONAPIErrors)
	})
})
示例#4
0
	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)
	})
})

var refreshToken = a.Type("RefreshToken", func() {
	a.Attribute("refresh_token", d.String, "Refresh token")
})
示例#5
0
		)
		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() {
示例#6
0
		)
		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)
	})
})
示例#7
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)
	})
})