2023-01-27 03:22:44 -08:00
|
|
|
import type { INodeProperties } from 'n8n-workflow';
|
2020-12-02 14:13:59 -08:00
|
|
|
|
2021-12-03 00:44:16 -08:00
|
|
|
export const urlOperations: INodeProperties[] = [
|
2020-12-02 14:13:59 -08:00
|
|
|
{
|
|
|
|
displayName: 'Operation',
|
|
|
|
name: 'operation',
|
|
|
|
type: 'options',
|
2022-05-20 14:47:24 -07:00
|
|
|
noDataExpression: true,
|
2020-12-02 14:13:59 -08:00
|
|
|
displayOptions: {
|
|
|
|
show: {
|
2022-08-17 08:50:24 -07:00
|
|
|
resource: ['url'],
|
2020-12-02 14:13:59 -08:00
|
|
|
},
|
|
|
|
},
|
|
|
|
options: [
|
|
|
|
{
|
|
|
|
name: 'Expand',
|
|
|
|
value: 'expand',
|
|
|
|
description: 'Expand a URL',
|
2022-07-10 13:50:51 -07:00
|
|
|
action: 'Expand a URL',
|
2020-12-02 14:13:59 -08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'Shorten',
|
|
|
|
value: 'shorten',
|
|
|
|
description: 'Shorten a URL',
|
2022-07-10 13:50:51 -07:00
|
|
|
action: 'Shorten a URL',
|
2020-12-02 14:13:59 -08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'Stats',
|
|
|
|
value: 'stats',
|
|
|
|
description: 'Get stats about one short URL',
|
2022-07-10 13:50:51 -07:00
|
|
|
action: 'Get stats for a URL',
|
2020-12-02 14:13:59 -08:00
|
|
|
},
|
|
|
|
],
|
|
|
|
default: 'shorten',
|
|
|
|
},
|
2021-12-03 00:44:16 -08:00
|
|
|
];
|
2020-12-02 14:13:59 -08:00
|
|
|
|
2021-12-03 00:44:16 -08:00
|
|
|
export const urlFields: INodeProperties[] = [
|
2020-12-02 14:13:59 -08:00
|
|
|
/* -------------------------------------------------------------------------- */
|
|
|
|
/* url:shorten */
|
|
|
|
/* -------------------------------------------------------------------------- */
|
|
|
|
{
|
|
|
|
displayName: 'URL',
|
|
|
|
name: 'url',
|
|
|
|
type: 'string',
|
|
|
|
required: true,
|
|
|
|
displayOptions: {
|
|
|
|
show: {
|
2022-08-17 08:50:24 -07:00
|
|
|
resource: ['url'],
|
|
|
|
operation: ['shorten'],
|
2020-12-02 14:13:59 -08:00
|
|
|
},
|
|
|
|
},
|
|
|
|
default: '',
|
2022-05-06 14:01:25 -07:00
|
|
|
description: 'The URL to shorten',
|
2020-12-02 14:13:59 -08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Additional Fields',
|
|
|
|
name: 'additionalFields',
|
|
|
|
type: 'collection',
|
|
|
|
placeholder: 'Add Field',
|
|
|
|
default: {},
|
|
|
|
displayOptions: {
|
|
|
|
show: {
|
2022-08-17 08:50:24 -07:00
|
|
|
resource: ['url'],
|
|
|
|
operation: ['shorten'],
|
2020-12-02 14:13:59 -08:00
|
|
|
},
|
|
|
|
},
|
|
|
|
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: {
|
2022-08-17 08:50:24 -07:00
|
|
|
resource: ['url'],
|
|
|
|
operation: ['expand'],
|
2020-12-02 14:13:59 -08:00
|
|
|
},
|
|
|
|
},
|
|
|
|
default: '',
|
2022-05-06 14:01:25 -07:00
|
|
|
description: 'The short URL to expand',
|
2020-12-02 14:13:59 -08:00
|
|
|
},
|
|
|
|
|
|
|
|
/* -------------------------------------------------------------------------- */
|
|
|
|
/* url:stats */
|
|
|
|
/* -------------------------------------------------------------------------- */
|
|
|
|
{
|
|
|
|
displayName: 'Short URL',
|
|
|
|
name: 'shortUrl',
|
|
|
|
type: 'string',
|
|
|
|
required: true,
|
|
|
|
displayOptions: {
|
|
|
|
show: {
|
2022-08-17 08:50:24 -07:00
|
|
|
resource: ['url'],
|
|
|
|
operation: ['stats'],
|
2020-12-02 14:13:59 -08:00
|
|
|
},
|
|
|
|
},
|
|
|
|
default: '',
|
2022-05-06 14:01:25 -07:00
|
|
|
description: 'The short URL for which to get stats',
|
2020-12-02 14:13:59 -08:00
|
|
|
},
|
2021-12-03 00:44:16 -08:00
|
|
|
];
|