/**
* list all scripts
*
*/
export async function main(
workspace: string,
page: string | undefined,
per_page: string | undefined,
order_desc: string | undefined,
created_by: string | undefined,
path_start: string | undefined,
path_exact: string | undefined,
first_parent_hash: string | undefined,
last_parent_hash: string | undefined,
parent_hash: string | undefined,
show_archived: string | undefined,
is_template: string | undefined,
kinds: string | undefined,
starred_only: string | undefined
) {
const url = new URL(`${BASE_URL}/api/w/${workspace}/scripts/list`);
for (const [k, v] of [
["page", page],
["per_page", per_page],
["order_desc", order_desc],
["created_by", created_by],
["path_start", path_start],
["path_exact", path_exact],
["first_parent_hash", first_parent_hash],
["last_parent_hash", last_parent_hash],
["parent_hash", parent_hash],
["show_archived", show_archived],
["is_template", is_template],
["kinds", kinds],
["starred_only", starred_only],
]) {
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 all scripts
*
*/
export async function main(
workspace: string,
page: string | undefined,
per_page: string | undefined,
order_desc: string | undefined,
created_by: string | undefined,
path_start: string | undefined,
path_exact: string | undefined,
first_parent_hash: string | undefined,
last_parent_hash: string | undefined,
parent_hash: string | undefined,
show_archived: string | undefined,
is_template: string | undefined,
kinds: string | undefined,
starred_only: string | undefined
) {
const url = new URL(`${BASE_URL}/api/w/${workspace}/scripts/list`);
for (const [k, v] of [
["page", page],
["per_page", per_page],
["order_desc", order_desc],
["created_by", created_by],
["path_start", path_start],
["path_exact", path_exact],
["first_parent_hash", first_parent_hash],
["last_parent_hash", last_parent_hash],
["parent_hash", parent_hash],
["show_archived", show_archived],
["is_template", is_template],
["kinds", kinds],
["starred_only", starred_only],
]) {
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 931 days ago
/**
* list all scripts
*
*/
export async function main(
workspace: string,
page: string | undefined,
per_page: string | undefined,
order_desc: string | undefined,
created_by: string | undefined,
path_start: string | undefined,
path_exact: string | undefined,
first_parent_hash: string | undefined,
last_parent_hash: string | undefined,
parent_hash: string | undefined,
show_archived: string | undefined,
is_template: string | undefined,
kinds: string | undefined,
starred_only: string | undefined
) {
const url = new URL(`${BASE_URL}/api/w/${workspace}/scripts/list`);
for (const [k, v] of [
["page", page],
["per_page", per_page],
["order_desc", order_desc],
["created_by", created_by],
["path_start", path_start],
["path_exact", path_exact],
["first_parent_hash", first_parent_hash],
["last_parent_hash", last_parent_hash],
["parent_hash", parent_hash],
["show_archived", show_archived],
["is_template", is_template],
["kinds", kinds],
["starred_only", starred_only],
]) {
if (v !== undefined) {
url.searchParams.append(k, v);
}
}
const response = await fetch(url, {
method: "GET",
headers: {
Authorization: "Bearer " + WM_TOKEN,
},
body: undefined,
});
return await response.json();
}
Submitted by rubenfiszel 933 days ago
/**
* list all scripts
*
*/
export async function main(
workspace: string,
page: string | undefined,
per_page: string | undefined,
order_desc: string | undefined,
created_by: string | undefined,
path_start: string | undefined,
path_exact: string | undefined,
first_parent_hash: string | undefined,
last_parent_hash: string | undefined,
parent_hash: string | undefined,
show_archived: string | undefined,
is_template: string | undefined,
kinds: string | undefined,
starred_only: string | undefined,
) {
const url = new URL(`${BASE_URL}/api/w/${workspace}/scripts/list`);
for (const [k, v] of [
["page", page],
["per_page", per_page],
["order_desc", order_desc],
["created_by", created_by],
["path_start", path_start],
["path_exact", path_exact],
["first_parent_hash", first_parent_hash],
["last_parent_hash", last_parent_hash],
["parent_hash", parent_hash],
["show_archived", show_archived],
["is_template", is_template],
["kinds", kinds],
["starred_only", starred_only],
]) {
if (v !== undefined) {
url.searchParams.append(k, v);
}
}
const response = await fetch(url, {
method: "GET",
headers: {
Authorization: "Bearer " + WM_TOKEN,
},
body: undefined,
});
return await response.json();
}
Submitted by admin 933 days ago