first commit
Security: Sync from Public / sync-from-public (push) Has been cancelled
Test: Benchmark Nightly / build (push) Has been cancelled
Test: Benchmark Nightly / Notify Cats on failure (push) Has been cancelled
CI: Python / Checks (push) Has been cancelled
Test: Evals Python / Workflow Comparison Python (push) Has been cancelled
Util: Check Docs URLs / check-docs-urls (push) Has been cancelled
Test: Visual Storybook / Cloudflare Pages (push) Has been cancelled
Test: E2E Performance / build-and-test-performance (push) Has been cancelled
Test: Workflows Nightly / Run Workflow Tests (push) Has been cancelled
Util: Cleanup CI Docker Images / Delete stale CI images (push) Has been cancelled
Test: Benchmark Destroy Env / build (push) Has been cancelled
Util: Update Node Popularity / update-popularity (push) Has been cancelled
Test: E2E Coverage Weekly / Coverage Tests (push) Has been cancelled
Security: Sync from Public / sync-from-public (push) Has been cancelled
Test: Benchmark Nightly / build (push) Has been cancelled
Test: Benchmark Nightly / Notify Cats on failure (push) Has been cancelled
CI: Python / Checks (push) Has been cancelled
Test: Evals Python / Workflow Comparison Python (push) Has been cancelled
Util: Check Docs URLs / check-docs-urls (push) Has been cancelled
Test: Visual Storybook / Cloudflare Pages (push) Has been cancelled
Test: E2E Performance / build-and-test-performance (push) Has been cancelled
Test: Workflows Nightly / Run Workflow Tests (push) Has been cancelled
Util: Cleanup CI Docker Images / Delete stale CI images (push) Has been cancelled
Test: Benchmark Destroy Env / build (push) Has been cancelled
Util: Update Node Popularity / update-popularity (push) Has been cancelled
Test: E2E Coverage Weekly / Coverage Tests (push) Has been cancelled
This commit is contained in:
@@ -0,0 +1,43 @@
|
||||
import type {
|
||||
IExecuteFunctions,
|
||||
IDataObject,
|
||||
JsonObject,
|
||||
IHttpRequestMethods,
|
||||
IRequestOptions,
|
||||
} from 'n8n-workflow';
|
||||
import { NodeApiError } from 'n8n-workflow';
|
||||
|
||||
export async function oneSimpleApiRequest(
|
||||
this: IExecuteFunctions,
|
||||
method: IHttpRequestMethods,
|
||||
resource: string,
|
||||
body: IDataObject = {},
|
||||
qs: IDataObject = {},
|
||||
uri?: string,
|
||||
option: IDataObject = {},
|
||||
) {
|
||||
const credentials = await this.getCredentials('oneSimpleApi');
|
||||
|
||||
const outputFormat = 'json';
|
||||
let options: IRequestOptions = {
|
||||
method,
|
||||
body,
|
||||
qs,
|
||||
uri:
|
||||
uri ||
|
||||
`https://onesimpleapi.com/api${resource}?token=${credentials.apiToken}&output=${outputFormat}`,
|
||||
json: true,
|
||||
};
|
||||
options = Object.assign({}, options, option);
|
||||
|
||||
if (Object.keys(body).length === 0) {
|
||||
delete options.body;
|
||||
}
|
||||
|
||||
try {
|
||||
const responseData = await this.helpers.request(options);
|
||||
return responseData;
|
||||
} catch (error) {
|
||||
throw new NodeApiError(this.getNode(), error as JsonObject);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
{
|
||||
"node": "n8n-nodes-base.oneSimpleApi",
|
||||
"nodeVersion": "1.0",
|
||||
"codexVersion": "1.0",
|
||||
"categories": ["Utility"],
|
||||
"resources": {
|
||||
"credentialDocumentation": [
|
||||
{
|
||||
"url": "https://docs.n8n.io/integrations/builtin/credentials/onesimpleapi/"
|
||||
}
|
||||
],
|
||||
"primaryDocumentation": [
|
||||
{
|
||||
"url": "https://docs.n8n.io/integrations/builtin/app-nodes/n8n-nodes-base.onesimpleapi/"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,883 @@
|
||||
import type {
|
||||
IExecuteFunctions,
|
||||
IDataObject,
|
||||
INodeExecutionData,
|
||||
INodeType,
|
||||
INodeTypeDescription,
|
||||
} from 'n8n-workflow';
|
||||
import { NodeConnectionTypes } from 'n8n-workflow';
|
||||
|
||||
import { oneSimpleApiRequest } from './GenericFunctions';
|
||||
|
||||
export class OneSimpleApi implements INodeType {
|
||||
description: INodeTypeDescription = {
|
||||
displayName: 'One Simple API',
|
||||
name: 'oneSimpleApi',
|
||||
icon: 'file:onesimpleapi.svg',
|
||||
group: ['transform'],
|
||||
version: 1,
|
||||
description: 'A toolbox of no-code utilities',
|
||||
defaults: {
|
||||
name: 'One Simple API',
|
||||
},
|
||||
usableAsTool: true,
|
||||
inputs: [NodeConnectionTypes.Main],
|
||||
outputs: [NodeConnectionTypes.Main],
|
||||
credentials: [
|
||||
{
|
||||
name: 'oneSimpleApi',
|
||||
required: true,
|
||||
},
|
||||
],
|
||||
properties: [
|
||||
{
|
||||
displayName: 'Resource',
|
||||
name: 'resource',
|
||||
type: 'options',
|
||||
noDataExpression: true,
|
||||
options: [
|
||||
{
|
||||
name: 'Information',
|
||||
value: 'information',
|
||||
},
|
||||
{
|
||||
name: 'Social Profile',
|
||||
value: 'socialProfile',
|
||||
},
|
||||
{
|
||||
name: 'Utility',
|
||||
value: 'utility',
|
||||
},
|
||||
{
|
||||
name: 'Website',
|
||||
value: 'website',
|
||||
},
|
||||
],
|
||||
default: 'website',
|
||||
required: true,
|
||||
},
|
||||
// website
|
||||
{
|
||||
displayName: 'Operation',
|
||||
name: 'operation',
|
||||
type: 'options',
|
||||
noDataExpression: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['website'],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
{
|
||||
name: 'Generate PDF',
|
||||
value: 'pdf',
|
||||
description: 'Generate a PDF from a webpage',
|
||||
action: 'Generate PDF',
|
||||
},
|
||||
{
|
||||
name: 'Get SEO Data',
|
||||
value: 'seo',
|
||||
description: 'Get SEO information from website',
|
||||
action: 'Get SEO Data',
|
||||
},
|
||||
{
|
||||
name: 'Take Screenshot',
|
||||
value: 'screenshot',
|
||||
description: 'Create a screenshot from a webpage',
|
||||
action: 'Screenshot',
|
||||
},
|
||||
],
|
||||
default: 'pdf',
|
||||
},
|
||||
// socialProfile
|
||||
{
|
||||
displayName: 'Operation',
|
||||
name: 'operation',
|
||||
type: 'options',
|
||||
noDataExpression: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['socialProfile'],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
{
|
||||
name: 'Instagram',
|
||||
value: 'instagramProfile',
|
||||
description: 'Get details about an Instagram profile',
|
||||
action: 'Get details about an Instagram profile',
|
||||
},
|
||||
{
|
||||
name: 'Spotify',
|
||||
value: 'spotifyArtistProfile',
|
||||
description: 'Get details about a Spotify Artist',
|
||||
action: 'Get details about a Spotify artist',
|
||||
},
|
||||
],
|
||||
default: 'instagramProfile',
|
||||
},
|
||||
// Information
|
||||
{
|
||||
displayName: 'Operation',
|
||||
name: 'operation',
|
||||
type: 'options',
|
||||
noDataExpression: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['information'],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
{
|
||||
name: 'Exchange Rate',
|
||||
value: 'exchangeRate',
|
||||
description: 'Convert a value between currencies',
|
||||
action: 'Convert a value between currencies',
|
||||
},
|
||||
{
|
||||
name: 'Image Metadata',
|
||||
value: 'imageMetadata',
|
||||
description: 'Retrieve image metadata from a URL',
|
||||
action: 'Get image metadata from a URL',
|
||||
},
|
||||
],
|
||||
default: 'exchangeRate',
|
||||
},
|
||||
// Utility
|
||||
{
|
||||
displayName: 'Operation',
|
||||
name: 'operation',
|
||||
type: 'options',
|
||||
noDataExpression: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['utility'],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
{
|
||||
name: 'Expand URL',
|
||||
value: 'expandURL',
|
||||
description: 'Expand a shortened URL',
|
||||
action: 'Expand a shortened URL',
|
||||
},
|
||||
{
|
||||
name: 'Generate QR Code',
|
||||
value: 'qrCode',
|
||||
description: 'Generate a QR Code',
|
||||
action: 'Generate a QR code utility',
|
||||
},
|
||||
{
|
||||
name: 'Validate Email',
|
||||
value: 'validateEmail',
|
||||
description: 'Validate an email address',
|
||||
action: 'Validate an email address',
|
||||
},
|
||||
],
|
||||
default: 'validateEmail',
|
||||
},
|
||||
// website: pdf
|
||||
{
|
||||
displayName: 'Webpage URL',
|
||||
name: 'link',
|
||||
type: 'string',
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: ['pdf'],
|
||||
resource: ['website'],
|
||||
},
|
||||
},
|
||||
default: '',
|
||||
description: 'Link to webpage to convert',
|
||||
},
|
||||
{
|
||||
displayName: 'Download PDF?',
|
||||
name: 'download',
|
||||
type: 'boolean',
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: ['pdf'],
|
||||
resource: ['website'],
|
||||
},
|
||||
},
|
||||
default: false,
|
||||
description: 'Whether to download the PDF or return a link to it',
|
||||
},
|
||||
{
|
||||
displayName: 'Put Output In Field',
|
||||
name: 'output',
|
||||
type: 'string',
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: ['pdf'],
|
||||
resource: ['website'],
|
||||
download: [true],
|
||||
},
|
||||
},
|
||||
default: 'data',
|
||||
description: 'The name of the output field to put the binary file data in',
|
||||
},
|
||||
{
|
||||
displayName: 'Options',
|
||||
name: 'options',
|
||||
type: 'collection',
|
||||
placeholder: 'Add option',
|
||||
default: {},
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['website'],
|
||||
operation: ['pdf'],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
{
|
||||
displayName: 'Page Size',
|
||||
name: 'page',
|
||||
type: 'options',
|
||||
options: [
|
||||
{
|
||||
name: 'A0',
|
||||
value: 'A0',
|
||||
},
|
||||
{
|
||||
name: 'A1',
|
||||
value: 'A1',
|
||||
},
|
||||
{
|
||||
name: 'A2',
|
||||
value: 'A2',
|
||||
},
|
||||
{
|
||||
name: 'A3',
|
||||
value: 'A3',
|
||||
},
|
||||
{
|
||||
name: 'A4',
|
||||
value: 'A4',
|
||||
},
|
||||
{
|
||||
name: 'A5',
|
||||
value: 'A5',
|
||||
},
|
||||
{
|
||||
name: 'A6',
|
||||
value: 'A6',
|
||||
},
|
||||
{
|
||||
name: 'Ledger',
|
||||
value: 'Ledger',
|
||||
},
|
||||
{
|
||||
name: 'Legal',
|
||||
value: 'Legal',
|
||||
},
|
||||
{
|
||||
name: 'Letter',
|
||||
value: 'Letter',
|
||||
},
|
||||
{
|
||||
name: 'Tabloid',
|
||||
value: 'Tabloid',
|
||||
},
|
||||
],
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Force Refresh',
|
||||
name: 'force',
|
||||
type: 'boolean',
|
||||
default: false,
|
||||
// eslint-disable-next-line n8n-nodes-base/node-param-description-boolean-without-whether
|
||||
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.",
|
||||
},
|
||||
],
|
||||
},
|
||||
// website: qrCode
|
||||
{
|
||||
displayName: 'QR Content',
|
||||
name: 'message',
|
||||
type: 'string',
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: ['qrCode'],
|
||||
resource: ['utility'],
|
||||
},
|
||||
},
|
||||
default: '',
|
||||
description: 'The text that should be turned into a QR code - like a website URL',
|
||||
},
|
||||
{
|
||||
displayName: 'Download Image?',
|
||||
name: 'download',
|
||||
type: 'boolean',
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: ['qrCode'],
|
||||
resource: ['utility'],
|
||||
},
|
||||
},
|
||||
default: false,
|
||||
description: 'Whether to download the QR code or return a link to it',
|
||||
},
|
||||
{
|
||||
displayName: 'Put Output In Field',
|
||||
name: 'output',
|
||||
type: 'string',
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: ['qrCode'],
|
||||
resource: ['utility'],
|
||||
download: [true],
|
||||
},
|
||||
},
|
||||
default: 'data',
|
||||
description: 'The name of the output field to put the binary file data in',
|
||||
},
|
||||
{
|
||||
displayName: 'Options',
|
||||
name: 'options',
|
||||
type: 'collection',
|
||||
placeholder: 'Add option',
|
||||
default: {},
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['utility'],
|
||||
operation: ['qrCode'],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
{
|
||||
displayName: 'Size',
|
||||
name: 'size',
|
||||
type: 'options',
|
||||
options: [
|
||||
{
|
||||
name: 'Small',
|
||||
value: 'Small',
|
||||
},
|
||||
{
|
||||
name: 'Medium',
|
||||
value: 'Medium',
|
||||
},
|
||||
{
|
||||
name: 'Large',
|
||||
value: 'Large',
|
||||
},
|
||||
],
|
||||
default: 'Small',
|
||||
description: 'The QR Code size',
|
||||
},
|
||||
{
|
||||
displayName: 'Format',
|
||||
name: 'format',
|
||||
type: 'options',
|
||||
options: [
|
||||
{
|
||||
name: 'PNG',
|
||||
value: 'PNG',
|
||||
},
|
||||
{
|
||||
name: 'SVG',
|
||||
value: 'SVG',
|
||||
},
|
||||
],
|
||||
default: 'PNG',
|
||||
description: 'The QR Code format',
|
||||
},
|
||||
],
|
||||
},
|
||||
// website: screenshot
|
||||
{
|
||||
displayName: 'Webpage URL',
|
||||
name: 'link',
|
||||
type: 'string',
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: ['screenshot'],
|
||||
resource: ['website'],
|
||||
},
|
||||
},
|
||||
default: '',
|
||||
description: 'Link to webpage to convert',
|
||||
},
|
||||
{
|
||||
displayName: 'Download Screenshot?',
|
||||
name: 'download',
|
||||
type: 'boolean',
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: ['screenshot'],
|
||||
resource: ['website'],
|
||||
},
|
||||
},
|
||||
default: false,
|
||||
description: 'Whether to download the screenshot or return a link to it',
|
||||
},
|
||||
{
|
||||
displayName: 'Put Output In Field',
|
||||
name: 'output',
|
||||
type: 'string',
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: ['screenshot'],
|
||||
resource: ['website'],
|
||||
download: [true],
|
||||
},
|
||||
},
|
||||
default: 'data',
|
||||
description: 'The name of the output field to put the binary file data in',
|
||||
},
|
||||
{
|
||||
displayName: 'Options',
|
||||
name: 'options',
|
||||
type: 'collection',
|
||||
placeholder: 'Add option',
|
||||
default: {},
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['website'],
|
||||
operation: ['screenshot'],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
{
|
||||
displayName: 'Screen Size',
|
||||
name: 'screen',
|
||||
type: 'options',
|
||||
options: [
|
||||
{
|
||||
name: 'Phone',
|
||||
value: 'phone',
|
||||
},
|
||||
{
|
||||
name: 'Phone Landscape',
|
||||
value: 'phone-landscape',
|
||||
},
|
||||
{
|
||||
name: 'Retina',
|
||||
value: 'retina',
|
||||
},
|
||||
{
|
||||
name: 'Tablet',
|
||||
value: 'tablet',
|
||||
},
|
||||
{
|
||||
name: 'Tablet Landscape',
|
||||
value: 'tablet-landscape',
|
||||
},
|
||||
],
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Force Refresh',
|
||||
name: 'force',
|
||||
type: 'boolean',
|
||||
default: false,
|
||||
// eslint-disable-next-line n8n-nodes-base/node-param-description-boolean-without-whether
|
||||
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.",
|
||||
},
|
||||
{
|
||||
displayName: 'Full Page',
|
||||
name: 'fullpage',
|
||||
type: 'boolean',
|
||||
default: false,
|
||||
// eslint-disable-next-line n8n-nodes-base/node-param-description-boolean-without-whether
|
||||
description:
|
||||
'The API takes a screenshot of the viewable area for the desired screen size. If you need a screenshot of the whole length of the page, use this option.',
|
||||
},
|
||||
],
|
||||
},
|
||||
// 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',
|
||||
name: 'value',
|
||||
type: 'string',
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: ['exchangeRate'],
|
||||
resource: ['information'],
|
||||
},
|
||||
},
|
||||
default: '',
|
||||
description: 'Value to convert',
|
||||
},
|
||||
{
|
||||
displayName: 'From Currency',
|
||||
name: 'fromCurrency',
|
||||
type: 'string',
|
||||
required: true,
|
||||
placeholder: 'USD',
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: ['exchangeRate'],
|
||||
resource: ['information'],
|
||||
},
|
||||
},
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'To Currency',
|
||||
name: 'toCurrency',
|
||||
type: 'string',
|
||||
placeholder: 'EUR',
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: ['exchangeRate'],
|
||||
resource: ['information'],
|
||||
},
|
||||
},
|
||||
default: '',
|
||||
},
|
||||
// information: imageMetadata
|
||||
{
|
||||
displayName: 'Link To Image',
|
||||
name: 'link',
|
||||
type: 'string',
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: ['imageMetadata'],
|
||||
resource: ['information'],
|
||||
},
|
||||
},
|
||||
default: '',
|
||||
description: 'Image to get metadata from',
|
||||
},
|
||||
// website: seo
|
||||
{
|
||||
displayName: 'Webpage URL',
|
||||
name: 'link',
|
||||
type: 'string',
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: ['seo'],
|
||||
resource: ['website'],
|
||||
},
|
||||
},
|
||||
default: '',
|
||||
description: 'Webpage to get SEO information for',
|
||||
},
|
||||
{
|
||||
displayName: 'Options',
|
||||
name: 'options',
|
||||
type: 'collection',
|
||||
placeholder: 'Add option',
|
||||
default: {},
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['website'],
|
||||
operation: ['seo'],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
{
|
||||
displayName: 'Include Headers?',
|
||||
name: 'headers',
|
||||
type: 'boolean',
|
||||
default: false,
|
||||
},
|
||||
],
|
||||
},
|
||||
// utility: validateEmail
|
||||
{
|
||||
displayName: 'Email Address',
|
||||
name: 'emailAddress',
|
||||
type: 'string',
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: ['validateEmail'],
|
||||
resource: ['utility'],
|
||||
},
|
||||
},
|
||||
default: '',
|
||||
},
|
||||
// utility: expandURL
|
||||
{
|
||||
displayName: 'URL',
|
||||
name: 'link',
|
||||
type: 'string',
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: ['expandURL'],
|
||||
resource: ['utility'],
|
||||
},
|
||||
},
|
||||
default: '',
|
||||
description: 'URL to unshorten',
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
async execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {
|
||||
const items = this.getInputData();
|
||||
const returnData: IDataObject[] = [];
|
||||
const length = items.length;
|
||||
const qs: IDataObject = {};
|
||||
let responseData;
|
||||
let download;
|
||||
for (let i = 0; i < length; i++) {
|
||||
try {
|
||||
const resource = this.getNodeParameter('resource', 0);
|
||||
const operation = this.getNodeParameter('operation', 0);
|
||||
|
||||
if (resource === 'website') {
|
||||
if (operation === 'pdf') {
|
||||
const link = this.getNodeParameter('link', i) as string;
|
||||
const options = this.getNodeParameter('options', i);
|
||||
download = this.getNodeParameter('download', i);
|
||||
qs.url = link;
|
||||
|
||||
if (options.page) {
|
||||
qs.page = options.page as string;
|
||||
}
|
||||
|
||||
if (options.force) {
|
||||
qs.force = 'yes';
|
||||
} else {
|
||||
qs.force = 'no';
|
||||
}
|
||||
|
||||
const response = await oneSimpleApiRequest.call(this, 'GET', '/pdf', {}, qs);
|
||||
|
||||
if (download) {
|
||||
const output = this.getNodeParameter('output', i) as string;
|
||||
const buffer = (await oneSimpleApiRequest.call(
|
||||
this,
|
||||
'GET',
|
||||
'',
|
||||
{},
|
||||
{},
|
||||
response.url as string,
|
||||
{ json: false, encoding: null },
|
||||
)) as Buffer;
|
||||
responseData = {
|
||||
json: response,
|
||||
binary: {
|
||||
[output]: await this.helpers.prepareBinaryData(buffer),
|
||||
},
|
||||
};
|
||||
} else {
|
||||
responseData = response;
|
||||
}
|
||||
}
|
||||
|
||||
if (operation === 'screenshot') {
|
||||
const link = this.getNodeParameter('link', i) as string;
|
||||
const options = this.getNodeParameter('options', i);
|
||||
download = this.getNodeParameter('download', i);
|
||||
|
||||
qs.url = link;
|
||||
|
||||
if (options.screen) {
|
||||
qs.screen = options.screen as string;
|
||||
}
|
||||
|
||||
if (options.fullpage) {
|
||||
qs.fullpage = 'yes';
|
||||
} else {
|
||||
qs.fullpage = 'no';
|
||||
}
|
||||
|
||||
if (options.force) {
|
||||
qs.force = 'yes';
|
||||
} else {
|
||||
qs.force = 'no';
|
||||
}
|
||||
|
||||
const response = await oneSimpleApiRequest.call(this, 'GET', '/screenshot', {}, qs);
|
||||
|
||||
if (download) {
|
||||
const output = this.getNodeParameter('output', i) as string;
|
||||
const buffer = (await oneSimpleApiRequest.call(
|
||||
this,
|
||||
'GET',
|
||||
'',
|
||||
{},
|
||||
{},
|
||||
response.url as string,
|
||||
{ json: false, encoding: null },
|
||||
)) as Buffer;
|
||||
responseData = {
|
||||
json: response,
|
||||
binary: {
|
||||
[output]: await this.helpers.prepareBinaryData(buffer),
|
||||
},
|
||||
};
|
||||
} else {
|
||||
responseData = response;
|
||||
}
|
||||
}
|
||||
|
||||
if (operation === 'seo') {
|
||||
const link = this.getNodeParameter('link', i) as string;
|
||||
const options = this.getNodeParameter('options', i);
|
||||
qs.url = link;
|
||||
|
||||
if (options.headers) {
|
||||
qs.headers = 'yes';
|
||||
}
|
||||
|
||||
responseData = await oneSimpleApiRequest.call(this, 'GET', '/page_info', {}, qs);
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
const fromCurrency = this.getNodeParameter('fromCurrency', i) as string;
|
||||
const toCurrency = this.getNodeParameter('toCurrency', i) as string;
|
||||
qs.from_currency = fromCurrency;
|
||||
qs.to_currency = toCurrency;
|
||||
qs.from_value = value;
|
||||
responseData = await oneSimpleApiRequest.call(this, 'GET', '/exchange_rate', {}, qs);
|
||||
}
|
||||
|
||||
if (operation === 'imageMetadata') {
|
||||
const link = this.getNodeParameter('link', i) as string;
|
||||
qs.url = link;
|
||||
qs.raw = true;
|
||||
responseData = await oneSimpleApiRequest.call(this, 'GET', '/image_info', {}, qs);
|
||||
}
|
||||
}
|
||||
|
||||
if (resource === 'utility') {
|
||||
// validateEmail
|
||||
if (operation === 'validateEmail') {
|
||||
const emailAddress = this.getNodeParameter('emailAddress', i) as string;
|
||||
qs.email = emailAddress;
|
||||
responseData = await oneSimpleApiRequest.call(this, 'GET', '/email', {}, qs);
|
||||
}
|
||||
// expandURL
|
||||
if (operation === 'expandURL') {
|
||||
const url = this.getNodeParameter('link', i) as string;
|
||||
qs.url = url;
|
||||
responseData = await oneSimpleApiRequest.call(this, 'GET', '/unshorten', {}, qs);
|
||||
}
|
||||
|
||||
if (operation === 'qrCode') {
|
||||
const message = this.getNodeParameter('message', i) as string;
|
||||
const options = this.getNodeParameter('options', i);
|
||||
download = this.getNodeParameter('download', i);
|
||||
|
||||
qs.message = message;
|
||||
|
||||
if (options.size) {
|
||||
qs.size = options.size as string;
|
||||
}
|
||||
|
||||
if (options.format) {
|
||||
qs.format = options.format as string;
|
||||
}
|
||||
|
||||
const response = await oneSimpleApiRequest.call(this, 'GET', '/qr_code', {}, qs);
|
||||
|
||||
if (download) {
|
||||
const output = this.getNodeParameter('output', i) as string;
|
||||
const buffer = (await oneSimpleApiRequest.call(
|
||||
this,
|
||||
'GET',
|
||||
'',
|
||||
{},
|
||||
{},
|
||||
response.url as string,
|
||||
{ json: false, encoding: null },
|
||||
)) as Buffer;
|
||||
responseData = {
|
||||
json: response,
|
||||
binary: {
|
||||
[output]: await this.helpers.prepareBinaryData(buffer),
|
||||
},
|
||||
};
|
||||
} else {
|
||||
responseData = response;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (Array.isArray(responseData)) {
|
||||
returnData.push.apply(returnData, responseData as IDataObject[]);
|
||||
} else {
|
||||
returnData.push(responseData as IDataObject);
|
||||
}
|
||||
} catch (error) {
|
||||
if (this.continueOnFail()) {
|
||||
returnData.push({ error: error.message });
|
||||
continue;
|
||||
}
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
if (download) {
|
||||
return [returnData as unknown as INodeExecutionData[]];
|
||||
}
|
||||
|
||||
return [this.helpers.returnJsonArray(returnData)];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" class="block h-9 w-auto" version="1.0" viewBox="0 0 512 512"><path fill="#2563eb" d="M38.1 2C29 4.4 23.2 7.7 16 14.6S4.5 28.8 2 38.4C.1 46.1 0 49.3 0 143.6v97.3l3.7-.5c12.8-1.7 19.1-4.3 25.9-10.6 5.7-5.3 9-11.2 11.5-20.5 1.9-6.9 2.2-12.3 2.9-46.8.9-42.2 1.3-45.5 7-60.3 9.8-25.4 30.4-43.9 60.9-54.3 8.6-3 8.4-3.2 12.1 8.8 1.8 6 3.5 11.3 3.7 11.9.2.7-3.5 3.1-8.4 5.4-16.5 8-27.4 22-32.3 41.5-2.8 11-3.9 27.3-4 58.5-.1 28.7-1 36.7-5.3 48.2C73 234.5 64.1 245.7 53 253c-2.3 1.5-4.1 3.1-4.1 3.4 0 .4 2.8 2.5 6.2 4.8 11.3 7.5 20.3 20.9 25 36.8 2 6.9 2.2 10.8 3 46.5.7 33.2 1.1 40.4 2.8 48.5 4.4 20.7 15.8 36.7 31.9 44.8 4.4 2.2 8.5 4.1 9.2 4.4 1 .3.4 3.2-2.5 11.8-2.1 6.3-4.1 11.9-4.5 12.3-.8.9-16.4-4.5-24.5-8.5-9.7-4.9-15.8-9.2-23.4-16.4-8.7-8.2-12.8-13.6-17.9-23.9-8.4-16.8-10.2-28-10.2-64-.1-30.9-1-44.3-3.9-53.5-5-16.1-16.7-25.6-34-27.6l-6.1-.7v97c0 94 .1 97.2 2 104.9 2.5 9.6 6.8 16.9 14 23.8 7.3 7 13.1 10.2 22.5 12.6 7.7 2 11.1 2 217.5 2 207 0 209.8 0 217.6-2 9.6-2.5 16.9-6.8 23.8-14 7-7.3 10.2-13.1 12.6-22.5 1.9-7.6 2-11.1 2-104.8v-96.9l-5.6.7c-18.6 2.3-30.2 12.8-35 31.7-1.2 4.9-1.8 15-2.4 45.3-.5 21.4-1.3 41.2-1.9 44-7.7 35.3-28.6 57.7-66.4 71-4.3 1.5-7.9 2.6-8.1 2.4-1.1-1.3-7.7-23.2-7.3-24.2.3-.7 2.3-1.9 4.4-2.5 10.7-3.2 24.7-16.2 30.7-28.4 7.2-14.6 7.8-18.8 8.6-61.8.9-44.7 1.7-50.4 9.2-65.7 4-8.3 14.6-19.2 23.7-24.5l6.3-3.7-4.9-2.5c-10.7-5.4-20-15-25.8-26.5-6.8-13.4-8.5-27.1-8.5-68.1 0-29.1-.9-37.7-5-50-3-8.9-10-19.8-16.5-25.9-5.2-4.7-18.1-12.1-21.1-12.1-2 0-1.8-1.2 2.3-13.8l3.8-11.3 3.4.6c1.9.4 6.8 2 11 3.6 27.7 11 45.9 28.2 55.1 52.1 5.7 14.9 6.1 18.1 7 60.8.6 30.8 1.1 40.9 2.4 45.8 4.8 18.9 15.6 28.4 35.4 31.1l5.2.8v-97.2c0-93.9-.1-97.4-2-105-2.4-9.4-5.6-15.2-12.6-22.5-6.9-7.2-14.2-11.5-23.8-14-7.8-2-10.5-2-218-1.9C51.1.1 45.3.2 38.1 2M290 231.5V389h-40V256.5c0-72.9-.2-132.5-.5-132.5s-14.1 5-30.7 11.1c-16.7 6.1-34.5 12.6-39.6 14.5l-9.2 3.3.2-18.1.3-18.1 56-21.3c33.4-12.6 57.5-21.2 59.8-21.3l3.7-.1z"/></svg>
|
||||
|
After Width: | Height: | Size: 2.0 KiB |
Reference in New Issue
Block a user