mirror of
https://github.com/n8n-io/n8n.git
synced 2024-12-25 12:44:07 -08:00
fix(beeminder Node): fix request id not being sent when creating a new datapoint
This commit is contained in:
parent
071ab40c9f
commit
73c5210294
|
@ -1,4 +1,9 @@
|
||||||
import { ICredentialType, INodeProperties } from 'n8n-workflow';
|
import {
|
||||||
|
IAuthenticateGeneric,
|
||||||
|
ICredentialTestRequest,
|
||||||
|
ICredentialType,
|
||||||
|
INodeProperties,
|
||||||
|
} from 'n8n-workflow';
|
||||||
|
|
||||||
export class BeeminderApi implements ICredentialType {
|
export class BeeminderApi implements ICredentialType {
|
||||||
name = 'beeminderApi';
|
name = 'beeminderApi';
|
||||||
|
@ -18,4 +23,20 @@ export class BeeminderApi implements ICredentialType {
|
||||||
default: '',
|
default: '',
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
|
authenticate: IAuthenticateGeneric = {
|
||||||
|
type: 'generic',
|
||||||
|
properties: {
|
||||||
|
body: {
|
||||||
|
auth_token: '={{$credentials.authToken}}',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
test: ICredentialTestRequest = {
|
||||||
|
request: {
|
||||||
|
baseURL: 'https://www.beeminder.com/api/v1',
|
||||||
|
url: `=/users/{{$credentials.user}}.json`,
|
||||||
|
},
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,7 +8,6 @@ import {
|
||||||
INodePropertyOptions,
|
INodePropertyOptions,
|
||||||
INodeType,
|
INodeType,
|
||||||
INodeTypeDescription,
|
INodeTypeDescription,
|
||||||
NodeOperationError,
|
|
||||||
} from 'n8n-workflow';
|
} from 'n8n-workflow';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
|
@ -197,7 +196,7 @@ export class Beeminder implements INodeType {
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
displayName: 'Request ID',
|
displayName: 'Request ID',
|
||||||
name: 'requestId',
|
name: 'requestid',
|
||||||
type: 'string',
|
type: 'string',
|
||||||
default: '',
|
default: '',
|
||||||
placeholder: '',
|
placeholder: '',
|
||||||
|
|
|
@ -15,10 +15,6 @@ export async function beeminderApiRequest(
|
||||||
query: IDataObject = {},
|
query: IDataObject = {},
|
||||||
// tslint:disable-next-line:no-any
|
// tslint:disable-next-line:no-any
|
||||||
): Promise<any> {
|
): Promise<any> {
|
||||||
const credentials = (await this.getCredentials('beeminderApi')) as IDataObject;
|
|
||||||
|
|
||||||
Object.assign(body, { auth_token: credentials.authToken });
|
|
||||||
|
|
||||||
const options: OptionsWithUri = {
|
const options: OptionsWithUri = {
|
||||||
method,
|
method,
|
||||||
body,
|
body,
|
||||||
|
@ -36,7 +32,7 @@ export async function beeminderApiRequest(
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
return await this.helpers.request!(options);
|
return await this.helpers.requestWithAuthentication.call(this, 'beeminderApi', options);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
throw new NodeApiError(this.getNode(), error);
|
throw new NodeApiError(this.getNode(), error);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue