MCPcopy Create free account
hub / github.com/GoMudEngine/GoMud / apiV1PatchKeywords

Function apiV1PatchKeywords

internal/web/api_v1_keywords.go:19–35  ·  view source on GitHub ↗

PATCH /admin/api/v1/keywords

(w http.ResponseWriter, r *http.Request)

Source from the content-addressed store, hash-verified

17
18// PATCH /admin/api/v1/keywords
19func apiV1PatchKeywords(w http.ResponseWriter, r *http.Request) {
20 var incoming keywords.Aliases
21 if err := json.NewDecoder(r.Body).Decode(&incoming); err != nil {
22 writeAPIError(w, http.StatusBadRequest, "malformed request body: "+err.Error())
23 return
24 }
25
26 if err := keywords.SaveKeywords(&incoming); err != nil {
27 writeAPIError(w, http.StatusInternalServerError, err.Error())
28 return
29 }
30
31 writeJSON(w, http.StatusOK, APIResponse[*keywords.Aliases]{
32 Success: true,
33 Data: keywords.GetKeywords(),
34 })
35}

Callers

nothing calls this directly

Calls 4

SaveKeywordsFunction · 0.92
GetKeywordsFunction · 0.92
writeAPIErrorFunction · 0.85
writeJSONFunction · 0.85

Tested by

no test coverage detected