2024-12-16 18:08:42 +01:00
|
|
|
import {
|
|
|
|
EventPublishType,
|
|
|
|
PostEventPublishRequest,
|
|
|
|
PostEventPublishResponse,
|
|
|
|
} from "@budibase/types"
|
2024-12-02 16:19:33 +01:00
|
|
|
import { BaseAPIClient } from "./types"
|
|
|
|
|
|
|
|
export interface EventEndpoints {
|
2024-12-16 18:08:42 +01:00
|
|
|
publishEvent: (type: EventPublishType) => Promise<PostEventPublishResponse>
|
2024-12-02 16:19:33 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
export const buildEventEndpoints = (API: BaseAPIClient): EventEndpoints => ({
|
|
|
|
publishEvent: async type => {
|
2024-12-16 18:08:42 +01:00
|
|
|
return await API.post<PostEventPublishRequest, PostEventPublishResponse>({
|
2024-12-02 16:19:33 +01:00
|
|
|
url: `/api/global/event/publish`,
|
|
|
|
body: {
|
|
|
|
type,
|
|
|
|
},
|
|
|
|
})
|
|
|
|
},
|
|
|
|
})
|