mirror of
https://github.com/n8n-io/n8n.git
synced 2024-12-25 04:34:06 -08:00
⚡ Minor improvements to Medium-Node
This commit is contained in:
parent
a5b6b3d209
commit
b13f29aab0
|
@ -102,9 +102,9 @@ export class Medium implements INodeType {
|
||||||
},
|
},
|
||||||
options: [
|
options: [
|
||||||
{
|
{
|
||||||
name: 'create',
|
name: 'Create',
|
||||||
value: 'create',
|
value: 'create',
|
||||||
description: 'Create a post.',
|
description: 'Create a post',
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
default: 'create',
|
default: 'create',
|
||||||
|
@ -241,12 +241,63 @@ export class Medium implements INodeType {
|
||||||
default: {},
|
default: {},
|
||||||
options: [
|
options: [
|
||||||
{
|
{
|
||||||
displayName: 'Tags',
|
displayName: 'Canonical Url',
|
||||||
name: 'tags',
|
name: 'canonicalUrl',
|
||||||
type: 'string',
|
type: 'string',
|
||||||
default: '',
|
default: '',
|
||||||
placeholder: 'open-source,mlh,fellowship',
|
description: 'The original home of this content, if it was originally published elsewhere.',
|
||||||
description: 'Comma-separated strings to be used as tags for post classification. Max allowed tags: 3. Max tag length: 25 characters.',
|
},
|
||||||
|
{
|
||||||
|
displayName: 'License',
|
||||||
|
name: 'license',
|
||||||
|
type: 'options',
|
||||||
|
default: 'all-rights-reserved',
|
||||||
|
options: [
|
||||||
|
{
|
||||||
|
name: 'all-rights-reserved',
|
||||||
|
value: 'all-rights-reserved',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'cc-40-by',
|
||||||
|
value: 'cc-40-by',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'cc-40-by-nc',
|
||||||
|
value: 'cc-40-by-nc',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'cc-40-by-nc-nd',
|
||||||
|
value: 'cc-40-by-nc-nd',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'cc-40-by-nc-sa',
|
||||||
|
value: 'cc-40-by-nc-sa',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'cc-40-by-nd',
|
||||||
|
value: 'cc-40-by-nd',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'cc-40-by-sa',
|
||||||
|
value: 'cc-40-by-sa',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'cc-40-zero',
|
||||||
|
value: 'cc-40-zero',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'public-domain',
|
||||||
|
value: 'public-domain',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
description: 'License of the post.',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
displayName: 'Notify Followers',
|
||||||
|
name: 'notifyFollowers',
|
||||||
|
type: 'boolean',
|
||||||
|
default: false,
|
||||||
|
description: 'Whether to notify followers that the user has published.',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
displayName: 'Publish Status',
|
displayName: 'Publish Status',
|
||||||
|
@ -270,56 +321,12 @@ export class Medium implements INodeType {
|
||||||
description: 'The status of the post.',
|
description: 'The status of the post.',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
displayName: 'Notify Followers',
|
displayName: 'Tags',
|
||||||
name: 'notifyFollowers',
|
name: 'tags',
|
||||||
type: 'boolean',
|
|
||||||
default: false,
|
|
||||||
description: 'Whether to notify followers that the user has published.',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
displayName: 'License',
|
|
||||||
name: 'license',
|
|
||||||
type: 'string',
|
type: 'string',
|
||||||
default: 'all-rights-reserved',
|
default: '',
|
||||||
options: [
|
placeholder: 'open-source,mlh,fellowship',
|
||||||
{
|
description: 'Comma-separated strings to be used as tags for post classification. Max allowed tags: 5. Max tag length: 25 characters.',
|
||||||
name: 'all-rights-reserved',
|
|
||||||
value: 'all-rights-reserved',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'cc-40-by',
|
|
||||||
value: 'cc-40-by',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'cc-40-by-sa',
|
|
||||||
value: 'cc-40-by-sa',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'cc-40-by-nd',
|
|
||||||
value: 'cc-40-by-nd',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'cc-40-by-nc',
|
|
||||||
value: 'cc-40-by-nc',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'cc-40-by-nc-nd',
|
|
||||||
value: 'cc-40-by-nc-nd',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'cc-40-by-nc-sa',
|
|
||||||
value: 'cc-40-by-nc-sa',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'cc-40-zero',
|
|
||||||
value: 'cc-40-zero',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'public-domain',
|
|
||||||
value: 'public-domain',
|
|
||||||
},
|
|
||||||
],
|
|
||||||
description: 'License of the post.',
|
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
@ -338,7 +345,7 @@ export class Medium implements INodeType {
|
||||||
{
|
{
|
||||||
name: 'Get All',
|
name: 'Get All',
|
||||||
value: 'getAll',
|
value: 'getAll',
|
||||||
description: 'Get all publications.',
|
description: 'Get all publications',
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
default: 'publication',
|
default: 'publication',
|
||||||
|
@ -462,18 +469,26 @@ export class Medium implements INodeType {
|
||||||
content,
|
content,
|
||||||
|
|
||||||
};
|
};
|
||||||
const additionalFields = this.getNodeParameter(
|
|
||||||
'additionalFields',
|
const additionalFields = this.getNodeParameter('additionalFields', i) as IDataObject;
|
||||||
i
|
|
||||||
) as IDataObject;
|
|
||||||
if (additionalFields.tags) {
|
if (additionalFields.tags) {
|
||||||
const tags = additionalFields.tags as string;
|
const tags = additionalFields.tags as string;
|
||||||
bodyRequest.tags = tags.split(',').map(item => {
|
bodyRequest.tags = tags.split(',').map(name => {
|
||||||
return parseInt(item, 10);
|
const returnValue = name.trim();
|
||||||
|
if (returnValue.length > 25) {
|
||||||
|
throw new Error(`The tag "${returnValue}" is to long. Maximum lenght of a tag is 25 characters.`);
|
||||||
|
}
|
||||||
|
return returnValue;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if ((bodyRequest.tags as string[]).length > 5) {
|
||||||
|
throw new Error('To many tags got used. Maximum 5 can be set.');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (additionalFields.canonicalUrl) {
|
||||||
|
bodyRequest.canonicalUrl = additionalFields.canonicalUrl as string;
|
||||||
|
}
|
||||||
if (additionalFields.publishStatus) {
|
if (additionalFields.publishStatus) {
|
||||||
bodyRequest.publishStatus = additionalFields.publishStatus as string;
|
bodyRequest.publishStatus = additionalFields.publishStatus as string;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue