n8n-nodes-recraft-v3
Version:
Unofficial n8n community node for Recraft v3 AI image generation and editing API - the #1 ranked text-to-image model. Created for testing and community use.
49 lines (48 loc) • 1.61 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.RecraftApi = void 0;
class RecraftApi {
constructor() {
this.name = 'recraftApi';
this.displayName = 'Recraft API';
this.documentationUrl = 'https://www.recraft.ai/docs';
this.properties = [
{
displayName: 'API Token',
name: 'apiToken',
type: 'string',
typeOptions: { password: true },
required: true,
default: '',
placeholder: 'recraft_api_token_here',
description: 'Your Recraft API token. Get it from your <a href="https://app.recraft.ai/profile/api" target="_blank">Recraft profile API page</a>.',
},
];
this.authenticate = {
type: 'generic',
properties: {
headers: {
Authorization: '=Bearer {{$credentials.apiToken}}',
},
},
};
this.test = {
request: {
baseURL: 'https://external.api.recraft.ai/v1',
url: '/users/me',
method: 'GET',
},
rules: [
{
type: 'responseSuccessBody',
properties: {
key: 'id',
value: '.*',
message: 'Invalid API token. Please check your Recraft API credentials.',
},
},
],
};
}
}
exports.RecraftApi = RecraftApi;