import { AxiosInstance } from 'axios' ; import { SubscriberQuery , SubscriberData , SubscriberDataUpdate , SubscriberSearchQuery , SubscriberActivityType } from '../@types' ; export default function ( client ) { return { async getSubscribers ( params = { } ) { return await client . get ( 'subscribers' , { params } ) ; } , async addSubscriber ( subscriber ) { return await client . post ( 'subscribers' , subscriber ) ; } , async getSubscriber ( identifier ) { return await client . get ( `subscribers/${ identifier }` ) ; } , async updateSubscriber ( identifier , subscriber ) { return await client . put ( `subscribers/${ identifier }` , subscriber ) ; } , async searchSubscribers ( params = { } ) { return await client . get ( 'subscribers/search' , { params } ) ; } , async getSubscriberActivity ( identifier ) { return await client . get ( `subscribers/${ identifier }/activity` ) ; } , async getSubscriberActivityByType ( identifier , activityType ) { const url = [ `subscribers/${ identifier }/actvity` , activityType , ] . join ( '/' ) ; return await client . get ( url ) ; } , async getSubscriberGroups ( identifier ) { return await client . get ( `subscribers/${ identifier }/groups` ) ; } , async removeSubscriber ( identifier ) { return await client . delete ( `subscribers/${ identifier }` ) ; } , } ; }