UNPKG

@aptly-as/types

Version:
46 lines (45 loc) 1.51 kB
import { AptlyWebhookEventStatus, AptlyWebhookType } from '../enums/index.js'; import { AptlyBaseSchema } from './extends.js'; type ServerKeys = 'run' | 'status' | 'url' | 'headers' | 'responses'; export type AptlyWebhookEvent<T = unknown> = Omit<AptlyWebhookEventSchema<string, string, T>, ServerKeys>; export interface AptlyWebhookEventSchema<ID, DATE, DATA = unknown> extends Omit<AptlyBaseSchema<ID, DATE>, 'name' | 'archived'> { specversion: string; type: AptlyWebhookType; source: string; subject: string; time: DATE; datacontenttype: 'application/json'; data?: DATA; state?: string; secret?: string; run: DATE; webhook: ID; organization: ID; project?: ID; unit?: ID; order?: ID; app?: ID; appWebhook?: ID; status: AptlyWebhookEventStatus; url: string; headers: AptlyWebhookEventHeaders; responses: AptlyWebhookEventResponseSchema<ID, DATE>[]; created: DATE; } export type AptlyWebhookEventResponse<DATA = any> = AptlyWebhookEventResponseSchema<string, string, DATA>; export interface AptlyWebhookEventResponseSchema<ID, DATE, DATA = any> { _id: ID; time: DATE; data: DATA; headers: object; status: number; statusText: string; } export interface AptlyWebhookEventHeaders { 'x-aptly-url-sha256'?: string; 'x-aptly-content-sha256'?: string; 'x-aptly-organization': string; 'webhook-request-origin': string; 'content-type': 'application/json;charset=UTF-8'; } export {};