Skip to content

Commit 76cc4c5

Browse files
committed
Update
1 parent 11faaa8 commit 76cc4c5

File tree

15 files changed

+1544
-1
lines changed

15 files changed

+1544
-1
lines changed

Miscellaneous/README.md

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
# Miscellaneous
2+
3+
## Markdown
4+
5+
### Render an arbitrary Markdown document
6+
7+
```
8+
POST /markdown
9+
```
10+
11+
### Parameters
12+
13+
|Name|Type|Description|
14+
|----|----|-----------|
15+
|text|string|**Required** The Markdown text to render|
16+
|mode|string|The rendering mode, can be empty or **gfm**. In **gfm** mode, Markdown will be rendered with repository context|
17+
|context|string|The repository context. Only taken into account when rendering mode is **gfm**|
18+
19+
### Example
20+
21+
```json
22+
{
23+
"text": "Hello world gogs/gogs#1 **cool**, and #1!",
24+
"mode": "gfm",
25+
"context": "gogs/gogs"
26+
}
27+
```
28+
29+
### Response
30+
31+
```
32+
Status: 200 OK
33+
Content-Type: text/html
34+
```
35+
```html
36+
<p>Hello world gogs/gogs#1 <strong>cool</strong>, and <a href="https://try.gogs.io/gogs/gogs/issues/1" rel="nofollow">#1</a>!</p>
37+
```
38+
39+
### Render a Markdown document in raw mode
40+
41+
```
42+
POST /markdown/raw
43+
```
44+
45+
### Parameters
46+
47+
The raw API takes a Markdown document as plaintext(`text/plain`) and renders it as plain Markdown without a repository context.
48+
49+
### Response
50+
51+
```
52+
Status: 200 OK
53+
Content-Type: text/html
54+
```
55+
```html
56+
<p>Hello world gogs/gogs#1 <strong>cool</strong>, and #1!</p>
57+
```

Organizations/Members.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Members
2+
3+
## Add or update organization membership
4+
5+
In order to create or update a user's membership with an organization, the authenticated user must be an organization owner.
6+
7+
```
8+
PUT /orgs/:orgname/memberships/:username
9+
```
10+
11+
### Parameters
12+
13+
|Name|Type|Description|
14+
|----|----|-----------|
15+
|role|string|**Required** The role to give the user in the organization. Can be one of: **admin** - The user will become an owner of the organization; **member** - The user will become a non-owner member of the organization.|

Organizations/README.md

Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
# Organizations
2+
3+
## List your organizations
4+
5+
List organizations for the authenticated user.
6+
7+
```
8+
GET /user/orgs
9+
```
10+
11+
### Response
12+
13+
```
14+
Status: 200 OK
15+
```
16+
```json
17+
[
18+
{
19+
"id": 6,
20+
"username": "gogs",
21+
"full_name": "Gogs",
22+
"avatar_url": "/avatars/6",
23+
"description": "Gogs is a painless self-hosted Git Service.",
24+
"website": "https://gogs.io",
25+
"location": "USA"
26+
}
27+
]
28+
```
29+
30+
## List user organizations
31+
32+
List public organization memberships for the specified user.
33+
34+
```
35+
GET /users/:username/orgs
36+
```
37+
38+
### Response
39+
40+
```
41+
Status: 200 OK
42+
```
43+
```json
44+
[
45+
{
46+
"id": 6,
47+
"username": "gogs",
48+
"full_name": "Gogs",
49+
"avatar_url": "/avatars/6",
50+
"description": "Gogs is a painless self-hosted Git Service.",
51+
"website": "https://gogs.io",
52+
"location": "USA"
53+
}
54+
]
55+
```
56+
57+
## Get an organization
58+
59+
```
60+
GET /orgs/:orgname
61+
```
62+
63+
### Response
64+
65+
```
66+
Status: 200 OK
67+
```
68+
```json
69+
{
70+
"id": 6,
71+
"username": "gogs",
72+
"full_name": "Gogs",
73+
"avatar_url": "/avatars/6",
74+
"description": "Gogs is a painless self-hosted Git Service.",
75+
"website": "https://gogs.io",
76+
"location": "USA"
77+
}
78+
```
79+
80+
## Edit an organization
81+
82+
```
83+
PATCH /orgs/:org
84+
```
85+
86+
### Parameters
87+
88+
|Name|Type|Description|
89+
|----|----|-----------|
90+
|full_name|string|Full name of organization|
91+
|description|string|Description to the organization|
92+
|website|string|Official website|
93+
|location|string|Organization location|
94+
95+
### Example
96+
97+
```json
98+
{
99+
"full_name": "Gogs2",
100+
"description": "Gogs is a painless self-hosted Git Service.",
101+
"website": "https://gogs.io",
102+
"location": "USA"
103+
}
104+
```
105+
106+
### Response
107+
108+
```
109+
Status: 200 OK
110+
```
111+
```json
112+
{
113+
"id": 6,
114+
"username": "gogs",
115+
"full_name": "Gogs2",
116+
"avatar_url": "/avatars/6",
117+
"description": "Gogs is a painless self-hosted Git Service.",
118+
"website": "https://gogs.io",
119+
"location": "USA"
120+
}
121+
```

Organizations/Teams.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# Teams
2+
3+
## List teams of an organization
4+
5+
```
6+
GET /orgs/:orgname/teams
7+
```
8+
9+
### Response
10+
11+
```
12+
Status: 200 OK
13+
```
14+
```json
15+
[
16+
{
17+
"id": 4,
18+
"name": "Owners",
19+
"description": "",
20+
"permission": "owner"
21+
},
22+
{
23+
"id": 5,
24+
"name": "Members",
25+
"description": "",
26+
"permission": "read"
27+
},
28+
{
29+
"id": 11,
30+
"name": "api-team",
31+
"description": "",
32+
"permission": "write"
33+
}
34+
]
35+
```

README.md

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,21 @@ If you have any questions or concern, please [file an issue](https://github.com/
1818
- [Comments](Issues/Comments.md)
1919
- [Labels](Issues/Labels.md)
2020
- [Milestones](Issues/Milestones.md)
21+
- [Miscellaneous](Miscellaneous)
22+
- [Organizations](Organizations)
23+
- [Members](Organizations/Members.md)
24+
- [Teams](Organizations/Teams.md)
2125
- [Repositories](Repositories)
26+
- [Branches](Repositories/Branches.md)
27+
- [Collaborators](Repositories/Collaborators.md)
2228
- [Commits](Repositories/Commits.md)
29+
- [Contents](Repositories/Contents.md)
30+
- [Deploy Keys](Repositories/Deploy%20Keys.md)
31+
- [Webhooks](Repositories/Webhooks.md)
32+
- [Users](Users)
33+
- [Emails](Users/Emails.md)
34+
- [Followers](Users/Followers.md)
35+
- [Public Keys](Users/Public%20Keys.md)
2336

2437
## Installation
2538

@@ -31,7 +44,7 @@ All Gogs APIs are under **v1** using request path prefix `/api/v1`.
3144

3245
## Schema
3346

34-
All data is sent and received as JSON.
47+
All data is sent and received as JSON unless specified otherwise.
3548

3649
```
3750
HTTP/2 200

Repositories/Branches.md

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
# Branches
2+
3+
## List Branches
4+
5+
```
6+
GET /repos/:owner/:repo/branches
7+
```
8+
9+
### Response
10+
11+
```
12+
Status: 200 OK
13+
```
14+
```json
15+
[
16+
{
17+
"name":"master",
18+
"commit":{
19+
"id":"c1c220c4dd6df895965a02b8be575c5e2f78dfd1",
20+
"message":"A commit message. \n",
21+
"url":"Not implemented",
22+
"author":{
23+
"name":"Author Name",
24+
"email":"author@email.com",
25+
"username":""
26+
}
27+
}
28+
},
29+
{
30+
"name":"second-branch",
31+
"commit":{
32+
"id":"0a0fdf63c23af6a2836c426c5284136015ec2996",
33+
"message":"A second commit message.\n",
34+
"url":"Not implemented",
35+
"author":{
36+
"name":"Author Name",
37+
"email":"author@email.com",
38+
"username":""
39+
}
40+
}
41+
}
42+
]
43+
```
44+
45+
## Get Branch
46+
47+
```
48+
GET /repos/:owner/:repo/branches/:branch
49+
```
50+
51+
### Response
52+
53+
```
54+
Status: 200 OK
55+
```
56+
```json
57+
{
58+
"name":":branchname",
59+
"commit":{
60+
"id":"0a0fdf63c23af6a2836c426c5284136015ec2996",
61+
"message":"A second commit message.\n",
62+
"url":"Not implemented",
63+
"author":{
64+
"name":"Author Name",
65+
"email":"author@email.com",
66+
"username":""
67+
}
68+
}
69+
}
70+
```

Repositories/Collaborators.md

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# Collaborators
2+
3+
## Add user as a collaborator
4+
5+
```
6+
PUT /repos/:username/:reponame/collaborators/:collaborator
7+
```
8+
9+
### Parameters
10+
11+
|Name|Type|Description|
12+
|----|----|-----------|
13+
|permission|string|The permission to grant the collaborator. Can be one of **read**, **write** and **admin**. Default is **write**. Read details on [forum](https://discuss.gogs.io/t/how-to-manage-collaborators/87)|
14+
15+
## Get collaborators
16+
17+
```
18+
GET /repos/:username/:reponame/collaborators
19+
```
20+
21+
### Response
22+
23+
```
24+
Status: 200 OK
25+
```
26+
```json
27+
[
28+
{
29+
"id": 3,
30+
"username": "user1",
31+
"login": "user1",
32+
"full_name": "",
33+
"email": "user1@user.com",
34+
"avatar_url": "https://secure.gravatar.com/avatar/0207f4280f6c1bd45e1a2ed7cb1cca3d",
35+
"permissions": {
36+
"admin": false,
37+
"push": true,
38+
"pull": true
39+
}
40+
}
41+
]
42+
```

0 commit comments

Comments
 (0)