Skip to content

Commit

Permalink
✨ Add docs for namespace member api
Browse files Browse the repository at this point in the history
  • Loading branch information
tosone committed Nov 24, 2023
1 parent 033b745 commit d64a698
Show file tree
Hide file tree
Showing 12 changed files with 4,490 additions and 5,829 deletions.
279 changes: 276 additions & 3 deletions pkg/handlers/apidocs/docs.go
Original file line number Diff line number Diff line change
Expand Up @@ -3116,15 +3116,15 @@ const docTemplate = `{
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/types.AddMemberRequest"
"$ref": "#/definitions/types.AddNamespaceMemberRequest"
}
}
],
"responses": {
"201": {
"description": "Created",
"schema": {
"$ref": "#/definitions/types.PostNamespaceResponse"
"$ref": "#/definitions/types.AddNamespaceMemberResponse"
}
},
"400": {
Expand Down Expand Up @@ -3267,6 +3267,220 @@ const docTemplate = `{
}
}
},
"/namespaces/{namespace_id}/members/": {
"get": {
"security": [
{
"BasicAuth": []
}
],
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"Namespace"
],
"summary": "List namespace members",
"parameters": [
{
"maximum": 100,
"minimum": 10,
"type": "integer",
"default": 10,
"description": "Limit size",
"name": "limit",
"in": "query"
},
{
"minimum": 1,
"type": "integer",
"default": 1,
"description": "Page number",
"name": "page",
"in": "query"
},
{
"type": "string",
"description": "Sort field",
"name": "sort",
"in": "query"
},
{
"enum": [
"asc",
"desc"
],
"type": "string",
"description": "Sort method",
"name": "method",
"in": "query"
},
{
"type": "string",
"description": "Search namespace namespace with name",
"name": "name",
"in": "query"
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"allOf": [
{
"$ref": "#/definitions/types.CommonList"
},
{
"type": "object",
"properties": {
"items": {
"type": "array",
"items": {
"$ref": "#/definitions/types.NamespaceMemberItem"
}
}
}
}
]
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/xerrors.ErrCode"
}
}
}
},
"put": {
"security": [
{
"BasicAuth": []
}
],
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"Namespace"
],
"summary": "Update namespace member",
"parameters": [
{
"type": "number",
"description": "Namespace id",
"name": "namespace_id",
"in": "path",
"required": true
},
{
"description": "Namespace member object",
"name": "message",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/types.UpdateMemberRequest"
}
}
],
"responses": {
"204": {
"description": "No Content"
}
}
},
"delete": {
"security": [
{
"BasicAuth": []
}
],
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"Namespace"
],
"summary": "Delete namespace member",
"parameters": [
{
"type": "number",
"description": "Namespace id",
"name": "namespace_id",
"in": "path",
"required": true
}
],
"responses": {
"204": {
"description": "No Content"
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/xerrors.ErrCode"
}
}
}
}
},
"/namespaces/{namespace_id}/members/self": {
"get": {
"security": [
{
"BasicAuth": []
}
],
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"Namespace"
],
"summary": "Get self namespace member info",
"parameters": [
{
"type": "number",
"description": "Namespace id",
"name": "namespace_id",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/types.NamespaceMemberItem"
}
},
"404": {
"description": "Not Found",
"schema": {
"$ref": "#/definitions/xerrors.ErrCode"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/xerrors.ErrCode"
}
}
}
}
},
"/namespaces/{namespace_id}/repositories/{repository_id}/builders": {
"post": {
"security": [
Expand Down Expand Up @@ -5409,7 +5623,7 @@ const docTemplate = `{
"WebhookResourceTypeMember"
]
},
"types.AddMemberRequest": {
"types.AddNamespaceMemberRequest": {
"type": "object",
"properties": {
"role": {
Expand All @@ -5426,6 +5640,15 @@ const docTemplate = `{
}
}
},
"types.AddNamespaceMemberResponse": {
"type": "object",
"properties": {
"id": {
"type": "integer",
"example": 10
}
}
},
"types.BuilderItem": {
"type": "object",
"properties": {
Expand Down Expand Up @@ -6415,6 +6638,39 @@ const docTemplate = `{
}
}
},
"types.NamespaceMemberItem": {
"type": "object",
"properties": {
"created_at": {
"type": "string",
"example": "2006-01-02 15:04:05"
},
"id": {
"type": "integer",
"example": 1
},
"role": {
"allOf": [
{
"$ref": "#/definitions/enums.NamespaceRole"
}
],
"example": "NamespaceAdmin"
},
"updated_at": {
"type": "string",
"example": "2006-01-02 15:04:05"
},
"user_id": {
"type": "integer",
"example": 1
},
"username": {
"type": "string",
"example": "admin"
}
}
},
"types.Oauth2ClientIDResponse": {
"type": "object",
"properties": {
Expand Down Expand Up @@ -7325,6 +7581,23 @@ const docTemplate = `{
}
}
},
"types.UpdateMemberRequest": {
"type": "object",
"properties": {
"role": {
"allOf": [
{
"$ref": "#/definitions/enums.NamespaceRole"
}
],
"example": "NamespaceReader"
},
"user_id": {
"type": "integer",
"example": 10
}
}
},
"types.UserItem": {
"type": "object",
"properties": {
Expand Down
Loading

0 comments on commit d64a698

Please sign in to comment.