add usages
Signed-off-by: Pakin <pakin.t@forth.co.th>
This commit is contained in:
parent
caa0833ea2
commit
c8f820e238
1 changed files with 171 additions and 0 deletions
171
README.md
Normal file
171
README.md
Normal file
|
|
@ -0,0 +1,171 @@
|
|||
# tbm-git-service
|
||||
|
||||
Git repo as a service with operational endpoints
|
||||
|
||||
---
|
||||
|
||||
## Endpoints
|
||||
|
||||
### Checkout file
|
||||
|
||||
Get file content or list of file in directory from HEAD
|
||||
|
||||
```
|
||||
GET .../checkout?path=<path_to_file>
|
||||
```
|
||||
|
||||
Examples
|
||||
|
||||
Get list of files in directory
|
||||
|
||||
```bash
|
||||
curl -X GET http://localhost:36593/checkout\?path\=inter
|
||||
aus,common,dev,gbr,gbr_premium,hkg,ltu,mys,rou,sgp,tha,tha_premium,uae_dubai,usa,whatthecup
|
||||
```
|
||||
|
||||
Get file
|
||||
|
||||
```bash
|
||||
curl -X GET http://localhost:36593/checkout\?path\=inter/mys/xml/page_catalog_group_other.lxml
|
||||
|
||||
<Popup>
|
||||
<Cache> "Enable" </Cache>
|
||||
<Width> 1080 </Width>
|
||||
<Height> 1920 </Height>
|
||||
;<Background> "0xeae6e1" </Background>
|
||||
<Volume> SoundVolume </Volume>
|
||||
<EventOpen>
|
||||
; On open
|
||||
|
||||
```
|
||||
|
||||
Error
|
||||
|
||||
```bash
|
||||
curl -X GET http://localhost:36593/checkout\?path\=inter2
|
||||
File not found
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### Fetch
|
||||
|
||||
Fetching & update index of current repo
|
||||
|
||||
```
|
||||
GET .../fetch
|
||||
```
|
||||
|
||||
Expected result
|
||||
|
||||
```
|
||||
{"result": "fetch success"}
|
||||
```
|
||||
|
||||
Error
|
||||
|
||||
```
|
||||
{"error": "..."}
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### Commit
|
||||
|
||||
Commit changes of file i.e. editing, adding, etc.
|
||||
|
||||
```
|
||||
POST .../commit
|
||||
```
|
||||
|
||||
Body must be multipart
|
||||
|
||||
- Single file
|
||||
|
||||
```
|
||||
path: string
|
||||
file: text/binary is acceptable
|
||||
signature_username: string
|
||||
signature_email: stirng
|
||||
message: string
|
||||
```
|
||||
|
||||
- Multiple file
|
||||
|
||||
```
|
||||
signature_username: string
|
||||
signature_email: stirng
|
||||
message: string
|
||||
fileX1: text/binary is acceptable
|
||||
pathX1: string
|
||||
fileX2: text/binary is acceptable
|
||||
pathX2: string
|
||||
...
|
||||
```
|
||||
|
||||
Example
|
||||
|
||||
```curl
|
||||
curl --request POST \
|
||||
--url http://localhost:36583/commit \
|
||||
--header 'content-type: multipart/form-data' \
|
||||
--form path=mys/version.dev \
|
||||
--form 'signature_username=git api' \
|
||||
--form signature_email=supra.m2.dev@forth.co.th \
|
||||
--form 'message=test commit' \
|
||||
--form file=@./mys.version.test
|
||||
```
|
||||
|
||||
NOTE: file & path in multiple file must have the same name after
|
||||
|
||||
---
|
||||
|
||||
### Push
|
||||
|
||||
Push local commits to remote
|
||||
|
||||
```
|
||||
GET .../push
|
||||
```
|
||||
|
||||
Expected result
|
||||
|
||||
```
|
||||
{"result": "push completed"}
|
||||
```
|
||||
|
||||
Error
|
||||
|
||||
```
|
||||
{"error": "..."}
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### Pull
|
||||
|
||||
Pull commits from remote. This operation always does git reset hard first before pull for reason of no conflicts.
|
||||
|
||||
```
|
||||
GET .../pull
|
||||
```
|
||||
|
||||
Expected result
|
||||
|
||||
```
|
||||
{"result": "pull completed"}
|
||||
```
|
||||
|
||||
Error
|
||||
|
||||
```
|
||||
{"error": "..."}
|
||||
```
|
||||
|
||||
NOTE: Commit did lost but could be checkout later
|
||||
|
||||
---
|
||||
|
||||
### Recovery
|
||||
|
||||
WIP...
|
||||
Loading…
Add table
Add a link
Reference in a new issue