From 658248f827fac5a8d42d7a12bdfdec2640bbfad5 Mon Sep 17 00:00:00 2001 From: Deluan Date: Tue, 23 Dec 2025 14:48:31 -0500 Subject: [PATCH] feat(subsonicapi): update Call method to return JSON string response Signed-off-by: Deluan --- plugins/host/subsonicapi.go | 2 +- plugins/host/subsonicapi_gen.go | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/plugins/host/subsonicapi.go b/plugins/host/subsonicapi.go index c0ba41853..d8fa900d3 100644 --- a/plugins/host/subsonicapi.go +++ b/plugins/host/subsonicapi.go @@ -14,5 +14,5 @@ type SubsonicAPIService interface { // The uri parameter should be the Subsonic API path without the server prefix, // e.g., "getAlbumList2?type=random&size=10". The response is returned as raw JSON. //nd:hostfunc - Call(ctx context.Context, uri string) (response []byte, err error) + Call(ctx context.Context, uri string) (responseJSON string, err error) } diff --git a/plugins/host/subsonicapi_gen.go b/plugins/host/subsonicapi_gen.go index c5bdf22a0..5b42d67d8 100644 --- a/plugins/host/subsonicapi_gen.go +++ b/plugins/host/subsonicapi_gen.go @@ -11,8 +11,8 @@ import ( // SubsonicAPICallResponse is the response type for SubsonicAPI.Call. type SubsonicAPICallResponse struct { - Response []byte `json:"response,omitempty"` - Error string `json:"error,omitempty"` + ResponseJSON string `json:"responseJSON,omitempty"` + Error string `json:"error,omitempty"` } // RegisterSubsonicAPIHostFunctions registers SubsonicAPI service host functions. @@ -34,14 +34,14 @@ func newSubsonicAPICallHostFunction(service SubsonicAPIService) extism.HostFunct } // Call the service method - response, err := service.Call(ctx, uri) + responsejson, err := service.Call(ctx, uri) if err != nil { subsonicapiWriteError(p, stack, err) return } // Write JSON response to plugin memory resp := SubsonicAPICallResponse{ - Response: response, + ResponseJSON: responsejson, } subsonicapiWriteResponse(p, stack, resp) },