1
type Zendesk = {
2
username: string;
3
password: string;
4
subdomain: string;
5
};
6
/**
7
* Reorder Organization Field
8
* #### Allowed For
9
10
* Admins
11
12
*/
13
export async function main(auth: Zendesk) {
14
const url = new URL(
15
`https://${auth.subdomain}.zendesk.com/api/v2/organization_fields/reorder`
16
);
17
18
const response = await fetch(url, {
19
method: "PUT",
20
headers: {
21
Authorization: "Basic " + btoa(`${auth.username}:${auth.password}`),
22
},
23
body: undefined,
24
});
25
if (!response.ok) {
26
const text = await response.text();
27
throw new Error(`${response.status} ${text}`);
28
}
29
return await response.text();
30
31