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

Function apiV1PatchAudio

internal/web/api_v1_audio.go:82–102  ·  view source on GitHub ↗

PATCH /admin/api/v1/audio Body: {"identifier": {"description":"...","filepath":"...","volume":80}, ...} Replaces the entire sounds configuration.

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

Source from the content-addressed store, hash-verified

80// Body: {"identifier": {"description":"...","filepath":"...","volume":80}, ...}
81// Replaces the entire sounds configuration.
82func apiV1PatchAudio(w http.ResponseWriter, r *http.Request) {
83 var patches map[string]audio.AudioConfig
84 if err := json.NewDecoder(r.Body).Decode(&patches); err != nil {
85 writeAPIError(w, http.StatusBadRequest, "malformed request body: "+err.Error())
86 return
87 }
88
89 if err := audio.SaveAudio(patches); err != nil {
90 writeAPIError(w, http.StatusInternalServerError, err.Error())
91 return
92 }
93
94 writeJSON(w, http.StatusOK, APIResponse[audioAPIResponse]{
95 Success: true,
96 Data: audioAPIResponse{
97 Sounds: audio.GetAllAudio(),
98 Music: audio.GetMusicFiles(),
99 SoundFiles: audio.GetSoundFiles(),
100 },
101 })
102}
103
104// DELETE /admin/api/v1/audio/{identifier}
105// Removes a single sound entry from audio.yaml.

Callers

nothing calls this directly

Calls 6

SaveAudioFunction · 0.92
GetAllAudioFunction · 0.92
GetMusicFilesFunction · 0.92
GetSoundFilesFunction · 0.92
writeAPIErrorFunction · 0.85
writeJSONFunction · 0.85

Tested by

no test coverage detected