feat(grpc): add support for fetching empty classrooms
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:
2026-06-02 13:59:30 +08:00
parent d64f2fa20b
commit ee5c36f3ac
7 changed files with 663 additions and 53 deletions

View File

@@ -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)
}