feat(pipedrive): add create note action
This commit is contained in:
@@ -1,6 +1,15 @@
|
||||
import listCurrencies from './list-currencies';
|
||||
import listDeals from './list-deals';
|
||||
import listLeads from './list-leads';
|
||||
import listOrganizations from './list-organizations';
|
||||
import listPersons from './list-persons';
|
||||
import listUsers from './list-users';
|
||||
|
||||
export default [listCurrencies, listOrganizations, listPersons, listUsers];
|
||||
export default [
|
||||
listCurrencies,
|
||||
listDeals,
|
||||
listLeads,
|
||||
listOrganizations,
|
||||
listPersons,
|
||||
listUsers,
|
||||
];
|
||||
|
@@ -0,0 +1,37 @@
|
||||
import { IGlobalVariable, IJSONObject } from '@automatisch/types';
|
||||
|
||||
export default {
|
||||
name: 'List deals',
|
||||
key: 'listDeals',
|
||||
|
||||
async run($: IGlobalVariable) {
|
||||
const deals: {
|
||||
data: IJSONObject[];
|
||||
} = {
|
||||
data: [],
|
||||
};
|
||||
|
||||
const params = {
|
||||
sort: 'add_time DESC',
|
||||
};
|
||||
|
||||
const { data } = await $.http.get(`${$.auth.data.apiDomain}/api/v1/deals`, {
|
||||
params,
|
||||
});
|
||||
|
||||
if (!data?.data) {
|
||||
return { data: [] };
|
||||
}
|
||||
|
||||
if (data.data.length) {
|
||||
for (const deal of data.data) {
|
||||
deals.data.push({
|
||||
value: deal.id,
|
||||
name: deal.title,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
return deals;
|
||||
},
|
||||
};
|
@@ -0,0 +1,37 @@
|
||||
import { IGlobalVariable, IJSONObject } from '@automatisch/types';
|
||||
|
||||
export default {
|
||||
name: 'List leads',
|
||||
key: 'listLeads',
|
||||
|
||||
async run($: IGlobalVariable) {
|
||||
const leads: {
|
||||
data: IJSONObject[];
|
||||
} = {
|
||||
data: [],
|
||||
};
|
||||
|
||||
const params = {
|
||||
sort: 'add_time DESC',
|
||||
};
|
||||
|
||||
const { data } = await $.http.get(`${$.auth.data.apiDomain}/api/v1/leads`, {
|
||||
params,
|
||||
});
|
||||
|
||||
if (!data?.data) {
|
||||
return { data: [] };
|
||||
}
|
||||
|
||||
if (data.data.length) {
|
||||
for (const lead of data.data) {
|
||||
leads.data.push({
|
||||
value: lead.id,
|
||||
name: lead.title,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
return leads;
|
||||
},
|
||||
};
|
Reference in New Issue
Block a user