@@ -39,6 +39,7 @@ export class HostingerApi implements INodeType {
3939 { name : 'VPS' , value : 'vps' } ,
4040 { name : 'DNS' , value : 'dns' } ,
4141 { name : 'Domains' , value : 'domains' } ,
42+ { name : 'Billing' , value : 'billing' } ,
4243 ] ,
4344 default : 'vps' ,
4445 } ,
@@ -69,6 +70,25 @@ export class HostingerApi implements INodeType {
6970 }
7071 }
7172 } ,
73+ {
74+ displayName : 'Subcategory' ,
75+ name : 'domainSubcategory' ,
76+ type : 'options' ,
77+ options : [
78+ { name : 'Availability' , value : 'availability' } ,
79+ { name : 'Portfolio' , value : 'portfolio' } ,
80+ { name : 'WHOIS' , value : 'whois' } ,
81+ { name : 'Forwarding' , value : 'forwarding' } ,
82+ ] ,
83+ default : 'availability' ,
84+ displayOptions : {
85+ show : {
86+ category : [
87+ 'domains'
88+ ]
89+ }
90+ }
91+ } ,
7292 {
7393 displayName : 'VPS Action' ,
7494 name : 'vpsAction' ,
@@ -280,6 +300,7 @@ export class HostingerApi implements INodeType {
280300 { name : 'Update Root Password' , value : 'updateRootPassword' } ,
281301 { name : 'Virtual Machine Get' , value : 'getVm' } ,
282302 { name : 'Virtual Machine List' , value : 'listVms' } ,
303+ { name : 'Purchase New Virtual Machine' , value : 'purchaseVm' } ,
283304 ] ,
284305 default : 'getVm' ,
285306 displayOptions : {
@@ -321,6 +342,84 @@ export class HostingerApi implements INodeType {
321342 displayOptions : {
322343 show : {
323344 category : [ 'domains' ] ,
345+ domainSubcategory : [ 'availability' ] ,
346+ } ,
347+ } ,
348+ } ,
349+ {
350+ displayName : 'Domains Action' ,
351+ name : 'domainsAction' ,
352+ type : 'options' ,
353+ options : [
354+ { name : 'Get Domain' , value : 'getDomain' } ,
355+ { name : 'List Domains' , value : 'listDomains' } ,
356+ { name : 'Purchase Domain' , value : 'purchaseDomain' } ,
357+ { name : 'Enable Domain Lock' , value : 'enableDomainLock' } ,
358+ { name : 'Disable Domain Lock' , value : 'disableDomainLock' } ,
359+ { name : 'Enable Privacy Protection' , value : 'enablePrivacyProtection' } ,
360+ { name : 'Disable Privacy Protection' , value : 'disablePrivacyProtection' } ,
361+ { name : 'Update Nameservers' , value : 'updateDomainNameservers' } ,
362+ ] ,
363+ default : 'listDomains' ,
364+ displayOptions : {
365+ show : {
366+ category : [ 'domains' ] ,
367+ domainSubcategory : [ 'portfolio' ] ,
368+ } ,
369+ } ,
370+ } ,
371+ {
372+ displayName : 'Domains Action' ,
373+ name : 'domainsAction' ,
374+ type : 'options' ,
375+ options : [
376+ { name : 'Get WHOIS Profile' , value : 'getWhoisProfile' } ,
377+ { name : 'Delete WHOIS Profile' , value : 'deleteWhoisProfile' } ,
378+ { name : 'List WHOIS Profiles' , value : 'listWhoisProfiles' } ,
379+ { name : 'Create WHOIS Profile' , value : 'createWhoisProfile' } ,
380+ { name : 'Get WHOIS Profile Usage' , value : 'getWhoisProfileUsage' } ,
381+ ] ,
382+ default : 'listWhoisProfiles' ,
383+ displayOptions : {
384+ show : {
385+ category : [ 'domains' ] ,
386+ domainSubcategory : [ 'whois' ] ,
387+ } ,
388+ } ,
389+ } ,
390+ {
391+ displayName : 'Domains Action' ,
392+ name : 'domainsAction' ,
393+ type : 'options' ,
394+ options : [
395+ { name : 'Get Forwarding Data' , value : 'getForwardingData' } ,
396+ { name : 'Delete Forwarding Data' , value : 'deleteForwardingData' } ,
397+ { name : 'Create Forwarding Data' , value : 'createForwardingData' } ,
398+ ] ,
399+ default : 'getForwardingData' ,
400+ displayOptions : {
401+ show : {
402+ category : [ 'domains' ] ,
403+ domainSubcategory : [ 'forwarding' ] ,
404+ } ,
405+ } ,
406+ } ,
407+ {
408+ displayName : 'Billing Action' ,
409+ name : 'billingAction' ,
410+ type : 'options' ,
411+ options : [
412+ { name : 'Get catalog item list' , value : 'getCatalogList' } ,
413+ { name : 'Set default payment method' , value : 'setPaymentMethod' } ,
414+ { name : 'Delete payment method' , value : 'deletePaymentMethod' } ,
415+ { name : 'Get payment method list' , value : 'getPaymentList' } ,
416+ { name : 'Cancel subscription' , value : 'deleteSubscription' } ,
417+ { name : 'Get subscription list' , value : 'getSubscriptionList' } ,
418+ ] ,
419+ default : 'getCatalogList' ,
420+ displayOptions : {
421+ show : {
422+ category : [ 'billing' ]
324423 } ,
325424 } ,
326425 } ,
@@ -429,6 +528,37 @@ export class HostingerApi implements INodeType {
429528 }
430529 }
431530 } ,
531+ {
532+ displayName : 'Domain' ,
533+ name : 'domain' ,
534+ type : 'string' ,
535+ default : '' ,
536+ displayOptions : {
537+ show : {
538+ category : [ 'domains' ] ,
539+ domainsAction : [
540+ 'getDomain' , 'enableDomainLock' , 'disableDomainLock' ,
541+ 'enablePrivacyProtection' , 'disablePrivacyProtection' ,
542+ 'updateDomainNameservers' , 'getForwardingData' ,
543+ 'deleteForwardingData'
544+ ]
545+ }
546+ }
547+ } ,
548+ {
549+ displayName : 'WHOIS ID' ,
550+ name : 'whoisId' ,
551+ type : 'string' ,
552+ default : '' ,
553+ displayOptions : {
554+ show : {
555+ category : [ 'domains' ] ,
556+ domainsAction : [
557+ 'getWhoisProfile' , 'deleteWhoisProfile' , 'getWhoisProfileUsage'
558+ ]
559+ }
560+ }
561+ } ,
432562 {
433563 displayName : 'Rule ID' ,
434564 name : 'ruleId' ,
@@ -477,6 +607,30 @@ export class HostingerApi implements INodeType {
477607 }
478608 }
479609 } ,
610+ {
611+ displayName : 'Payment Method ID' ,
612+ name : 'paymentMethodId' ,
613+ type : 'string' ,
614+ default : '' ,
615+ displayOptions : {
616+ show : {
617+ category : [ 'billing' ] ,
618+ billingAction : [ 'setPaymentMethod' , 'deletePaymentMethod' ]
619+ }
620+ }
621+ } ,
622+ {
623+ displayName : 'Subscription ID' ,
624+ name : 'subscriptionId' ,
625+ type : 'string' ,
626+ default : '' ,
627+ displayOptions : {
628+ show : {
629+ category : [ 'billing' ] ,
630+ billingAction : [ 'deleteSubscription' ]
631+ }
632+ }
633+ } ,
480634 {
481635 displayName : 'Request Body' ,
482636 name : 'requestBody' ,
@@ -500,10 +654,59 @@ export class HostingerApi implements INodeType {
500654 description : 'Raw JSON body for POST/PUT requests' ,
501655 displayOptions : {
502656 show : {
503- category : [ 'domains' , ' dns']
657+ category : [ 'dns' ]
504658 }
505659 }
506- }
660+ } ,
661+ {
662+ displayName : 'Request Body' ,
663+ name : 'requestBody' ,
664+ type : 'json' ,
665+ default : '{}' ,
666+ description : 'Raw JSON body for POST/PUT requests' ,
667+ displayOptions : {
668+ show : {
669+ category : [ 'domains' ] ,
670+ domainsAction : [
671+ 'checkDomainAvailability' , 'purchaseDomain' ,
672+ 'updateDomainNameservers' , 'createWhoisProfile' ,
673+ 'createForwardingData'
674+ ]
675+ }
676+ }
677+ } ,
678+ {
679+ displayName : 'Request Body' ,
680+ name : 'requestBody' ,
681+ type : 'json' ,
682+ default : `{
683+ "item_id": "hostingercom-vps-kvm2-usd-1m",
684+ "payment_method_id": 1327362,
685+ "setup": {
686+ "template_id": 1130,
687+ "data_center_id": 19,
688+ "post_install_script_id": 6324,
689+ "password": "oMeNRustosIO",
690+ "hostname": "my.server.tld",
691+ "install_monarx": false,
692+ "enable_backups": true,
693+ "ns1": "4.3.2.1",
694+ "ns2": "1.2.3.4",
695+ "public_key": {
696+ "name": "my-key",
697+ "key": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQC2X..."
698+ }
699+ },
700+ "coupons": [[ "Coupon 3"]]
701+ }` ,
702+ description : 'Raw JSON body for POST/PUT requests' ,
703+ displayOptions : {
704+ show : {
705+ category : [ 'vps' ] ,
706+ vpsAction : [ 'purchaseVm' ]
707+ }
708+ }
709+ } ,
507710 ]
508711 } ;
509712
@@ -526,6 +729,9 @@ export class HostingerApi implements INodeType {
526729 case 'domains' :
527730 action = this . getNodeParameter ( 'domainsAction' , i ) as string ;
528731 break ;
732+ case 'billing' :
733+ action = this . getNodeParameter ( 'billingAction' , i ) as string ;
734+ break ;
529735 default :
530736 throw new ApplicationError ( `Unknown category: ${ category } ` ) ;
531737 }
@@ -595,6 +801,7 @@ export class HostingerApi implements INodeType {
595801 case 'resetHostname' : method = 'DELETE' ; endpoint = `/api/vps/v1/virtual-machines/${ getParam ( 'virtualMachineId' ) } /hostname` ; break ;
596802 case 'getVm' : endpoint = `/api/vps/v1/virtual-machines/${ getParam ( 'virtualMachineId' ) } ` ; break ;
597803 case 'listVms' : endpoint = '/api/vps/v1/virtual-machines' ; break ;
804+ case 'purchaseVm' : method = 'POST' ; endpoint = '/api/vps/v1/virtual-machines' ; break ;
598805 case 'getVmMetrics' : endpoint = `/api/vps/v1/virtual-machines/${ getParam ( 'virtualMachineId' ) } /metrics?date_from=${ getParam ( 'date_from' ) } &date_to=${ getParam ( 'date_to' ) } ` ; break ;
599806 case 'updateNameservers' : method = 'PUT' ; endpoint = `/api/vps/v1/virtual-machines/${ getParam ( 'virtualMachineId' ) } /nameservers` ; break ;
600807 case 'updatePanelPassword' : method = 'PUT' ; endpoint = `/api/vps/v1/virtual-machines/${ getParam ( 'virtualMachineId' ) } /panel-password` ; break ;
@@ -614,8 +821,34 @@ export class HostingerApi implements INodeType {
614821 case 'deleteDnsZone' : method = 'DELETE' ; endpoint = `/api/dns/v1/zones/${ getParam ( 'domain' ) } ` ; break ;
615822 case 'resetDnsZone' : method = 'POST' ; endpoint = `/api/dns/v1/zones/${ getParam ( 'domain' ) } /reset` ; break ;
616823 case 'validateDnsZone' : method = 'POST' ; endpoint = `/api/dns/v1/zones/${ getParam ( 'domain' ) } /validate` ; break ;
617- //Domains
824+ //Domains - Availability
618825 case 'checkDomainAvailability' : method = 'POST' ; endpoint = '/api/domains/v1/availability' ; break ;
826+ //Domains - Portfolio
827+ case 'getDomain' : method = 'GET' ; endpoint = `/api/domains/v1/portfolio/${ getParam ( 'domain' ) } ` ; break ;
828+ case 'listDomains' : method = 'GET' ; endpoint = '/api/domains/v1/portfolio' ; break ;
829+ case 'purchaseDomain' : method = 'POST' ; endpoint = '/api/domains/v1/portfolio' ; break ;
830+ case 'enableDomainLock' : method = 'PUT' ; endpoint = `/api/domains/v1/portfolio/${ getParam ( 'domain' ) } /domain-lock` ; break ;
831+ case 'disableDomainLock' : method = 'DELETE' ; endpoint = `/api/domains/v1/portfolio/${ getParam ( 'domain' ) } /domain-lock` ; break ;
832+ case 'enablePrivacyProtection' : method = 'PUT' ; endpoint = `/api/domains/v1/portfolio/${ getParam ( 'domain' ) } /privacy-protection` ; break ;
833+ case 'disablePrivacyProtection' : method = 'DELETE' ; endpoint = `/api/domains/v1/portfolio/${ getParam ( 'domain' ) } /privacy-protection` ; break ;
834+ case 'updateDomainNameservers' : method = 'PUT' ; endpoint = `/api/domains/v1/portfolio/${ getParam ( 'domain' ) } /nameservers` ; break ;
835+ //Domains - WHOIS
836+ case 'getWhoisProfile' : method = 'GET' ; endpoint = `/api/domains/v1/whois/${ getParam ( 'whoisId' ) } ` ; break ;
837+ case 'deleteWhoisProfile' : method = 'DELETE' ; endpoint = `/api/domains/v1/whois/${ getParam ( 'whoisId' ) } ` ; break ;
838+ case 'listWhoisProfiles' : method = 'GET' ; endpoint = '/api/domains/v1/whois' ; break ;
839+ case 'createWhoisProfile' : method = 'POST' ; endpoint = '/api/domains/v1/whois' ; break ;
840+ case 'getWhoisProfileUsage' : method = 'GET' ; endpoint = `/api/domains/v1/whois/${ getParam ( 'whoisId' ) } /usage` ; break ;
841+ //Domains - Forwarding
842+ case 'getForwardingData' : method = 'GET' ; endpoint = `/api/domains/v1/forwarding/${ getParam ( 'domain' ) } ` ; break ;
843+ case 'deleteForwardingData' : method = 'DELETE' ; endpoint = `/api/domains/v1/forwarding/${ getParam ( 'domain' ) } ` ; break ;
844+ case 'createForwardingData' : method = 'POST' ; endpoint = '/api/domains/v1/forwarding' ; break ;
845+ //Billing
846+ case 'getCatalogList' : method = 'GET' ; endpoint = '/api/billing/v1/catalog' ; break ;
847+ case 'setPaymentMethod' : method = 'POST' ; endpoint = `/api/billing/v1/payment-methods/${ getParam ( 'paymentMethodId' ) } ` ; break ;
848+ case 'deletePaymentMethod' : method = 'DELETE' ; endpoint = `/api/billing/v1/payment-methods/${ getParam ( 'paymentMethodId' ) } ` ; break ;
849+ case 'getPaymentList' : method = 'GET' ; endpoint = '/api/billing/v1/payment-methods' ; break ;
850+ case 'deleteSubscription' : method = 'DELETE' ; endpoint = `/api/billing/v1/subscriptions/${ getParam ( 'subscriptionId' ) } ` ; break ;
851+ case 'getSubscriptionList' : method = 'GET' ; endpoint = '/api/billing/v1/subscriptions' ; break ;
619852
620853 default : throw new ApplicationError ( `Unsupported action: ${ action } ` ) ;
621854 }
0 commit comments