first commit
This commit is contained in:
18
nodes/GwezzChangdunovel/GwezzChangdunovel.node.json
Normal file
18
nodes/GwezzChangdunovel/GwezzChangdunovel.node.json
Normal file
@@ -0,0 +1,18 @@
|
||||
{
|
||||
"node": "n8n-nodes-gwezz-changdunovel",
|
||||
"nodeVersion": "1.0",
|
||||
"codexVersion": "1.0",
|
||||
"categories": ["Development", "Developer Tools"],
|
||||
"resources": {
|
||||
"credentialDocumentation": [
|
||||
{
|
||||
"url": "https://github.com/org/repo?tab=readme-ov-file#credentials"
|
||||
}
|
||||
],
|
||||
"primaryDocumentation": [
|
||||
{
|
||||
"url": "https://github.com/org/repo?tab=readme-ov-file"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
50
nodes/GwezzChangdunovel/GwezzChangdunovel.node.ts
Normal file
50
nodes/GwezzChangdunovel/GwezzChangdunovel.node.ts
Normal file
@@ -0,0 +1,50 @@
|
||||
import { NodeConnectionType, type INodeType, type INodeTypeDescription } from 'n8n-workflow';
|
||||
import { userDescription } from './resources/user';
|
||||
import { companyDescription } from './resources/company';
|
||||
|
||||
export class GwezzChangdunovel implements INodeType {
|
||||
description: INodeTypeDescription = {
|
||||
displayName: 'Gwezz Changdunovel',
|
||||
name: 'gwezzChangdunovel',
|
||||
icon: { light: 'file:gwezzChangdunovel.svg', dark: 'file:gwezzChangdunovel.dark.svg' },
|
||||
group: ['transform'],
|
||||
version: 1,
|
||||
subtitle: '={{$parameter["operation"] + ": " + $parameter["resource"]}}',
|
||||
description: 'Interact with the Gwezz Changdunovel API',
|
||||
defaults: {
|
||||
name: 'Gwezz Changdunovel',
|
||||
},
|
||||
usableAsTool: true,
|
||||
inputs: [NodeConnectionType.Main],
|
||||
outputs: [NodeConnectionType.Main],
|
||||
credentials: [],
|
||||
requestDefaults: {
|
||||
baseURL: 'https://www.changdunovel.com/novelsale/openapi',
|
||||
headers: {
|
||||
Accept: 'application/json',
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
},
|
||||
properties: [
|
||||
{
|
||||
displayName: 'Resource',
|
||||
name: 'resource',
|
||||
type: 'options',
|
||||
noDataExpression: true,
|
||||
options: [
|
||||
{
|
||||
name: 'User',
|
||||
value: 'user',
|
||||
},
|
||||
{
|
||||
name: 'Company',
|
||||
value: 'company',
|
||||
},
|
||||
],
|
||||
default: 'user',
|
||||
},
|
||||
...userDescription,
|
||||
...companyDescription,
|
||||
],
|
||||
};
|
||||
}
|
||||
13
nodes/GwezzChangdunovel/gwezzChangdunovel.dark.svg
Normal file
13
nodes/GwezzChangdunovel/gwezzChangdunovel.dark.svg
Normal file
@@ -0,0 +1,13 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="aquamarine"
|
||||
stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-cpu">
|
||||
<rect x="4" y="4" width="16" height="16" rx="2" ry="2"></rect>
|
||||
<rect x="9" y="9" width="6" height="6"></rect>
|
||||
<line x1="9" y1="1" x2="9" y2="4"></line>
|
||||
<line x1="15" y1="1" x2="15" y2="4"></line>
|
||||
<line x1="9" y1="20" x2="9" y2="23"></line>
|
||||
<line x1="15" y1="20" x2="15" y2="23"></line>
|
||||
<line x1="20" y1="9" x2="23" y2="9"></line>
|
||||
<line x1="20" y1="14" x2="23" y2="14"></line>
|
||||
<line x1="1" y1="9" x2="4" y2="9"></line>
|
||||
<line x1="1" y1="14" x2="4" y2="14"></line>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 698 B |
13
nodes/GwezzChangdunovel/gwezzChangdunovel.svg
Normal file
13
nodes/GwezzChangdunovel/gwezzChangdunovel.svg
Normal file
@@ -0,0 +1,13 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="darkblue"
|
||||
stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-cpu">
|
||||
<rect x="4" y="4" width="16" height="16" rx="2" ry="2"></rect>
|
||||
<rect x="9" y="9" width="6" height="6"></rect>
|
||||
<line x1="9" y1="1" x2="9" y2="4"></line>
|
||||
<line x1="15" y1="1" x2="15" y2="4"></line>
|
||||
<line x1="9" y1="20" x2="9" y2="23"></line>
|
||||
<line x1="15" y1="20" x2="15" y2="23"></line>
|
||||
<line x1="20" y1="9" x2="23" y2="9"></line>
|
||||
<line x1="20" y1="14" x2="23" y2="14"></line>
|
||||
<line x1="1" y1="9" x2="4" y2="9"></line>
|
||||
<line x1="1" y1="14" x2="4" y2="14"></line>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 696 B |
61
nodes/GwezzChangdunovel/resources/company/getAll.ts
Normal file
61
nodes/GwezzChangdunovel/resources/company/getAll.ts
Normal file
@@ -0,0 +1,61 @@
|
||||
import type { INodeProperties } from 'n8n-workflow';
|
||||
|
||||
const showOnlyForCompanyGetMany = {
|
||||
operation: ['getAll'],
|
||||
resource: ['company'],
|
||||
};
|
||||
|
||||
export const companyGetManyDescription: INodeProperties[] = [
|
||||
{
|
||||
displayName: 'Limit',
|
||||
name: 'limit',
|
||||
type: 'number',
|
||||
displayOptions: {
|
||||
show: {
|
||||
...showOnlyForCompanyGetMany,
|
||||
returnAll: [false],
|
||||
},
|
||||
},
|
||||
typeOptions: {
|
||||
minValue: 1,
|
||||
maxValue: 100,
|
||||
},
|
||||
default: 50,
|
||||
routing: {
|
||||
send: {
|
||||
type: 'query',
|
||||
property: 'limit',
|
||||
},
|
||||
output: {
|
||||
maxResults: '={{$value}}',
|
||||
},
|
||||
},
|
||||
description: 'Max number of results to return',
|
||||
},
|
||||
{
|
||||
displayName: 'Return All',
|
||||
name: 'returnAll',
|
||||
type: 'boolean',
|
||||
displayOptions: {
|
||||
show: showOnlyForCompanyGetMany,
|
||||
},
|
||||
default: false,
|
||||
description: 'Whether to return all results or only up to a given limit',
|
||||
routing: {
|
||||
send: {
|
||||
paginate: '={{ $value }}',
|
||||
},
|
||||
operations: {
|
||||
pagination: {
|
||||
type: 'offset',
|
||||
properties: {
|
||||
limitParameter: 'limit',
|
||||
offsetParameter: 'offset',
|
||||
pageSize: 100,
|
||||
type: 'query',
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
];
|
||||
34
nodes/GwezzChangdunovel/resources/company/index.ts
Normal file
34
nodes/GwezzChangdunovel/resources/company/index.ts
Normal file
@@ -0,0 +1,34 @@
|
||||
import type { INodeProperties } from 'n8n-workflow';
|
||||
import { companyGetManyDescription } from './getAll';
|
||||
|
||||
const showOnlyForCompanies = {
|
||||
resource: ['company'],
|
||||
};
|
||||
|
||||
export const companyDescription: INodeProperties[] = [
|
||||
{
|
||||
displayName: 'Operation',
|
||||
name: 'operation',
|
||||
type: 'options',
|
||||
noDataExpression: true,
|
||||
displayOptions: {
|
||||
show: showOnlyForCompanies,
|
||||
},
|
||||
options: [
|
||||
{
|
||||
name: 'Get Many',
|
||||
value: 'getAll',
|
||||
action: 'Get companies',
|
||||
description: 'Get companies',
|
||||
routing: {
|
||||
request: {
|
||||
method: 'GET',
|
||||
url: '/companies',
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
default: 'getAll',
|
||||
},
|
||||
...companyGetManyDescription,
|
||||
];
|
||||
26
nodes/GwezzChangdunovel/resources/user/create.ts
Normal file
26
nodes/GwezzChangdunovel/resources/user/create.ts
Normal file
@@ -0,0 +1,26 @@
|
||||
import type { INodeProperties } from 'n8n-workflow';
|
||||
|
||||
const showOnlyForUserCreate = {
|
||||
operation: ['create'],
|
||||
resource: ['user'],
|
||||
};
|
||||
|
||||
export const userCreateDescription: INodeProperties[] = [
|
||||
{
|
||||
displayName: 'Name',
|
||||
name: 'name',
|
||||
type: 'string',
|
||||
default: '',
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: showOnlyForUserCreate,
|
||||
},
|
||||
description: 'The name of the user',
|
||||
routing: {
|
||||
send: {
|
||||
type: 'body',
|
||||
property: 'name',
|
||||
},
|
||||
},
|
||||
},
|
||||
];
|
||||
17
nodes/GwezzChangdunovel/resources/user/get.ts
Normal file
17
nodes/GwezzChangdunovel/resources/user/get.ts
Normal file
@@ -0,0 +1,17 @@
|
||||
import type { INodeProperties } from 'n8n-workflow';
|
||||
|
||||
const showOnlyForUserGet = {
|
||||
operation: ['get'],
|
||||
resource: ['user'],
|
||||
};
|
||||
|
||||
export const userGetDescription: INodeProperties[] = [
|
||||
{
|
||||
displayName: 'User ID',
|
||||
name: 'userId',
|
||||
type: 'string',
|
||||
displayOptions: { show: showOnlyForUserGet },
|
||||
default: '',
|
||||
description: "The user's ID to retrieve",
|
||||
},
|
||||
];
|
||||
60
nodes/GwezzChangdunovel/resources/user/index.ts
Normal file
60
nodes/GwezzChangdunovel/resources/user/index.ts
Normal file
@@ -0,0 +1,60 @@
|
||||
import type { INodeProperties } from 'n8n-workflow';
|
||||
import { userCreateDescription } from './create';
|
||||
import { userGetDescription } from './get';
|
||||
|
||||
const showOnlyForUsers = {
|
||||
resource: ['user'],
|
||||
};
|
||||
|
||||
export const userDescription: INodeProperties[] = [
|
||||
{
|
||||
displayName: 'Operation',
|
||||
name: 'operation',
|
||||
type: 'options',
|
||||
noDataExpression: true,
|
||||
displayOptions: {
|
||||
show: showOnlyForUsers,
|
||||
},
|
||||
options: [
|
||||
{
|
||||
name: 'Get Many',
|
||||
value: 'getAll',
|
||||
action: 'Get users',
|
||||
description: 'Get many users',
|
||||
routing: {
|
||||
request: {
|
||||
method: 'GET',
|
||||
url: '/users',
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
name: 'Get',
|
||||
value: 'get',
|
||||
action: 'Get a user',
|
||||
description: 'Get the data of a single user',
|
||||
routing: {
|
||||
request: {
|
||||
method: 'GET',
|
||||
url: '=/users/{{$parameter.userId}}',
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
name: 'Create',
|
||||
value: 'create',
|
||||
action: 'Create a new user',
|
||||
description: 'Create a new user',
|
||||
routing: {
|
||||
request: {
|
||||
method: 'POST',
|
||||
url: '/users',
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
default: 'getAll',
|
||||
},
|
||||
...userGetDescription,
|
||||
...userCreateDescription,
|
||||
];
|
||||
Reference in New Issue
Block a user