Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue with NodeValue, documentation maybe ? #20

Open
Nytrm opened this issue May 13, 2024 · 1 comment
Open

Issue with NodeValue, documentation maybe ? #20

Nytrm opened this issue May 13, 2024 · 1 comment

Comments

@Nytrm
Copy link

Nytrm commented May 13, 2024

Hi, great project but the example seems just a little minimal.

I am trying to access the iTunesLibrary from node but i am not sure how to map the values/types to return types.
In this example its just a string that does not seem to work for me.

no exact matches in call to initializer return NodeValue(self.library.applicationVersion)

my plan was to map playlist but i got stuck with just the string.
https://developer.apple.com/documentation/ituneslibrary/itlibrary/allplaylists

import iTunesLibrary
import NodeAPI

@NodeClass final class iTunesLibraryClass {

    private let library: ITLibrary

    @NodeActor
    @NodeConstructor init() throws {
        library = try ITLibrary(apiVersion: "1.0")
    }

    @NodeActor
    @NodeMethod func allPlaylists() throws -> NodeValueConvertible {
        return NodeValue(self.library.applicationVersion)
    }
}

#NodeModule(exports: ["iTunesLibrary": iTunesLibraryClass.deferredConstructor])`

Any documentation or examples that i can check out how this works ?

@kabiroberai
Copy link
Owner

Could you try return self.library.applicationVersion? iirc String conforms to NodeValueConvertible. Let me know if that works.

Regarding docs, definitely agree that there's a lot of room for improvement. I'd ideally like to create a DocC catalog but haven't got around to it yet due to a lack of time. It's on the roadmap though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants