type Zendesk = {
username: string;
password: string;
subdomain: string;
};
/**
* Show Many Ticket Forms
* Takes an `ids` query parameter that accepts a comma-separated list of up to 100 ticket form ids. This endpoint is used primarily by the mobile SDK and the Web Widget.
#### Allowed For
* Anyone
*/
export async function main(
auth: Zendesk,
ids: string | undefined,
active: string | undefined,
end_user_visible: string | undefined,
fallback_to_default: string | undefined,
associated_to_brand: string | undefined
) {
const url = new URL(
`https://${auth.subdomain}.zendesk.com/api/v2/ticket_forms/show_many`
);
for (const [k, v] of [
["ids", ids],
["active", active],
["end_user_visible", end_user_visible],
["fallback_to_default", fallback_to_default],
["associated_to_brand", associated_to_brand],
]) {
if (v !== undefined && v !== "") {
url.searchParams.append(k, v);
}
}
const response = await fetch(url, {
method: "GET",
headers: {
Authorization: "Basic " + btoa(`${auth.username}:${auth.password}`),
},
body: undefined,
});
if (!response.ok) {
const text = await response.text();
throw new Error(`${response.status} ${text}`);
}
return await response.json();
}
Submitted by hugo697 377 days ago
type Zendesk = {
username: string;
password: string;
subdomain: string;
};
/**
* Show Many Ticket Forms
* Takes an `ids` query parameter that accepts a comma-separated list of up to 100 ticket form ids. This endpoint is used primarily by the mobile SDK and the Web Widget.
#### Allowed For
* Anyone
*/
export async function main(
auth: Zendesk,
ids: string | undefined,
active: string | undefined,
end_user_visible: string | undefined,
fallback_to_default: string | undefined,
associated_to_brand: string | undefined
) {
const url = new URL(
`https://${auth.subdomain}.zendesk.com/api/v2/ticket_forms/show_many`
);
for (const [k, v] of [
["ids", ids],
["active", active],
["end_user_visible", end_user_visible],
["fallback_to_default", fallback_to_default],
["associated_to_brand", associated_to_brand],
]) {
if (v !== undefined && v !== "") {
url.searchParams.append(k, v);
}
}
const response = await fetch(url, {
method: "GET",
headers: {
Authorization: "Basic " + btoa(`${auth.username}:${auth.password}`),
},
body: undefined,
});
if (!response.ok) {
const text = await response.text();
throw new Error(`${response.status} ${text}`);
}
return await response.json();
}
Submitted by hugo697 923 days ago