2023-03-17 20:25:05 +08:00
|
|
|
import RestAdapter from "discourse/adapters/rest";
|
2016-09-19 16:43:06 +08:00
|
|
|
|
2023-03-17 20:25:05 +08:00
|
|
|
export default class WebHookEvent extends RestAdapter {
|
2016-09-19 16:43:06 +08:00
|
|
|
basePath() {
|
|
|
|
return "/admin/api/";
|
2023-03-17 20:25:05 +08:00
|
|
|
}
|
2024-06-07 23:26:00 +08:00
|
|
|
|
|
|
|
appendQueryParams(path, findArgs, extension) {
|
|
|
|
const urlSearchParams = new URLSearchParams();
|
|
|
|
|
|
|
|
for (const [key, value] of Object.entries(findArgs)) {
|
|
|
|
if (value && key !== "webhookId") {
|
|
|
|
urlSearchParams.set(key, value);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
const queryString = urlSearchParams.toString();
|
|
|
|
let url = `${path}/${findArgs.webhookId}${extension || ""}`;
|
|
|
|
|
|
|
|
if (queryString) {
|
|
|
|
url = `${url}?${queryString}`;
|
|
|
|
}
|
|
|
|
return url;
|
|
|
|
}
|
2023-03-17 20:25:05 +08:00
|
|
|
}
|