n8n/packages/nodes-base/credentials/StrapiApi.credentials.ts

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

42 lines
1.1 KiB
TypeScript
Raw Normal View History

2024-09-25 03:01:38 -07:00
import { type ICredentialType, CredentialSchema, type InferCredentialSchema } from 'n8n-workflow';
export const strapiApiCredentialSchema = CredentialSchema.create({
2024-09-25 03:01:38 -07:00
notice: CredentialSchema.notice('Make sure you are using a user account not an admin account'),
email: CredentialSchema.email({ placeholder: 'name@email.com' }),
password: CredentialSchema.password(),
url: CredentialSchema.url({
2024-09-25 03:01:38 -07:00
placeholder: 'https://api.example.com',
}),
apiVersion: CredentialSchema.options({
2024-09-25 03:01:38 -07:00
label: 'API Version',
description: 'The version of api to be used',
options: [
{
2024-09-25 03:01:38 -07:00
label: 'Version 4',
value: 'v4',
description: 'API version supported by Strapi 4',
},
{
2024-09-25 03:01:38 -07:00
label: 'Version 3',
value: 'v3',
default: true,
2024-09-25 03:01:38 -07:00
description: 'API version supported by Strapi 3',
},
],
}),
});
2024-09-25 03:01:38 -07:00
export type StrapiApiCredential = InferCredentialSchema<typeof strapiApiCredentialSchema>;
export class StrapiApi implements ICredentialType {
2024-09-25 03:01:38 -07:00
name = 'strapiApi';
2024-09-25 03:01:38 -07:00
displayName = 'Strapi API';
2024-09-25 03:01:38 -07:00
documentationUrl = 'strapi';
properties = strapiApiCredentialSchema.toNodeProperties();
schema = strapiApiCredentialSchema;
}