From 61796ab57da3ff84b1f6267d153b98dbe77d49e9 Mon Sep 17 00:00:00 2001 From: sshelgwezz Date: Thu, 30 Oct 2025 18:11:19 +0800 Subject: [PATCH] add resource --- .../GwezzOceanengineOAuth2Api.credentials.ts | 25 +++++++- .../GwezzOceanengine/GwezzOceanengine.node.ts | 4 -- .../resources/company/getAll.ts | 61 ------------------- .../resources/company/index.ts | 34 ----------- .../GwezzOceanengine/resources/user/create.ts | 26 -------- nodes/GwezzOceanengine/resources/user/get.ts | 17 ------ .../GwezzOceanengine/resources/user/index.ts | 60 ------------------ 7 files changed, 23 insertions(+), 204 deletions(-) delete mode 100644 nodes/GwezzOceanengine/resources/company/getAll.ts delete mode 100644 nodes/GwezzOceanengine/resources/company/index.ts delete mode 100644 nodes/GwezzOceanengine/resources/user/create.ts delete mode 100644 nodes/GwezzOceanengine/resources/user/get.ts delete mode 100644 nodes/GwezzOceanengine/resources/user/index.ts diff --git a/credentials/GwezzOceanengineOAuth2Api.credentials.ts b/credentials/GwezzOceanengineOAuth2Api.credentials.ts index 63f4cbc..0b04821 100644 --- a/credentials/GwezzOceanengineOAuth2Api.credentials.ts +++ b/credentials/GwezzOceanengineOAuth2Api.credentials.ts @@ -12,6 +12,27 @@ export class GwezzOceanengineOAuth2Api implements ICredentialType { documentationUrl = 'https://gitea.gwezz.com/n8n-nodes/n8n-nodes-gwezz-oceanengine/wiki'; properties: INodeProperties[] = [ + { + displayName: 'APP_ID', + name: 'appId', + type: 'string', + default: '', + }, + { + displayName: 'Secret', + name: 'secret', + type: 'string', + typeOptions: { + password: true, + }, + default: '', + }, + { + displayName: 'Redirect URI', + name: 'redirectUri', + type: 'hidden', + default: '={{$oauth2.redirectUrl}}', + }, { displayName: 'Grant Type', name: 'grantType', @@ -22,13 +43,13 @@ export class GwezzOceanengineOAuth2Api implements ICredentialType { displayName: 'Authorization URL', name: 'authUrl', type: 'hidden', - default: 'https://api.example.com/oauth/authorize', + default: 'https://ad.oceanengine.com/openapi/audit/oauth.html', }, { displayName: 'Access Token URL', name: 'accessTokenUrl', type: 'hidden', - default: 'https://api.example.com/oauth/token', + default: 'https://ad.oceanengine.com/open_api/oauth2/access_token/', }, { displayName: 'Auth URI Query Parameters', diff --git a/nodes/GwezzOceanengine/GwezzOceanengine.node.ts b/nodes/GwezzOceanengine/GwezzOceanengine.node.ts index a8c63f7..c835fe2 100644 --- a/nodes/GwezzOceanengine/GwezzOceanengine.node.ts +++ b/nodes/GwezzOceanengine/GwezzOceanengine.node.ts @@ -1,6 +1,4 @@ import { type INodeType, type INodeTypeDescription } from 'n8n-workflow'; -import { userDescription } from './resources/user'; -import { companyDescription } from './resources/company'; export class GwezzOceanengine implements INodeType { description: INodeTypeDescription = { @@ -36,8 +34,6 @@ export class GwezzOceanengine implements INodeType { ], default: 'user', }, - ...userDescription, - ...companyDescription, ], }; } diff --git a/nodes/GwezzOceanengine/resources/company/getAll.ts b/nodes/GwezzOceanengine/resources/company/getAll.ts deleted file mode 100644 index d67638a..0000000 --- a/nodes/GwezzOceanengine/resources/company/getAll.ts +++ /dev/null @@ -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', - }, - }, - }, - }, - }, -]; diff --git a/nodes/GwezzOceanengine/resources/company/index.ts b/nodes/GwezzOceanengine/resources/company/index.ts deleted file mode 100644 index 53267ed..0000000 --- a/nodes/GwezzOceanengine/resources/company/index.ts +++ /dev/null @@ -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, -]; diff --git a/nodes/GwezzOceanengine/resources/user/create.ts b/nodes/GwezzOceanengine/resources/user/create.ts deleted file mode 100644 index 7cfcf15..0000000 --- a/nodes/GwezzOceanengine/resources/user/create.ts +++ /dev/null @@ -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', - }, - }, - }, -]; diff --git a/nodes/GwezzOceanengine/resources/user/get.ts b/nodes/GwezzOceanengine/resources/user/get.ts deleted file mode 100644 index e73681f..0000000 --- a/nodes/GwezzOceanengine/resources/user/get.ts +++ /dev/null @@ -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", - }, -]; diff --git a/nodes/GwezzOceanengine/resources/user/index.ts b/nodes/GwezzOceanengine/resources/user/index.ts deleted file mode 100644 index 954130e..0000000 --- a/nodes/GwezzOceanengine/resources/user/index.ts +++ /dev/null @@ -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, -];