summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--routers/api/v1/api.go3
-rw-r--r--routers/api/v1/org/org.go23
-rw-r--r--templates/swagger/v1_json.tmpl24
3 files changed, 49 insertions, 1 deletions
diff --git a/routers/api/v1/api.go b/routers/api/v1/api.go
index 0284e845ff..dcc77969f1 100644
--- a/routers/api/v1/api.go
+++ b/routers/api/v1/api.go
@@ -622,7 +622,8 @@ func RegisterRoutes(m *macaron.Macaron) {
m.Group("/orgs/:orgname", func() {
m.Get("/repos", user.ListOrgRepos)
m.Combo("").Get(org.Get).
- Patch(reqToken(), reqOrgOwnership(), bind(api.EditOrgOption{}), org.Edit)
+ Patch(reqToken(), reqOrgOwnership(), bind(api.EditOrgOption{}), org.Edit).
+ Delete(reqToken(), reqOrgOwnership(), org.Delete)
m.Group("/members", func() {
m.Get("", org.ListMembers)
m.Combo("/:username").Get(org.IsMember).
diff --git a/routers/api/v1/org/org.go b/routers/api/v1/org/org.go
index 217b38683e..59351e20d1 100644
--- a/routers/api/v1/org/org.go
+++ b/routers/api/v1/org/org.go
@@ -166,3 +166,26 @@ func Edit(ctx *context.APIContext, form api.EditOrgOption) {
ctx.JSON(200, convert.ToOrganization(org))
}
+
+//Delete an organization
+func Delete(ctx *context.APIContext) {
+ // swagger:operation DELETE /orgs/{org} organization orgDelete
+ // ---
+ // summary: Delete an organization
+ // produces:
+ // - application/json
+ // parameters:
+ // - name: org
+ // in: path
+ // description: organization that is to be deleted
+ // type: string
+ // required: true
+ // responses:
+ // "204":
+ // "$ref": "#/responses/empty"
+ if err := models.DeleteOrganization(ctx.Org.Organization); err != nil {
+ ctx.Error(500, "DeleteOrganization", err)
+ return
+ }
+ ctx.Status(204)
+}
diff --git a/templates/swagger/v1_json.tmpl b/templates/swagger/v1_json.tmpl
index ce5382152b..b96a20109c 100644
--- a/templates/swagger/v1_json.tmpl
+++ b/templates/swagger/v1_json.tmpl
@@ -467,6 +467,30 @@
}
}
},
+ "delete": {
+ "produces": [
+ "application/json"
+ ],
+ "tags": [
+ "organization"
+ ],
+ "summary": "Delete an organization",
+ "operationId": "orgDelete",
+ "parameters": [
+ {
+ "type": "string",
+ "description": "organization that is to be deleted",
+ "name": "org",
+ "in": "path",
+ "required": true
+ }
+ ],
+ "responses": {
+ "204": {
+ "$ref": "#/responses/empty"
+ }
+ }
+ },
"patch": {
"consumes": [
"application/json"