Skip to content

Commit

Permalink
style: format code
Browse files Browse the repository at this point in the history
Signed-off-by: Raúl Fernández Fernández <[email protected]>
  • Loading branch information
rfdez committed Jul 10, 2023
1 parent a78da27 commit 89ec97d
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 25 deletions.
18 changes: 9 additions & 9 deletions credentials/SplitwiseApi.credentials.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {
IAuthenticateGeneric,
ICredentialTestRequest,
ICredentialTestRequest,
ICredentialType,
INodeProperties,
} from 'n8n-workflow';
Expand All @@ -21,15 +21,15 @@ export class SplitwiseApi implements ICredentialType {
authenticate: IAuthenticateGeneric = {
type: 'generic',
properties: {
headers: {
Authorization: '=Bearer {{$credentials.apiKey}}'
headers: {
Authorization: '=Bearer {{$credentials.apiKey}}',
},
},
};
test: ICredentialTestRequest = {
request: {
baseURL: 'https://secure.splitwise.com/api/v3.0',
url: '/get_current_user',
},
};
test: ICredentialTestRequest = {
request: {
baseURL: 'https://secure.splitwise.com/api/v3.0',
url: '/get_current_user',
},
};
}
5 changes: 1 addition & 4 deletions credentials/SplitwiseOAuth2Api.credentials.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
import {
ICredentialType,
INodeProperties,
} from 'n8n-workflow';
import { ICredentialType, INodeProperties } from 'n8n-workflow';

export class SplitwiseOAuth2Api implements ICredentialType {
name = 'splitwiseOAuth2Api';
Expand Down
11 changes: 7 additions & 4 deletions nodes/Splitwise/ExpenseDescription.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,8 @@ const createExpenseFields: INodeProperties[] = [
displayName: 'Group Name or ID',
name: 'group_id',
type: 'options',
description: 'Name or ID of the group to add the expense to. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
description:
'Name or ID of the group to add the expense to. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
default: '',
required: true,
displayOptions: {
Expand All @@ -78,7 +79,8 @@ const createExpenseFields: INodeProperties[] = [
displayName: 'Currency Code Name or ID',
name: 'currency_code',
type: 'options',
description: 'Currency code of the expense (the ID is the Code). Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
description:
'Currency code of the expense (the ID is the Code). Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
default: '',
required: true,
displayOptions: {
Expand All @@ -95,7 +97,8 @@ const createExpenseFields: INodeProperties[] = [
displayName: 'Category Name or ID',
name: 'category_id',
type: 'options',
description: 'Category of the expense. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
description:
'Category of the expense. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
default: '',
required: true,
displayOptions: {
Expand Down Expand Up @@ -179,7 +182,7 @@ const createExpenseFields: INodeProperties[] = [
],
},
],
}
},
];

export const expenseFields: INodeProperties[] = [...createExpenseFields];
14 changes: 10 additions & 4 deletions nodes/Splitwise/GenericFunctions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
INodePropertyOptions,
JsonObject,
NodeApiError,
} from "n8n-workflow";
} from 'n8n-workflow';

export async function splitwiseApiRequest(
this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions,
Expand Down Expand Up @@ -41,7 +41,9 @@ export async function getCurrencies(this: ILoadOptionsFunctions): Promise<INodeP
const responseData = await splitwiseApiRequest.call(this, 'GET', endpoint, {});

if (responseData.currencies === undefined) {
throw new NodeApiError(this.getNode(), responseData as JsonObject, { message: 'No data got returned' });
throw new NodeApiError(this.getNode(), responseData as JsonObject, {
message: 'No data got returned',
});
}

const returnData: INodePropertyOptions[] = [];
Expand Down Expand Up @@ -72,7 +74,9 @@ export async function getCategories(this: ILoadOptionsFunctions): Promise<INodeP
const responseData = await splitwiseApiRequest.call(this, 'GET', endpoint, {});

if (responseData.categories === undefined) {
throw new NodeApiError(this.getNode(), responseData as JsonObject, { message: 'No data got returned' });
throw new NodeApiError(this.getNode(), responseData as JsonObject, {
message: 'No data got returned',
});
}

const returnData: INodePropertyOptions[] = [];
Expand Down Expand Up @@ -116,7 +120,9 @@ export async function getGroups(this: ILoadOptionsFunctions): Promise<INodePrope
const responseData = await splitwiseApiRequest.call(this, 'GET', endpoint, {});

if (responseData.groups === undefined) {
throw new NodeApiError(this.getNode(), responseData as JsonObject, { message: 'No data got returned' });
throw new NodeApiError(this.getNode(), responseData as JsonObject, {
message: 'No data got returned',
});
}

const returnData: INodePropertyOptions[] = [];
Expand Down
15 changes: 11 additions & 4 deletions nodes/Splitwise/Splitwise.node.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
import { IDataObject, IExecuteFunctions, INodeExecutionData, INodeType, INodeTypeDescription, NodeOperationError } from 'n8n-workflow';
import {
IDataObject,
IExecuteFunctions,
INodeExecutionData,
INodeType,
INodeTypeDescription,
NodeOperationError,
} from 'n8n-workflow';
import { expenseFields, expenseOperations } from './ExpenseDescription';
import { getCategories, getCurrencies, getGroups, splitwiseApiRequest } from './GenericFunctions';

Expand Down Expand Up @@ -76,15 +83,15 @@ export class Splitwise implements INodeType {
...expenseOperations,
...expenseFields,
],
}
};

methods = {
loadOptions: {
getCategories,
getCurrencies,
getGroups
getGroups,
},
}
};

async execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {
const items = this.getInputData();
Expand Down

0 comments on commit 89ec97d

Please sign in to comment.