v0.1
This commit is contained in:
@@ -1,61 +0,0 @@
|
||||
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',
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
];
|
||||
@@ -1,34 +0,0 @@
|
||||
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,
|
||||
];
|
||||
@@ -0,0 +1,26 @@
|
||||
import type { INodeProperties } from 'n8n-workflow';
|
||||
|
||||
const showOnlyForDistributionContentBookMetaV1 = {
|
||||
operation: ['contentBookMetaV1'],
|
||||
resource: ['distribution'],
|
||||
};
|
||||
|
||||
export const contentBookMetaV1Description: INodeProperties[] = [
|
||||
{
|
||||
displayName: '书籍 ID',
|
||||
name: 'bookId',
|
||||
type: 'string',
|
||||
required: true,
|
||||
default: '',
|
||||
displayOptions: {
|
||||
show: showOnlyForDistributionContentBookMetaV1,
|
||||
},
|
||||
routing: {
|
||||
send: {
|
||||
type: 'query',
|
||||
property: 'book_id',
|
||||
},
|
||||
},
|
||||
description: '要查询信息的书籍 ID',
|
||||
},
|
||||
];
|
||||
33
nodes/GwezzChangdunovel/resources/distribution/index.ts
Normal file
33
nodes/GwezzChangdunovel/resources/distribution/index.ts
Normal file
@@ -0,0 +1,33 @@
|
||||
import type { INodeProperties } from 'n8n-workflow';
|
||||
import { contentBookMetaV1Description } from './contentBooMetaV1';
|
||||
|
||||
const showOnlyForDistributions = {
|
||||
resource: ['distribution'],
|
||||
};
|
||||
|
||||
export const distributionDescription: INodeProperties[] = [
|
||||
{
|
||||
displayName: '操作',
|
||||
name: 'operation',
|
||||
type: 'options',
|
||||
noDataExpression: true,
|
||||
displayOptions: {
|
||||
show: showOnlyForDistributions,
|
||||
},
|
||||
options: [
|
||||
{
|
||||
name: '获取书籍信息',
|
||||
value: 'contentBookMetaV1',
|
||||
action: 'Get content book metadata',
|
||||
routing: {
|
||||
request: {
|
||||
method: 'GET',
|
||||
url: '/content/book_meta/v1/',
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
default: 'contentBookMetaV1',
|
||||
},
|
||||
...contentBookMetaV1Description,
|
||||
];
|
||||
@@ -1,26 +0,0 @@
|
||||
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',
|
||||
},
|
||||
},
|
||||
},
|
||||
];
|
||||
@@ -1,17 +0,0 @@
|
||||
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",
|
||||
},
|
||||
];
|
||||
@@ -1,60 +0,0 @@
|
||||
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