Type event endpoints
This commit is contained in:
parent
dedd5f273a
commit
417286b16d
|
@ -1,13 +0,0 @@
|
||||||
export const buildEventEndpoints = API => ({
|
|
||||||
/**
|
|
||||||
* Publish a specific event to the backend.
|
|
||||||
*/
|
|
||||||
publishEvent: async eventType => {
|
|
||||||
return await API.post({
|
|
||||||
url: `/api/global/event/publish`,
|
|
||||||
body: {
|
|
||||||
type: eventType,
|
|
||||||
},
|
|
||||||
})
|
|
||||||
},
|
|
||||||
})
|
|
|
@ -0,0 +1,17 @@
|
||||||
|
import { EventPublishType, PostEventPublishRequest } from "@budibase/types"
|
||||||
|
import { BaseAPIClient } from "./types"
|
||||||
|
|
||||||
|
export interface EventEndpoints {
|
||||||
|
publishEvent: (type: EventPublishType) => Promise<void>
|
||||||
|
}
|
||||||
|
|
||||||
|
export const buildEventEndpoints = (API: BaseAPIClient): EventEndpoints => ({
|
||||||
|
publishEvent: async type => {
|
||||||
|
return await API.post<PostEventPublishRequest>({
|
||||||
|
url: `/api/global/event/publish`,
|
||||||
|
body: {
|
||||||
|
type,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
},
|
||||||
|
})
|
|
@ -9,6 +9,7 @@ import { BackupEndpoints } from "./backups"
|
||||||
import { ConfigEndpoints } from "./configs"
|
import { ConfigEndpoints } from "./configs"
|
||||||
import { DatasourceEndpoints } from "./datasources"
|
import { DatasourceEndpoints } from "./datasources"
|
||||||
import { EnvironmentVariableEndpoints } from "./environmentVariables"
|
import { EnvironmentVariableEndpoints } from "./environmentVariables"
|
||||||
|
import { EventEndpoints } from "./events"
|
||||||
|
|
||||||
export enum HTTPMethod {
|
export enum HTTPMethod {
|
||||||
POST = "POST",
|
POST = "POST",
|
||||||
|
@ -79,4 +80,5 @@ export type APIClient = BaseAPIClient &
|
||||||
BackupEndpoints &
|
BackupEndpoints &
|
||||||
ConfigEndpoints &
|
ConfigEndpoints &
|
||||||
DatasourceEndpoints &
|
DatasourceEndpoints &
|
||||||
EnvironmentVariableEndpoints
|
EnvironmentVariableEndpoints &
|
||||||
|
EventEndpoints
|
||||||
|
|
Loading…
Reference in New Issue