rakutentech / docpub

DocPub is a command line utility for converting a folder structure of markdown files to HTML and uploading the result to Zendesk.
MIT License
12 stars 16 forks source link

Add CLI option to clear unused article attachments #22

Open corycaywood opened 7 years ago

corycaywood commented 7 years ago

A method is needed for deleting unused article attachments from Zendesk. Zendesk doesn't have an API for updating attachments, so anytime an attachment is updated in the local repository, a completely new attachment is uploaded to Zendesk.

Currently, the old attachment is never deleted, it just continues to exist on Zendesk even though it isn't used. Due to the way the synchronization feature was implemented, it isn't possible to delete the old attachment at the same time as uploading a new one.

So a feature needs to be added for finding and deleting unused attachments on Zendesk.

This should not run as part of the "synchronization" step because it will require many API calls. The only way to get a list of attachments is to call the list for each article. This is why I suggest it should be a command line option, such as --clearattachments.