feat(pipedrive): add create deal action

This commit is contained in:
Rıdvan Akca
2023-09-29 15:56:29 +03:00
committed by Faruk AYDIN
parent aad0b4ddfe
commit c35be241ca
10 changed files with 393 additions and 0 deletions

View File

@@ -0,0 +1,37 @@
import { IGlobalVariable, IJSONObject } from '@automatisch/types';
export default {
name: 'List persons',
key: 'listPersons',
async run($: IGlobalVariable) {
const persons: {
data: IJSONObject[];
} = {
data: [],
};
const params = {
start: 0,
limit: 100,
};
do {
const { data } = await $.http.get(
`${$.auth.data.apiDomain}/api/v1/persons`,
{ params }
);
params.start = data.additional_data?.pagination?.next_start;
if (data.data.length) {
for (const person of data.data) {
persons.data.push({
value: person.id,
name: person.name,
});
}
}
} while (params.start);
return persons;
},
};