// Code generated by ndpgen. DO NOT EDIT.//// This file contains client wrappers for the List host service.// It is intended for use in Navidrome plugins built with TinyGo.////go:build wasip1package ndhostimport ("encoding/json""errors""github.com/navidrome/navidrome/plugins/pdk/go/pdk")// Filter represents the Filter data structure.type Filter struct {Active bool `json:"active"`}// list_items is the host function provided by Navidrome.////go:wasmimport extism:host/user list_itemsfunc list_items(uint64) uint64type listItemsRequest struct {Name string `json:"name"`Filter Filter `json:"filter"`}type listItemsResponse struct {Count int32 `json:"count,omitempty"`Error string `json:"error,omitempty"`}// ListItems calls the list_items host function.func ListItems(name string, filter Filter) (int32, error) {// Marshal request to JSONreq := listItemsRequest{Name: name,Filter: filter,}reqBytes, err := json.Marshal(req)if err != nil {return 0, err}reqMem := pdk.AllocateBytes(reqBytes)defer reqMem.Free()// Call the host functionresponsePtr := list_items(reqMem.Offset())// Read the response from memoryresponseMem := pdk.FindMemory(responsePtr)responseBytes := responseMem.ReadBytes()// Parse the responsevar response listItemsResponseif err := json.Unmarshal(responseBytes, &response); err != nil {return 0, err}// Convert Error field to Go errorif response.Error != "" {return 0, errors.New(response.Error)}return response.Count, nil}