import { AxiosInstance } from 'axios' ; import { WebhookData , WebhooksResponse } from '../@types' ; export default function ( client ) { return { async getWebhooks ( ) { const { webhooks } = await this . getWebhooksRaw ( ) ; return webhooks ; } , async getWebhooksCount ( ) { const { count } = await this . getWebhooksRaw ( ) ; return count ; } , async getWebhooksRaw ( ) { return await client . get ( 'webhooks' ) ; } , async getWebhook ( webhookId ) { return await client . get ( `webhooks/${ webhookId }` ) ; } , async createWebhook ( webhook ) { return await client . post ( 'webhooks' , webhook ) ; } , async updateWebhook ( webhookId , webhook ) { return await client . post ( `webhooks/${ webhookId }` , webhook ) ; } , async removeWebhook ( webhookId ) { return await client . delete ( `webhooks/${ webhookId }` ) ; } , } ; }