enh: ot move

This commit is contained in:
Timothy Jaeryang Baek
2026-03-02 12:03:23 -06:00
parent c701ebe07b
commit 0c42cd2c01
3 changed files with 97 additions and 10 deletions
+26
View File
@@ -193,3 +193,29 @@ export const setCwd = async (
});
return res;
};
export const moveEntry = async (
baseUrl: string,
apiKey: string,
source: string,
destination: string
): Promise<{ source: string; destination: string } | null> => {
const url = `${baseUrl.replace(/\/$/, '')}/files/move`;
const res = await fetch(url, {
method: 'POST',
headers: {
Authorization: `Bearer ${apiKey}`,
'Content-Type': 'application/json'
},
body: JSON.stringify({ source, destination })
})
.then(async (res) => {
if (!res.ok) throw await res.json();
return res.json();
})
.catch((err) => {
console.error('open-terminal moveEntry error:', err);
return null;
});
return res;
};