feat(grpc): add support for fetching empty classrooms
All checks were successful
Build / build (push) Successful in 1m31s
All checks were successful
Build / build (push) Successful in 1m31s
Implement the `TASK_TYPE_GET_EMPTY_CLASSROOM` task type to allow users to fetch available classroom information. - Add `TASK_TYPE_GET_EMPTY_CLASSROOM` to the `TaskType` enum in protobuf. - Define `GetEmptyClassroomPayload` and `EmptyClassroomResultData` messages. - Implement `getEmptyClassrooms`
This commit is contained in:
@@ -2,6 +2,7 @@ package parser
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"encoding/json"
|
||||
"io"
|
||||
"net/http"
|
||||
"strings"
|
||||
@@ -71,4 +72,12 @@ func isValidUTF8(data []byte) bool {
|
||||
}
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
func decodeJSONResponse(resp *http.Response, v any) error {
|
||||
body, err := io.ReadAll(resp.Body)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return json.NewDecoder(bytes.NewReader(body)).Decode(v)
|
||||
}
|
||||
Reference in New Issue
Block a user