2019-10-09 06:01:52 +00:00
|
|
|
import { stringify as stringifyQs } from "qs";
|
|
|
|
import urlJoin from "url-join";
|
|
|
|
|
2019-10-15 10:06:19 +00:00
|
|
|
import {
|
|
|
|
ActiveTab,
|
|
|
|
Dialog,
|
|
|
|
Filters,
|
|
|
|
Pagination,
|
|
|
|
SingleAction,
|
|
|
|
TabActionDialog
|
|
|
|
} from "../types";
|
2019-10-09 06:01:52 +00:00
|
|
|
|
|
|
|
export const webhooksSection = "/webhooks/";
|
|
|
|
|
|
|
|
export const webhooksListPath = webhooksSection;
|
2019-10-15 10:06:19 +00:00
|
|
|
export enum WebhookListUrlFiltersEnum {
|
|
|
|
query = "query"
|
|
|
|
}
|
|
|
|
export type WebhookListUrlFilters = Filters<WebhookListUrlFiltersEnum>;
|
|
|
|
export type WebhookListUrlDialog = "remove" | TabActionDialog;
|
|
|
|
export type WebhooksListUrlQueryParams = ActiveTab &
|
|
|
|
WebhookListUrlFilters &
|
|
|
|
Dialog<WebhookListUrlDialog> &
|
2019-10-10 05:38:21 +00:00
|
|
|
Pagination &
|
|
|
|
SingleAction;
|
2019-10-09 06:01:52 +00:00
|
|
|
export const webhooksListUrl = (params?: WebhooksListUrlQueryParams) =>
|
2019-10-09 20:50:03 +00:00
|
|
|
webhooksListPath + "?" + stringifyQs(params);
|
2019-10-09 06:01:52 +00:00
|
|
|
|
|
|
|
export const webhooksPath = (id: string) => urlJoin(webhooksSection, id);
|
2019-10-10 05:38:21 +00:00
|
|
|
export type WebhookUrlDialog = "remove";
|
|
|
|
export type WebhooksUrlQueryParams = Dialog<WebhookUrlDialog> & SingleAction;
|
2019-10-09 06:01:52 +00:00
|
|
|
export const webhooksUrl = (id: string, params?: WebhooksUrlQueryParams) =>
|
|
|
|
webhooksPath(encodeURIComponent(id)) + "?" + stringifyQs(params);
|
2019-10-09 20:50:03 +00:00
|
|
|
|
|
|
|
export const webhooksAddPath = urlJoin(webhooksSection, "add");
|
|
|
|
export const webhooksAddUrl = webhooksAddPath;
|