//native
type Kustomer = {
apiKey: string;
};
/**
* Update Theme Draft Revision
* Updates a Knowledge Base theme revision draft.
*/
export async function main(
auth: Kustomer,
themeId: string,
body:
| {
name: string;
manifest: {
name: string;
label?: string;
description?: string;
enabled?: false | true;
link?: {
label: string;
learnMoreLink?: string;
buttonText?: string;
description?: string;
value: string;
};
variables: {};
}[];
jsxSnippets: string[];
}
| { publish: false | true },
) {
const url = new URL(
`https://api.kustomerapp.com/v3/kb/themes/${themeId}/revisions/draft`,
);
const response = await fetch(url, {
method: "PUT",
headers: {
"Content-Type": "application/json",
Authorization: "Bearer " + auth.apiKey,
},
body: JSON.stringify(body),
});
if (!response.ok) {
const text = await response.text();
throw new Error(`${response.status} ${text}`);
}
return await response.json();
}
Submitted by hugo697 235 days ago