import type { IAuthenticateGeneric, ICredentialTestRequest, ICredentialType, INodeProperties, } from "n8n-workflow"; /** * Songs2VID REST auth — cloud accepts Authorization: Bearer only. * Paste the raw key (s2yt_live_…) or a full "Bearer …" value. */ export class Songs2VidApi implements ICredentialType { name = "songs2VidApi"; displayName = "Songs2VID API"; documentationUrl = "https://songs2vid.com/docs/n8n"; properties: INodeProperties[] = [ { displayName: "API Key", name: "apiKey", type: "string", typeOptions: { password: true }, default: "", required: true, description: "Developer+ key from Dashboard → Settings (starts with s2yt_live_). Sent as Authorization: Bearer.", }, { displayName: "Base URL", name: "baseUrl", type: "string", default: "https://songs2vid.com", required: true, description: "Cloud origin or self-hosted base (no trailing slash).", }, ]; authenticate: IAuthenticateGeneric = { type: "generic", properties: { headers: { Authorization: '={{ $credentials.apiKey.toString().startsWith("Bearer ") ? $credentials.apiKey : "Bearer " + $credentials.apiKey }}', }, }, }; test: ICredentialTestRequest = { request: { baseURL: "={{ $credentials.baseUrl.replace(/\\/$/, \"\") }}", url: "/api/v1/user/api-keys", method: "GET", }, }; }