/**
* List the file keys available in the workspace files storage (S3)
*
*/
export async function main(
workspace: string,
max_keys: string | undefined,
marker: string | undefined,
prefix: string | undefined
) {
const url = new URL(
`${BASE_URL}/api/w/${workspace}/job_helpers/list_stored_files`
);
for (const [k, v] of [
["max_keys", max_keys],
["marker", marker],
["prefix", prefix],
]) {
if (v !== undefined && v !== "") {
url.searchParams.append(k, v);
}
}
const response = await fetch(url, {
method: "GET",
headers: {
Authorization: "Bearer " + WM_TOKEN,
},
body: undefined,
});
if (!response.ok) {
const text = await response.text();
throw new Error(`${response.status} ${text}`);
}
return await response.json();
}
Submitted by hugo697 370 days ago
/**
* List the file keys available in the workspace files storage (S3)
*
*/
export async function main(
workspace: string,
max_keys: string | undefined,
marker: string | undefined,
prefix: string | undefined
) {
const url = new URL(
`${BASE_URL}/api/w/${workspace}/job_helpers/list_stored_files`
);
for (const [k, v] of [
["max_keys", max_keys],
["marker", marker],
["prefix", prefix],
]) {
if (v !== undefined && v !== "") {
url.searchParams.append(k, v);
}
}
const response = await fetch(url, {
method: "GET",
headers: {
Authorization: "Bearer " + WM_TOKEN,
},
body: undefined,
});
if (!response.ok) {
const text = await response.text();
throw new Error(`${response.status} ${text}`);
}
return await response.json();
}
Submitted by hugo697 797 days ago