webhooks.d.ts 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. import { BaseCollection } from "./base_collection";
  2. import { Webhook } from "../models/webhook";
  3. import { PaginatedResult } from "../interfaces/paginated_result";
  4. import { ProjectWithPagination } from "../interfaces/project_with_pagination";
  5. import { ProjectOnly } from "../interfaces/project_only";
  6. type EventLangMap = {
  7. event?: string;
  8. lang_iso_codes?: string[];
  9. };
  10. type CreateWebhookParams = {
  11. url: string;
  12. branch?: string;
  13. events: string[];
  14. event_lang_map?: EventLangMap[];
  15. };
  16. type UpdateWebhookParams = Omit<CreateWebhookParams, "url" | "events"> & {
  17. url?: string;
  18. events?: string[];
  19. };
  20. type WebhookDeleted = {
  21. project_id: string;
  22. webhook_deleted: boolean;
  23. };
  24. type WebhookRegenerated = {
  25. project_id: string;
  26. secret: string;
  27. };
  28. export declare class Webhooks extends BaseCollection {
  29. protected static rootElementName: string;
  30. protected static rootElementNameSingular: string;
  31. protected static prefixURI: string;
  32. protected static elementClass: typeof Webhook;
  33. list(request_params: ProjectWithPagination): Promise<PaginatedResult<Webhook>>;
  34. create(webhook_params: CreateWebhookParams, request_params: ProjectOnly): Promise<Webhook>;
  35. get(webhook_id: string | number, request_params: ProjectOnly): Promise<Webhook>;
  36. update(webhook_id: string | number, webhook_params: UpdateWebhookParams, request_params: ProjectOnly): Promise<Webhook>;
  37. delete(webhook_id: string | number, request_params: ProjectOnly): Promise<WebhookDeleted>;
  38. regenerate_secret(webhook_id: string | number, request_params: ProjectOnly): Promise<WebhookRegenerated>;
  39. }
  40. export {};