Add Social Profiles to OneSimpleAPI (#2459)

* Added Instagram Profile and Spotify Artist Profile to OneSimpleAPI

* Changed to tabs
This commit is contained in:
Jonathan Bennetts 2021-12-11 17:01:43 +00:00 committed by GitHub
parent d007d0c395
commit b4469eee33
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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',
@ -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)];
}
}