Add setAlias and removeAlias operations to n8n trust center node
Signed-off-by: Bryan Frimin <bryan@probo.com>
This commit is contained in:
@@ -22,6 +22,8 @@ import * as getAllFilesOp from './getAllFiles.operation';
|
|||||||
import * as deleteFileOp from './deleteFile.operation';
|
import * as deleteFileOp from './deleteFile.operation';
|
||||||
import * as createExternalUrlOp from './createExternalUrl.operation';
|
import * as createExternalUrlOp from './createExternalUrl.operation';
|
||||||
import * as deleteExternalUrlOp from './deleteExternalUrl.operation';
|
import * as deleteExternalUrlOp from './deleteExternalUrl.operation';
|
||||||
|
import * as setAliasOp from './setAlias.operation';
|
||||||
|
import * as removeAliasOp from './removeAlias.operation';
|
||||||
|
|
||||||
export const description: INodeProperties[] = [
|
export const description: INodeProperties[] = [
|
||||||
{
|
{
|
||||||
@@ -83,6 +85,18 @@ export const description: INodeProperties[] = [
|
|||||||
description: 'Get many trust center references',
|
description: 'Get many trust center references',
|
||||||
action: 'Get many trust center references',
|
action: 'Get many trust center references',
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: 'Remove Alias',
|
||||||
|
value: 'removeAlias',
|
||||||
|
description: 'Remove a trust center alias from a resource',
|
||||||
|
action: 'Remove a trust center alias',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'Set Alias',
|
||||||
|
value: 'setAlias',
|
||||||
|
description: 'Set a trust center alias for a document, file, or audit',
|
||||||
|
action: 'Set a trust center alias',
|
||||||
|
},
|
||||||
{
|
{
|
||||||
name: 'Update',
|
name: 'Update',
|
||||||
value: 'update',
|
value: 'update',
|
||||||
@@ -101,6 +115,8 @@ export const description: INodeProperties[] = [
|
|||||||
...deleteFileOp.description,
|
...deleteFileOp.description,
|
||||||
...createExternalUrlOp.description,
|
...createExternalUrlOp.description,
|
||||||
...deleteExternalUrlOp.description,
|
...deleteExternalUrlOp.description,
|
||||||
|
...setAliasOp.description,
|
||||||
|
...removeAliasOp.description,
|
||||||
];
|
];
|
||||||
|
|
||||||
export {
|
export {
|
||||||
@@ -113,4 +129,6 @@ export {
|
|||||||
deleteFileOp as deleteFile,
|
deleteFileOp as deleteFile,
|
||||||
createExternalUrlOp as createExternalUrl,
|
createExternalUrlOp as createExternalUrl,
|
||||||
deleteExternalUrlOp as deleteExternalUrl,
|
deleteExternalUrlOp as deleteExternalUrl,
|
||||||
|
setAliasOp as setAlias,
|
||||||
|
removeAliasOp as removeAlias,
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -0,0 +1,57 @@
|
|||||||
|
// Copyright (c) 2025-2026 Probo Inc <hello@probo.com>.
|
||||||
|
//
|
||||||
|
// Permission to use, copy, modify, and/or distribute this software for any
|
||||||
|
// purpose with or without fee is hereby granted, provided that the above
|
||||||
|
// copyright notice and this permission notice appear in all copies.
|
||||||
|
//
|
||||||
|
// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
||||||
|
// REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||||
|
// AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
||||||
|
// INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
||||||
|
// LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
||||||
|
// OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||||
|
// PERFORMANCE OF THIS SOFTWARE.
|
||||||
|
|
||||||
|
import type { INodeProperties, IExecuteFunctions, INodeExecutionData } from 'n8n-workflow';
|
||||||
|
import { proboApiRequest } from '../../GenericFunctions';
|
||||||
|
|
||||||
|
export const description: INodeProperties[] = [
|
||||||
|
{
|
||||||
|
displayName: 'Resource ID',
|
||||||
|
name: 'resourceId',
|
||||||
|
type: 'string',
|
||||||
|
displayOptions: {
|
||||||
|
show: {
|
||||||
|
resource: ['trustCenter'],
|
||||||
|
operation: ['removeAlias'],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
default: '',
|
||||||
|
description: 'Document, trust center file, or audit ID',
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
|
export async function execute(
|
||||||
|
this: IExecuteFunctions,
|
||||||
|
itemIndex: number,
|
||||||
|
): Promise<INodeExecutionData> {
|
||||||
|
const resourceId = this.getNodeParameter('resourceId', itemIndex) as string;
|
||||||
|
|
||||||
|
const query = `
|
||||||
|
mutation RemoveTrustCenterAlias($input: RemoveTrustCenterAliasInput!) {
|
||||||
|
removeTrustCenterAlias(input: $input) {
|
||||||
|
deletedResourceId
|
||||||
|
}
|
||||||
|
}
|
||||||
|
`;
|
||||||
|
|
||||||
|
const responseData = await proboApiRequest.call(this, query, {
|
||||||
|
input: { resourceId },
|
||||||
|
});
|
||||||
|
|
||||||
|
return {
|
||||||
|
json: responseData,
|
||||||
|
pairedItem: { item: itemIndex },
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -0,0 +1,75 @@
|
|||||||
|
// Copyright (c) 2025-2026 Probo Inc <hello@probo.com>.
|
||||||
|
//
|
||||||
|
// Permission to use, copy, modify, and/or distribute this software for any
|
||||||
|
// purpose with or without fee is hereby granted, provided that the above
|
||||||
|
// copyright notice and this permission notice appear in all copies.
|
||||||
|
//
|
||||||
|
// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
||||||
|
// REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||||
|
// AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
||||||
|
// INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
||||||
|
// LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
||||||
|
// OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||||
|
// PERFORMANCE OF THIS SOFTWARE.
|
||||||
|
|
||||||
|
import type { INodeProperties, IExecuteFunctions, INodeExecutionData } from 'n8n-workflow';
|
||||||
|
import { proboApiRequest } from '../../GenericFunctions';
|
||||||
|
|
||||||
|
export const description: INodeProperties[] = [
|
||||||
|
{
|
||||||
|
displayName: 'Resource ID',
|
||||||
|
name: 'resourceId',
|
||||||
|
type: 'string',
|
||||||
|
displayOptions: {
|
||||||
|
show: {
|
||||||
|
resource: ['trustCenter'],
|
||||||
|
operation: ['setAlias'],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
default: '',
|
||||||
|
description: 'Document, trust center file, or audit ID',
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
displayName: 'Alias',
|
||||||
|
name: 'alias',
|
||||||
|
type: 'string',
|
||||||
|
displayOptions: {
|
||||||
|
show: {
|
||||||
|
resource: ['trustCenter'],
|
||||||
|
operation: ['setAlias'],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
default: '',
|
||||||
|
description: 'Human-readable alias slug',
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
|
export async function execute(
|
||||||
|
this: IExecuteFunctions,
|
||||||
|
itemIndex: number,
|
||||||
|
): Promise<INodeExecutionData> {
|
||||||
|
const resourceId = this.getNodeParameter('resourceId', itemIndex) as string;
|
||||||
|
const alias = this.getNodeParameter('alias', itemIndex) as string;
|
||||||
|
|
||||||
|
const query = `
|
||||||
|
mutation SetTrustCenterAlias($input: SetTrustCenterAliasInput!) {
|
||||||
|
setTrustCenterAlias(input: $input) {
|
||||||
|
alias {
|
||||||
|
resourceId
|
||||||
|
alias
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
`;
|
||||||
|
|
||||||
|
const responseData = await proboApiRequest.call(this, query, {
|
||||||
|
input: { resourceId, alias },
|
||||||
|
});
|
||||||
|
|
||||||
|
return {
|
||||||
|
json: responseData,
|
||||||
|
pairedItem: { item: itemIndex },
|
||||||
|
};
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user