mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 10:02:05 +00:00
feat(Oura Node): Update node for v2 api (#11604)
This commit is contained in:
@@ -4,7 +4,7 @@ import type {
|
||||
IHookFunctions,
|
||||
ILoadOptionsFunctions,
|
||||
JsonObject,
|
||||
IRequestOptions,
|
||||
IHttpRequestOptions,
|
||||
IHttpRequestMethods,
|
||||
} from 'n8n-workflow';
|
||||
import { NodeApiError } from 'n8n-workflow';
|
||||
@@ -18,15 +18,11 @@ export async function ouraApiRequest(
|
||||
uri?: string,
|
||||
option: IDataObject = {},
|
||||
) {
|
||||
const credentials = await this.getCredentials('ouraApi');
|
||||
let options: IRequestOptions = {
|
||||
headers: {
|
||||
Authorization: `Bearer ${credentials.accessToken}`,
|
||||
},
|
||||
let options: IHttpRequestOptions = {
|
||||
method,
|
||||
qs,
|
||||
body,
|
||||
uri: uri || `https://api.ouraring.com/v1${resource}`,
|
||||
url: uri ?? `https://api.ouraring.com/v2${resource}`,
|
||||
json: true,
|
||||
};
|
||||
|
||||
@@ -41,7 +37,7 @@ export async function ouraApiRequest(
|
||||
options = Object.assign({}, options, option);
|
||||
|
||||
try {
|
||||
return await this.helpers.request(options);
|
||||
return await this.helpers.httpRequestWithAuthentication.call(this, 'ouraApi', options);
|
||||
} catch (error) {
|
||||
throw new NodeApiError(this.getNode(), error as JsonObject);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user