Skip to content

Commit

Permalink
Merge pull request #11 from masa-finance/feature/na-addtypes-to-param…
Browse files Browse the repository at this point in the history
…eters

Feature/na addtypes to parameters
  • Loading branch information
gabitanalla committed Apr 16, 2022
2 parents 17386c6 + e0212f1 commit 6be31fb
Show file tree
Hide file tree
Showing 11 changed files with 24 additions and 13 deletions.
3 changes: 2 additions & 1 deletion src/common/components/rest-method/rest-method.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@ export const RestMethod = ({
};

const onValueChange = (key: string, value: string) => {
setCustomParameters({ ...customParameters, [key]: value });
const parameter = parameters.filter(parameter => parameter['name'] = key)
setCustomParameters({ ...customParameters, [key]: parameter.dataType == 'string' ? value : Number(value)});
};

const onValuePathChange = (key: string, value: string) => {
Expand Down
2 changes: 1 addition & 1 deletion src/common/rest/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export interface Parameter {
required: 'yes' | 'no';
description: string;
default: string;
dataType?: string;
dataType: 'string' | 'number';
}

export interface MethodMetadata {
Expand Down
4 changes: 3 additions & 1 deletion src/common/rest/plaid/get-plaid-access-token/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { MethodMetadata, Parameter } from '..';
import { MethodMetadata, Parameter } from '../..';
import { useRestCall } from '../../../helpers/rest-calls';
import { Headers } from '../../../helpers/axios';

Expand All @@ -21,13 +21,15 @@ const parameters: Parameter[] = [
description: 'User ID',
required: 'yes',
default: '',
dataType: 'string'
},
{
key: 2,
name: 'publicToken',
description: 'Public Token',
required: 'yes',
default: '',
dataType: 'string'
},
];

Expand Down
3 changes: 2 additions & 1 deletion src/common/rest/plaid/get-plaid-account/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { MethodMetadata, Parameter } from '..';
import { MethodMetadata, Parameter } from '../..';
import { useRestCall } from '../../../helpers/rest-calls';
import { Headers } from '../../../helpers/axios';

Expand All @@ -21,6 +21,7 @@ const parameters: Parameter[] = [
description: 'Account ID',
required: 'yes',
default: '',
dataType: 'string'
},
];

Expand Down
3 changes: 2 additions & 1 deletion src/common/rest/plaid/get-plaid-link-token/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { MethodMetadata, Parameter } from '..';
import { MethodMetadata, Parameter } from '../..';
import { Headers } from '../../../helpers/axios';
import { useRestCall } from '../../../helpers/rest-calls';

Expand All @@ -21,6 +21,7 @@ const parameters: Parameter[] = [
description: 'User ID',
required: 'yes',
default: '',
dataType: 'string'
},
];

Expand Down
3 changes: 2 additions & 1 deletion src/common/rest/plaid/get-plaid-transaction/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { MethodMetadata, Parameter } from '..';
import { MethodMetadata, Parameter } from '../..';
import { useRestCall } from '../../../helpers/rest-calls';
import { Headers } from '../../../helpers/axios';

Expand All @@ -21,6 +21,7 @@ const parameters: Parameter[] = [
description: 'Transaction ID',
required: 'yes',
default: '',
dataType: 'string'
},
];

Expand Down
3 changes: 2 additions & 1 deletion src/common/rest/plaid/list-plaid-accounts/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { MethodMetadata, Parameter } from '..';
import { MethodMetadata, Parameter } from '../..';
import { useRestCall } from '../../../helpers/rest-calls';
import { Headers } from '../../../helpers/axios';

Expand All @@ -21,6 +21,7 @@ const parameters: Parameter[] = [
description: 'User ID',
required: 'yes',
default: '',
dataType: 'string'
},
];

Expand Down
3 changes: 2 additions & 1 deletion src/common/rest/plaid/list-plaid-transactions/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { MethodMetadata, Parameter } from '..';
import { MethodMetadata, Parameter } from '../..';
import { useRestCall } from '../../../helpers/rest-calls';
import { Headers } from '../../../helpers/axios';

Expand All @@ -21,6 +21,7 @@ const parameters: Parameter[] = [
description: 'User ID',
required: 'yes',
default: '',
dataType: 'string'
},
];

Expand Down
4 changes: 3 additions & 1 deletion src/common/rest/plaid/save-plaid-accounts/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { MethodMetadata, Parameter } from '..';
import { MethodMetadata, Parameter } from '../..';
import { useRestCall } from '../../../helpers/rest-calls';
import { Headers } from '../../../helpers/axios';

Expand All @@ -21,13 +21,15 @@ const parameters: Parameter[] = [
description: 'User ID',
required: 'yes',
default: '',
dataType: 'string'
},
{
key: 3,
name: 'accounts',
description: 'Accounts',
required: 'yes',
default: '',
dataType: 'string'
},
];

Expand Down
3 changes: 2 additions & 1 deletion src/common/rest/plaid/save-plaid-transactions/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { MethodMetadata, Parameter } from '..';
import { MethodMetadata, Parameter } from '../..';
import { useRestCall } from '../../../helpers/rest-calls';
import { Headers } from '../../../helpers/axios';

Expand All @@ -21,6 +21,7 @@ const parameters: Parameter[] = [
description: 'User ID',
required: 'yes',
default: '',
dataType: 'string'
},
];

Expand Down
6 changes: 3 additions & 3 deletions src/common/rest/post-user/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const parameters: Parameter[] = [
description: '',
required: 'yes',
default: '',
dataType: 'string[]'
dataType: 'string'
},
{
key: 3,
Expand Down Expand Up @@ -66,7 +66,7 @@ const parameters: Parameter[] = [
description: 'Last time user logged in',
required: 'yes',
default: '',
dataType: 'timestamp'
dataType: 'string'
},
{
key: 8,
Expand All @@ -82,7 +82,7 @@ const parameters: Parameter[] = [
description: 'User\'s date of birth',
required: 'yes',
default: '',
dataType: 'timestamp'
dataType: 'string'
},
{
key: 10,
Expand Down

0 comments on commit 6be31fb

Please sign in to comment.