| 
									
										
										
										
											2022-06-20 15:22:10 +02:00
										 |  |  | import { INodeProperties } from 'n8n-workflow'; | 
					
						
							| 
									
										
										
										
											2022-06-16 11:59:25 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-06-28 15:27:25 +02:00
										 |  |  | // When the resource `httpVerb` is selected, this `operation` parameter will be shown.
 | 
					
						
							| 
									
										
										
										
											2022-06-20 15:22:10 +02:00
										 |  |  | export const httpVerbOperations: INodeProperties[] = [ | 
					
						
							| 
									
										
										
										
											2022-06-16 11:59:25 +02:00
										 |  |  | 	{ | 
					
						
							| 
									
										
										
										
											2022-06-20 15:22:10 +02:00
										 |  |  | 		displayName: 'Operation', | 
					
						
							|  |  |  | 		name: 'operation', | 
					
						
							|  |  |  | 		type: 'options', | 
					
						
							| 
									
										
										
										
											2022-06-16 11:59:25 +02:00
										 |  |  | 		noDataExpression: true, | 
					
						
							| 
									
										
										
										
											2022-06-28 15:27:25 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-06-16 11:59:25 +02:00
										 |  |  | 		displayOptions: { | 
					
						
							|  |  |  | 			show: { | 
					
						
							| 
									
										
										
										
											2022-06-28 15:27:25 +02:00
										 |  |  | 				resource: ['httpVerb'], | 
					
						
							| 
									
										
										
										
											2022-06-16 11:59:25 +02:00
										 |  |  | 			}, | 
					
						
							|  |  |  | 		}, | 
					
						
							|  |  |  | 		options: [ | 
					
						
							|  |  |  | 			{ | 
					
						
							| 
									
										
										
										
											2022-06-20 15:22:10 +02:00
										 |  |  | 				name: 'GET', | 
					
						
							|  |  |  | 				value: 'get', | 
					
						
							| 
									
										
										
										
											2022-06-16 11:59:25 +02:00
										 |  |  | 				routing: { | 
					
						
							|  |  |  | 					request: { | 
					
						
							| 
									
										
										
										
											2022-06-20 15:22:10 +02:00
										 |  |  | 						method: 'GET', | 
					
						
							|  |  |  | 						url: '/get', | 
					
						
							| 
									
										
										
										
											2022-06-16 11:59:25 +02:00
										 |  |  | 					}, | 
					
						
							|  |  |  | 				}, | 
					
						
							|  |  |  | 			}, | 
					
						
							|  |  |  | 			{ | 
					
						
							| 
									
										
										
										
											2022-06-20 15:22:10 +02:00
										 |  |  | 				name: 'DELETE', | 
					
						
							|  |  |  | 				value: 'delete', | 
					
						
							| 
									
										
										
										
											2022-06-16 11:59:25 +02:00
										 |  |  | 				routing: { | 
					
						
							|  |  |  | 					request: { | 
					
						
							| 
									
										
										
										
											2022-06-20 15:22:10 +02:00
										 |  |  | 						method: 'DELETE', | 
					
						
							|  |  |  | 						url: '/delete', | 
					
						
							| 
									
										
										
										
											2022-06-16 11:59:25 +02:00
										 |  |  | 					}, | 
					
						
							|  |  |  | 				}, | 
					
						
							|  |  |  | 			}, | 
					
						
							|  |  |  | 		], | 
					
						
							| 
									
										
										
										
											2022-06-20 15:22:10 +02:00
										 |  |  | 		default: 'get', | 
					
						
							| 
									
										
										
										
											2022-06-16 11:59:25 +02:00
										 |  |  | 	}, | 
					
						
							|  |  |  | ]; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-06-28 15:27:25 +02:00
										 |  |  | // Here we define what to show when the `get` operation is selected.
 | 
					
						
							|  |  |  | // We do that by adding `operation: ["get"]` to `displayOptions.show`
 | 
					
						
							| 
									
										
										
										
											2022-06-20 15:22:10 +02:00
										 |  |  | const getOperation: INodeProperties[] = [ | 
					
						
							| 
									
										
										
										
											2022-06-16 11:59:25 +02:00
										 |  |  | 	{ | 
					
						
							| 
									
										
										
										
											2022-06-20 15:22:10 +02:00
										 |  |  | 		name: 'typeofData', | 
					
						
							|  |  |  | 		default: 'queryParameter', | 
					
						
							|  |  |  | 		description: 'Select type of data to send [Query Parameters]', | 
					
						
							|  |  |  | 		displayName: 'Type of Data', | 
					
						
							| 
									
										
										
										
											2022-06-16 11:59:25 +02:00
										 |  |  | 		displayOptions: { | 
					
						
							|  |  |  | 			show: { | 
					
						
							| 
									
										
										
										
											2022-06-28 15:27:25 +02:00
										 |  |  | 				resource: ['httpVerb'], | 
					
						
							| 
									
										
										
										
											2022-06-20 15:22:10 +02:00
										 |  |  | 				operation: ['get'], | 
					
						
							| 
									
										
										
										
											2022-06-16 11:59:25 +02:00
										 |  |  | 			}, | 
					
						
							|  |  |  | 		}, | 
					
						
							| 
									
										
										
										
											2022-06-20 15:22:10 +02:00
										 |  |  | 		type: 'options', | 
					
						
							| 
									
										
										
										
											2022-06-16 11:59:25 +02:00
										 |  |  | 		options: [ | 
					
						
							|  |  |  | 			{ | 
					
						
							| 
									
										
										
										
											2022-06-20 15:22:10 +02:00
										 |  |  | 				name: 'Query', | 
					
						
							|  |  |  | 				value: 'queryParameter', | 
					
						
							| 
									
										
										
										
											2022-06-16 11:59:25 +02:00
										 |  |  | 			}, | 
					
						
							|  |  |  | 		], | 
					
						
							|  |  |  | 		required: true, | 
					
						
							|  |  |  | 	}, | 
					
						
							|  |  |  | 	{ | 
					
						
							| 
									
										
										
										
											2022-06-20 15:22:10 +02:00
										 |  |  | 		name: 'arguments', | 
					
						
							| 
									
										
										
										
											2022-06-16 11:59:25 +02:00
										 |  |  | 		default: {}, | 
					
						
							| 
									
										
										
										
											2022-06-27 11:45:32 +02:00
										 |  |  | 		description: "The request's query parameters", | 
					
						
							| 
									
										
										
										
											2022-06-20 15:22:10 +02:00
										 |  |  | 		displayName: 'Query Parameters', | 
					
						
							| 
									
										
										
										
											2022-06-16 11:59:25 +02:00
										 |  |  | 		displayOptions: { | 
					
						
							|  |  |  | 			show: { | 
					
						
							| 
									
										
										
										
											2022-06-28 15:27:25 +02:00
										 |  |  | 				resource: ['httpVerb'], | 
					
						
							| 
									
										
										
										
											2022-06-20 15:22:10 +02:00
										 |  |  | 				operation: ['get'], | 
					
						
							| 
									
										
										
										
											2022-06-16 11:59:25 +02:00
										 |  |  | 			}, | 
					
						
							|  |  |  | 		}, | 
					
						
							|  |  |  | 		options: [ | 
					
						
							|  |  |  | 			{ | 
					
						
							| 
									
										
										
										
											2022-06-20 15:22:10 +02:00
										 |  |  | 				name: 'keyvalue', | 
					
						
							|  |  |  | 				displayName: 'Key:Value', | 
					
						
							| 
									
										
										
										
											2022-06-16 11:59:25 +02:00
										 |  |  | 				values: [ | 
					
						
							|  |  |  | 					{ | 
					
						
							| 
									
										
										
										
											2022-06-20 15:22:10 +02:00
										 |  |  | 						displayName: 'Key', | 
					
						
							|  |  |  | 						name: 'key', | 
					
						
							|  |  |  | 						type: 'string', | 
					
						
							|  |  |  | 						default: '', | 
					
						
							| 
									
										
										
										
											2022-06-16 11:59:25 +02:00
										 |  |  | 						required: true, | 
					
						
							| 
									
										
										
										
											2022-06-20 15:22:10 +02:00
										 |  |  | 						description: 'Key of query parameter', | 
					
						
							| 
									
										
										
										
											2022-06-16 11:59:25 +02:00
										 |  |  | 					}, | 
					
						
							|  |  |  | 					{ | 
					
						
							| 
									
										
										
										
											2022-06-20 15:22:10 +02:00
										 |  |  | 						displayName: 'Value', | 
					
						
							|  |  |  | 						name: 'value', | 
					
						
							|  |  |  | 						type: 'string', | 
					
						
							|  |  |  | 						default: '', | 
					
						
							| 
									
										
										
										
											2022-06-16 11:59:25 +02:00
										 |  |  | 						routing: { | 
					
						
							|  |  |  | 							send: { | 
					
						
							| 
									
										
										
										
											2022-06-20 15:22:10 +02:00
										 |  |  | 								property: '={{$parent.key}}', | 
					
						
							|  |  |  | 								type: 'query', | 
					
						
							| 
									
										
										
										
											2022-06-16 11:59:25 +02:00
										 |  |  | 							}, | 
					
						
							|  |  |  | 						}, | 
					
						
							|  |  |  | 						required: true, | 
					
						
							| 
									
										
										
										
											2022-06-20 15:22:10 +02:00
										 |  |  | 						description: 'Value of query parameter', | 
					
						
							| 
									
										
										
										
											2022-06-16 11:59:25 +02:00
										 |  |  | 					}, | 
					
						
							|  |  |  | 				], | 
					
						
							|  |  |  | 			}, | 
					
						
							|  |  |  | 		], | 
					
						
							| 
									
										
										
										
											2022-06-20 15:22:10 +02:00
										 |  |  | 		type: 'fixedCollection', | 
					
						
							| 
									
										
										
										
											2022-06-16 11:59:25 +02:00
										 |  |  | 		typeOptions: { | 
					
						
							|  |  |  | 			multipleValues: true, | 
					
						
							|  |  |  | 		}, | 
					
						
							|  |  |  | 	}, | 
					
						
							|  |  |  | ]; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-06-28 15:27:25 +02:00
										 |  |  | // Here we define what to show when the DELETE Operation is selected.
 | 
					
						
							|  |  |  | // We do that by adding `operation: ["delete"]` to `displayOptions.show`
 | 
					
						
							| 
									
										
										
										
											2022-06-20 15:22:10 +02:00
										 |  |  | const deleteOperation: INodeProperties[] = [ | 
					
						
							| 
									
										
										
										
											2022-06-16 11:59:25 +02:00
										 |  |  | 	{ | 
					
						
							| 
									
										
										
										
											2022-06-20 15:22:10 +02:00
										 |  |  | 		name: 'typeofData', | 
					
						
							|  |  |  | 		default: 'queryParameter', | 
					
						
							| 
									
										
										
										
											2022-06-27 11:45:32 +02:00
										 |  |  | 		description: 'Select type of data to send [Query Parameter Arguments, JSON-Body]', | 
					
						
							| 
									
										
										
										
											2022-06-20 15:22:10 +02:00
										 |  |  | 		displayName: 'Type of Data', | 
					
						
							| 
									
										
										
										
											2022-06-16 11:59:25 +02:00
										 |  |  | 		displayOptions: { | 
					
						
							|  |  |  | 			show: { | 
					
						
							| 
									
										
										
										
											2022-06-28 15:27:25 +02:00
										 |  |  | 				resource: ['httpVerb'], | 
					
						
							| 
									
										
										
										
											2022-06-20 15:22:10 +02:00
										 |  |  | 				operation: ['delete'], | 
					
						
							| 
									
										
										
										
											2022-06-16 11:59:25 +02:00
										 |  |  | 			}, | 
					
						
							|  |  |  | 		}, | 
					
						
							|  |  |  | 		options: [ | 
					
						
							|  |  |  | 			{ | 
					
						
							| 
									
										
										
										
											2022-06-20 15:22:10 +02:00
										 |  |  | 				name: 'Query', | 
					
						
							|  |  |  | 				value: 'queryParameter', | 
					
						
							| 
									
										
										
										
											2022-06-16 11:59:25 +02:00
										 |  |  | 			}, | 
					
						
							|  |  |  | 			{ | 
					
						
							| 
									
										
										
										
											2022-06-20 15:22:10 +02:00
										 |  |  | 				name: 'JSON', | 
					
						
							|  |  |  | 				value: 'jsonData', | 
					
						
							| 
									
										
										
										
											2022-06-16 11:59:25 +02:00
										 |  |  | 			}, | 
					
						
							|  |  |  | 		], | 
					
						
							|  |  |  | 		required: true, | 
					
						
							| 
									
										
										
										
											2022-06-20 15:22:10 +02:00
										 |  |  | 		type: 'options', | 
					
						
							| 
									
										
										
										
											2022-06-16 11:59:25 +02:00
										 |  |  | 	}, | 
					
						
							|  |  |  | 	{ | 
					
						
							| 
									
										
										
										
											2022-06-20 15:22:10 +02:00
										 |  |  | 		name: 'arguments', | 
					
						
							| 
									
										
										
										
											2022-06-16 11:59:25 +02:00
										 |  |  | 		default: {}, | 
					
						
							| 
									
										
										
										
											2022-06-27 11:45:32 +02:00
										 |  |  | 		description: "The request's query parameters", | 
					
						
							| 
									
										
										
										
											2022-06-20 15:22:10 +02:00
										 |  |  | 		displayName: 'Query Parameters', | 
					
						
							| 
									
										
										
										
											2022-06-16 11:59:25 +02:00
										 |  |  | 		displayOptions: { | 
					
						
							|  |  |  | 			show: { | 
					
						
							| 
									
										
										
										
											2022-06-28 15:27:25 +02:00
										 |  |  | 				resource: ['httpVerb'], | 
					
						
							| 
									
										
										
										
											2022-06-20 15:22:10 +02:00
										 |  |  | 				operation: ['delete'], | 
					
						
							|  |  |  | 				typeofData: ['queryParameter'], | 
					
						
							| 
									
										
										
										
											2022-06-16 11:59:25 +02:00
										 |  |  | 			}, | 
					
						
							|  |  |  | 		}, | 
					
						
							|  |  |  | 		options: [ | 
					
						
							|  |  |  | 			{ | 
					
						
							| 
									
										
										
										
											2022-06-20 15:22:10 +02:00
										 |  |  | 				name: 'keyvalue', | 
					
						
							|  |  |  | 				displayName: 'Key:Value', | 
					
						
							| 
									
										
										
										
											2022-06-16 11:59:25 +02:00
										 |  |  | 				values: [ | 
					
						
							|  |  |  | 					{ | 
					
						
							| 
									
										
										
										
											2022-06-20 15:22:10 +02:00
										 |  |  | 						displayName: 'Key', | 
					
						
							|  |  |  | 						name: 'key', | 
					
						
							|  |  |  | 						type: 'string', | 
					
						
							|  |  |  | 						default: '', | 
					
						
							| 
									
										
										
										
											2022-06-16 11:59:25 +02:00
										 |  |  | 						required: true, | 
					
						
							| 
									
										
										
										
											2022-06-20 15:22:10 +02:00
										 |  |  | 						description: 'Key of query parameter', | 
					
						
							| 
									
										
										
										
											2022-06-16 11:59:25 +02:00
										 |  |  | 					}, | 
					
						
							|  |  |  | 					{ | 
					
						
							| 
									
										
										
										
											2022-06-20 15:22:10 +02:00
										 |  |  | 						displayName: 'Value', | 
					
						
							|  |  |  | 						name: 'value', | 
					
						
							|  |  |  | 						type: 'string', | 
					
						
							|  |  |  | 						default: '', | 
					
						
							| 
									
										
										
										
											2022-06-16 11:59:25 +02:00
										 |  |  | 						routing: { | 
					
						
							|  |  |  | 							send: { | 
					
						
							| 
									
										
										
										
											2022-06-20 15:22:10 +02:00
										 |  |  | 								property: '={{$parent.key}}', | 
					
						
							|  |  |  | 								type: 'query', | 
					
						
							| 
									
										
										
										
											2022-06-16 11:59:25 +02:00
										 |  |  | 							}, | 
					
						
							|  |  |  | 						}, | 
					
						
							|  |  |  | 						required: true, | 
					
						
							| 
									
										
										
										
											2022-06-20 15:22:10 +02:00
										 |  |  | 						description: 'Value of query parameter', | 
					
						
							| 
									
										
										
										
											2022-06-16 11:59:25 +02:00
										 |  |  | 					}, | 
					
						
							|  |  |  | 				], | 
					
						
							|  |  |  | 			}, | 
					
						
							|  |  |  | 		], | 
					
						
							| 
									
										
										
										
											2022-06-20 15:22:10 +02:00
										 |  |  | 		type: 'fixedCollection', | 
					
						
							| 
									
										
										
										
											2022-06-16 11:59:25 +02:00
										 |  |  | 		typeOptions: { | 
					
						
							|  |  |  | 			multipleValues: true, | 
					
						
							|  |  |  | 		}, | 
					
						
							|  |  |  | 	}, | 
					
						
							|  |  |  | 	{ | 
					
						
							| 
									
										
										
										
											2022-06-20 15:22:10 +02:00
										 |  |  | 		name: 'arguments', | 
					
						
							| 
									
										
										
										
											2022-06-16 11:59:25 +02:00
										 |  |  | 		default: {}, | 
					
						
							| 
									
										
										
										
											2022-06-27 11:45:32 +02:00
										 |  |  | 		description: "The request's JSON properties", | 
					
						
							| 
									
										
										
										
											2022-06-20 15:22:10 +02:00
										 |  |  | 		displayName: 'JSON Object', | 
					
						
							| 
									
										
										
										
											2022-06-16 11:59:25 +02:00
										 |  |  | 		displayOptions: { | 
					
						
							|  |  |  | 			show: { | 
					
						
							| 
									
										
										
										
											2022-06-28 15:27:25 +02:00
										 |  |  | 				resource: ['httpVerb'], | 
					
						
							| 
									
										
										
										
											2022-06-20 15:22:10 +02:00
										 |  |  | 				operation: ['delete'], | 
					
						
							|  |  |  | 				typeofData: ['jsonData'], | 
					
						
							| 
									
										
										
										
											2022-06-16 11:59:25 +02:00
										 |  |  | 			}, | 
					
						
							|  |  |  | 		}, | 
					
						
							|  |  |  | 		options: [ | 
					
						
							|  |  |  | 			{ | 
					
						
							| 
									
										
										
										
											2022-06-20 15:22:10 +02:00
										 |  |  | 				name: 'keyvalue', | 
					
						
							|  |  |  | 				displayName: 'Key:Value', | 
					
						
							| 
									
										
										
										
											2022-06-16 11:59:25 +02:00
										 |  |  | 				values: [ | 
					
						
							|  |  |  | 					{ | 
					
						
							| 
									
										
										
										
											2022-06-20 15:22:10 +02:00
										 |  |  | 						displayName: 'Key', | 
					
						
							|  |  |  | 						name: 'key', | 
					
						
							|  |  |  | 						type: 'string', | 
					
						
							|  |  |  | 						default: '', | 
					
						
							| 
									
										
										
										
											2022-06-16 11:59:25 +02:00
										 |  |  | 						required: true, | 
					
						
							| 
									
										
										
										
											2022-06-21 11:23:10 +02:00
										 |  |  | 						description: 'Key of JSON property', | 
					
						
							| 
									
										
										
										
											2022-06-16 11:59:25 +02:00
										 |  |  | 					}, | 
					
						
							|  |  |  | 					{ | 
					
						
							| 
									
										
										
										
											2022-06-20 15:22:10 +02:00
										 |  |  | 						displayName: 'Value', | 
					
						
							|  |  |  | 						name: 'value', | 
					
						
							|  |  |  | 						type: 'string', | 
					
						
							|  |  |  | 						default: '', | 
					
						
							| 
									
										
										
										
											2022-06-16 11:59:25 +02:00
										 |  |  | 						routing: { | 
					
						
							|  |  |  | 							send: { | 
					
						
							| 
									
										
										
										
											2022-06-20 15:22:10 +02:00
										 |  |  | 								property: '={{$parent.key}}', | 
					
						
							|  |  |  | 								type: 'body', | 
					
						
							| 
									
										
										
										
											2022-06-16 11:59:25 +02:00
										 |  |  | 							}, | 
					
						
							|  |  |  | 						}, | 
					
						
							|  |  |  | 						required: true, | 
					
						
							| 
									
										
										
										
											2022-06-21 11:23:10 +02:00
										 |  |  | 						description: 'Value of JSON property', | 
					
						
							| 
									
										
										
										
											2022-06-16 11:59:25 +02:00
										 |  |  | 					}, | 
					
						
							|  |  |  | 				], | 
					
						
							|  |  |  | 			}, | 
					
						
							|  |  |  | 		], | 
					
						
							| 
									
										
										
										
											2022-06-20 15:22:10 +02:00
										 |  |  | 		type: 'fixedCollection', | 
					
						
							| 
									
										
										
										
											2022-06-16 11:59:25 +02:00
										 |  |  | 		typeOptions: { | 
					
						
							|  |  |  | 			multipleValues: true, | 
					
						
							|  |  |  | 		}, | 
					
						
							|  |  |  | 	}, | 
					
						
							|  |  |  | ]; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-06-20 15:22:10 +02:00
										 |  |  | export const httpVerbFields: INodeProperties[] = [ | 
					
						
							| 
									
										
										
										
											2022-06-16 11:59:25 +02:00
										 |  |  | 	/* -------------------------------------------------------------------------- */ | 
					
						
							| 
									
										
										
										
											2022-06-28 15:27:25 +02:00
										 |  |  | 	/*                                httpVerb:get                                */ | 
					
						
							| 
									
										
										
										
											2022-06-16 11:59:25 +02:00
										 |  |  | 	/* -------------------------------------------------------------------------- */ | 
					
						
							|  |  |  | 	...getOperation, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	/* -------------------------------------------------------------------------- */ | 
					
						
							| 
									
										
										
										
											2022-06-28 15:27:25 +02:00
										 |  |  | 	/*                              httpVerb:delete                               */ | 
					
						
							| 
									
										
										
										
											2022-06-16 11:59:25 +02:00
										 |  |  | 	/* -------------------------------------------------------------------------- */ | 
					
						
							|  |  |  | 	...deleteOperation, | 
					
						
							|  |  |  | ]; |