@pipedream/podio
Version:
Pipedream Podio Components
67 lines (65 loc) • 1.43 kB
JavaScript
import common from "../common/common-hook.mjs";
export default {
key: "podio-new-application-created",
name: "New Application Created",
description: "Emit new events when a new application is created. [See the documentation](https://developers.podio.com/doc/hooks)",
version: "0.0.2",
type: "source",
dedupe: "unique",
...common,
props: {
...common.props,
orgId: {
propDefinition: [
common.props.app,
"orgId",
],
},
spaceId: {
propDefinition: [
common.props.app,
"spaceId",
(configuredProps) => ({
orgId: configuredProps.orgId,
}),
],
},
},
methods: {
...common.methods,
getMeta(event) {
return {
id: event?.body?.app_id,
ts: Date.now(),
summary: `New application created (ID:${event?.body?.app_id})`,
};
},
async getData(event) {
return this.app.getApp({
appId: event?.body?.app_id,
});
},
getEvent() {
return "app.create";
},
getRefType() {
return "space";
},
getRefId() {
return this.spaceId;
},
async loadHistoricalEvents() {
const apps = await this.app.getApps({
spaceId: this.spaceId,
});
for (const app of apps) {
this.$emit(
app,
this.getMeta({
body: app,
}),
);
}
},
},
};