Foundations TS Defintions
TypeScript definition files for the Reapit Foundations API
Usage:
import { AppModel } from '@reapit/foundations-ts-definitions'
// Or
const { AppModel } = require('@reapit/foundations-ts-definitions')Webhook types
import {
ReapitWebhookPayloadType,
ReapitWebhookTopicEnum,
ReapitWebhookApplicantCreatedEvent,
} from '@reapit/foundations-ts-definitions'
export const webhookEventHandler = (event: ReapitWebookPayloadType) => {
switch (event.topicId) {
case ReapitWebhookTopicEnum.APPLICANTS_CREATED:
handleApplicantCreated(event) // event is of infered type ReapitWebhookApplicantCreatedEvent
break
default:
console.log(event.new) // event.new is of infered type any
}
}
const handleApplicantCreated = (event: ReapitWebhookApplicantCreatedEvent) => {
console.log(event.new) // new is of inferred type ApplicantModel
}Last updated