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

Function apiV2GetSpellScript

internal/web/api_v2_spells.go:121–133  ·  view source on GitHub ↗

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

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

Source from the content-addressed store, hash-verified

119
120// GET /admin/api/v2/spells/{spellId}/script
121func apiV2GetSpellScript(w http.ResponseWriter, r *http.Request) {
122 spellId := r.PathValue("spellId")
123 spec := spells.GetSpell(spellId)
124 if spec == nil {
125 writeAPIError(w, http.StatusNotFound, "spell not found: "+spellId)
126 return
127 }
128
129 writeJSON(w, http.StatusOK, APIResponse[map[string]string]{
130 Success: true,
131 Data: map[string]string{"script": spec.GetScript()},
132 })
133}
134
135// PUT /admin/api/v2/spells/{spellId}/script
136func apiV2PutSpellScript(w http.ResponseWriter, r *http.Request) {

Callers

nothing calls this directly

Calls 4

GetSpellFunction · 0.92
writeAPIErrorFunction · 0.85
writeJSONFunction · 0.85
GetScriptMethod · 0.45

Tested by

no test coverage detected