Skip to content

Commit b3fbf3c

Browse files
committed
update
1 parent e213aea commit b3fbf3c

File tree

4 files changed

+313
-1
lines changed

4 files changed

+313
-1
lines changed

Administration/Organizations.md

Lines changed: 133 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,133 @@
1+
# Organization Administration
2+
3+
## Create a new organization
4+
5+
```
6+
POST /admin/users/:username/orgs
7+
```
8+
9+
### Parameters
10+
11+
|Name|Type|Description|
12+
|----|----|-----------|
13+
|username|string|**Required** Organization user name|
14+
|full_name|string|Full name of organization|
15+
|description|string|Description to the organization|
16+
|website|string|Official website|
17+
|location|string|Organization location|
18+
19+
### Example
20+
21+
```json
22+
{
23+
"username": "gogs",
24+
"full_name": "Gogs",
25+
"description": "Gogs is a painless self-hosted Git Service.",
26+
"website": "https://gogs.io",
27+
"location": "USA"
28+
}
29+
```
30+
31+
### Response
32+
33+
```
34+
Status: 201 Created
35+
```
36+
```json
37+
{
38+
"id": 7,
39+
"username": "gogs",
40+
"full_name": "Gogs",
41+
"avatar_url": "/avatars/7",
42+
"description": "Gogs is a painless self-hosted Git Service.",
43+
"website": "https://gogs.io",
44+
"location": "USA"
45+
}
46+
```
47+
48+
## Create team of an organization
49+
50+
```
51+
POST /admin/orgs/:orgname/teams
52+
```
53+
54+
### Parameters
55+
56+
|Name|Type|Description|
57+
|----|----|-----------|
58+
|name|string|**Required** Team name|
59+
|description|string|Description to the team|
60+
|permission|string|Team permission, can be **read**, **write** or **admin**, default is **read**|
61+
62+
### Example
63+
64+
```json
65+
{
66+
"name": "new-team",
67+
"description": "A new team created by API",
68+
"permission": "write"
69+
}
70+
```
71+
72+
### Response
73+
74+
```
75+
Status: 201 Created
76+
```
77+
```json
78+
{
79+
"id": 12,
80+
"name": "new-team",
81+
"description": "A new team created by API",
82+
"permission": "write"
83+
}
84+
```
85+
86+
## Add team membership
87+
88+
```
89+
PUT /admin/teams/:teamid/members/:username
90+
```
91+
92+
### Response
93+
94+
```
95+
Status: 204 No Content
96+
```
97+
98+
## Remove team membership
99+
100+
```
101+
DELETE /admin/teams/:teamid/members/:username
102+
```
103+
104+
### Response
105+
106+
```
107+
Status: 204 No Content
108+
```
109+
110+
## Add or update team repository
111+
112+
```
113+
PUT /admin/teams/:teamid/repos/:reponame
114+
```
115+
116+
### Response
117+
118+
```
119+
Status: 204 No Content
120+
```
121+
122+
## Remove team repository
123+
124+
```
125+
DELETE /admin/teams/:teamid/repos/:reponame
126+
```
127+
128+
### Response
129+
130+
```
131+
Status: 204 No Content
132+
```
133+

Administration/Repositories.md

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
# Repositorie Administration
2+
3+
## Create a new repository
4+
5+
Create a new repository for a user or organization.
6+
7+
```
8+
POST /admin/users/:username/repos
9+
```
10+
11+
### Parameters
12+
13+
|Name|Type|Description|
14+
|----|----|-----------|
15+
|name|string|**Required** The name of the repository|
16+
|description|string|A short description of the repository|
17+
|private|bool|Either **true** to create a private repository, or **false** to create a public one. Default is **false**|
18+
|auto_init|bool|Pass **true** to create an initial commit with README, .gitignore and LICENSE. Default is **false**|
19+
|gitignores|string|Desired [language .gitignore templates](https://github.com/gogs/gogs/tree/master/conf/gitignore) to apply. Use the name of the templates. For example, "Go" or "Go,SublimeText".|
20+
|license|string|Desired [LICENSE template](https://github.com/gogs/gogs/tree/master/conf/license) to apply. Use the name of the template. For example, "Apache v2 License" or "MIT License".|
21+
|readme|string|Desired README template to apply. Use the name of the template. Default is **Default**|
22+
23+
### Example
24+
25+
```json
26+
{
27+
"name": "Hello-World",
28+
"description": "This is your first repository",
29+
"private": false
30+
}
31+
```
32+
33+
### Response
34+
35+
```
36+
Status: 201 Created
37+
```
38+
```json
39+
{
40+
"id": 27,
41+
"owner": {
42+
"id": 1,
43+
"username": "unknwon",
44+
"full_name": "",
45+
"email": "fake@local",
46+
"avatar_url": "/avatars/1"
47+
},
48+
"full_name": "unknwon/Hello-World",
49+
"private": false,
50+
"fork": false,
51+
"html_url": "https://try.gogs.io/unknwon/Hello-World",
52+
"clone_url": "https://try.gogs.io/unknwon/hello-world.git",
53+
"ssh_url": "git@try.gogs.io:unknwon/hello-world.git",
54+
"permissions": {
55+
"admin": true,
56+
"push": true,
57+
"pull": true
58+
}
59+
}
60+
```

Administration/Users.md

Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
# User Administration
2+
3+
## Create a new user
4+
5+
```
6+
POST /admin/users
7+
```
8+
9+
### Parameters
10+
11+
|Name|Type|Description|
12+
|----|----|-----------|
13+
|source_id|int|Authentication source ID. Remain default means a local user|
14+
|login_name|string|Authentication source login name, **required** for non-local user|
15+
|username|string|**Required** Unique user name|
16+
|email|string|**Required** Unique email address of user|
17+
|password|string|Default password for user, **required** for local user|
18+
|send_notify|bool|Send a notification email for this creation, require mailer service enabled|
19+
20+
### Example
21+
22+
```json
23+
{
24+
"source_id": 1,
25+
"login_name": "apiuser",
26+
"username": "apiuser",
27+
"email": "apiuser@user.com"
28+
}
29+
```
30+
31+
### Response
32+
33+
```
34+
Status: 201 Created
35+
```
36+
```json
37+
{
38+
"id": 9,
39+
"username": "apiuser",
40+
"full_name": "",
41+
"email": "apiuser@user.com",
42+
"avatar_url": "//1.gravatar.com/avatar/0550f43afcac6f78c3af2dd3a6f1c176"
43+
}
44+
```
45+
46+
## Edit an existing user
47+
48+
```
49+
PATCH /admin/users/:username
50+
```
51+
52+
### Parameters
53+
54+
|Name|Type|Description|
55+
|----|----|-----------|
56+
|source_id|int|Authentication source ID. Remain default means a local user|
57+
|login_name|string|Authentication source login name, **required** for non-local user|
58+
|full_name|string|Full name of user|
59+
|email|string|**Required** Unique email address of user|
60+
|password|string|New password for user. Ignore this field to leave it unchanged|
61+
|website|string|Personal website of user|
62+
|location|string|Location of user|
63+
|active|bool|Active or deactive the user. Ignore this field to leave it unchanged|
64+
|admin|bool|Promote or depromote the user to be site admin. Ignore this field to leave it unchanged|
65+
|allow_git_hook|bool|Allow or disallow the user for using Git hooks. Ignore this field to leave it unchanged|
66+
|allow_import_local|bool|Allow or disallow the user for importing local repositories. Ignore this field to leave it unchanged|
67+
68+
### Example
69+
70+
```json
71+
{
72+
"source_id":1,
73+
"login_name":"apiuser",
74+
"full_name": "API User",
75+
"email":"apiuser@user.com"
76+
}
77+
```
78+
79+
### Response
80+
81+
```
82+
Status: 200 OK
83+
```
84+
```json
85+
{
86+
"id": 9,
87+
"username": "apiuser",
88+
"full_name": "API User",
89+
"email": "apiuser@user.com",
90+
"avatar_url": "//1.gravatar.com/avatar/b7193b9f212a6fe7a20db58d556fcc41"
91+
}
92+
```
93+
94+
## Delete a user
95+
96+
```
97+
DELETE /admin/users/:username
98+
```
99+
100+
```
101+
Status: 204 No Content
102+
```
103+
104+
## Create a public key for user
105+
106+
```
107+
POST /admin/users/:username/keys
108+
```
109+
110+
### Parameters
111+
112+
|Name|Type|Description|
113+
|----|----|-----------|
114+
|title|string|**Required** The name of the key|
115+
|key|string|**Required** The content of the key|

README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,12 @@ If you have any questions or concern, please [file an issue](https://github.com/
1010

1111
## TOC
1212

13+
- [Administration](Administration)
14+
- [Users](Administration/Users.md)
15+
- [Repositories](Administration/Repositories.md)
16+
- [Organizations](Administration/Organizations.md)
1317
- [Repositories](Repositories)
14-
- [Commits](Repositories/Commits.md)
18+
- [Commits](Repositories/Commits.md)
1519

1620
## Installation
1721

0 commit comments

Comments
 (0)