2024-08-29 06:55:53 -07:00
|
|
|
import { NodeConnectionType, type INodeType, type INodeTypeDescription } from 'n8n-workflow';
|
2022-07-04 13:47:50 -07:00
|
|
|
|
2022-08-17 08:50:24 -07:00
|
|
|
import { campaignFields, campaignOperations } from './CampaignDescription';
|
2022-07-04 13:47:50 -07:00
|
|
|
|
|
|
|
export class GoogleAds implements INodeType {
|
|
|
|
description: INodeTypeDescription = {
|
|
|
|
displayName: 'Google Ads',
|
|
|
|
name: 'googleAds',
|
|
|
|
icon: 'file:googleAds.svg',
|
|
|
|
group: ['transform'],
|
|
|
|
version: 1,
|
|
|
|
subtitle: '={{$parameter["operation"] + ": " + $parameter["resource"]}}',
|
|
|
|
description: 'Use the Google Ads API',
|
|
|
|
defaults: {
|
|
|
|
name: 'Google Ads',
|
|
|
|
},
|
2024-08-29 06:55:53 -07:00
|
|
|
inputs: [NodeConnectionType.Main],
|
|
|
|
outputs: [NodeConnectionType.Main],
|
2022-07-04 13:47:50 -07:00
|
|
|
credentials: [
|
|
|
|
{
|
|
|
|
name: 'googleAdsOAuth2Api',
|
|
|
|
required: true,
|
|
|
|
testedBy: {
|
|
|
|
request: {
|
|
|
|
method: 'GET',
|
2024-10-14 06:13:15 -07:00
|
|
|
url: '/v17/customers:listAccessibleCustomers',
|
2022-07-04 13:47:50 -07:00
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
],
|
|
|
|
requestDefaults: {
|
|
|
|
returnFullResponse: true,
|
|
|
|
baseURL: 'https://googleads.googleapis.com',
|
|
|
|
headers: {
|
|
|
|
'developer-token': '={{$credentials.developerToken}}',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
properties: [
|
|
|
|
{
|
|
|
|
displayName: 'Resource',
|
|
|
|
name: 'resource',
|
|
|
|
type: 'options',
|
|
|
|
noDataExpression: true,
|
|
|
|
options: [
|
|
|
|
{
|
|
|
|
name: 'Campaign',
|
|
|
|
value: 'campaign',
|
|
|
|
},
|
|
|
|
],
|
|
|
|
default: 'campaign',
|
|
|
|
},
|
|
|
|
//-------------------------------
|
|
|
|
// Campaign Operations
|
|
|
|
//-------------------------------
|
|
|
|
...campaignOperations,
|
|
|
|
{
|
2022-08-17 08:50:24 -07:00
|
|
|
displayName:
|
|
|
|
'Divide field names expressed with <i>micros</i> by 1,000,000 to get the actual value',
|
2022-07-04 13:47:50 -07:00
|
|
|
name: 'campaigsNotice',
|
|
|
|
type: 'notice',
|
|
|
|
default: '',
|
|
|
|
displayOptions: {
|
|
|
|
show: {
|
2022-08-17 08:50:24 -07:00
|
|
|
resource: ['campaign'],
|
2022-07-04 13:47:50 -07:00
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
...campaignFields,
|
|
|
|
],
|
|
|
|
};
|
|
|
|
}
|