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', name: 'Information',
value: 'information', value: 'information',
}, },
{
name: 'Social Profile',
value: 'socialProfile',
},
{ {
name: 'Utility', name: 'Utility',
value: 'utility', value: 'utility',
@ -55,7 +59,7 @@ export class OneSimpleApi implements INodeType {
default: 'website', default: 'website',
required: true, required: true,
}, },
// Generation // website
{ {
displayName: 'Operation', displayName: 'Operation',
name: 'operation', name: 'operation',
@ -86,6 +90,32 @@ export class OneSimpleApi implements INodeType {
], ],
default: 'pdf', 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 // Information
{ {
displayName: 'Operation', displayName: 'Operation',
@ -113,7 +143,7 @@ export class OneSimpleApi implements INodeType {
default: 'exchangeRate', default: 'exchangeRate',
description: 'The operation to perform.', description: 'The operation to perform.',
}, },
// Utiliy // Utility
{ {
displayName: 'Operation', displayName: 'Operation',
name: 'operation', name: 'operation',
@ -279,7 +309,7 @@ export class OneSimpleApi implements INodeType {
type: 'boolean', type: 'boolean',
default: false, default: false,
description: `Normally the API will reuse a previously taken screenshot of the URL to give a faster response. 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', type: 'boolean',
default: false, default: false,
description: `Normally the API will reuse a previously taken screenshot of the URL to give a faster response. 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', 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 // information: exchangeRate
{ {
displayName: 'Value', 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 (resource === 'information') {
if (operation === 'exchangeRate') { if (operation === 'exchangeRate') {
const value = this.getNodeParameter('value', i) as string; const value = this.getNodeParameter('value', i) as string;
@ -865,3 +947,4 @@ export class OneSimpleApi implements INodeType {
return [this.helpers.returnJsonArray(returnData)]; return [this.helpers.returnJsonArray(returnData)];
} }
} }