// Code generated by hostgen. 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 wasip1 package main import ( "encoding/json" "github.com/extism/go-pdk" ) // list_items is the host function provided by Navidrome. // //go:wasmimport extism:host/user list_items func list_items(uint64, uint64) uint64 // ListItemsResponse is the response type for List.Items. 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) (*ListItemsResponse, error) { nameMem := pdk.AllocateString(name) defer nameMem.Free() filterBytes, err := json.Marshal(filter) if err != nil { return nil, err } filterMem := pdk.AllocateBytes(filterBytes) defer filterMem.Free() // Call the host function responsePtr := list_items(nameMem.Offset(), filterMem.Offset()) // Read the response from memory responseMem := pdk.FindMemory(responsePtr) responseBytes := responseMem.ReadBytes() // Parse the response var response ListItemsResponse if err := json.Unmarshal(responseBytes, &response); err != nil { return nil, err } return &response, nil }