mirror of
https://github.com/n8n-io/n8n.git
synced 2024-12-24 20:24:05 -08:00
0448feec56
* ⚡ Initial setup
* 👕 Update `.eslintignore`
* 👕 Autofix node-param-default-missing (#3173)
* 🔥 Remove duplicate key
* 👕 Add exceptions
* 📦 Update package-lock.json
* 👕 Apply `node-class-description-inputs-wrong-trigger-node` (#3176)
* 👕 Apply `node-class-description-inputs-wrong-regular-node` (#3177)
* 👕 Apply `node-class-description-outputs-wrong` (#3178)
* 👕 Apply `node-execute-block-double-assertion-for-items` (#3179)
* 👕 Apply `node-param-default-wrong-for-collection` (#3180)
* 👕 Apply node-param-default-wrong-for-boolean (#3181)
* Autofixed default missing
* Autofixed booleans, worked well
* ⚡ Fix params
* ⏪ Undo exempted autofixes
* 📦 Update package-lock.json
* 👕 Apply node-class-description-missing-subtitle (#3182)
* ⚡ Fix missing comma
* 👕 Apply `node-param-default-wrong-for-fixed-collection` (#3184)
* 👕 Add exception for `node-class-description-missing-subtitle`
* 👕 Apply `node-param-default-wrong-for-multi-options` (#3185)
* 👕 Apply `node-param-collection-type-unsorted-items` (#3186)
* Missing coma
* 👕 Apply `node-param-default-wrong-for-simplify` (#3187)
* 👕 Apply `node-param-description-comma-separated-hyphen` (#3190)
* 👕 Apply `node-param-description-empty-string` (#3189)
* 👕 Apply `node-param-description-excess-inner-whitespace` (#3191)
* Rule looks good
* Add whitespace rule in eslint config
* :zao: fix
* 👕 Apply `node-param-description-identical-to-display-name` (#3193)
* 👕 Apply `node-param-description-missing-for-ignore-ssl-issues` (#3195)
* ⏪ Revert ":zao: fix"
This reverts commit ef8a76f3df
.
* 👕 Apply `node-param-description-missing-for-simplify` (#3196)
* 👕 Apply `node-param-description-missing-final-period` (#3194)
* Rule working as intended
* Add rule to eslint
* 👕 Apply node-param-description-missing-for-return-all (#3197)
* ⚡ Restore `lintfix` command
Co-authored-by: agobrech <45268029+agobrech@users.noreply.github.com>
Co-authored-by: Omar Ajoue <krynble@gmail.com>
Co-authored-by: agobrech <ael.gobrecht@gmail.com>
Co-authored-by: Michael Kret <michael.k@radency.com>
751 lines
18 KiB
TypeScript
751 lines
18 KiB
TypeScript
import {
|
|
IExecuteFunctions,
|
|
} from 'n8n-core';
|
|
|
|
import {
|
|
IDataObject,
|
|
ILoadOptionsFunctions,
|
|
INodeExecutionData,
|
|
INodePropertyOptions,
|
|
INodeType,
|
|
INodeTypeDescription,
|
|
} from 'n8n-workflow';
|
|
|
|
import {
|
|
clockifyApiRequest,
|
|
clockifyApiRequestAllItems,
|
|
} from './GenericFunctions';
|
|
|
|
import {
|
|
IClientDto,
|
|
IWorkspaceDto,
|
|
} from './WorkpaceInterfaces';
|
|
|
|
import {
|
|
IUserDto,
|
|
} from './UserDtos';
|
|
|
|
import {
|
|
IProjectDto,
|
|
} from './ProjectInterfaces';
|
|
|
|
import {
|
|
projectFields,
|
|
projectOperations,
|
|
} from './ProjectDescription';
|
|
|
|
import {
|
|
tagFields,
|
|
tagOperations,
|
|
} from './TagDescription';
|
|
|
|
import {
|
|
taskFields,
|
|
taskOperations,
|
|
} from './TaskDescription';
|
|
|
|
import {
|
|
timeEntryFields,
|
|
timeEntryOperations,
|
|
} from './TimeEntryDescription';
|
|
|
|
import moment from 'moment-timezone';
|
|
|
|
export class Clockify implements INodeType {
|
|
description: INodeTypeDescription = {
|
|
displayName: 'Clockify',
|
|
name: 'clockify',
|
|
icon: 'file:clockify.svg',
|
|
group: ['transform'],
|
|
version: 1,
|
|
subtitle: '={{$parameter["operation"] + ": " + $parameter["resource"]}}',
|
|
description: 'Consume Clockify REST API',
|
|
defaults: {
|
|
name: 'Clockify',
|
|
},
|
|
inputs: ['main'],
|
|
outputs: ['main'],
|
|
credentials: [
|
|
{
|
|
name: 'clockifyApi',
|
|
required: true,
|
|
},
|
|
],
|
|
properties: [
|
|
{
|
|
displayName: 'Resource',
|
|
name: 'resource',
|
|
type: 'options',
|
|
options: [
|
|
{
|
|
name: 'Project',
|
|
value: 'project',
|
|
},
|
|
{
|
|
name: 'Tag',
|
|
value: 'tag',
|
|
},
|
|
{
|
|
name: 'Task',
|
|
value: 'task',
|
|
},
|
|
{
|
|
name: 'Time Entry',
|
|
value: 'timeEntry',
|
|
},
|
|
],
|
|
default: 'project',
|
|
description: 'The resource to operate on.',
|
|
},
|
|
...projectOperations,
|
|
...tagOperations,
|
|
...taskOperations,
|
|
...timeEntryOperations,
|
|
{
|
|
displayName: 'Workspace ID',
|
|
name: 'workspaceId',
|
|
type: 'options',
|
|
typeOptions: {
|
|
loadOptionsMethod: 'listWorkspaces',
|
|
},
|
|
required: true,
|
|
default: [],
|
|
},
|
|
...projectFields,
|
|
...tagFields,
|
|
...taskFields,
|
|
...timeEntryFields,
|
|
],
|
|
};
|
|
|
|
methods = {
|
|
loadOptions: {
|
|
async listWorkspaces(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]> {
|
|
const rtv: INodePropertyOptions[] = [];
|
|
const workspaces: IWorkspaceDto[] = await clockifyApiRequest.call(this, 'GET', 'workspaces');
|
|
if (undefined !== workspaces) {
|
|
workspaces.forEach(value => {
|
|
rtv.push(
|
|
{
|
|
name: value.name,
|
|
value: value.id,
|
|
});
|
|
});
|
|
}
|
|
return rtv;
|
|
},
|
|
async loadUsersForWorkspace(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]> {
|
|
const rtv: INodePropertyOptions[] = [];
|
|
const workspaceId = this.getCurrentNodeParameter('workspaceId');
|
|
if (undefined !== workspaceId) {
|
|
const resource = `workspaces/${workspaceId}/users`;
|
|
const users: IUserDto[] = await clockifyApiRequest.call(this, 'GET', resource);
|
|
if (undefined !== users) {
|
|
users.forEach(value => {
|
|
rtv.push(
|
|
{
|
|
name: value.name,
|
|
value: value.id,
|
|
});
|
|
});
|
|
}
|
|
}
|
|
return rtv;
|
|
},
|
|
async loadClientsForWorkspace(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]> {
|
|
const rtv: INodePropertyOptions[] = [];
|
|
const workspaceId = this.getCurrentNodeParameter('workspaceId');
|
|
if (undefined !== workspaceId) {
|
|
const resource = `workspaces/${workspaceId}/clients`;
|
|
const clients: IClientDto[] = await clockifyApiRequest.call(this, 'GET', resource);
|
|
if (undefined !== clients) {
|
|
clients.forEach(value => {
|
|
rtv.push(
|
|
{
|
|
name: value.name,
|
|
value: value.id,
|
|
});
|
|
});
|
|
}
|
|
}
|
|
return rtv;
|
|
},
|
|
async loadProjectsForWorkspace(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]> {
|
|
const rtv: INodePropertyOptions[] = [];
|
|
const workspaceId = this.getCurrentNodeParameter('workspaceId');
|
|
if (undefined !== workspaceId) {
|
|
const resource = `workspaces/${workspaceId}/projects`;
|
|
const users: IProjectDto[] = await clockifyApiRequest.call(this, 'GET', resource);
|
|
if (undefined !== users) {
|
|
users.forEach(value => {
|
|
rtv.push(
|
|
{
|
|
name: value.name,
|
|
value: value.id,
|
|
});
|
|
});
|
|
}
|
|
}
|
|
return rtv;
|
|
},
|
|
async loadTagsForWorkspace(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]> {
|
|
const rtv: INodePropertyOptions[] = [];
|
|
const workspaceId = this.getCurrentNodeParameter('workspaceId');
|
|
if (undefined !== workspaceId) {
|
|
const resource = `workspaces/${workspaceId}/tags`;
|
|
const users: IProjectDto[] = await clockifyApiRequest.call(this, 'GET', resource);
|
|
if (undefined !== users) {
|
|
users.forEach(value => {
|
|
rtv.push(
|
|
{
|
|
name: value.name,
|
|
value: value.id,
|
|
});
|
|
});
|
|
}
|
|
}
|
|
return rtv;
|
|
},
|
|
async loadCustomFieldsForWorkspace(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]> {
|
|
const rtv: INodePropertyOptions[] = [];
|
|
const workspaceId = this.getCurrentNodeParameter('workspaceId');
|
|
if (undefined !== workspaceId) {
|
|
const resource = `workspaces/${workspaceId}/custom-fields`;
|
|
const customFields = await clockifyApiRequest.call(this, 'GET', resource);
|
|
for (const customField of customFields) {
|
|
rtv.push(
|
|
{
|
|
name: customField.name,
|
|
value: customField.id,
|
|
});
|
|
}
|
|
}
|
|
return rtv;
|
|
},
|
|
},
|
|
};
|
|
|
|
async execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {
|
|
|
|
const items = this.getInputData();
|
|
|
|
const returnData: IDataObject[] = [];
|
|
|
|
const length = items.length;
|
|
|
|
const qs: IDataObject = {};
|
|
|
|
let responseData;
|
|
|
|
const resource = this.getNodeParameter('resource', 0) as string;
|
|
|
|
const operation = this.getNodeParameter('operation', 0) as string;
|
|
|
|
for (let i = 0; i < length; i++) {
|
|
|
|
try {
|
|
if (resource === 'project') {
|
|
|
|
if (operation === 'create') {
|
|
|
|
const workspaceId = this.getNodeParameter('workspaceId', i) as string;
|
|
|
|
const name = this.getNodeParameter('name', i) as string;
|
|
|
|
const additionalFields = this.getNodeParameter('additionalFields', i) as IDataObject;
|
|
|
|
const body: IDataObject = {
|
|
name,
|
|
};
|
|
|
|
Object.assign(body, additionalFields);
|
|
|
|
if (body.estimateUi) {
|
|
|
|
body.estimate = (body.estimateUi as IDataObject).estimateValues;
|
|
|
|
delete body.estimateUi;
|
|
}
|
|
|
|
responseData = await clockifyApiRequest.call(
|
|
this,
|
|
'POST',
|
|
`/workspaces/${workspaceId}/projects`,
|
|
body,
|
|
qs,
|
|
);
|
|
}
|
|
|
|
if (operation === 'delete') {
|
|
|
|
const workspaceId = this.getNodeParameter('workspaceId', i) as string;
|
|
|
|
const projectId = this.getNodeParameter('projectId', i) as string;
|
|
|
|
responseData = await clockifyApiRequest.call(
|
|
this,
|
|
'DELETE',
|
|
`/workspaces/${workspaceId}/projects/${projectId}`,
|
|
{},
|
|
qs,
|
|
);
|
|
|
|
responseData = { success: true };
|
|
}
|
|
|
|
if (operation === 'get') {
|
|
|
|
const workspaceId = this.getNodeParameter('workspaceId', i) as string;
|
|
|
|
const projectId = this.getNodeParameter('projectId', i) as string;
|
|
|
|
responseData = await clockifyApiRequest.call(
|
|
this,
|
|
'GET',
|
|
`/workspaces/${workspaceId}/projects/${projectId}`,
|
|
{},
|
|
qs,
|
|
);
|
|
}
|
|
|
|
if (operation === 'getAll') {
|
|
|
|
const returnAll = this.getNodeParameter('returnAll', i) as boolean;
|
|
|
|
const workspaceId = this.getNodeParameter('workspaceId', i) as string;
|
|
|
|
const additionalFields = this.getNodeParameter('additionalFields', i) as IDataObject;
|
|
|
|
Object.assign(qs, additionalFields);
|
|
|
|
if (returnAll) {
|
|
responseData = await clockifyApiRequestAllItems.call(
|
|
this,
|
|
'GET',
|
|
`/workspaces/${workspaceId}/projects`,
|
|
{},
|
|
qs,
|
|
);
|
|
|
|
} else {
|
|
|
|
qs.limit = this.getNodeParameter('limit', i) as number;
|
|
|
|
responseData = await clockifyApiRequestAllItems.call(
|
|
this,
|
|
'GET',
|
|
`/workspaces/${workspaceId}/projects`,
|
|
{},
|
|
qs,
|
|
);
|
|
|
|
responseData = responseData.splice(0, qs.limit);
|
|
}
|
|
}
|
|
|
|
if (operation === 'update') {
|
|
|
|
const workspaceId = this.getNodeParameter('workspaceId', i) as string;
|
|
|
|
const projectId = this.getNodeParameter('projectId', i) as string;
|
|
|
|
const updateFields = this.getNodeParameter('updateFields', i) as IDataObject;
|
|
|
|
const body: IDataObject = {};
|
|
|
|
Object.assign(body, updateFields);
|
|
|
|
if (body.estimateUi) {
|
|
|
|
body.estimate = (body.estimateUi as IDataObject).estimateValues;
|
|
|
|
delete body.estimateUi;
|
|
}
|
|
|
|
responseData = await clockifyApiRequest.call(
|
|
this,
|
|
'PUT',
|
|
`/workspaces/${workspaceId}/projects/${projectId}`,
|
|
body,
|
|
qs,
|
|
);
|
|
}
|
|
}
|
|
|
|
if (resource === 'tag') {
|
|
|
|
if (operation === 'create') {
|
|
|
|
const workspaceId = this.getNodeParameter('workspaceId', i) as string;
|
|
|
|
const name = this.getNodeParameter('name', i) as string;
|
|
|
|
const body: IDataObject = {
|
|
name,
|
|
};
|
|
|
|
responseData = await clockifyApiRequest.call(
|
|
this,
|
|
'POST',
|
|
`/workspaces/${workspaceId}/tags`,
|
|
body,
|
|
qs,
|
|
);
|
|
}
|
|
|
|
if (operation === 'delete') {
|
|
|
|
const workspaceId = this.getNodeParameter('workspaceId', i) as string;
|
|
|
|
const tagId = this.getNodeParameter('tagId', i) as string;
|
|
|
|
responseData = await clockifyApiRequest.call(
|
|
this,
|
|
'DELETE',
|
|
`/workspaces/${workspaceId}/tags/${tagId}`,
|
|
{},
|
|
qs,
|
|
);
|
|
|
|
responseData = { success: true };
|
|
}
|
|
|
|
if (operation === 'getAll') {
|
|
|
|
const returnAll = this.getNodeParameter('returnAll', i) as boolean;
|
|
|
|
const workspaceId = this.getNodeParameter('workspaceId', i) as string;
|
|
|
|
const additionalFields = this.getNodeParameter('additionalFields', i) as IDataObject;
|
|
|
|
Object.assign(qs, additionalFields);
|
|
|
|
if (returnAll) {
|
|
responseData = await clockifyApiRequestAllItems.call(
|
|
this,
|
|
'GET',
|
|
`/workspaces/${workspaceId}/tags`,
|
|
{},
|
|
qs,
|
|
);
|
|
|
|
} else {
|
|
|
|
qs.limit = this.getNodeParameter('limit', i) as number;
|
|
|
|
responseData = await clockifyApiRequestAllItems.call(
|
|
this,
|
|
'GET',
|
|
`/workspaces/${workspaceId}/tags`,
|
|
{},
|
|
qs,
|
|
);
|
|
|
|
responseData = responseData.splice(0, qs.limit);
|
|
}
|
|
}
|
|
|
|
if (operation === 'update') {
|
|
|
|
const workspaceId = this.getNodeParameter('workspaceId', i) as string;
|
|
|
|
const tagId = this.getNodeParameter('tagId', i) as string;
|
|
|
|
const updateFields = this.getNodeParameter('updateFields', i) as IDataObject;
|
|
|
|
const body: IDataObject = {};
|
|
|
|
Object.assign(body, updateFields);
|
|
|
|
responseData = await clockifyApiRequest.call(
|
|
this,
|
|
'PUT',
|
|
`/workspaces/${workspaceId}/tags/${tagId}`,
|
|
body,
|
|
qs,
|
|
);
|
|
}
|
|
}
|
|
|
|
if (resource === 'task') {
|
|
if (operation === 'create') {
|
|
const workspaceId = this.getNodeParameter(
|
|
'workspaceId',
|
|
i,
|
|
) as string;
|
|
|
|
const projectId = this.getNodeParameter('projectId', i) as string;
|
|
|
|
const name = this.getNodeParameter('name', i) as string;
|
|
|
|
const additionalFields = this.getNodeParameter(
|
|
'additionalFields',
|
|
i,
|
|
) as IDataObject;
|
|
|
|
const body: IDataObject = {
|
|
name,
|
|
};
|
|
|
|
Object.assign(body, additionalFields);
|
|
|
|
if (body.estimate) {
|
|
const [hour, minute] = (body.estimate as string).split(':');
|
|
body.estimate = `PT${hour}H${minute}M`;
|
|
}
|
|
|
|
responseData = await clockifyApiRequest.call(
|
|
this,
|
|
'POST',
|
|
`/workspaces/${workspaceId}/projects/${projectId}/tasks`,
|
|
body,
|
|
qs,
|
|
);
|
|
}
|
|
|
|
if (operation === 'delete') {
|
|
const workspaceId = this.getNodeParameter(
|
|
'workspaceId',
|
|
i,
|
|
) as string;
|
|
|
|
const projectId = this.getNodeParameter('projectId', i) as string;
|
|
|
|
const taskId = this.getNodeParameter('taskId', i) as string;
|
|
|
|
responseData = await clockifyApiRequest.call(
|
|
this,
|
|
'DELETE',
|
|
`/workspaces/${workspaceId}/projects/${projectId}/tasks/${taskId}`,
|
|
{},
|
|
qs,
|
|
);
|
|
}
|
|
|
|
if (operation === 'get') {
|
|
const workspaceId = this.getNodeParameter(
|
|
'workspaceId',
|
|
i,
|
|
) as string;
|
|
|
|
const projectId = this.getNodeParameter('projectId', i) as string;
|
|
|
|
const taskId = this.getNodeParameter('taskId', i) as string;
|
|
|
|
responseData = await clockifyApiRequest.call(
|
|
this,
|
|
'GET',
|
|
`/workspaces/${workspaceId}/projects/${projectId}/tasks/${taskId}`,
|
|
{},
|
|
qs,
|
|
);
|
|
}
|
|
|
|
if (operation === 'getAll') {
|
|
const returnAll = this.getNodeParameter('returnAll', i) as boolean;
|
|
|
|
const workspaceId = this.getNodeParameter(
|
|
'workspaceId',
|
|
i,
|
|
) as string;
|
|
|
|
const projectId = this.getNodeParameter('projectId', i) as string;
|
|
|
|
const filters = this.getNodeParameter(
|
|
'filters',
|
|
i,
|
|
) as IDataObject;
|
|
|
|
Object.assign(qs, filters);
|
|
|
|
if (returnAll) {
|
|
responseData = await clockifyApiRequestAllItems.call(
|
|
this,
|
|
'GET',
|
|
`/workspaces/${workspaceId}/projects/${projectId}/tasks`,
|
|
{},
|
|
qs,
|
|
);
|
|
} else {
|
|
qs['page-size'] = this.getNodeParameter('limit', i) as number;
|
|
|
|
responseData = await clockifyApiRequest.call(
|
|
this,
|
|
'GET',
|
|
`/workspaces/${workspaceId}/projects/${projectId}/tasks`,
|
|
{},
|
|
qs,
|
|
);
|
|
}
|
|
}
|
|
|
|
if (operation === 'update') {
|
|
const workspaceId = this.getNodeParameter(
|
|
'workspaceId',
|
|
i,
|
|
) as string;
|
|
|
|
const projectId = this.getNodeParameter('projectId', i) as string;
|
|
|
|
const taskId = this.getNodeParameter('taskId', i) as string;
|
|
|
|
const updateFields = this.getNodeParameter(
|
|
'updateFields',
|
|
i,
|
|
) as IDataObject;
|
|
|
|
const body: IDataObject = {};
|
|
|
|
Object.assign(body, updateFields);
|
|
|
|
if (body.estimate) {
|
|
const [hour, minute] = (body.estimate as string).split(':');
|
|
body.estimate = `PT${hour}H${minute}M`;
|
|
}
|
|
|
|
responseData = await clockifyApiRequest.call(
|
|
this,
|
|
'PUT',
|
|
`/workspaces/${workspaceId}/projects/${projectId}/tasks/${taskId}`,
|
|
body,
|
|
qs,
|
|
);
|
|
}
|
|
}
|
|
|
|
if (resource === 'timeEntry') {
|
|
|
|
if (operation === 'create') {
|
|
|
|
const timezone = this.getTimezone();
|
|
|
|
const workspaceId = this.getNodeParameter('workspaceId', i) as string;
|
|
|
|
const start = this.getNodeParameter('start', i) as string;
|
|
|
|
const additionalFields = this.getNodeParameter('additionalFields', i) as IDataObject;
|
|
|
|
const body: IDataObject = {
|
|
start: moment.tz(start, timezone).utc().format(),
|
|
};
|
|
|
|
Object.assign(body, additionalFields);
|
|
|
|
if (body.end) {
|
|
body.end = moment.tz(body.end, timezone).utc().format();
|
|
}
|
|
|
|
if (body.customFieldsUi) {
|
|
|
|
const customFields = (body.customFieldsUi as IDataObject).customFieldsValues as IDataObject[];
|
|
|
|
body.customFields = customFields;
|
|
}
|
|
|
|
responseData = await clockifyApiRequest.call(
|
|
this,
|
|
'POST',
|
|
`/workspaces/${workspaceId}/time-entries`,
|
|
body,
|
|
qs,
|
|
);
|
|
}
|
|
|
|
if (operation === 'delete') {
|
|
|
|
const workspaceId = this.getNodeParameter('workspaceId', i) as string;
|
|
|
|
const timeEntryId = this.getNodeParameter('timeEntryId', i) as string;
|
|
|
|
responseData = await clockifyApiRequest.call(
|
|
this,
|
|
'DELETE',
|
|
`/workspaces/${workspaceId}/time-entries/${timeEntryId}`,
|
|
{},
|
|
qs,
|
|
);
|
|
|
|
responseData = { success: true };
|
|
}
|
|
|
|
if (operation === 'get') {
|
|
|
|
const workspaceId = this.getNodeParameter('workspaceId', i) as string;
|
|
|
|
const timeEntryId = this.getNodeParameter('timeEntryId', i) as string;
|
|
|
|
responseData = await clockifyApiRequest.call(
|
|
this,
|
|
'GET',
|
|
`/workspaces/${workspaceId}/time-entries/${timeEntryId}`,
|
|
{},
|
|
qs,
|
|
);
|
|
}
|
|
|
|
if (operation === 'update') {
|
|
|
|
const timezone = this.getTimezone();
|
|
|
|
const workspaceId = this.getNodeParameter('workspaceId', i) as string;
|
|
|
|
const timeEntryId = this.getNodeParameter('timeEntryId', i) as string;
|
|
|
|
const updateFields = this.getNodeParameter('updateFields', i) as IDataObject;
|
|
|
|
const body: IDataObject = {};
|
|
|
|
Object.assign(body, updateFields);
|
|
|
|
if (body.end) {
|
|
body.end = moment.tz(body.end, timezone).utc().format();
|
|
}
|
|
|
|
if (body.start) {
|
|
body.start = moment.tz(body.start, timezone).utc().format();
|
|
} else {
|
|
// even if you do not want to update the start time, it always has to be set
|
|
// to make it more simple to the user, if he did not set a start time look for the current start time
|
|
// and set it
|
|
const { timeInterval: { start } } = await clockifyApiRequest.call(
|
|
this,
|
|
'GET',
|
|
`/workspaces/${workspaceId}/time-entries/${timeEntryId}`,
|
|
{},
|
|
qs,
|
|
);
|
|
|
|
body.start = start;
|
|
}
|
|
|
|
responseData = await clockifyApiRequest.call(
|
|
this,
|
|
'PUT',
|
|
`/workspaces/${workspaceId}/time-entries/${timeEntryId}`,
|
|
body,
|
|
qs,
|
|
);
|
|
}
|
|
}
|
|
|
|
if (Array.isArray(responseData)) {
|
|
|
|
returnData.push.apply(returnData, responseData as IDataObject[]);
|
|
|
|
} else if (responseData !== undefined) {
|
|
|
|
returnData.push(responseData as IDataObject);
|
|
}
|
|
} catch (error) {
|
|
if (this.continueOnFail()) {
|
|
returnData.push({ error: error.message });
|
|
continue;
|
|
}
|
|
throw error;
|
|
}
|
|
}
|
|
|
|
return [this.helpers.returnJsonArray(returnData)];
|
|
}
|
|
}
|