(r *http.Request)
| 13 | } |
| 14 | |
| 15 | func (m *FishingModule) apiPatchConfig(r *http.Request) (int, bool, any) { |
| 16 | var body struct { |
| 17 | FishingRodItemIds []int `json:"fishingroditems"` |
| 18 | } |
| 19 | if err := json.NewDecoder(r.Body).Decode(&body); err != nil { |
| 20 | return http.StatusBadRequest, false, map[string]string{"error": "malformed request body: " + err.Error()} |
| 21 | } |
| 22 | |
| 23 | if body.FishingRodItemIds == nil { |
| 24 | body.FishingRodItemIds = []int{} |
| 25 | } |
| 26 | m.cfg.FishingRodItemIds = body.FishingRodItemIds |
| 27 | if err := m.plug.WriteStruct(configKey, m.cfg); err != nil { |
| 28 | return http.StatusInternalServerError, false, map[string]string{"error": "failed to save config: " + err.Error()} |
| 29 | } |
| 30 | |
| 31 | return http.StatusOK, true, map[string]string{"status": "saved"} |
| 32 | } |
| 33 | |
| 34 | func (m *FishingModule) apiGetCatchables(r *http.Request) (int, bool, any) { |
| 35 | catchables := m.cfg.Catchables |
nothing calls this directly
no test coverage detected