Add organization operations

Signed-off-by: Bryan Frimin <bryan@getprobo.com>
This commit is contained in:
Bryan Frimin
2025-12-02 15:01:09 +01:00
parent 6ba68ee830
commit ba4c229ef1
8 changed files with 447 additions and 0 deletions

View File

@@ -0,0 +1,61 @@
import type { INodeProperties, IExecuteFunctions, INodeExecutionData } from 'n8n-workflow';
import { proboApiRequest } from '../../GenericFunctions';
export const description: INodeProperties[] = [
{
displayName: 'Name',
name: 'name',
type: 'string',
displayOptions: {
show: {
resource: ['organization'],
operation: ['create'],
},
},
default: '',
description: 'The name of the organization',
required: true,
},
];
export async function execute(
this: IExecuteFunctions,
itemIndex: number,
): Promise<INodeExecutionData> {
const name = this.getNodeParameter('name', itemIndex) as string;
const query = `
mutation CreateOrganization($input: CreateOrganizationInput!) {
createOrganization(input: $input) {
organizationEdge {
node {
id
name
description
websiteUrl
email
headquarterAddress
logoUrl
horizontalLogoUrl
createdAt
updatedAt
}
}
}
}
`;
const variables = {
input: {
name,
},
};
const responseData = await proboApiRequest.call(this, query, variables);
return {
json: responseData,
pairedItem: { item: itemIndex },
};
}