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

Function apiV2GetSpell

internal/web/api_v2_spells.go:33–45  ·  view source on GitHub ↗

GET /admin/api/v2/spells/{spellId}

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

Source from the content-addressed store, hash-verified

31
32// GET /admin/api/v2/spells/{spellId}
33func apiV2GetSpell(w http.ResponseWriter, r *http.Request) {
34 spellId := r.PathValue("spellId")
35 spec := spells.GetSpell(spellId)
36 if spec == nil {
37 writeAPIError(w, http.StatusNotFound, "spell not found: "+spellId)
38 return
39 }
40
41 writeJSON(w, http.StatusOK, APIResponse[*spells.SpellData]{
42 Success: true,
43 Data: spec,
44 })
45}
46
47// POST /admin/api/v2/spells
48func apiV2CreateSpell(w http.ResponseWriter, r *http.Request) {

Callers

nothing calls this directly

Calls 3

GetSpellFunction · 0.92
writeAPIErrorFunction · 0.85
writeJSONFunction · 0.85

Tested by

no test coverage detected