Skip to content

Commit efb7bef

Browse files
committed
setup existing func to use the call func and added some todo
1 parent 6595411 commit efb7bef

File tree

1 file changed

+16
-18
lines changed

1 file changed

+16
-18
lines changed

guac_connections.go

Lines changed: 16 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@ package guacapi
22

33
import (
44
"encoding/json"
5-
"io/ioutil"
6-
"net/http"
75
)
86

97
type RootGuacConnection struct {
@@ -50,22 +48,7 @@ type GuacConnectionAttributes struct {
5048
}
5149

5250
func (g *Guac) GetConnections() (RootGuacConnection, error) {
53-
req, _ := http.NewRequest("GET", g.URI+"/api/session/data/mysql/connectionGroups/ROOT/tree", nil)
54-
55-
q := req.URL.Query()
56-
q.Add("token", g.Token)
57-
req.URL.RawQuery = q.Encode()
58-
59-
client := &http.Client{}
60-
resp, err := client.Do(req)
61-
if err != nil {
62-
return RootGuacConnection{}, err
63-
}
64-
65-
body, err := ioutil.ReadAll(resp.Body)
66-
if err != nil {
67-
return RootGuacConnection{}, err
68-
}
51+
body, err := g.Call("GET", "/api/session/data/mysql/connectionGroups/ROOT/tree", map[string]string{})
6952

7053
var connresp RootGuacConnection
7154

@@ -76,3 +59,18 @@ func (g *Guac) GetConnections() (RootGuacConnection, error) {
7659

7760
return connresp, err
7861
}
62+
63+
// TODO
64+
func (g *Guac) GetConnectionsFlat() ([]GuacConnection, error) {
65+
return []GuacConnection{}, nil
66+
}
67+
68+
func (g *Guac) AddConnection(conn GuacConnection) (GuacConnection, error) {
69+
return GuacConnection{}, nil
70+
}
71+
func (g *Guac) DeleteConnection(conn GuacConnection) (GuacConnection, error) {
72+
return GuacConnection{}, nil
73+
}
74+
func (g *Guac) GetConnection(conn GuacConnection) (GuacConnection, error) {
75+
return GuacConnection{}, nil
76+
}

0 commit comments

Comments
 (0)