There is a spec which is followed by at least GNOME Files, KDE Dolphin (two of the most popular Linux DE) and xfce Thunar.
So it would be a matter of moving the file to $XDG_DATA_HOME/Trash/files
and creating a .trashinfo
file in $XDG_DATA_HOME/Trash/info
like this:
[Trash Info]
Path=/home/foobar/foobar.txt
DeletionDate=2019-10-17T20:58:00