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

Build code examples on top of the Helpdesk app from the Get Started guide #92

Open
Exadra37 opened this issue Feb 9, 2023 · 3 comments
Labels
documentation Improvements or additions to documentation

Comments

@Exadra37
Copy link

Exadra37 commented Feb 9, 2023

Show where you found the issue

I have followed the Get Started guide to build the Helpdesk app and then followed the Whats next section where we have a link to learn how to use Code interfaces.

While I perfectly understood how to use the define_for , because it builds on top of the Helpdesk app, I wasn't able to grasp how to use the define_interface, because the example for it doesn't build on top of the Helpdesk app.

Share the problematic documentation

define_for and define_interface

Notice how we included a specific Api module using define_for above. Without this, no functions will be defined in the resource. This is because you might want to define the interface for multiple resources in a single module. While we encourage the use of define_for Api , it is not the only way to do it. You could also do something like this:

defmodule MyApp.MyApi.Interface do
 require Ash.CodeInterface

 Ash.CodeInterface.define_interface(MyApp.MyApi, MyApp.Resource1)
 Ash.CodeInterface.define_interface(MyApp.MyApi, MyApp.Resource2)
end

And then call functions on MyApp.MyApi.Interface instead. 

`

Additional context

It would be awesome if all the docs code examples would build on top of the HelpDesk app.

@Exadra37 Exadra37 added the documentation Improvements or additions to documentation label Feb 9, 2023
@zachdaniel
Copy link
Collaborator

Great idea :D

@Exadra37
Copy link
Author

Can you please give me an example of how to use define_interface with the Helpdesk app?

@zachdaniel
Copy link
Collaborator

Hey there! Sorry it took me a while to get to this. I responded on discord with an example :)

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

No branches or pull requests

3 participants
@Exadra37 @zachdaniel and others