mirror of
https://github.com/n8n-io/n8n.git
synced 2024-11-10 14:44:05 -08:00
138 lines
2.6 KiB
TypeScript
138 lines
2.6 KiB
TypeScript
|
import {
|
||
|
INodeProperties,
|
||
|
} from 'n8n-workflow';
|
||
|
|
||
|
export const urlOperations = [
|
||
|
{
|
||
|
displayName: 'Operation',
|
||
|
name: 'operation',
|
||
|
type: 'options',
|
||
|
displayOptions: {
|
||
|
show: {
|
||
|
resource: [
|
||
|
'url',
|
||
|
],
|
||
|
},
|
||
|
},
|
||
|
options: [
|
||
|
{
|
||
|
name: 'Expand',
|
||
|
value: 'expand',
|
||
|
description: 'Expand a URL',
|
||
|
},
|
||
|
{
|
||
|
name: 'Shorten',
|
||
|
value: 'shorten',
|
||
|
description: 'Shorten a URL',
|
||
|
},
|
||
|
{
|
||
|
name: 'Stats',
|
||
|
value: 'stats',
|
||
|
description: 'Get stats about one short URL',
|
||
|
},
|
||
|
],
|
||
|
default: 'shorten',
|
||
|
description: 'The operation to perform.',
|
||
|
},
|
||
|
] as INodeProperties[];
|
||
|
|
||
|
export const urlFields = [
|
||
|
|
||
|
/* -------------------------------------------------------------------------- */
|
||
|
/* url:shorten */
|
||
|
/* -------------------------------------------------------------------------- */
|
||
|
{
|
||
|
displayName: 'URL',
|
||
|
name: 'url',
|
||
|
type: 'string',
|
||
|
required: true,
|
||
|
displayOptions: {
|
||
|
show: {
|
||
|
resource: [
|
||
|
'url',
|
||
|
],
|
||
|
operation: [
|
||
|
'shorten',
|
||
|
],
|
||
|
},
|
||
|
},
|
||
|
default: '',
|
||
|
description: 'The URL to shorten.',
|
||
|
},
|
||
|
{
|
||
|
displayName: 'Additional Fields',
|
||
|
name: 'additionalFields',
|
||
|
type: 'collection',
|
||
|
placeholder: 'Add Field',
|
||
|
default: {},
|
||
|
displayOptions: {
|
||
|
show: {
|
||
|
resource: [
|
||
|
'url',
|
||
|
],
|
||
|
operation: [
|
||
|
'shorten',
|
||
|
],
|
||
|
},
|
||
|
},
|
||
|
options: [
|
||
|
{
|
||
|
displayName: 'Keyword',
|
||
|
name: 'keyword',
|
||
|
type: 'string',
|
||
|
default: '',
|
||
|
},
|
||
|
{
|
||
|
displayName: 'Title',
|
||
|
name: 'title',
|
||
|
type: 'string',
|
||
|
default: '',
|
||
|
description: 'Title for custom short URLs',
|
||
|
},
|
||
|
],
|
||
|
},
|
||
|
/* -------------------------------------------------------------------------- */
|
||
|
/* url:expand */
|
||
|
/* -------------------------------------------------------------------------- */
|
||
|
{
|
||
|
displayName: 'Short URL',
|
||
|
name: 'shortUrl',
|
||
|
type: 'string',
|
||
|
required: true,
|
||
|
displayOptions: {
|
||
|
show: {
|
||
|
resource: [
|
||
|
'url',
|
||
|
],
|
||
|
operation: [
|
||
|
'expand',
|
||
|
],
|
||
|
},
|
||
|
},
|
||
|
default: '',
|
||
|
description: 'The short URL to expand.',
|
||
|
},
|
||
|
|
||
|
/* -------------------------------------------------------------------------- */
|
||
|
/* url:stats */
|
||
|
/* -------------------------------------------------------------------------- */
|
||
|
{
|
||
|
displayName: 'Short URL',
|
||
|
name: 'shortUrl',
|
||
|
type: 'string',
|
||
|
required: true,
|
||
|
displayOptions: {
|
||
|
show: {
|
||
|
resource: [
|
||
|
'url',
|
||
|
],
|
||
|
operation: [
|
||
|
'stats',
|
||
|
],
|
||
|
},
|
||
|
},
|
||
|
default: '',
|
||
|
description: 'The short URL for which to get stats.',
|
||
|
},
|
||
|
] as INodeProperties[];
|