mirror of
https://github.com/n8n-io/n8n.git
synced 2025-01-12 05:17:28 -08:00
Flatten responses for profile:get
This commit is contained in:
parent
3545303a3b
commit
50b5305a9c
|
@ -41,7 +41,6 @@ export async function redditApiRequest(
|
|||
}
|
||||
|
||||
try {
|
||||
// console.log(options);
|
||||
return authRequired
|
||||
? await this.helpers.requestOAuth2.call(this, 'redditOAuth2Api', options)
|
||||
: await this.helpers.request.call(this, options);
|
||||
|
@ -73,11 +72,7 @@ export async function redditApiRequestAllItems(
|
|||
const operation = this.getNodeParameter('operation', 0) as string;
|
||||
|
||||
do {
|
||||
// console.log(method);
|
||||
// console.log(endpoint);
|
||||
// console.log(qs);
|
||||
responseData = await redditApiRequest.call(this, method, endpoint, qs);
|
||||
console.log(responseData);
|
||||
qs.after = responseData.after;
|
||||
|
||||
if (endpoint === 'api/search_subreddits.json') {
|
||||
|
|
|
@ -234,14 +234,13 @@ export class Reddit implements INodeType {
|
|||
|
||||
} else if (operation === 'getAll') {
|
||||
|
||||
// https://www.reddit.com/r/{subrreddit}/comments/{postId}.json
|
||||
|
||||
const subreddit = this.getNodeParameter('subreddit', i);
|
||||
const postId = this.getNodeParameter('postId', i) as string;
|
||||
const endpoint = `r/${subreddit}/comments/${postId}.json`;
|
||||
|
||||
responseData = await handleListing.call(this, i, endpoint);
|
||||
// console.log(responseData);
|
||||
// responseData = await redditApiRequest.call(this, 'GET', endpoint, {});
|
||||
// responseData = responseData[1].data.children.map((child: any) => child.data); // tslint:disable-line:no-any
|
||||
|
||||
} else if (operation === 'remove') {
|
||||
|
||||
|
@ -306,6 +305,12 @@ export class Reddit implements INodeType {
|
|||
|
||||
if (details === 'identity') {
|
||||
responseData = responseData.features;
|
||||
} else if (details === 'friends') {
|
||||
responseData = responseData.data.children;
|
||||
} else if (details === 'karma') {
|
||||
responseData = responseData.data;
|
||||
} else if (details === 'trophies') {
|
||||
responseData = responseData.data.trophies.map((trophy: IDataObject) => trophy.data);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -395,7 +400,9 @@ export class Reddit implements INodeType {
|
|||
? await redditApiRequest.call(this, 'GET', endpoint, {})
|
||||
: await handleListing.call(this, i, endpoint);
|
||||
|
||||
if (details === 'about') {
|
||||
if (details === 'gilded') {
|
||||
responseData = responseData.data.children;
|
||||
} else if (details === 'about') {
|
||||
responseData = responseData.data;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue