// Code generated by hostgen. DO NOT EDIT. // // This file contains client wrappers for the Math host service. // It is intended for use in Navidrome plugins built with TinyGo. package main import ( "encoding/json" "errors" "github.com/extism/go-pdk" ) // math_add is the host function provided by Navidrome. // //go:wasmimport extism:host/user math_add func math_add(int32, int32) uint64 // MathAddResponse is the response type for Math.Add. type MathAddResponse struct { Result int32 `json:"result,omitempty"` Error string `json:"error,omitempty"` } // MathAdd calls the math_add host function. func MathAdd(a int32, b int32) (*MathAddResponse, error) { // Call the host function responsePtr := math_add(a, b) // Read the response from memory responseMem := pdk.FindMemory(responsePtr) responseBytes := responseMem.ReadBytes() // Parse the response var response MathAddResponse if err := json.Unmarshal(responseBytes, &response); err != nil { return nil, err } if response.Error != "" { return nil, errors.New(response.Error) } return &response, nil }