czottmann / obsidian-actions-uri

A plugin for Obsidian (https://obsidian.md) that adds additional `x-callback-url` endpoints to the app for common actions — it's a clean, super-charged addition to Obsidian URI.
https://zottmann.dev/obsidian-actions-uri/
MIT License
138 stars 6 forks source link

[ZCO-126] Add optional parameter to note creation routes for graceful handling of existing notes #57

Closed czottmann closed 1 year ago

czottmann commented 1 year ago

Currently, when note creation is attempted, and a note already exists (ex: create daily note, daily note already in place), an error is returned. One could use the optional overwrite flag to overwrite the existing note, but this is not always desirable. It would be nice to have an optional parameter that would allow the user to skip creation, i.e. to handle an existing target note not as a fail state but as a success state.

Idea

New optional if-exists parameter for note creation routes, only used in case the target note already exists. If its value is skip, the route will return a success response, but will not create a new note. If its value is overwrite, the current note will effectively be deleted, then created from scratch. (This would supersede and effectively deprecate the overwrite parameter.)

If if-exists isn't set, and the target note already exists, an error will be returned as it was before.

ZCO-126

czottmann commented 1 year ago

Will be released in v0.18.