gi-nx / fetchUserFiles
ts
function fetchUserFiles(): Promise<GiFileForDocs[]>;Fetches files for the user.
Returns
Promise<GiFileForDocs[]>
A promise that resolves with files (and content packs) that the user has access to.
Remarks
The app URL needs to be whitelisted before it can access the temporary public URLs returned by getTempUrl. Contact us for details.
Example
tsx
const filesWithPublicUrls = await rpc.invoke("fetchUserFiles")
.then((files) =>
Promise.all(
files.map(async (file) => {
const publicTemporaryUrl = await rpc.invoke("getTempUrl", file.url);
return { ...file, publicTemporaryUrl, storageProxyUrl: file.url };
})
)
)
.catch((error) => {
console.error("Error fetching files:", error);
});