@heines/n8n-nodes-pax8 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -0
- package/dist/credentials/Pax8OAuth2Api.credentials.d.ts +6 -0
- package/dist/credentials/Pax8OAuth2Api.credentials.js +15 -0
- package/dist/index.d.ts +27 -0
- package/dist/index.js +66 -0
- package/dist/nodes/Pax8AccessToken.node.d.ts +7 -0
- package/dist/nodes/Pax8AccessToken.node.js +33 -0
- package/dist/nodes/Pax8Companies.node.d.ts +7 -0
- package/dist/nodes/Pax8Companies.node.js +33 -0
- package/dist/nodes/Pax8Contacts.node.d.ts +7 -0
- package/dist/nodes/Pax8Contacts.node.js +33 -0
- package/dist/nodes/Pax8Invoices.node.d.ts +7 -0
- package/dist/nodes/Pax8Invoices.node.js +33 -0
- package/dist/nodes/Pax8Libraryattachments.node.d.ts +7 -0
- package/dist/nodes/Pax8Libraryattachments.node.js +33 -0
- package/dist/nodes/Pax8Orders.node.d.ts +7 -0
- package/dist/nodes/Pax8Orders.node.js +33 -0
- package/dist/nodes/Pax8Preferenceattachments.node.d.ts +7 -0
- package/dist/nodes/Pax8Preferenceattachments.node.js +33 -0
- package/dist/nodes/Pax8Products.node.d.ts +7 -0
- package/dist/nodes/Pax8Products.node.js +33 -0
- package/dist/nodes/Pax8ProvisionAttempts.node.d.ts +7 -0
- package/dist/nodes/Pax8ProvisionAttempts.node.js +33 -0
- package/dist/nodes/Pax8ProvisionDetails.node.d.ts +7 -0
- package/dist/nodes/Pax8ProvisionDetails.node.js +33 -0
- package/dist/nodes/Pax8ProvisionRequests.node.d.ts +7 -0
- package/dist/nodes/Pax8ProvisionRequests.node.js +33 -0
- package/dist/nodes/Pax8ProvisionResults.node.d.ts +7 -0
- package/dist/nodes/Pax8ProvisionResults.node.js +33 -0
- package/dist/nodes/Pax8Provisioners.node.d.ts +7 -0
- package/dist/nodes/Pax8Provisioners.node.js +33 -0
- package/dist/nodes/Pax8ProvisioningSimulations.node.d.ts +7 -0
- package/dist/nodes/Pax8ProvisioningSimulations.node.js +33 -0
- package/dist/nodes/Pax8Quoteaccesslist.node.d.ts +7 -0
- package/dist/nodes/Pax8Quoteaccesslist.node.js +33 -0
- package/dist/nodes/Pax8Quoteattachments.node.d.ts +7 -0
- package/dist/nodes/Pax8Quoteattachments.node.js +33 -0
- package/dist/nodes/Pax8Quotelineitems.node.d.ts +7 -0
- package/dist/nodes/Pax8Quotelineitems.node.js +33 -0
- package/dist/nodes/Pax8Quotepreferences.node.d.ts +7 -0
- package/dist/nodes/Pax8Quotepreferences.node.js +33 -0
- package/dist/nodes/Pax8Quotes.node.d.ts +7 -0
- package/dist/nodes/Pax8Quotes.node.js +33 -0
- package/dist/nodes/Pax8Quotesections.node.d.ts +7 -0
- package/dist/nodes/Pax8Quotesections.node.js +33 -0
- package/dist/nodes/Pax8Subscriptions.node.d.ts +7 -0
- package/dist/nodes/Pax8Subscriptions.node.js +33 -0
- package/dist/nodes/Pax8TopicDefinitions.node.d.ts +7 -0
- package/dist/nodes/Pax8TopicDefinitions.node.js +33 -0
- package/dist/nodes/Pax8UsageLines.node.d.ts +7 -0
- package/dist/nodes/Pax8UsageLines.node.js +33 -0
- package/dist/nodes/Pax8UsageSummaries.node.d.ts +7 -0
- package/dist/nodes/Pax8UsageSummaries.node.js +33 -0
- package/dist/nodes/Pax8WebhookLogs.node.d.ts +7 -0
- package/dist/nodes/Pax8WebhookLogs.node.js +33 -0
- package/dist/nodes/Pax8Webhooks.node.d.ts +7 -0
- package/dist/nodes/Pax8Webhooks.node.js +33 -0
- package/package.json +55 -0
- package/src/credentials/Pax8OAuth2Api.credentials.ts +11 -0
- package/src/index.ts +27 -0
- package/src/nodes/Pax8AccessToken.node.ts +27 -0
- package/src/nodes/Pax8Companies.node.ts +27 -0
- package/src/nodes/Pax8Contacts.node.ts +27 -0
- package/src/nodes/Pax8Invoices.node.ts +27 -0
- package/src/nodes/Pax8Libraryattachments.node.ts +27 -0
- package/src/nodes/Pax8Orders.node.ts +27 -0
- package/src/nodes/Pax8Preferenceattachments.node.ts +27 -0
- package/src/nodes/Pax8Products.node.ts +27 -0
- package/src/nodes/Pax8ProvisionAttempts.node.ts +27 -0
- package/src/nodes/Pax8ProvisionDetails.node.ts +27 -0
- package/src/nodes/Pax8ProvisionRequests.node.ts +27 -0
- package/src/nodes/Pax8ProvisionResults.node.ts +27 -0
- package/src/nodes/Pax8Provisioners.node.ts +27 -0
- package/src/nodes/Pax8ProvisioningSimulations.node.ts +27 -0
- package/src/nodes/Pax8Quoteaccesslist.node.ts +27 -0
- package/src/nodes/Pax8Quoteattachments.node.ts +27 -0
- package/src/nodes/Pax8Quotelineitems.node.ts +27 -0
- package/src/nodes/Pax8Quotepreferences.node.ts +27 -0
- package/src/nodes/Pax8Quotes.node.ts +27 -0
- package/src/nodes/Pax8Quotesections.node.ts +27 -0
- package/src/nodes/Pax8Subscriptions.node.ts +27 -0
- package/src/nodes/Pax8TopicDefinitions.node.ts +27 -0
- package/src/nodes/Pax8UsageLines.node.ts +27 -0
- package/src/nodes/Pax8UsageSummaries.node.ts +27 -0
- package/src/nodes/Pax8WebhookLogs.node.ts +27 -0
- package/src/nodes/Pax8Webhooks.node.ts +27 -0
- package/tsconfig.json +13 -0
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
|
|
2
|
+
import axios from 'axios';
|
|
3
|
+
import qs from 'qs';
|
|
4
|
+
import { IExecuteFunctions } from 'n8n-workflow';
|
|
5
|
+
import { INodeType, INodeTypeDescription } from 'n8n-workflow';
|
|
6
|
+
export class Pax8Quotelineitems implements INodeType {
|
|
7
|
+
description: INodeTypeDescription = {
|
|
8
|
+
displayName:'Pax8 Quote line items', name:'pax8Quotelineitems', group:['transform'], version:1,
|
|
9
|
+
description:'Pax8 Quote line items', defaults:{name:'Pax8 Quote line items'}, inputs:['main'], outputs:['main'],
|
|
10
|
+
credentials:[{name:'pax8OAuth2Api', required:true}],
|
|
11
|
+
properties:[{displayName:'Operation', name:'operation', type:'options', options:[{"name": "POST /v2/quotes/{quoteId}/line-items", "value": "post:/v2/quotes/{quoteId}/line-items"}, {"name": "PUT /v2/quotes/{quoteId}/line-items", "value": "put:/v2/quotes/{quoteId}/line-items"}, {"name": "POST /v2/quotes/{quoteId}/line-items/bulk-delete", "value": "post:/v2/quotes/{quoteId}/line-items/bulk-delete"}, {"name": "DELETE /v2/quotes/{quoteId}/line-items/{lineItemId}", "value": "delete:/v2/quotes/{quoteId}/line-items/{lineItemId}"}], default:''}]
|
|
12
|
+
};
|
|
13
|
+
async getAccessToken(creds:any){
|
|
14
|
+
const data = qs.stringify({grant_type:'client_credentials', client_id:creds.clientId, client_secret:creds.clientSecret, scope:creds.scope});
|
|
15
|
+
const res = await axios.post('https://api.pax8.com/auth/connect/token', data, {headers:{'Content-Type':'application/x-www-form-urlencoded'}});
|
|
16
|
+
return res.data.access_token;
|
|
17
|
+
}
|
|
18
|
+
async execute(this:IExecuteFunctions){
|
|
19
|
+
const op=this.getNodeParameter('operation',0) as string;
|
|
20
|
+
const [method,path]=op.split(':');
|
|
21
|
+
const creds=await this.getCredentials('pax8OAuth2Api');
|
|
22
|
+
const token=await this.getAccessToken(creds);
|
|
23
|
+
const url='https://api.pax8.com'+path;
|
|
24
|
+
const res=await axios({method,url,headers:{Authorization:`Bearer ${token }`}});
|
|
25
|
+
return [this.helpers.returnJsonArray(res.data)];
|
|
26
|
+
}
|
|
27
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
|
|
2
|
+
import axios from 'axios';
|
|
3
|
+
import qs from 'qs';
|
|
4
|
+
import { IExecuteFunctions } from 'n8n-workflow';
|
|
5
|
+
import { INodeType, INodeTypeDescription } from 'n8n-workflow';
|
|
6
|
+
export class Pax8Quotepreferences implements INodeType {
|
|
7
|
+
description: INodeTypeDescription = {
|
|
8
|
+
displayName:'Pax8 Quote preferences', name:'pax8Quotepreferences', group:['transform'], version:1,
|
|
9
|
+
description:'Pax8 Quote preferences', defaults:{name:'Pax8 Quote preferences'}, inputs:['main'], outputs:['main'],
|
|
10
|
+
credentials:[{name:'pax8OAuth2Api', required:true}],
|
|
11
|
+
properties:[{displayName:'Operation', name:'operation', type:'options', options:[{"name": "GET /v2/quote-preferences", "value": "get:/v2/quote-preferences"}, {"name": "PUT /v2/quote-preferences", "value": "put:/v2/quote-preferences"}], default:''}]
|
|
12
|
+
};
|
|
13
|
+
async getAccessToken(creds:any){
|
|
14
|
+
const data = qs.stringify({grant_type:'client_credentials', client_id:creds.clientId, client_secret:creds.clientSecret, scope:creds.scope});
|
|
15
|
+
const res = await axios.post('https://api.pax8.com/auth/connect/token', data, {headers:{'Content-Type':'application/x-www-form-urlencoded'}});
|
|
16
|
+
return res.data.access_token;
|
|
17
|
+
}
|
|
18
|
+
async execute(this:IExecuteFunctions){
|
|
19
|
+
const op=this.getNodeParameter('operation',0) as string;
|
|
20
|
+
const [method,path]=op.split(':');
|
|
21
|
+
const creds=await this.getCredentials('pax8OAuth2Api');
|
|
22
|
+
const token=await this.getAccessToken(creds);
|
|
23
|
+
const url='https://api.pax8.com'+path;
|
|
24
|
+
const res=await axios({method,url,headers:{Authorization:`Bearer ${token }`}});
|
|
25
|
+
return [this.helpers.returnJsonArray(res.data)];
|
|
26
|
+
}
|
|
27
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
|
|
2
|
+
import axios from 'axios';
|
|
3
|
+
import qs from 'qs';
|
|
4
|
+
import { IExecuteFunctions } from 'n8n-workflow';
|
|
5
|
+
import { INodeType, INodeTypeDescription } from 'n8n-workflow';
|
|
6
|
+
export class Pax8Quotes implements INodeType {
|
|
7
|
+
description: INodeTypeDescription = {
|
|
8
|
+
displayName:'Pax8 Quotes', name:'pax8Quotes', group:['transform'], version:1,
|
|
9
|
+
description:'Pax8 Quotes', defaults:{name:'Pax8 Quotes'}, inputs:['main'], outputs:['main'],
|
|
10
|
+
credentials:[{name:'pax8OAuth2Api', required:true}],
|
|
11
|
+
properties:[{displayName:'Operation', name:'operation', type:'options', options:[{"name": "GET /v2/quotes", "value": "get:/v2/quotes"}, {"name": "POST /v2/quotes", "value": "post:/v2/quotes"}, {"name": "DELETE /v2/quotes/{quoteId}", "value": "delete:/v2/quotes/{quoteId}"}, {"name": "GET /v2/quotes/{quoteId}", "value": "get:/v2/quotes/{quoteId}"}, {"name": "PUT /v2/quotes/{quoteId}", "value": "put:/v2/quotes/{quoteId}"}], default:''}]
|
|
12
|
+
};
|
|
13
|
+
async getAccessToken(creds:any){
|
|
14
|
+
const data = qs.stringify({grant_type:'client_credentials', client_id:creds.clientId, client_secret:creds.clientSecret, scope:creds.scope});
|
|
15
|
+
const res = await axios.post('https://api.pax8.com/auth/connect/token', data, {headers:{'Content-Type':'application/x-www-form-urlencoded'}});
|
|
16
|
+
return res.data.access_token;
|
|
17
|
+
}
|
|
18
|
+
async execute(this:IExecuteFunctions){
|
|
19
|
+
const op=this.getNodeParameter('operation',0) as string;
|
|
20
|
+
const [method,path]=op.split(':');
|
|
21
|
+
const creds=await this.getCredentials('pax8OAuth2Api');
|
|
22
|
+
const token=await this.getAccessToken(creds);
|
|
23
|
+
const url='https://api.pax8.com'+path;
|
|
24
|
+
const res=await axios({method,url,headers:{Authorization:`Bearer ${token }`}});
|
|
25
|
+
return [this.helpers.returnJsonArray(res.data)];
|
|
26
|
+
}
|
|
27
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
|
|
2
|
+
import axios from 'axios';
|
|
3
|
+
import qs from 'qs';
|
|
4
|
+
import { IExecuteFunctions } from 'n8n-workflow';
|
|
5
|
+
import { INodeType, INodeTypeDescription } from 'n8n-workflow';
|
|
6
|
+
export class Pax8Quotesections implements INodeType {
|
|
7
|
+
description: INodeTypeDescription = {
|
|
8
|
+
displayName:'Pax8 Quote sections', name:'pax8Quotesections', group:['transform'], version:1,
|
|
9
|
+
description:'Pax8 Quote sections', defaults:{name:'Pax8 Quote sections'}, inputs:['main'], outputs:['main'],
|
|
10
|
+
credentials:[{name:'pax8OAuth2Api', required:true}],
|
|
11
|
+
properties:[{displayName:'Operation', name:'operation', type:'options', options:[{"name": "GET /v2/quotes/{quoteId}/sections", "value": "get:/v2/quotes/{quoteId}/sections"}, {"name": "POST /v2/quotes/{quoteId}/sections", "value": "post:/v2/quotes/{quoteId}/sections"}, {"name": "PUT /v2/quotes/{quoteId}/sections", "value": "put:/v2/quotes/{quoteId}/sections"}], default:''}]
|
|
12
|
+
};
|
|
13
|
+
async getAccessToken(creds:any){
|
|
14
|
+
const data = qs.stringify({grant_type:'client_credentials', client_id:creds.clientId, client_secret:creds.clientSecret, scope:creds.scope});
|
|
15
|
+
const res = await axios.post('https://api.pax8.com/auth/connect/token', data, {headers:{'Content-Type':'application/x-www-form-urlencoded'}});
|
|
16
|
+
return res.data.access_token;
|
|
17
|
+
}
|
|
18
|
+
async execute(this:IExecuteFunctions){
|
|
19
|
+
const op=this.getNodeParameter('operation',0) as string;
|
|
20
|
+
const [method,path]=op.split(':');
|
|
21
|
+
const creds=await this.getCredentials('pax8OAuth2Api');
|
|
22
|
+
const token=await this.getAccessToken(creds);
|
|
23
|
+
const url='https://api.pax8.com'+path;
|
|
24
|
+
const res=await axios({method,url,headers:{Authorization:`Bearer ${token }`}});
|
|
25
|
+
return [this.helpers.returnJsonArray(res.data)];
|
|
26
|
+
}
|
|
27
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
|
|
2
|
+
import axios from 'axios';
|
|
3
|
+
import qs from 'qs';
|
|
4
|
+
import { IExecuteFunctions } from 'n8n-workflow';
|
|
5
|
+
import { INodeType, INodeTypeDescription } from 'n8n-workflow';
|
|
6
|
+
export class Pax8Subscriptions implements INodeType {
|
|
7
|
+
description: INodeTypeDescription = {
|
|
8
|
+
displayName:'Pax8 Subscriptions', name:'pax8Subscriptions', group:['transform'], version:1,
|
|
9
|
+
description:'Pax8 Subscriptions', defaults:{name:'Pax8 Subscriptions'}, inputs:['main'], outputs:['main'],
|
|
10
|
+
credentials:[{name:'pax8OAuth2Api', required:true}],
|
|
11
|
+
properties:[{displayName:'Operation', name:'operation', type:'options', options:[{"name": "GET /subscriptions", "value": "get:/subscriptions"}, {"name": "GET /subscriptions/{subscriptionId}", "value": "get:/subscriptions/{subscriptionId}"}, {"name": "PUT /subscriptions/{subscriptionId}", "value": "put:/subscriptions/{subscriptionId}"}, {"name": "DELETE /subscriptions/{subscriptionId}", "value": "delete:/subscriptions/{subscriptionId}"}, {"name": "GET /subscriptions/{subscriptionId}/history", "value": "get:/subscriptions/{subscriptionId}/history"}], default:''}]
|
|
12
|
+
};
|
|
13
|
+
async getAccessToken(creds:any){
|
|
14
|
+
const data = qs.stringify({grant_type:'client_credentials', client_id:creds.clientId, client_secret:creds.clientSecret, scope:creds.scope});
|
|
15
|
+
const res = await axios.post('https://api.pax8.com/auth/connect/token', data, {headers:{'Content-Type':'application/x-www-form-urlencoded'}});
|
|
16
|
+
return res.data.access_token;
|
|
17
|
+
}
|
|
18
|
+
async execute(this:IExecuteFunctions){
|
|
19
|
+
const op=this.getNodeParameter('operation',0) as string;
|
|
20
|
+
const [method,path]=op.split(':');
|
|
21
|
+
const creds=await this.getCredentials('pax8OAuth2Api');
|
|
22
|
+
const token=await this.getAccessToken(creds);
|
|
23
|
+
const url='https://api.pax8.com'+path;
|
|
24
|
+
const res=await axios({method,url,headers:{Authorization:`Bearer ${token }`}});
|
|
25
|
+
return [this.helpers.returnJsonArray(res.data)];
|
|
26
|
+
}
|
|
27
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
|
|
2
|
+
import axios from 'axios';
|
|
3
|
+
import qs from 'qs';
|
|
4
|
+
import { IExecuteFunctions } from 'n8n-workflow';
|
|
5
|
+
import { INodeType, INodeTypeDescription } from 'n8n-workflow';
|
|
6
|
+
export class Pax8TopicDefinitions implements INodeType {
|
|
7
|
+
description: INodeTypeDescription = {
|
|
8
|
+
displayName:'Pax8 Topic Definitions', name:'pax8TopicDefinitions', group:['transform'], version:1,
|
|
9
|
+
description:'Pax8 Topic Definitions', defaults:{name:'Pax8 Topic Definitions'}, inputs:['main'], outputs:['main'],
|
|
10
|
+
credentials:[{name:'pax8OAuth2Api', required:true}],
|
|
11
|
+
properties:[{displayName:'Operation', name:'operation', type:'options', options:[{"name": "GET /webhooks/topic-definitions", "value": "get:/webhooks/topic-definitions"}], default:''}]
|
|
12
|
+
};
|
|
13
|
+
async getAccessToken(creds:any){
|
|
14
|
+
const data = qs.stringify({grant_type:'client_credentials', client_id:creds.clientId, client_secret:creds.clientSecret, scope:creds.scope});
|
|
15
|
+
const res = await axios.post('https://api.pax8.com/auth/connect/token', data, {headers:{'Content-Type':'application/x-www-form-urlencoded'}});
|
|
16
|
+
return res.data.access_token;
|
|
17
|
+
}
|
|
18
|
+
async execute(this:IExecuteFunctions){
|
|
19
|
+
const op=this.getNodeParameter('operation',0) as string;
|
|
20
|
+
const [method,path]=op.split(':');
|
|
21
|
+
const creds=await this.getCredentials('pax8OAuth2Api');
|
|
22
|
+
const token=await this.getAccessToken(creds);
|
|
23
|
+
const url='https://api.pax8.com'+path;
|
|
24
|
+
const res=await axios({method,url,headers:{Authorization:`Bearer ${token }`}});
|
|
25
|
+
return [this.helpers.returnJsonArray(res.data)];
|
|
26
|
+
}
|
|
27
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
|
|
2
|
+
import axios from 'axios';
|
|
3
|
+
import qs from 'qs';
|
|
4
|
+
import { IExecuteFunctions } from 'n8n-workflow';
|
|
5
|
+
import { INodeType, INodeTypeDescription } from 'n8n-workflow';
|
|
6
|
+
export class Pax8UsageLines implements INodeType {
|
|
7
|
+
description: INodeTypeDescription = {
|
|
8
|
+
displayName:'Pax8 Usage Lines', name:'pax8UsageLines', group:['transform'], version:1,
|
|
9
|
+
description:'Pax8 Usage Lines', defaults:{name:'Pax8 Usage Lines'}, inputs:['main'], outputs:['main'],
|
|
10
|
+
credentials:[{name:'pax8OAuth2Api', required:true}],
|
|
11
|
+
properties:[{displayName:'Operation', name:'operation', type:'options', options:[{"name": "GET /lines", "value": "get:/lines"}, {"name": "POST /lines", "value": "post:/lines"}, {"name": "POST /aggregate-lines", "value": "post:/aggregate-lines"}], default:''}]
|
|
12
|
+
};
|
|
13
|
+
async getAccessToken(creds:any){
|
|
14
|
+
const data = qs.stringify({grant_type:'client_credentials', client_id:creds.clientId, client_secret:creds.clientSecret, scope:creds.scope});
|
|
15
|
+
const res = await axios.post('https://api.pax8.com/auth/connect/token', data, {headers:{'Content-Type':'application/x-www-form-urlencoded'}});
|
|
16
|
+
return res.data.access_token;
|
|
17
|
+
}
|
|
18
|
+
async execute(this:IExecuteFunctions){
|
|
19
|
+
const op=this.getNodeParameter('operation',0) as string;
|
|
20
|
+
const [method,path]=op.split(':');
|
|
21
|
+
const creds=await this.getCredentials('pax8OAuth2Api');
|
|
22
|
+
const token=await this.getAccessToken(creds);
|
|
23
|
+
const url='https://api.pax8.com'+path;
|
|
24
|
+
const res=await axios({method,url,headers:{Authorization:`Bearer ${token }`}});
|
|
25
|
+
return [this.helpers.returnJsonArray(res.data)];
|
|
26
|
+
}
|
|
27
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
|
|
2
|
+
import axios from 'axios';
|
|
3
|
+
import qs from 'qs';
|
|
4
|
+
import { IExecuteFunctions } from 'n8n-workflow';
|
|
5
|
+
import { INodeType, INodeTypeDescription } from 'n8n-workflow';
|
|
6
|
+
export class Pax8UsageSummaries implements INodeType {
|
|
7
|
+
description: INodeTypeDescription = {
|
|
8
|
+
displayName:'Pax8 Usage Summaries', name:'pax8UsageSummaries', group:['transform'], version:1,
|
|
9
|
+
description:'Pax8 Usage Summaries', defaults:{name:'Pax8 Usage Summaries'}, inputs:['main'], outputs:['main'],
|
|
10
|
+
credentials:[{name:'pax8OAuth2Api', required:true}],
|
|
11
|
+
properties:[{displayName:'Operation', name:'operation', type:'options', options:[{"name": "GET /subscriptions/{subscriptionId}/usage-summaries", "value": "get:/subscriptions/{subscriptionId}/usage-summaries"}, {"name": "GET /usage-summaries/{usageSummaryId}", "value": "get:/usage-summaries/{usageSummaryId}"}, {"name": "GET /usage-summaries/{usageSummaryId}/usage-lines", "value": "get:/usage-summaries/{usageSummaryId}/usage-lines"}], default:''}]
|
|
12
|
+
};
|
|
13
|
+
async getAccessToken(creds:any){
|
|
14
|
+
const data = qs.stringify({grant_type:'client_credentials', client_id:creds.clientId, client_secret:creds.clientSecret, scope:creds.scope});
|
|
15
|
+
const res = await axios.post('https://api.pax8.com/auth/connect/token', data, {headers:{'Content-Type':'application/x-www-form-urlencoded'}});
|
|
16
|
+
return res.data.access_token;
|
|
17
|
+
}
|
|
18
|
+
async execute(this:IExecuteFunctions){
|
|
19
|
+
const op=this.getNodeParameter('operation',0) as string;
|
|
20
|
+
const [method,path]=op.split(':');
|
|
21
|
+
const creds=await this.getCredentials('pax8OAuth2Api');
|
|
22
|
+
const token=await this.getAccessToken(creds);
|
|
23
|
+
const url='https://api.pax8.com'+path;
|
|
24
|
+
const res=await axios({method,url,headers:{Authorization:`Bearer ${token }`}});
|
|
25
|
+
return [this.helpers.returnJsonArray(res.data)];
|
|
26
|
+
}
|
|
27
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
|
|
2
|
+
import axios from 'axios';
|
|
3
|
+
import qs from 'qs';
|
|
4
|
+
import { IExecuteFunctions } from 'n8n-workflow';
|
|
5
|
+
import { INodeType, INodeTypeDescription } from 'n8n-workflow';
|
|
6
|
+
export class Pax8WebhookLogs implements INodeType {
|
|
7
|
+
description: INodeTypeDescription = {
|
|
8
|
+
displayName:'Pax8 Webhook Logs', name:'pax8WebhookLogs', group:['transform'], version:1,
|
|
9
|
+
description:'Pax8 Webhook Logs', defaults:{name:'Pax8 Webhook Logs'}, inputs:['main'], outputs:['main'],
|
|
10
|
+
credentials:[{name:'pax8OAuth2Api', required:true}],
|
|
11
|
+
properties:[{displayName:'Operation', name:'operation', type:'options', options:[{"name": "GET /webhooks/{webhookId}/logs", "value": "get:/webhooks/{webhookId}/logs"}, {"name": "GET /webhooks/{webhookId}/logs/{id}", "value": "get:/webhooks/{webhookId}/logs/{id}"}, {"name": "POST /webhooks/{webhookId}/logs/{logId}/retry", "value": "post:/webhooks/{webhookId}/logs/{logId}/retry"}], default:''}]
|
|
12
|
+
};
|
|
13
|
+
async getAccessToken(creds:any){
|
|
14
|
+
const data = qs.stringify({grant_type:'client_credentials', client_id:creds.clientId, client_secret:creds.clientSecret, scope:creds.scope});
|
|
15
|
+
const res = await axios.post('https://api.pax8.com/auth/connect/token', data, {headers:{'Content-Type':'application/x-www-form-urlencoded'}});
|
|
16
|
+
return res.data.access_token;
|
|
17
|
+
}
|
|
18
|
+
async execute(this:IExecuteFunctions){
|
|
19
|
+
const op=this.getNodeParameter('operation',0) as string;
|
|
20
|
+
const [method,path]=op.split(':');
|
|
21
|
+
const creds=await this.getCredentials('pax8OAuth2Api');
|
|
22
|
+
const token=await this.getAccessToken(creds);
|
|
23
|
+
const url='https://api.pax8.com'+path;
|
|
24
|
+
const res=await axios({method,url,headers:{Authorization:`Bearer ${token }`}});
|
|
25
|
+
return [this.helpers.returnJsonArray(res.data)];
|
|
26
|
+
}
|
|
27
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
|
|
2
|
+
import axios from 'axios';
|
|
3
|
+
import qs from 'qs';
|
|
4
|
+
import { IExecuteFunctions } from 'n8n-workflow';
|
|
5
|
+
import { INodeType, INodeTypeDescription } from 'n8n-workflow';
|
|
6
|
+
export class Pax8Webhooks implements INodeType {
|
|
7
|
+
description: INodeTypeDescription = {
|
|
8
|
+
displayName:'Pax8 Webhooks', name:'pax8Webhooks', group:['transform'], version:1,
|
|
9
|
+
description:'Pax8 Webhooks', defaults:{name:'Pax8 Webhooks'}, inputs:['main'], outputs:['main'],
|
|
10
|
+
credentials:[{name:'pax8OAuth2Api', required:true}],
|
|
11
|
+
properties:[{displayName:'Operation', name:'operation', type:'options', options:[{"name": "GET /webhooks", "value": "get:/webhooks"}, {"name": "POST /webhooks", "value": "post:/webhooks"}, {"name": "GET /webhooks/{id}", "value": "get:/webhooks/{id}"}, {"name": "DELETE /webhooks/{id}", "value": "delete:/webhooks/{id}"}, {"name": "POST /webhooks/{id}/configuration", "value": "post:/webhooks/{id}/configuration"}, {"name": "POST /webhooks/{id}/status", "value": "post:/webhooks/{id}/status"}, {"name": "POST /webhooks/{id}/topics", "value": "post:/webhooks/{id}/topics"}, {"name": "PUT /webhooks/{id}/topics", "value": "put:/webhooks/{id}/topics"}, {"name": "DELETE /webhooks/{id}/topics/{topicId}", "value": "delete:/webhooks/{id}/topics/{topicId}"}, {"name": "POST /webhooks/{id}/topics/{topicId}/configuration", "value": "post:/webhooks/{id}/topics/{topicId}/configuration"}, {"name": "POST /webhooks/{id}/topics/{topic}/test", "value": "post:/webhooks/{id}/topics/{topic}/test"}], default:''}]
|
|
12
|
+
};
|
|
13
|
+
async getAccessToken(creds:any){
|
|
14
|
+
const data = qs.stringify({grant_type:'client_credentials', client_id:creds.clientId, client_secret:creds.clientSecret, scope:creds.scope});
|
|
15
|
+
const res = await axios.post('https://api.pax8.com/auth/connect/token', data, {headers:{'Content-Type':'application/x-www-form-urlencoded'}});
|
|
16
|
+
return res.data.access_token;
|
|
17
|
+
}
|
|
18
|
+
async execute(this:IExecuteFunctions){
|
|
19
|
+
const op=this.getNodeParameter('operation',0) as string;
|
|
20
|
+
const [method,path]=op.split(':');
|
|
21
|
+
const creds=await this.getCredentials('pax8OAuth2Api');
|
|
22
|
+
const token=await this.getAccessToken(creds);
|
|
23
|
+
const url='https://api.pax8.com'+path;
|
|
24
|
+
const res=await axios({method,url,headers:{Authorization:`Bearer ${token }`}});
|
|
25
|
+
return [this.helpers.returnJsonArray(res.data)];
|
|
26
|
+
}
|
|
27
|
+
}
|