export def upload [file: path] { let filename = ($file | path parse | get stem) let extension = ($file | path parse | get extension) curl $"http://($env.REMARKABLE_IP)/upload" -H "Origin: http://192.168.178.24" -H "Referer: http://192.168.178.24" -H 'Connection: keep-alive' -F $"file=@($file);filename=($filename);type=application/($extension)" } export def download [collection_id?: string] { curl $"http://($env.REMARKABLE_IP)/documents/($collection_id)" | from json | select VissibleName ID Type | input list | if $in.Type == 'DocumentType' { let name = $in.VissibleName; curl $"http://($env.REMARKABLE_IP)/download/($in.ID)/pdf" | save -f $"($name | str snake-case).pdf" } else { download $in.ID } }