mirror of
https://github.com/n8n-io/n8n.git
synced 2024-11-16 09:34:07 -08:00
088daf952e
* Add basic layout with icon for Google Ads * Add node versioning(V1) * Add node and credential to package * Add basic layout with icon for Google Ads * Add node versioning(V1) * Add node and credential to package * Add api call to getall * Fix formdata in the body for the request * N8N-2928 Added custom queries to campaign * Fix header bug and add developer-token field * Add operation and fields to campaign new format * Add more configurations and queries * Add Invoice ressources and operations * Remov old version from the node * Fixed bud with typo * Correctly prepends the baseURL * add query to invocie request * Fixes header not parsing the expression * Invoice param changes * Fixes bug related to headers not being parsed, and bug with auth * Remove useless imports * Added analytics to google ad node and removed useless header * Removed url for testing * Fixed inconsistent behaviour with the access token not being refreshed * Added placeholders to help user * Removed useless comments * Resolved name confusion * Added support for body in a GET method * Removed hyphens, parse body's expression * Renamed operation for clarity * Remove unused code * Removed invoice resource and fixed bug with body and headers The invoice operation was removed since it does not reflect what a user would expect from it. Google ADS invoices are only used for big advertisers where invoicing is performed after the end of the month and for big sums. This would be misleading for the majority of the users expecting an expenses report. Also fixed a bug with header and body being sent since it was broken for multiple input rows. The first execution would override all others. Lastly, made some improvements to the node itself by transforming data, adding filters and operations. * Improve campagin operation and remove analytics; fix tests * Improve tooltips and descriptions * Fix lint issues * Improve tooltip to explain amounts in micros * Change wording for micros * Change the fix to a more elegant solution Co-authored-by: Cyril Gobrecht <cyril.gobrecht@gmail.com> Co-authored-by: Aël Gobrecht <ael.gobrecht@gmail.com>
80 lines
1.6 KiB
TypeScript
80 lines
1.6 KiB
TypeScript
import {
|
|
INodeType,
|
|
INodeTypeDescription,
|
|
} from 'n8n-workflow';
|
|
|
|
import {
|
|
campaignFields,
|
|
campaignOperations,
|
|
} from './CampaignDescription';
|
|
|
|
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',
|
|
color: '#ff0000',
|
|
},
|
|
inputs: ['main'],
|
|
outputs: ['main'],
|
|
credentials: [
|
|
{
|
|
name: 'googleAdsOAuth2Api',
|
|
required: true,
|
|
testedBy: {
|
|
request: {
|
|
method: 'GET',
|
|
url: '/v9/customers:listAccessibleCustomers',
|
|
},
|
|
},
|
|
},
|
|
],
|
|
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,
|
|
{
|
|
displayName: 'Divide field names expressed with <i>micros</i> by 1,000,000 to get the actual value',
|
|
name: 'campaigsNotice',
|
|
type: 'notice',
|
|
default: '',
|
|
displayOptions: {
|
|
show: {
|
|
resource: [
|
|
'campaign',
|
|
],
|
|
},
|
|
},
|
|
},
|
|
...campaignFields,
|
|
],
|
|
};
|
|
}
|