Security: Sync from Public / sync-from-public (push) Has been cancelled
Test: Benchmark Nightly / build (push) Has been cancelled
Test: Benchmark Nightly / Notify Cats on failure (push) Has been cancelled
CI: Python / Checks (push) Has been cancelled
Test: Evals Python / Workflow Comparison Python (push) Has been cancelled
Util: Check Docs URLs / check-docs-urls (push) Has been cancelled
Test: Visual Storybook / Cloudflare Pages (push) Has been cancelled
Test: E2E Performance / build-and-test-performance (push) Has been cancelled
Test: Workflows Nightly / Run Workflow Tests (push) Has been cancelled
Util: Cleanup CI Docker Images / Delete stale CI images (push) Has been cancelled
Test: Benchmark Destroy Env / build (push) Has been cancelled
Util: Update Node Popularity / update-popularity (push) Has been cancelled
Test: E2E Coverage Weekly / Coverage Tests (push) Has been cancelled
80 lines
2.0 KiB
TypeScript
80 lines
2.0 KiB
TypeScript
import { NodeConnectionTypes, type INodeType, type INodeTypeDescription } from 'n8n-workflow';
|
|
|
|
import { searchAccounts, searchLocations, searchPosts, searchReviews } from './GenericFunctions';
|
|
import { postFields, postOperations } from './PostDescription';
|
|
import { reviewFields, reviewOperations } from './ReviewDescription';
|
|
|
|
export class GoogleBusinessProfile implements INodeType {
|
|
description: INodeTypeDescription = {
|
|
displayName: 'Google Business Profile',
|
|
name: 'googleBusinessProfile',
|
|
icon: 'file:googleBusinessProfile.svg',
|
|
group: ['input'],
|
|
version: 1,
|
|
subtitle: '={{$parameter["operation"] + ": " + $parameter["resource"]}}',
|
|
description: 'Consume Google Business Profile API',
|
|
schemaPath: 'Google/BusinessProfile',
|
|
defaults: {
|
|
name: 'Google Business Profile',
|
|
},
|
|
usableAsTool: true,
|
|
inputs: [NodeConnectionTypes.Main],
|
|
outputs: [NodeConnectionTypes.Main],
|
|
hints: [
|
|
{
|
|
message: 'Please select a parameter in the options to modify the post',
|
|
displayCondition:
|
|
'={{$parameter["resource"] === "post" && $parameter["operation"] === "update" && Object.keys($parameter["additionalOptions"]).length === 0}}',
|
|
whenToDisplay: 'always',
|
|
location: 'outputPane',
|
|
type: 'warning',
|
|
},
|
|
],
|
|
credentials: [
|
|
{
|
|
name: 'googleBusinessProfileOAuth2Api',
|
|
required: true,
|
|
},
|
|
],
|
|
requestDefaults: {
|
|
baseURL: 'https://mybusiness.googleapis.com/v4',
|
|
headers: {
|
|
Accept: 'application/json',
|
|
'Content-Type': 'application/json',
|
|
},
|
|
},
|
|
properties: [
|
|
{
|
|
displayName: 'Resource',
|
|
name: 'resource',
|
|
type: 'options',
|
|
noDataExpression: true,
|
|
options: [
|
|
{
|
|
name: 'Post',
|
|
value: 'post',
|
|
},
|
|
{
|
|
name: 'Review',
|
|
value: 'review',
|
|
},
|
|
],
|
|
default: 'post',
|
|
},
|
|
...postOperations,
|
|
...postFields,
|
|
...reviewOperations,
|
|
...reviewFields,
|
|
],
|
|
};
|
|
|
|
methods = {
|
|
listSearch: {
|
|
searchAccounts,
|
|
searchLocations,
|
|
searchReviews,
|
|
searchPosts,
|
|
},
|
|
};
|
|
}
|