From 5d82b21165ab6fa55230a4476ff60de513414b07 Mon Sep 17 00:00:00 2001 From: Emile Date: Fri, 8 Mar 2019 12:51:31 +0100 Subject: updated the api --- http.go | 113 +++++++++++++++++++++++++++++++++++++++++++++++++++++----------- 1 file changed, 94 insertions(+), 19 deletions(-) (limited to 'http.go') diff --git a/http.go b/http.go index 851fa53..af4fdba 100644 --- a/http.go +++ b/http.go @@ -18,32 +18,99 @@ package main import ( "database/sql" - "git.darknebu.la/GalaxySimulator/db_actions" + "git.darknebu.la/GalaxySimulator/db-actions" "git.darknebu.la/GalaxySimulator/structs" ) // IndexEndpoint gives a basic overview over the api func indexEndpoint() string { - indexString := `Galaxy Simulator Database + indexString := `

Galaxy Simulator Database

API: - - / ("GET") - - /new ("POST") - - /printall ("GET") - - /insert/{treeindex} ("POST") - - /starlist/{treeindex} ("GET") - - /dumptree/{treeindex} ("GET") - - - /updatetotalmass/{treeindex} ("GET") - - /updatecenterofmass/{treeindex} ("GET") - - - /metrics ("GET") - - /export/{treeindex} ("POST") - - - /fastinsertjson/{filename} ("GET") - - /fastinsertlist/{filename} ("GET") - - - /readdir ("GET") +

/ (GET)

+ +

/new (POST)

+ Create a new Tree +
+ Parameters: + + +

/deleteStars (POST)

+ Delete all stars from the stars Table +
+ Parameters: + + +

/deleteNodes (POST)

+ Delete all nodes from the nodes Table +
+ Parameters: + + +

/starslist/go (GET)

+ List all stars using go-array format +
+ Parameters: + + +

/starslist/csv (GET)

+ List all stars as a csv +
+ Parameters: + + +

/updatetotalmass (POST)

+ Update the total mass of all the nodes in the tree with the given index +
+ Parameters: + + +

/updatecenterofmass (POST)

+ Update the center of mass of all the nodes in the tree with the given index +
+ Parameters: + + +

/genforesttree (GET)

+ Generate the forest representation of the tree with the given index +
+ Parameters: + + + + ` return indexString @@ -95,3 +162,11 @@ func updateCenterOfMassEndpoint(db *sql.DB, index int64) { func genForestTreeEndpoint(db *sql.DB, index int64) string { return db_actions.GenForestTree(db, index) } + +func initStarsTableEndpoint(db *sql.DB) { + db_actions.InitStarsTable(db) +} + +func initNodesTableEndpoint(db *sql.DB) { + db_actions.InitNodesTable(db) +} -- cgit 1.4.1