From b4469eee332b230d623aa4146df6fabce6b05ce5 Mon Sep 17 00:00:00 2001 From: Jonathan Bennetts Date: Sat, 11 Dec 2021 17:01:43 +0000 Subject: [PATCH] :sparkles: Add Social Profiles to OneSimpleAPI (#2459) * Added Instagram Profile and Spotify Artist Profile to OneSimpleAPI * Changed to tabs --- .../nodes/OneSimpleApi/OneSimpleApi.node.ts | 91 ++++++++++++++++++- 1 file changed, 87 insertions(+), 4 deletions(-) diff --git a/packages/nodes-base/nodes/OneSimpleApi/OneSimpleApi.node.ts b/packages/nodes-base/nodes/OneSimpleApi/OneSimpleApi.node.ts index 5edda2ee4b..070f71daf8 100644 --- a/packages/nodes-base/nodes/OneSimpleApi/OneSimpleApi.node.ts +++ b/packages/nodes-base/nodes/OneSimpleApi/OneSimpleApi.node.ts @@ -43,6 +43,10 @@ export class OneSimpleApi implements INodeType { name: 'Information', value: 'information', }, + { + name: 'Social Profile', + value: 'socialProfile', + }, { name: 'Utility', value: 'utility', @@ -55,7 +59,7 @@ export class OneSimpleApi implements INodeType { default: 'website', required: true, }, - // Generation + // website { displayName: 'Operation', name: 'operation', @@ -86,6 +90,32 @@ export class OneSimpleApi implements INodeType { ], default: 'pdf', }, + // socialProfile + { + displayName: 'Operation', + name: 'operation', + type: 'options', + displayOptions: { + show: { + resource: [ + 'socialProfile', + ], + }, + }, + options: [ + { + name: 'Instagram', + value: 'instagramProfile', + description: 'Get details about an Instagram profile', + }, + { + name: 'Spotify', + value: 'spotifyArtistProfile', + description: 'Get details about a Spotify Artist', + }, + ], + default: 'instagramProfile', + }, // Information { displayName: 'Operation', @@ -113,7 +143,7 @@ export class OneSimpleApi implements INodeType { default: 'exchangeRate', description: 'The operation to perform.', }, - // Utiliy + // Utility { displayName: 'Operation', name: 'operation', @@ -279,7 +309,7 @@ export class OneSimpleApi implements INodeType { type: 'boolean', default: false, description: `Normally the API will reuse a previously taken screenshot of the URL to give a faster response. - This option allows you to retake the screenshot at that exact time, for those times when it's necessary`, + This option allows you to retake the screenshot at that exact time, for those times when it's necessary`, }, ], }, @@ -508,7 +538,7 @@ export class OneSimpleApi implements INodeType { type: 'boolean', default: false, description: `Normally the API will reuse a previously taken screenshot of the URL to give a faster response. - This option allows you to retake the screenshot at that exact time, for those times when it's necessary`, + This option allows you to retake the screenshot at that exact time, for those times when it's necessary`, }, { displayName: 'Full Page', @@ -519,6 +549,44 @@ export class OneSimpleApi implements INodeType { }, ], }, + // socialProfile: instagramProfile + { + displayName: 'Profile Name', + name: 'profileName', + type: 'string', + required: true, + displayOptions: { + show: { + operation: [ + 'instagramProfile', + ], + resource: [ + 'socialProfile', + ], + }, + }, + default: '', + description: 'Profile name to get details of', + }, + // socialProfile: spotifyArtistProfile + { + displayName: 'Artist Name', + name: 'artistName', + type: 'string', + required: true, + displayOptions: { + show: { + operation: [ + 'spotifyArtistProfile', + ], + resource: [ + 'socialProfile', + ], + }, + }, + default: '', + description: 'Artist name to get details for', + }, // information: exchangeRate { displayName: 'Value', @@ -778,6 +846,20 @@ export class OneSimpleApi implements INodeType { } } + if (resource === 'socialProfile') { + if (operation === 'instagramProfile') { + const profileName = this.getNodeParameter('profileName', i) as string; + qs.profile = profileName; + responseData = await oneSimpleApiRequest.call(this, 'GET', '/instagram_profile', {}, qs); + } + + if (operation === 'spotifyArtistProfile') { + const artistName = this.getNodeParameter('artistName', i) as string; + qs.profile = artistName; + responseData = await oneSimpleApiRequest.call(this, 'GET', '/spotify_profile', {}, qs); + } + } + if (resource === 'information') { if (operation === 'exchangeRate') { const value = this.getNodeParameter('value', i) as string; @@ -865,3 +947,4 @@ export class OneSimpleApi implements INodeType { return [this.helpers.returnJsonArray(returnData)]; } } +