Files
Agent-n8n/n8n-n8n-1.109.2/packages/nodes-base/nodes/SeaTable/v2/actions/asset/getPublicURL.operation.ts
2025-09-08 04:48:28 +08:00

49 lines
1017 B
TypeScript
Executable File

import {
type IDataObject,
type INodeExecutionData,
type INodeProperties,
type IExecuteFunctions,
updateDisplayOptions,
} from 'n8n-workflow';
import { seaTableApiRequest } from '../../GenericFunctions';
const properties: INodeProperties[] = [
{
displayName: 'Asset Path',
name: 'assetPath',
type: 'string',
placeholder: '/images/2023-09/logo.png',
required: true,
default: '',
},
];
const displayOptions = {
show: {
resource: ['asset'],
operation: ['getPublicURL'],
},
};
export const description = updateDisplayOptions(displayOptions, properties);
export async function execute(
this: IExecuteFunctions,
index: number,
): Promise<INodeExecutionData[]> {
const assetPath = this.getNodeParameter('assetPath', index) as string;
let responseData = [] as IDataObject[];
if (assetPath) {
responseData = await seaTableApiRequest.call(
this,
{},
'GET',
`/api/v2.1/dtable/app-download-link/?path=${assetPath}`,
);
}
return this.helpers.returnJsonArray(responseData);
}