Compare commits
1 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
ced4602501 |
@@ -1,4 +0,0 @@
|
|||||||
import listTemplates from './list-templates/index.js';
|
|
||||||
import listWorkspaces from './list-workspaces/index.js';
|
|
||||||
|
|
||||||
export default [listTemplates, listWorkspaces];
|
|
@@ -1,39 +0,0 @@
|
|||||||
export default {
|
|
||||||
name: 'List templates',
|
|
||||||
key: 'listTemplates',
|
|
||||||
|
|
||||||
async run($) {
|
|
||||||
const templates = {
|
|
||||||
data: [],
|
|
||||||
};
|
|
||||||
const workspaceId = $.step.parameters.workspaceId;
|
|
||||||
let next = false;
|
|
||||||
|
|
||||||
const params = {
|
|
||||||
page: 'all',
|
|
||||||
'q[workspace_id]': workspaceId,
|
|
||||||
};
|
|
||||||
|
|
||||||
if (!workspaceId) {
|
|
||||||
return templates;
|
|
||||||
}
|
|
||||||
|
|
||||||
do {
|
|
||||||
const { data } = await $.http.get('/v1/document_template_cards', params);
|
|
||||||
next = data.meta.next_page;
|
|
||||||
|
|
||||||
if (!data?.document_template_cards?.length) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (const template of data.document_template_cards) {
|
|
||||||
templates.data.push({
|
|
||||||
value: template.id,
|
|
||||||
name: template.identifier,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
} while (next);
|
|
||||||
|
|
||||||
return templates;
|
|
||||||
},
|
|
||||||
};
|
|
@@ -1,29 +0,0 @@
|
|||||||
export default {
|
|
||||||
name: 'List workspaces',
|
|
||||||
key: 'listWorkspaces',
|
|
||||||
|
|
||||||
async run($) {
|
|
||||||
const workspaces = {
|
|
||||||
data: [],
|
|
||||||
};
|
|
||||||
let next = false;
|
|
||||||
|
|
||||||
do {
|
|
||||||
const { data } = await $.http.get('/v1/workspace_cards');
|
|
||||||
next = data.meta.next_page;
|
|
||||||
|
|
||||||
if (!data?.workspace_cards?.length) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (const workspace of data.workspace_cards) {
|
|
||||||
workspaces.data.push({
|
|
||||||
value: workspace.id,
|
|
||||||
name: workspace.identifier,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
} while (next);
|
|
||||||
|
|
||||||
return workspaces;
|
|
||||||
},
|
|
||||||
};
|
|
@@ -1,8 +1,6 @@
|
|||||||
import defineApp from '../../helpers/define-app.js';
|
import defineApp from '../../helpers/define-app.js';
|
||||||
import addAuthHeader from './common/add-auth-header.js';
|
import addAuthHeader from './common/add-auth-header.js';
|
||||||
import auth from './auth/index.js';
|
import auth from './auth/index.js';
|
||||||
import triggers from './triggers/index.js';
|
|
||||||
import dynamicData from './dynamic-data/index.js';
|
|
||||||
|
|
||||||
export default defineApp({
|
export default defineApp({
|
||||||
name: 'PDFMonkey',
|
name: 'PDFMonkey',
|
||||||
@@ -12,9 +10,7 @@ export default defineApp({
|
|||||||
supportsConnections: true,
|
supportsConnections: true,
|
||||||
baseUrl: 'https://pdfmonkey.io',
|
baseUrl: 'https://pdfmonkey.io',
|
||||||
apiBaseUrl: 'https://api.pdfmonkey.io/api',
|
apiBaseUrl: 'https://api.pdfmonkey.io/api',
|
||||||
primaryColor: '376794',
|
primaryColor: 'db2777',
|
||||||
beforeRequest: [addAuthHeader],
|
beforeRequest: [addAuthHeader],
|
||||||
auth,
|
auth,
|
||||||
triggers,
|
|
||||||
dynamicData,
|
|
||||||
});
|
});
|
||||||
|
@@ -1,99 +0,0 @@
|
|||||||
import defineTrigger from '../../../../helpers/define-trigger.js';
|
|
||||||
|
|
||||||
export default defineTrigger({
|
|
||||||
name: 'Documents Generated',
|
|
||||||
key: 'documentsGenerated',
|
|
||||||
pollInterval: 15,
|
|
||||||
description:
|
|
||||||
'Triggers upon the successful completion of document generation.',
|
|
||||||
arguments: [
|
|
||||||
{
|
|
||||||
label: 'Workspace',
|
|
||||||
key: 'workspaceId',
|
|
||||||
type: 'dropdown',
|
|
||||||
required: true,
|
|
||||||
description: '',
|
|
||||||
variables: true,
|
|
||||||
source: {
|
|
||||||
type: 'query',
|
|
||||||
name: 'getDynamicData',
|
|
||||||
arguments: [
|
|
||||||
{
|
|
||||||
name: 'key',
|
|
||||||
value: 'listWorkspaces',
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: 'Templates',
|
|
||||||
key: 'templateIds',
|
|
||||||
type: 'dynamic',
|
|
||||||
required: false,
|
|
||||||
description: 'Apply this trigger exclusively for particular templates.',
|
|
||||||
fields: [
|
|
||||||
{
|
|
||||||
label: 'Template',
|
|
||||||
key: 'templateId',
|
|
||||||
type: 'dropdown',
|
|
||||||
required: false,
|
|
||||||
depensOn: ['parameters.workspaceId'],
|
|
||||||
description: '',
|
|
||||||
variables: true,
|
|
||||||
source: {
|
|
||||||
type: 'query',
|
|
||||||
name: 'getDynamicData',
|
|
||||||
arguments: [
|
|
||||||
{
|
|
||||||
name: 'key',
|
|
||||||
value: 'listTemplates',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'parameters.workspaceId',
|
|
||||||
value: '{parameters.workspaceId}',
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
],
|
|
||||||
|
|
||||||
async run($) {
|
|
||||||
const workspaceId = $.step.parameters.workspaceId;
|
|
||||||
const templateIds = $.step.parameters.templateIds;
|
|
||||||
const allTemplates = templateIds
|
|
||||||
.map((templateId) => templateId.templateId)
|
|
||||||
.join(',');
|
|
||||||
|
|
||||||
const params = {
|
|
||||||
'page[size]': 100,
|
|
||||||
'q[workspace_id]': workspaceId,
|
|
||||||
'q[status]': 'success',
|
|
||||||
};
|
|
||||||
|
|
||||||
if (!templateIds.length) {
|
|
||||||
params['q[document_template_id]'] = allTemplates;
|
|
||||||
}
|
|
||||||
|
|
||||||
let next = false;
|
|
||||||
do {
|
|
||||||
const { data } = await $.http.get('/v1/document_cards', { params });
|
|
||||||
|
|
||||||
if (!data?.document_cards?.length) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
next = data.meta.next_page;
|
|
||||||
|
|
||||||
for (const document of data.document_cards) {
|
|
||||||
$.pushTriggerItem({
|
|
||||||
raw: document,
|
|
||||||
meta: {
|
|
||||||
internalId: document.id,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
}
|
|
||||||
} while (next);
|
|
||||||
},
|
|
||||||
});
|
|
@@ -1,3 +0,0 @@
|
|||||||
import documentsGenerated from './documents-generated/index.js';
|
|
||||||
|
|
||||||
export default [documentsGenerated];
|
|
@@ -256,10 +256,7 @@ export default defineConfig({
|
|||||||
text: 'PDFMonkey',
|
text: 'PDFMonkey',
|
||||||
collapsible: true,
|
collapsible: true,
|
||||||
collapsed: true,
|
collapsed: true,
|
||||||
items: [
|
items: [{ text: 'Connection', link: '/apps/pdf-monkey/connection' }],
|
||||||
{ text: 'Triggers', link: '/apps/pdf-monkey/triggers' },
|
|
||||||
{ text: 'Connection', link: '/apps/pdf-monkey/connection' },
|
|
||||||
],
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
text: 'Pipedrive',
|
text: 'Pipedrive',
|
||||||
|
@@ -1,12 +0,0 @@
|
|||||||
---
|
|
||||||
favicon: /favicons/pdf-monkey.svg
|
|
||||||
items:
|
|
||||||
- name: Documents Generated
|
|
||||||
desc: Triggers upon the successful completion of document generation.
|
|
||||||
---
|
|
||||||
|
|
||||||
<script setup>
|
|
||||||
import CustomListing from '../../components/CustomListing.vue'
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<CustomListing />
|
|
Reference in New Issue
Block a user