Get a list of user-defined aliases of a snap

After a few months break I’m resuming work on my snap ansible module and am implementing support for setting snap aliases right now. I need to check whether an alias exists already so I can avoid invoking snap alias needlessly. I checked the output of snap info, but aliases don’t seem to be listed there. Is there a command to do this? Or do I have to rely on implementation details (reading snapd's data files)?

Aliases are now define by the store. You can request an alias for your snap by posting a request in the “store” category here. The process is documented here:

Sorry, perhaps my OP wasn’t clear enough on what I’m trying to accomplish.

I’m not talking about registering an alias on the store, but about simply getting a list of ALL ALIASES, whether defined by the user themselves OR the store.

Perhaps explaining my usecase a bit would help:

For example, if the user tells my module to alias to ytdl they’d write the following ansible playbook:

name: Alias the youtube-dl-casept snap
  # The name of the snap
  name: youtube-dl-casept
# The binary within the snap
  command: youtube-dl
# Alias that to ytdl
  alias: ytdl
  alias-state: present

My module would then invoke the following command for the user:

snap alias ytdl

The user can now run youtube-dl simply by invoking ytdl.

Now, the actual problem: Ansible is designed to manage the system’s configuration declaratively rather than imperatively (as a shell script would), which means that if the alias already exists snap alias shouldn’t be run at all. Also, my module should tell the user it didn’t change anything, because the desired alias already exists. Tthat’s why I need to know what aliases are defined for the particular snap.

TL;DR: How do I get a list of all the aliases declared for a snap, whether by the store or by invoking snap alias locally?

$ snap aliases will show you all currently assigned aliases.

Thanks, that’s exactly what I’m looking for!