mirror of
https://github.com/n8n-io/n8n.git
synced 2025-01-24 02:52:24 -08:00
⚡ Minor improvements to Strapi-Node
This commit is contained in:
parent
a5ecf3d58d
commit
73e1399c42
|
@ -17,6 +17,9 @@ export class StrapiApi implements ICredentialType {
|
|||
displayName: 'Password',
|
||||
name: 'password',
|
||||
type: 'string' as NodePropertyTypes,
|
||||
typeOptions: {
|
||||
password: true,
|
||||
},
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
|
@ -24,6 +27,7 @@ export class StrapiApi implements ICredentialType {
|
|||
name: 'url',
|
||||
type: 'string' as NodePropertyTypes,
|
||||
default: '',
|
||||
placeholder: 'https://api.example.com',
|
||||
},
|
||||
];
|
||||
}
|
||||
|
|
|
@ -66,7 +66,7 @@ export const entryFields = [
|
|||
],
|
||||
},
|
||||
},
|
||||
description: 'Name of the content type',
|
||||
description: 'Name of the content type.',
|
||||
},
|
||||
{
|
||||
displayName: 'Columns',
|
||||
|
@ -86,6 +86,7 @@ export const entryFields = [
|
|||
placeholder: 'id,name,description',
|
||||
description: 'Comma separated list of the properties which should used as columns for the new rows.',
|
||||
},
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* entry:delete */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
@ -105,7 +106,7 @@ export const entryFields = [
|
|||
],
|
||||
},
|
||||
},
|
||||
description: 'Name of the content type',
|
||||
description: 'Name of the content type.',
|
||||
},
|
||||
{
|
||||
displayName: 'Entry ID',
|
||||
|
@ -123,8 +124,9 @@ export const entryFields = [
|
|||
],
|
||||
},
|
||||
},
|
||||
description: 'The ID of the entry to get.',
|
||||
description: 'The ID of the entry to delete.',
|
||||
},
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* entry:get */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
@ -144,7 +146,7 @@ export const entryFields = [
|
|||
],
|
||||
},
|
||||
},
|
||||
description: 'Name of the content type',
|
||||
description: 'Name of the content type.',
|
||||
},
|
||||
{
|
||||
displayName: 'Entry ID',
|
||||
|
@ -164,6 +166,7 @@ export const entryFields = [
|
|||
},
|
||||
description: 'The ID of the entry to get.',
|
||||
},
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* entry:getAll */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
@ -286,6 +289,7 @@ export const entryFields = [
|
|||
},
|
||||
],
|
||||
},
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* entry:update */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
@ -305,7 +309,7 @@ export const entryFields = [
|
|||
],
|
||||
},
|
||||
},
|
||||
description: 'Name of the content type',
|
||||
description: 'Name of the content type.',
|
||||
},
|
||||
{
|
||||
displayName: 'Update Key',
|
||||
|
|
|
@ -16,7 +16,7 @@ import {
|
|||
export async function strapiApiRequest(this: IExecuteFunctions | ILoadOptionsFunctions | IHookFunctions | IWebhookFunctions, method: string, resource: string, body: any = {}, qs: IDataObject = {}, uri?: string, headers: IDataObject = {}): Promise<any> { // tslint:disable-line:no-any
|
||||
|
||||
const credentials = this.getCredentials('strapiApi') as IDataObject;
|
||||
|
||||
|
||||
try {
|
||||
const options: OptionsWithUri = {
|
||||
headers: {
|
||||
|
|
|
@ -92,7 +92,7 @@ export class Strapi implements INodeType {
|
|||
}
|
||||
}
|
||||
responseData = await strapiApiRequest.call(this, 'POST', `/${contentType}`, body, qs);
|
||||
|
||||
|
||||
returnData.push(responseData);
|
||||
}
|
||||
}
|
||||
|
@ -102,7 +102,7 @@ export class Strapi implements INodeType {
|
|||
const contentType = this.getNodeParameter('contentType', i) as string;
|
||||
|
||||
const entryId = this.getNodeParameter('entryId', i) as string;
|
||||
|
||||
|
||||
responseData = await strapiApiRequest.call(this, 'DELETE', `/${contentType}/${entryId}`, {}, qs);
|
||||
|
||||
returnData.push(responseData);
|
||||
|
@ -140,7 +140,7 @@ export class Strapi implements INodeType {
|
|||
responseData = await strapiApiRequestAllItems.call(this, 'GET', `/${contentType}`, {}, qs);
|
||||
} else {
|
||||
qs._limit = this.getNodeParameter('limit', i) as number;
|
||||
|
||||
|
||||
responseData = await strapiApiRequest.call(this, 'GET', `/${contentType}`, {}, qs);
|
||||
}
|
||||
returnData.push.apply(returnData, responseData);
|
||||
|
@ -181,7 +181,7 @@ export class Strapi implements INodeType {
|
|||
}
|
||||
}
|
||||
responseData = await strapiApiRequest.call(this, 'PUT', `/${contentType}/${entryId}`, body, qs);
|
||||
|
||||
|
||||
returnData.push(responseData);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue