Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Todoist: add move task between sections - N8N-3128 #3074

Merged
merged 26 commits into from
Jun 20, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
25e54c7
refactor todoist implementation and break code into separate classes
rahimlis Nov 22, 2021
6a34ac3
add move item between sections functionality
rahimlis Nov 30, 2021
9a77513
add todoist sync integration
rahimlis Dec 31, 2021
b409ad7
Merge branch 'master' of https://github.com/rahimlis/n8n into feature…
rahimlis Dec 31, 2021
edf9324
rebase with master
rahimlis Dec 31, 2021
35a1cdb
Merge branch 'feature/todoist_sections' into n8n-3128-Todoist-PR-2462
agobrech Mar 21, 2022
d25460a
Fixed get task returning only true
agobrech Mar 23, 2022
03af366
Fix empty response bug
agobrech Mar 23, 2022
b816d57
Fixed bug which prevented sections from being loaded
agobrech Mar 30, 2022
624306f
Merge remote-tracking branch 'upstream/master' into n8n-3128-Todoist-…
agobrech Mar 30, 2022
84506e1
Merge branch 'master' into n8n-3128-Todoist-PR-2462
agobrech Apr 21, 2022
70f38db
Merge branch 'master' into n8n-3128-Todoist-PR-2462
agobrech Apr 25, 2022
76d1fad
Removed crendentials from node and injected directly in credentials file
agobrech Apr 25, 2022
de2a827
Remove console.logs
agobrech Apr 25, 2022
645a08e
Changed parameter name for coherence
agobrech Apr 25, 2022
654e2e3
Merge branch 'master' into n8n-3128-Todoist-PR-2462
agobrech May 31, 2022
3f926a7
Fixed error
agobrech May 31, 2022
1c66c3a
Merge branch 'master' into n8n-3128-Todoist-PR-2462
RicardoE105 Jun 15, 2022
8463979
:bug: Fix merge issues
RicardoE105 Jun 15, 2022
aa84998
:zap: Improvements
RicardoE105 Jun 16, 2022
05ca53c
:fire: Remove unnecessary code
RicardoE105 Jun 16, 2022
47eca8c
:shirt: Fix linting issue
RicardoE105 Jun 16, 2022
c94ed0c
:shirt: Fix linting issue
RicardoE105 Jun 16, 2022
b960148
:bug: Fix ts issue
RicardoE105 Jun 16, 2022
ca88a5d
:shirt: Fix linting issue
RicardoE105 Jun 18, 2022
6ca49ff
:twisted_rightwards_arrows: Merge branch 'master' into n8n-3128-Todoi…
janober Jun 20, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions packages/nodes-base/credentials/TodoistApi.credentials.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ import {
ICredentialType,
INodeProperties,
} from 'n8n-workflow';


export class TodoistApi implements ICredentialType {
name = 'todoistApi';
displayName = 'Todoist API';
Expand All @@ -17,6 +15,7 @@ export class TodoistApi implements ICredentialType {
type: 'string',
default: '',
},

];

authenticate = {
Expand Down
37 changes: 32 additions & 5 deletions packages/nodes-base/nodes/Todoist/GenericFunctions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,16 @@ import {
IDataObject, NodeApiError,
} from 'n8n-workflow';

export type Context = IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions;

export function FormatDueDatetime(isoString: string): string {
// Assuming that the problem with incorrect date format was caused by milliseconds
// Replacing the last 5 characters of ISO-formatted string with just Z char
return isoString.replace(new RegExp('.000Z$'), 'Z');
}

export async function todoistApiRequest(
this:
| IHookFunctions
| IExecuteFunctions
| ILoadOptionsFunctions,
this: Context,
method: string,
resource: string,
body: any = {}, // tslint:disable-line:no-any
Expand All @@ -48,6 +47,34 @@ export async function todoistApiRequest(
return await this.helpers.requestWithAuthentication.call(this, credentialType, options);

} catch (error) {
throw new NodeApiError(this.getNode(), error);
throw new NodeApiError(this.getNode(), (error));
}
}

export async function todoistSyncRequest(
this: Context,
body: any = {}, // tslint:disable-line:no-any
qs: IDataObject = {},
): Promise<any> { // tslint:disable-line:no-any
const authentication = this.getNodeParameter('authentication', 0, 'oAuth2');

const options: OptionsWithUri = {
headers: {},
method: 'POST',
qs,
uri: `https://api.todoist.com/sync/v8/sync`,
json: true,
};

if (Object.keys(body).length !== 0) {
options.body = body;
}

try {
const credentialType = authentication === 'oAuth2' ? 'todoistOAuth2Api' : 'todoistApi';
return await this.helpers.requestWithAuthentication.call(this, credentialType, options);

} catch (error) {
throw new NodeApiError(this.getNode(), (error));
}
}
Loading