mirror of
https://github.com/n8n-io/n8n-nodes-starter.git
synced 2025-10-28 14:12:24 -05:00
🚨 Autofix node linting
This commit is contained in:
parent
b15212d300
commit
b2b5a97188
3 changed files with 143 additions and 153 deletions
|
|
@ -4,18 +4,18 @@ import {
|
||||||
ICredentialType,
|
ICredentialType,
|
||||||
IHttpRequestOptions,
|
IHttpRequestOptions,
|
||||||
INodeProperties,
|
INodeProperties,
|
||||||
} from "n8n-workflow";
|
} from 'n8n-workflow';
|
||||||
|
|
||||||
export class HttpBinApi implements ICredentialType {
|
export class HttpBinApi implements ICredentialType {
|
||||||
name = "httpbinApi";
|
name = 'httpbinApi';
|
||||||
displayName = "HttpBin API";
|
displayName = 'HttpBin API';
|
||||||
documentationUrl = "httpbin";
|
documentationUrl = 'httpbin';
|
||||||
properties: INodeProperties[] = [
|
properties: INodeProperties[] = [
|
||||||
{
|
{
|
||||||
displayName: "Token",
|
displayName: 'Token',
|
||||||
name: "token",
|
name: 'token',
|
||||||
type: "string",
|
type: 'string',
|
||||||
default: "",
|
default: '',
|
||||||
},
|
},
|
||||||
// {
|
// {
|
||||||
// displayName: "API Key",
|
// displayName: "API Key",
|
||||||
|
|
@ -24,10 +24,10 @@ export class HttpBinApi implements ICredentialType {
|
||||||
// default: "",
|
// default: "",
|
||||||
// },
|
// },
|
||||||
{
|
{
|
||||||
displayName: "Domain",
|
displayName: 'Domain',
|
||||||
name: "domain",
|
name: 'domain',
|
||||||
type: "string",
|
type: 'string',
|
||||||
default: "https://httpbin.org",
|
default: 'https://httpbin.org',
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
@ -41,7 +41,7 @@ export class HttpBinApi implements ICredentialType {
|
||||||
|
|
||||||
authenticate = async (
|
authenticate = async (
|
||||||
credentials: ICredentialDataDecryptedObject,
|
credentials: ICredentialDataDecryptedObject,
|
||||||
requestOptions: IHttpRequestOptions
|
requestOptions: IHttpRequestOptions,
|
||||||
): Promise<IHttpRequestOptions> => {
|
): Promise<IHttpRequestOptions> => {
|
||||||
const headers = requestOptions.headers || {};
|
const headers = requestOptions.headers || {};
|
||||||
const authentication = { Authorization: `Bearer ${credentials.token}` };
|
const authentication = { Authorization: `Bearer ${credentials.token}` };
|
||||||
|
|
@ -53,8 +53,8 @@ export class HttpBinApi implements ICredentialType {
|
||||||
|
|
||||||
test: ICredentialTestRequest = {
|
test: ICredentialTestRequest = {
|
||||||
request: {
|
request: {
|
||||||
baseURL: "={{$credentials?.domain}}",
|
baseURL: '={{$credentials?.domain}}',
|
||||||
url: "/bearer",
|
url: '/bearer',
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,33 +1,33 @@
|
||||||
import { INodeType, INodeTypeDescription } from "n8n-workflow";
|
import { INodeType, INodeTypeDescription } from 'n8n-workflow';
|
||||||
import { httpVerbOperations, httpVerbFields } from "./HttpVerbDescriptions";
|
import { httpVerbFields, httpVerbOperations } from './HttpVerbDescriptions';
|
||||||
|
|
||||||
export class HttpBin implements INodeType {
|
export class HttpBin implements INodeType {
|
||||||
description: INodeTypeDescription = {
|
description: INodeTypeDescription = {
|
||||||
displayName: "HttpBin",
|
displayName: 'HttpBin',
|
||||||
name: "httpbin",
|
name: 'httpbin',
|
||||||
icon: "file:httpbin.svg",
|
icon: 'file:httpbin.svg',
|
||||||
group: ["transform"],
|
group: ['transform'],
|
||||||
version: 1,
|
version: 1,
|
||||||
subtitle: '={{$parameter["operation"] + ": " + $parameter["resource"]}}',
|
subtitle: '={{$parameter["operation"] + ": " + $parameter["resource"]}}',
|
||||||
description: "Interact with HttpBin API",
|
description: 'Interact with HttpBin API',
|
||||||
defaults: {
|
defaults: {
|
||||||
name: "HttpBin",
|
name: 'HttpBin',
|
||||||
color: "#3b4151",
|
color: '#3b4151',
|
||||||
},
|
},
|
||||||
inputs: ["main"],
|
inputs: ['main'],
|
||||||
outputs: ["main"],
|
outputs: ['main'],
|
||||||
credentials: [
|
credentials: [
|
||||||
{
|
{
|
||||||
name: "httpbinApi",
|
name: 'httpbinApi',
|
||||||
required: false,
|
required: false,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
requestDefaults: {
|
requestDefaults: {
|
||||||
baseURL: "https://httpbin.org",
|
baseURL: 'https://httpbin.org',
|
||||||
url: "",
|
url: '',
|
||||||
headers: {
|
headers: {
|
||||||
Accept: "application/json",
|
Accept: 'application/json',
|
||||||
"Content-Type": "application/json",
|
'Content-Type': 'application/json',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
|
|
@ -44,17 +44,17 @@ export class HttpBin implements INodeType {
|
||||||
*/
|
*/
|
||||||
properties: [
|
properties: [
|
||||||
{
|
{
|
||||||
displayName: "Resource",
|
displayName: 'Resource',
|
||||||
name: "resource",
|
name: 'resource',
|
||||||
type: "options",
|
type: 'options',
|
||||||
noDataExpression: true,
|
noDataExpression: true,
|
||||||
options: [
|
options: [
|
||||||
{
|
{
|
||||||
name: "HTTP Verbs",
|
name: 'HTTP Verbs',
|
||||||
value: "httpverbs",
|
value: 'httpverbs',
|
||||||
}
|
},
|
||||||
],
|
],
|
||||||
default: "httpverbs",
|
default: 'httpverbs',
|
||||||
},
|
},
|
||||||
|
|
||||||
...httpVerbOperations,
|
...httpVerbOperations,
|
||||||
|
|
|
||||||
|
|
@ -1,249 +1,239 @@
|
||||||
import { INodeProperties } from "n8n-workflow";
|
import { INodeProperties } from 'n8n-workflow';
|
||||||
|
|
||||||
/**
|
// This maps the operations to when the Resource option HTTP Verbs is selected
|
||||||
* This maps the operations to when the Resource option HTTP Verbs is selected
|
export const httpVerbOperations: INodeProperties[] = [
|
||||||
*/
|
|
||||||
export const httpVerbOperations: Array<INodeProperties> = [
|
|
||||||
{
|
{
|
||||||
displayName: "Operation",
|
displayName: 'Operation',
|
||||||
name: "operation",
|
name: 'operation',
|
||||||
type: "options",
|
type: 'options',
|
||||||
noDataExpression: true,
|
noDataExpression: true,
|
||||||
displayOptions: {
|
displayOptions: {
|
||||||
show: {
|
show: {
|
||||||
resource: ["httpverbs"],
|
resource: ['httpverbs'],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
options: [
|
options: [
|
||||||
{
|
{
|
||||||
name: "GET",
|
name: 'GET',
|
||||||
value: "get",
|
value: 'get',
|
||||||
routing: {
|
routing: {
|
||||||
request: {
|
request: {
|
||||||
method: "GET",
|
method: 'GET',
|
||||||
url: "/get",
|
url: '/get',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "DELETE",
|
name: 'DELETE',
|
||||||
value: "delete",
|
value: 'delete',
|
||||||
routing: {
|
routing: {
|
||||||
request: {
|
request: {
|
||||||
method: "DELETE",
|
method: 'DELETE',
|
||||||
url: "/delete",
|
url: '/delete',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
default: "get",
|
default: 'get',
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
// Here we define what to show when the GET Operation is selected
|
||||||
*
|
// We do that by adding operation: ["get"], to "displayOptions.show"
|
||||||
* Here we define what to show when the GET Operation is selected
|
const getOperation: INodeProperties[] = [
|
||||||
*
|
|
||||||
* We do that by adding operation: ["get"], to "displayOptions.show"
|
|
||||||
*/
|
|
||||||
const getOperation: Array<INodeProperties> = [
|
|
||||||
{
|
{
|
||||||
name: "typeofData",
|
name: 'typeofData',
|
||||||
default: "queryParameter",
|
default: 'queryParameter',
|
||||||
description: "Select type of data to send [Query Parameters]",
|
description: 'Select type of data to send [Query Parameters]',
|
||||||
displayName: "Type of Data",
|
displayName: 'Type of Data',
|
||||||
displayOptions: {
|
displayOptions: {
|
||||||
show: {
|
show: {
|
||||||
resource: ["httpverbs"],
|
resource: ['httpverbs'],
|
||||||
operation: ["get"],
|
operation: ['get'],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
type: "options",
|
type: 'options',
|
||||||
options: [
|
options: [
|
||||||
{
|
{
|
||||||
name: "Query",
|
name: 'Query',
|
||||||
value: "queryParameter",
|
value: 'queryParameter',
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
required: true,
|
required: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "arguments",
|
name: 'arguments',
|
||||||
default: {},
|
default: {},
|
||||||
description: "The request's query parameters",
|
description: 'The request\'s query parameters',
|
||||||
displayName: "Query Parameters",
|
displayName: 'Query Parameters',
|
||||||
displayOptions: {
|
displayOptions: {
|
||||||
show: {
|
show: {
|
||||||
resource: ["httpverbs"],
|
resource: ['httpverbs'],
|
||||||
operation: ["get"],
|
operation: ['get'],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
options: [
|
options: [
|
||||||
{
|
{
|
||||||
name: "keyvalue",
|
name: 'keyvalue',
|
||||||
displayName: "Key:Value",
|
displayName: 'Key:Value',
|
||||||
values: [
|
values: [
|
||||||
{
|
{
|
||||||
displayName: "Key",
|
displayName: 'Key',
|
||||||
name: "key",
|
name: 'key',
|
||||||
type: "string",
|
type: 'string',
|
||||||
default: "",
|
default: '',
|
||||||
required: true,
|
required: true,
|
||||||
description: "Key of query parameter",
|
description: 'Key of query parameter',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
displayName: "Value",
|
displayName: 'Value',
|
||||||
name: "value",
|
name: 'value',
|
||||||
type: "string",
|
type: 'string',
|
||||||
default: "",
|
default: '',
|
||||||
routing: {
|
routing: {
|
||||||
send: {
|
send: {
|
||||||
property: "={{$parent.key}}",
|
property: '={{$parent.key}}',
|
||||||
type: "query",
|
type: 'query',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
required: true,
|
required: true,
|
||||||
description: "Value of query parameter",
|
description: 'Value of query parameter',
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
type: "fixedCollection",
|
type: 'fixedCollection',
|
||||||
typeOptions: {
|
typeOptions: {
|
||||||
multipleValues: true,
|
multipleValues: true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
// Here we define what to show when the DELETE Operation is selected
|
||||||
*
|
// We do that by adding operation: ["delete"], to "displayOptions.show"
|
||||||
* Here we define what to show when the DELETE Operation is selected
|
const deleteOperation: INodeProperties[] = [
|
||||||
*
|
|
||||||
* We do that by adding operation: ["delete"], to "displayOptions.show"
|
|
||||||
*/
|
|
||||||
const deleteOperation: Array<INodeProperties> = [
|
|
||||||
{
|
{
|
||||||
name: "typeofData",
|
name: 'typeofData',
|
||||||
default: "queryParameter",
|
default: 'queryParameter',
|
||||||
description:
|
description:
|
||||||
"Select type of data to send [Query Parameter Arguments, JSON-Body]",
|
'Select type of data to send [Query Parameter Arguments, JSON-Body]',
|
||||||
displayName: "Type of Data",
|
displayName: 'Type of Data',
|
||||||
displayOptions: {
|
displayOptions: {
|
||||||
show: {
|
show: {
|
||||||
resource: ["httpverbs"],
|
resource: ['httpverbs'],
|
||||||
operation: ["delete"],
|
operation: ['delete'],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
options: [
|
options: [
|
||||||
{
|
{
|
||||||
name: "Query",
|
name: 'Query',
|
||||||
value: "queryParameter",
|
value: 'queryParameter',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "JSON",
|
name: 'JSON',
|
||||||
value: "jsonData",
|
value: 'jsonData',
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
required: true,
|
required: true,
|
||||||
type: "options",
|
type: 'options',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "arguments",
|
name: 'arguments',
|
||||||
default: {},
|
default: {},
|
||||||
description: "The request's query parameters",
|
description: 'The request\'s query parameters',
|
||||||
displayName: "Query Parameters",
|
displayName: 'Query Parameters',
|
||||||
displayOptions: {
|
displayOptions: {
|
||||||
show: {
|
show: {
|
||||||
resource: ["httpverbs"],
|
resource: ['httpverbs'],
|
||||||
operation: ["delete"],
|
operation: ['delete'],
|
||||||
typeofData: ["queryParameter"],
|
typeofData: ['queryParameter'],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
options: [
|
options: [
|
||||||
{
|
{
|
||||||
name: "keyvalue",
|
name: 'keyvalue',
|
||||||
displayName: "Key:Value",
|
displayName: 'Key:Value',
|
||||||
values: [
|
values: [
|
||||||
{
|
{
|
||||||
displayName: "Key",
|
displayName: 'Key',
|
||||||
name: "key",
|
name: 'key',
|
||||||
type: "string",
|
type: 'string',
|
||||||
default: "",
|
default: '',
|
||||||
required: true,
|
required: true,
|
||||||
description: "Key of query parameter",
|
description: 'Key of query parameter',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
displayName: "Value",
|
displayName: 'Value',
|
||||||
name: "value",
|
name: 'value',
|
||||||
type: "string",
|
type: 'string',
|
||||||
default: "",
|
default: '',
|
||||||
routing: {
|
routing: {
|
||||||
send: {
|
send: {
|
||||||
property: "={{$parent.key}}",
|
property: '={{$parent.key}}',
|
||||||
type: "query",
|
type: 'query',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
required: true,
|
required: true,
|
||||||
description: "Value of query parameter",
|
description: 'Value of query parameter',
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
type: "fixedCollection",
|
type: 'fixedCollection',
|
||||||
typeOptions: {
|
typeOptions: {
|
||||||
multipleValues: true,
|
multipleValues: true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "arguments",
|
name: 'arguments',
|
||||||
default: {},
|
default: {},
|
||||||
description: "The request's JSON properties",
|
description: 'The request\'s JSON properties',
|
||||||
displayName: "JSON Object",
|
displayName: 'JSON Object',
|
||||||
displayOptions: {
|
displayOptions: {
|
||||||
show: {
|
show: {
|
||||||
resource: ["httpverbs"],
|
resource: ['httpverbs'],
|
||||||
operation: ["delete"],
|
operation: ['delete'],
|
||||||
typeofData: ["jsonData"],
|
typeofData: ['jsonData'],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
options: [
|
options: [
|
||||||
{
|
{
|
||||||
name: "keyvalue",
|
name: 'keyvalue',
|
||||||
displayName: "Key:Value",
|
displayName: 'Key:Value',
|
||||||
values: [
|
values: [
|
||||||
{
|
{
|
||||||
displayName: "Key",
|
displayName: 'Key',
|
||||||
name: "key",
|
name: 'key',
|
||||||
type: "string",
|
type: 'string',
|
||||||
default: "",
|
default: '',
|
||||||
required: true,
|
required: true,
|
||||||
description: "Key of json property",
|
description: 'Key of json property',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
displayName: "Value",
|
displayName: 'Value',
|
||||||
name: "value",
|
name: 'value',
|
||||||
type: "string",
|
type: 'string',
|
||||||
default: "",
|
default: '',
|
||||||
routing: {
|
routing: {
|
||||||
send: {
|
send: {
|
||||||
property: "={{$parent.key}}",
|
property: '={{$parent.key}}',
|
||||||
type: "body",
|
type: 'body',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
required: true,
|
required: true,
|
||||||
description: "Value of json property",
|
description: 'Value of json property',
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
type: "fixedCollection",
|
type: 'fixedCollection',
|
||||||
typeOptions: {
|
typeOptions: {
|
||||||
multipleValues: true,
|
multipleValues: true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
export const httpVerbFields: Array<INodeProperties> = [
|
export const httpVerbFields: INodeProperties[] = [
|
||||||
/* -------------------------------------------------------------------------- */
|
/* -------------------------------------------------------------------------- */
|
||||||
/* Http Verbs:Get */
|
/* Http Verbs:Get */
|
||||||
/* -------------------------------------------------------------------------- */
|
/* -------------------------------------------------------------------------- */
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue