Beispiel #1
0
func startSession(r *commandRequest, w http.ResponseWriter) {
    type Res struct {
        Name string `json:"name"`
        State string `json:"state"`
        Results map[string]interface{} `json:"results"`
    }
    res := Res{
        Name: r.Name,
        State: "done",
        Results: map[string]interface{}{
            "sessionId": "SID_0001",
            "timeout": 180,
        },
    }
    webtool.WriteJsonResponse(res, w)
}
Beispiel #2
0
func takePicture(r *commandRequest, w http.ResponseWriter) {
    fmt.Println(r)
    type Res struct {
        Name string `json:"name"`
        State string `json:"state"`
        Id int64 `json:"id"`
        Progress map[string]int64 `json:"progress"`
    }
    res := Res{
        Name: r.Name,
        State: "inProgress",
        Id: 1,
        Progress: map[string]int64 {
            "completion": 0,
        },
    }
    webtool.WriteJsonResponse(res, w)
}