2022-06-20 15:22:10 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								import { INodeType, INodeTypeDescription } from 'n8n-workflow';
							 | 
						
					
						
							
								
									
										
										
										
											2022-06-28 15:27:25 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								import { httpVerbFields, httpVerbOperations } from './HttpVerbDescription';
							 | 
						
					
						
							
								
									
										
										
										
											2022-06-14 16:31:05 +02:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								export class HttpBin implements INodeType {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									description: INodeTypeDescription = {
							 | 
						
					
						
							
								
									
										
										
										
											2022-06-20 15:22:10 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										displayName: 'HttpBin',
							 | 
						
					
						
							
								
									
										
										
										
											2022-06-28 15:27:25 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										name: 'httpBin',
							 | 
						
					
						
							
								
									
										
										
										
											2022-06-20 15:22:10 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										icon: 'file:httpbin.svg',
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										group: ['transform'],
							 | 
						
					
						
							
								
									
										
										
										
											2022-06-14 16:31:05 +02:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
										version: 1,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										subtitle: '={{$parameter["operation"] + ": " + $parameter["resource"]}}',
							 | 
						
					
						
							
								
									
										
										
										
											2022-06-20 15:22:10 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										description: 'Interact with HttpBin API',
							 | 
						
					
						
							
								
									
										
										
										
											2022-06-14 16:31:05 +02:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
										defaults: {
							 | 
						
					
						
							
								
									
										
										
										
											2022-06-20 15:22:10 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
											name: 'HttpBin',
							 | 
						
					
						
							
								
									
										
										
										
											2022-06-14 16:31:05 +02:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
										},
							 | 
						
					
						
							
								
									
										
										
										
											2022-06-20 15:22:10 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										inputs: ['main'],
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										outputs: ['main'],
							 | 
						
					
						
							
								
									
										
										
										
											2022-06-14 16:31:05 +02:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
										credentials: [
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											{
							 | 
						
					
						
							
								
									
										
										
										
											2022-06-20 15:22:10 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
												name: 'httpbinApi',
							 | 
						
					
						
							
								
									
										
										
										
											2022-06-14 17:02:04 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
												required: false,
							 | 
						
					
						
							
								
									
										
										
										
											2022-06-14 16:31:05 +02:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
											},
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										],
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										requestDefaults: {
							 | 
						
					
						
							
								
									
										
										
										
											2022-06-20 15:22:10 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
											baseURL: 'https://httpbin.org',
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											url: '',
							 | 
						
					
						
							
								
									
										
										
										
											2022-06-14 16:31:05 +02:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
											headers: {
							 | 
						
					
						
							
								
									
										
										
										
											2022-06-20 15:22:10 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
												Accept: 'application/json',
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
												'Content-Type': 'application/json',
							 | 
						
					
						
							
								
									
										
										
										
											2022-06-14 16:31:05 +02:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
											},
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										},
							 | 
						
					
						
							
								
									
										
										
										
											2022-06-14 17:02:04 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										/**
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										 * In the properties array we have two mandatory options objects required
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										 *
							 | 
						
					
						
							
								
									
										
										
										
											2022-06-16 15:03:56 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										 * [Resource & Operation]
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										 *
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										 * https://docs.n8n.io/integrations/creating-nodes/code/create-first-node/#resources-and-operations
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										 *
							 | 
						
					
						
							
								
									
										
										
										
											2022-06-28 15:27:25 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										 * In our example, the operations are separated into their own file (HTTPVerbDescription.ts)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										 * to keep this class easy to read.
							 | 
						
					
						
							
								
									
										
										
										
											2022-06-14 17:02:04 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										 *
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										 */
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										properties: [
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											{
							 | 
						
					
						
							
								
									
										
										
										
											2022-06-20 15:22:10 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
												displayName: 'Resource',
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
												name: 'resource',
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
												type: 'options',
							 | 
						
					
						
							
								
									
										
										
										
											2022-06-14 17:02:04 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
												noDataExpression: true,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
												options: [
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
													{
							 | 
						
					
						
							
								
									
										
										
										
											2022-06-21 11:23:10 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
														name: 'HTTP Verb',
							 | 
						
					
						
							
								
									
										
										
										
											2022-06-28 15:27:25 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
														value: 'httpVerb',
							 | 
						
					
						
							
								
									
										
										
										
											2022-06-20 15:22:10 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
													},
							 | 
						
					
						
							
								
									
										
										
										
											2022-06-14 17:02:04 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
												],
							 | 
						
					
						
							
								
									
										
										
										
											2022-06-28 15:27:25 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
												default: 'httpVerb',
							 | 
						
					
						
							
								
									
										
										
										
											2022-06-14 17:02:04 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
											},
							 | 
						
					
						
							
								
									
										
										
										
											2022-06-16 15:03:56 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2022-06-16 12:00:05 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
											...httpVerbOperations,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											...httpVerbFields,
							 | 
						
					
						
							
								
									
										
										
										
											2022-06-14 17:02:04 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										],
							 | 
						
					
						
							
								
									
										
										
										
											2022-06-14 16:31:05 +02:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
									};
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 |