├── .gitignore
├── .npmignore
├── LICENSE
├── README.md
├── docs
├── Addons.html
├── Addons.js.html
├── Affiliates.html
├── Affiliates.js.html
├── Authentication.html
├── Authentication.js.html
├── Billing.html
├── Clients.html
├── Clients.js.html
├── Domains.html
├── Modules.html
├── Modules.js.html
├── Orders.html
├── Orders.js.html
├── Products.html
├── ProjectManagement.html
├── ProjectManagement.js.html
├── Servers.html
├── Servers.js.html
├── Services.html
├── Services.js.html
├── Support.html
├── System.html
├── System.js.html
├── Tickets.html
├── Tickets.js.html
├── billing.js.html
├── domains.js.html
├── fonts
│ ├── OpenSans-Bold-webfont.eot
│ ├── OpenSans-Bold-webfont.svg
│ ├── OpenSans-Bold-webfont.woff
│ ├── OpenSans-BoldItalic-webfont.eot
│ ├── OpenSans-BoldItalic-webfont.svg
│ ├── OpenSans-BoldItalic-webfont.woff
│ ├── OpenSans-Italic-webfont.eot
│ ├── OpenSans-Italic-webfont.svg
│ ├── OpenSans-Italic-webfont.woff
│ ├── OpenSans-Light-webfont.eot
│ ├── OpenSans-Light-webfont.svg
│ ├── OpenSans-Light-webfont.woff
│ ├── OpenSans-LightItalic-webfont.eot
│ ├── OpenSans-LightItalic-webfont.svg
│ ├── OpenSans-LightItalic-webfont.woff
│ ├── OpenSans-Regular-webfont.eot
│ ├── OpenSans-Regular-webfont.svg
│ └── OpenSans-Regular-webfont.woff
├── index.html
├── products.js.html
├── scripts
│ ├── linenumber.js
│ └── prettify
│ │ ├── Apache-License-2.0.txt
│ │ ├── lang-css.js
│ │ └── prettify.js
├── styles
│ ├── jsdoc-default.css
│ ├── prettify-jsdoc.css
│ └── prettify-tomorrow.css
└── support.js.html
├── index.js
├── modules
├── Addons.js
├── Affiliates.js
├── Authentication.js
├── Billing.js
├── Clients.js
├── Domains.js
├── Modules.js
├── Orders.js
├── Products.js
├── ProjectManagement.js
├── Servers.js
├── Services.js
├── Support.js
├── System.js
└── Tickets.js
├── package-lock.json
├── package.json
└── whmcs.js
/.gitignore:
--------------------------------------------------------------------------------
1 | node_modules
2 |
--------------------------------------------------------------------------------
/.npmignore:
--------------------------------------------------------------------------------
1 | docs
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | Apache License
2 | Version 2.0, January 2004
3 | http://www.apache.org/licenses/
4 |
5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6 |
7 | 1. Definitions.
8 |
9 | "License" shall mean the terms and conditions for use, reproduction,
10 | and distribution as defined by Sections 1 through 9 of this document.
11 |
12 | "Licensor" shall mean the copyright owner or entity authorized by
13 | the copyright owner that is granting the License.
14 |
15 | "Legal Entity" shall mean the union of the acting entity and all
16 | other entities that control, are controlled by, or are under common
17 | control with that entity. For the purposes of this definition,
18 | "control" means (i) the power, direct or indirect, to cause the
19 | direction or management of such entity, whether by contract or
20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the
21 | outstanding shares, or (iii) beneficial ownership of such entity.
22 |
23 | "You" (or "Your") shall mean an individual or Legal Entity
24 | exercising permissions granted by this License.
25 |
26 | "Source" form shall mean the preferred form for making modifications,
27 | including but not limited to software source code, documentation
28 | source, and configuration files.
29 |
30 | "Object" form shall mean any form resulting from mechanical
31 | transformation or translation of a Source form, including but
32 | not limited to compiled object code, generated documentation,
33 | and conversions to other media types.
34 |
35 | "Work" shall mean the work of authorship, whether in Source or
36 | Object form, made available under the License, as indicated by a
37 | copyright notice that is included in or attached to the work
38 | (an example is provided in the Appendix below).
39 |
40 | "Derivative Works" shall mean any work, whether in Source or Object
41 | form, that is based on (or derived from) the Work and for which the
42 | editorial revisions, annotations, elaborations, or other modifications
43 | represent, as a whole, an original work of authorship. For the purposes
44 | of this License, Derivative Works shall not include works that remain
45 | separable from, or merely link (or bind by name) to the interfaces of,
46 | the Work and Derivative Works thereof.
47 |
48 | "Contribution" shall mean any work of authorship, including
49 | the original version of the Work and any modifications or additions
50 | to that Work or Derivative Works thereof, that is intentionally
51 | submitted to Licensor for inclusion in the Work by the copyright owner
52 | or by an individual or Legal Entity authorized to submit on behalf of
53 | the copyright owner. For the purposes of this definition, "submitted"
54 | means any form of electronic, verbal, or written communication sent
55 | to the Licensor or its representatives, including but not limited to
56 | communication on electronic mailing lists, source code control systems,
57 | and issue tracking systems that are managed by, or on behalf of, the
58 | Licensor for the purpose of discussing and improving the Work, but
59 | excluding communication that is conspicuously marked or otherwise
60 | designated in writing by the copyright owner as "Not a Contribution."
61 |
62 | "Contributor" shall mean Licensor and any individual or Legal Entity
63 | on behalf of whom a Contribution has been received by Licensor and
64 | subsequently incorporated within the Work.
65 |
66 | 2. Grant of Copyright License. Subject to the terms and conditions of
67 | this License, each Contributor hereby grants to You a perpetual,
68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69 | copyright license to reproduce, prepare Derivative Works of,
70 | publicly display, publicly perform, sublicense, and distribute the
71 | Work and such Derivative Works in Source or Object form.
72 |
73 | 3. Grant of Patent License. Subject to the terms and conditions of
74 | this License, each Contributor hereby grants to You a perpetual,
75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76 | (except as stated in this section) patent license to make, have made,
77 | use, offer to sell, sell, import, and otherwise transfer the Work,
78 | where such license applies only to those patent claims licensable
79 | by such Contributor that are necessarily infringed by their
80 | Contribution(s) alone or by combination of their Contribution(s)
81 | with the Work to which such Contribution(s) was submitted. If You
82 | institute patent litigation against any entity (including a
83 | cross-claim or counterclaim in a lawsuit) alleging that the Work
84 | or a Contribution incorporated within the Work constitutes direct
85 | or contributory patent infringement, then any patent licenses
86 | granted to You under this License for that Work shall terminate
87 | as of the date such litigation is filed.
88 |
89 | 4. Redistribution. You may reproduce and distribute copies of the
90 | Work or Derivative Works thereof in any medium, with or without
91 | modifications, and in Source or Object form, provided that You
92 | meet the following conditions:
93 |
94 | (a) You must give any other recipients of the Work or
95 | Derivative Works a copy of this License; and
96 |
97 | (b) You must cause any modified files to carry prominent notices
98 | stating that You changed the files; and
99 |
100 | (c) You must retain, in the Source form of any Derivative Works
101 | that You distribute, all copyright, patent, trademark, and
102 | attribution notices from the Source form of the Work,
103 | excluding those notices that do not pertain to any part of
104 | the Derivative Works; and
105 |
106 | (d) If the Work includes a "NOTICE" text file as part of its
107 | distribution, then any Derivative Works that You distribute must
108 | include a readable copy of the attribution notices contained
109 | within such NOTICE file, excluding those notices that do not
110 | pertain to any part of the Derivative Works, in at least one
111 | of the following places: within a NOTICE text file distributed
112 | as part of the Derivative Works; within the Source form or
113 | documentation, if provided along with the Derivative Works; or,
114 | within a display generated by the Derivative Works, if and
115 | wherever such third-party notices normally appear. The contents
116 | of the NOTICE file are for informational purposes only and
117 | do not modify the License. You may add Your own attribution
118 | notices within Derivative Works that You distribute, alongside
119 | or as an addendum to the NOTICE text from the Work, provided
120 | that such additional attribution notices cannot be construed
121 | as modifying the License.
122 |
123 | You may add Your own copyright statement to Your modifications and
124 | may provide additional or different license terms and conditions
125 | for use, reproduction, or distribution of Your modifications, or
126 | for any such Derivative Works as a whole, provided Your use,
127 | reproduction, and distribution of the Work otherwise complies with
128 | the conditions stated in this License.
129 |
130 | 5. Submission of Contributions. Unless You explicitly state otherwise,
131 | any Contribution intentionally submitted for inclusion in the Work
132 | by You to the Licensor shall be under the terms and conditions of
133 | this License, without any additional terms or conditions.
134 | Notwithstanding the above, nothing herein shall supersede or modify
135 | the terms of any separate license agreement you may have executed
136 | with Licensor regarding such Contributions.
137 |
138 | 6. Trademarks. This License does not grant permission to use the trade
139 | names, trademarks, service marks, or product names of the Licensor,
140 | except as required for reasonable and customary use in describing the
141 | origin of the Work and reproducing the content of the NOTICE file.
142 |
143 | 7. Disclaimer of Warranty. Unless required by applicable law or
144 | agreed to in writing, Licensor provides the Work (and each
145 | Contributor provides its Contributions) on an "AS IS" BASIS,
146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147 | implied, including, without limitation, any warranties or conditions
148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149 | PARTICULAR PURPOSE. You are solely responsible for determining the
150 | appropriateness of using or redistributing the Work and assume any
151 | risks associated with Your exercise of permissions under this License.
152 |
153 | 8. Limitation of Liability. In no event and under no legal theory,
154 | whether in tort (including negligence), contract, or otherwise,
155 | unless required by applicable law (such as deliberate and grossly
156 | negligent acts) or agreed to in writing, shall any Contributor be
157 | liable to You for damages, including any direct, indirect, special,
158 | incidental, or consequential damages of any character arising as a
159 | result of this License or out of the use or inability to use the
160 | Work (including but not limited to damages for loss of goodwill,
161 | work stoppage, computer failure or malfunction, or any and all
162 | other commercial damages or losses), even if such Contributor
163 | has been advised of the possibility of such damages.
164 |
165 | 9. Accepting Warranty or Additional Liability. While redistributing
166 | the Work or Derivative Works thereof, You may choose to offer,
167 | and charge a fee for, acceptance of support, warranty, indemnity,
168 | or other liability obligations and/or rights consistent with this
169 | License. However, in accepting such obligations, You may act only
170 | on Your own behalf and on Your sole responsibility, not on behalf
171 | of any other Contributor, and only if You agree to indemnify,
172 | defend, and hold each Contributor harmless for any liability
173 | incurred by, or claims asserted against, such Contributor by reason
174 | of your accepting any such warranty or additional liability.
175 |
176 | END OF TERMS AND CONDITIONS
177 |
178 | APPENDIX: How to apply the Apache License to your work.
179 |
180 | To apply the Apache License to your work, attach the following
181 | boilerplate notice, with the fields enclosed by brackets "[]"
182 | replaced with your own identifying information. (Don't include
183 | the brackets!) The text should be enclosed in the appropriate
184 | comment syntax for the file format. We also recommend that a
185 | file or class name and description of purpose be included on the
186 | same "printed page" as the copyright notice for easier
187 | identification within third-party archives.
188 |
189 | Copyright [yyyy] [name of copyright owner]
190 |
191 | Licensed under the Apache License, Version 2.0 (the "License");
192 | you may not use this file except in compliance with the License.
193 | You may obtain a copy of the License at
194 |
195 | http://www.apache.org/licenses/LICENSE-2.0
196 |
197 | Unless required by applicable law or agreed to in writing, software
198 | distributed under the License is distributed on an "AS IS" BASIS,
199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200 | See the License for the specific language governing permissions and
201 | limitations under the License.
202 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # WHMCS Node Module
2 |
3 | This module allows you to remotely manage your WHMCS installation(s) using Node.
4 |
5 | ## Installation
6 |
7 | ```shell
8 | npm install whmcs-js
9 | ```
10 |
11 | ## Usage
12 |
13 | **Reminder: You need to whitelist the IP from which you are making API calls in WHMCS. Otherwise you will get an error.**
14 |
15 | You can do this under *Setup > General Settings > Security*. [More info](https://developers.whmcs.com/api/access-control/)
16 |
17 | ### Configuring
18 |
19 | You can remotely identify on the API using two methods: *Note that you will always need to declare serverUrl*
20 |
21 | #### With `username` and `password`
22 |
23 | ```javascript
24 | const config = {
25 | username: 'api_username',
26 | password: 'password_as_md5',
27 | serverUrl: 'http://127.0.0.1/includes/api.php' // Remember to point to the api.php file
28 | }
29 | ```
30 |
31 | #### With `identifier` and `secret`
32 |
33 | You can generate these under *Setup > Staff Management > Manage API Credentials*. [More info](https://docs.whmcs.com/API_Authentication_Credentials#Creating_Admin_API_Authentication_Credentials)
34 |
35 | ```javascript
36 | const config = {
37 | identifier: 'zzzzzzzzzzzzzzzzzzzzzzzzzzzzz',
38 | secret: 'zzzzzzzzzzzzzzzzzzzzzzzzzzzzz',
39 | serverUrl: 'http://127.0.0.1/includes/api.php' // Remember to point to the api.php file
40 | }
41 | ```
42 |
43 | ### Making calls
44 |
45 | Every request returns a Promise with JSON data, so you can do:
46 |
47 | ```javascript
48 | const { Billing } = require('whmcs-js')
49 |
50 | const myBilling = new Billing(config)
51 |
52 | const invoices = await myBilling.getInvoices()
53 | ```
54 |
55 | ## Available Modules
56 |
57 | See a list of available Modules and their methods here: [https://damageesp.github.io/whmcs-js/](https://damageesp.github.io/whmcs-js/)
58 |
59 | ## [Documentation](https://damageesp.github.io/whmcs-js/)
60 |
61 | ## License
62 |
63 | Víctor Campos - [@DamageESP](https://twitter.com/damageesp)
64 |
65 | Licensed under the Apache license, version 2.0 (the "license"); You may not use this file except in compliance with the license. You may obtain a copy of the license at:
66 |
67 | [http://www.apache.org/licenses/LICENSE-2.0.html](http://www.apache.org/licenses/LICENSE-2.0.html)
68 |
69 | Unless required by applicable law or agreed to in writing, software distributed under the license is distributed on an "as is" basis, without warranties or conditions of any kind, either express or implied. See the license for the specific language governing permissions and limitations under the license.
70 |
71 | The contents in this repository are based on the repository [node-whmcs](https://github.com/apocas/node-whmcs), which is licensed under the Apache license, version 2.0 by Pedro Dias - [@pedromdias](https://twitter.com/pedromdias), but include major modifications to it.
72 |
73 | Original repository: [https://github.com/apocas/node-whmcs](https://github.com/apocas/node-whmcs)
--------------------------------------------------------------------------------
/docs/Addons.js.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
const WHMCS = require('../whmcs')
30 |
31 | /**
32 | * Allows you to manage your Authentication module in WHMCS.
33 | * @extends WHMCS
34 | */
35 | class Authentication extends WHMCS {
36 | /**
37 | * @param {Object} config Object containing your API credentials.
38 | * @param {string} config.serverUrl URL to your installation. Remember to point to /includes/api.php
39 | * @param {string} [config.username]
40 | * @param {string} [config.password]
41 | * @param {string} [config.identifier]
42 | * @param {string} [config.secret]
43 | */
44 | constructor (config) {
45 | super(config)
46 | }
47 | /**
48 | * Create an OAuth Credential - https://developers.whmcs.com/api-reference/createoauthcredential/
49 | * @param {Object} opts
50 | * @param {String} opts.grantType One of ‘authorization_code’ or ‘single_sign_on’
51 | * @param {String} opts.scope A space separated list of valid scopes from tbloauthserver_scopes
52 | * @param {String} [opts.name] The name to give the oAuth Credential for the authorization_code $grantType
53 | * @param {Number} [opts.serviceId] The id of the service for the single_sign_on $grantType
54 | * @param {String} [opts.description] The description of the OAuth Credential
55 | * @param {String} [opts.logoUri] URL or Path Relative to the Base WHMCS Client Area Directory to a logo image file for this application.
56 | * @param {String} [opts.redirectUri] Authorised Redirect URIs
57 | */
58 | createOAuthCredential (opts) {
59 | const options = {
60 | action: 'CreateOAuthCredential',
61 | ...opts
62 | }
63 | return this.callApi(options)
64 | }
65 | /**
66 | * Removes OAuth Credential record. This action cannot be undone. - https://developers.whmcs.com/api-reference/deleteoauthcredential/
67 | * @param {Object} opts
68 | * @param {Number} opts.credentialId The credential id to be deleted
69 | */
70 | deleteOAuthCredential (opts) {
71 | const options = {
72 | action: 'DeleteOAuthCredential',
73 | ...opts
74 | }
75 | return this.callApi(options)
76 | }
77 | /**
78 | * This command can be used to validate an email address and password against
79 | a registered user in WHMCS. On success, the userid and password hash will
80 | be returned which can be used to create an authenticated session by setting
81 | the session key ‘uid’ to the userid and the session key ‘upw’ to the
82 | passwordhash. Note: if session IP validation is enabled, this API call
83 | must be executed via the local API to receive a valid hash. - https://developers.whmcs.com/api-reference/validatelogin/
84 | * @param {Object} opts
85 | * @param {String} opts.email Client or Sub-Account Email Address
86 | * @param {String} opts.password2 Password to validate
87 | */
88 | validateLogin (opts) {
89 | const options = {
90 | action: 'ValidateLogin',
91 | ...opts
92 | }
93 | return this.callApi(options)
94 | }
95 | /**
96 | * Updates a given OAuth API Client Credential. - https://developers.whmcs.com/api-reference/updateoauthcredential/
97 | * @param {Object} opts
98 | * @param {Number} opts.credentialId The auto increment ID of the credential set to be updated
99 | * @param {String} [opts.clientApiIdentifier] The OAuth API Client Credential Unique Identifier (Client ID) to be updated. Only required if credentialId is not known/passed.
100 | * @param {String} [opts.name] The name to assign
101 | * @param {String} [opts.description] The description to assign
102 | * @param {String} [opts.grantType] The grant type for which the credential set is valid for. Possible values include: authorization_code or single_sign_on
103 | * @param {String} [opts.scope] A space delimited list of the scopes for which the credential set is valid. See CreateOAuthCredential for permitted values
104 | * @param {Number} [opts.serviceId] The service ID for which the credential relates to
105 | * @param {Array.<String>} [opts.logoUri] he logoUri to assign
106 | * @param {String} [opts.redirectUri] An array of Authorized Redirect URIs
107 | * @param {Boolean} [opts.resetSecret] Set to true to reset the OAuth API Client Credential Secret
108 | */
109 | updateOAuthCredential (opts) {
110 | const options = {
111 | action: 'UpdateOAuthCredential',
112 | ...opts
113 | }
114 | return this.callApi(options)
115 | }
116 | /**
117 | * List OAuth Credentials matching passed criteria - https://developers.whmcs.com/api-reference/listoauthcredentials/
118 | * @param {Object} opts
119 | * @param {String} [opts.grantType] Find credentials for a specific grant type
120 | * @param {String} [opts.sortField] Sort the response using the passed field
121 | * @param {String} [opts.sortOrder] The direction of the sort order (‘ASC’, ‘DESC’)
122 | * @param {Number} [opts.limit] To limit the number of returned credentials
123 | */
124 | listOAuthCredentials (opts) {
125 | const options = {
126 | action: 'ListOAuthCredentials',
127 | ...opts
128 | }
129 | return this.callApi(options)
130 | }
131 | }
132 |
133 | module.exports = Authentication
134 |
const WHMCS = require('../whmcs')
30 |
31 | /**
32 | * Allows you to manage your orders module in WHMCS.
33 | * @extends WHMCS
34 | */
35 |
36 | class Orders extends WHMCS {
37 | /**
38 | * @param {Object} config Object containing your API credentials.
39 | * @param {string} config.serverUrl URL to your installation. Remember to point to /includes/api.php
40 | * @param {string} [config.username]
41 | * @param {string} [config.password]
42 | * @param {string} [config.identifier]
43 | * @param {string} [config.secret]
44 | */
45 | constructor (config) {
46 | super(config)
47 | }
48 | /**
49 | * Retrieve Order Status and number in those statuses - https://developers.whmcs.com/api-reference/getorderstatuses/
50 | * @param {Object} opts
51 | */
52 | getOrderStatuses (opts) {
53 | const options = {
54 | action: 'GetOrderStatuses',
55 | ...opts
56 | }
57 | return this.callApi(options)
58 | }
59 | /**
60 | * NOTE: This API method is designed to be used in the building of custom order
61 | forms. As a result, only custom fields that have the ‘Show on Order Form’
62 | setting enabled will be returned for a given product. - https://developers.whmcs.com/api-reference/getproducts/
63 | * @param {Object} opts
64 | * @param {Number} [opts.pid] string
65 | * @param {Number} [opts.gid] Retrieve products in a specific group id
66 | * @param {String} [opts.module] Retrieve products utilising a specific module
67 | */
68 | getProducts (opts) {
69 | const options = {
70 | action: 'GetProducts',
71 | ...opts
72 | }
73 | return this.callApi(options)
74 | }
75 | /**
76 | * Accepts a pending order - https://developers.whmcs.com/api-reference/acceptorder/
77 | * @param {Object} opts
78 | * @param {Number} opts.orderid The order id to be accepted
79 | * @param {Number} [opts.serverid] The specific server to assign to products within the order
80 | * @param {String} [opts.serviceusername] The specific username to assign to products within the order
81 | * @param {String} [opts.servicepassword] The specific password to assign to products within the order
82 | * @param {String} [opts.registrar] The specific registrar to assign to domains within the order
83 | * @param {Boolean} [opts.sendregistrar] Send the request to the registrar to register the domain.
84 | * @param {Boolean} [opts.autosetup] Send the request to the product module to activate the service. This can override the product configuration.
85 | * @param {Boolean} [opts.sendemail] Send any automatic emails. This can be Product Welcome, Domain Renewal, Domain Transfer etc.
86 | */
87 | acceptOrder (opts) {
88 | const options = {
89 | action: 'AcceptOrder',
90 | ...opts
91 | }
92 | return this.callApi(options)
93 | }
94 | /**
95 | * Sets an order, and all associated order items to Pending status - https://developers.whmcs.com/api-reference/pendingorder/
96 | * @param {Object} opts
97 | * @param {Number} opts.orderid The order id to be accepted
98 | */
99 | pendingOrder (opts) {
100 | const options = {
101 | action: 'PendingOrder',
102 | ...opts
103 | }
104 | return this.callApi(options)
105 | }
106 | /**
107 | * Marks an order as fraudulent. - https://developers.whmcs.com/api-reference/fraudorder/
108 | * @param {Object} opts
109 | * @param {Number} opts.orderid The Order ID to set as fraud
110 | * @param {Boolean} [opts.cancelsub] Pass as true to cancel any PayPal Subscription(s) associated with the products & services that belong to the given order.
111 | */
112 | fraudOrder (opts) {
113 | const options = {
114 | action: 'FraudOrder',
115 | ...opts
116 | }
117 | return this.callApi(options)
118 | }
119 | /**
120 | * Cancel a Pending Order - https://developers.whmcs.com/api-reference/cancelorder/
121 | * @param {Object} opts
122 | * @param {Number} opts.orderid The ID of the pending order
123 | * @param {Boolean} [opts.cancelsub] Attempt to cancel the subscription associated with the products
124 | * @param {Boolean} [opts.noemail] Set to true to stop the invoice payment email being sent if the invoice becomes paid
125 | */
126 | cancelOrder (opts) {
127 | const options = {
128 | action: 'CancelOrder',
129 | ...opts
130 | }
131 | return this.callApi(options)
132 | }
133 | /**
134 | * Adds an order to a client. - https://developers.whmcs.com/api-reference/addorder/
135 | * @param {Object} opts
136 | * @param {Number} opts.clientid
137 | * @param {String} opts.paymentmethod The payment method for the order in the system format. eg. paypal, mailin
138 | * @param {Array.<Number>} [opts.pid] The array of product ids to add the order for
139 | * @param {Array.<String>} [opts.domain] The array of domain names associated with the products/domains
140 | * @param {Array.<String>} [opts.billingcycle] The array of billing cycles for the products
141 | * @param {Array.<String>} [opts.domaintype] For domain registrations, an array of register or transfer values
142 | * @param {Array.<Number>} [opts.regperiod] For domain registrations, the registration periods for the domains in the order
143 | * @param {Array.<String>} [opts.eppcode] For domain transfers. The epp codes for the domains being transferred in the order
144 | * @param {String} [opts.nameserver1] The first nameserver to apply to all domains in the order
145 | * @param {String} [opts.nameserver2] The second nameserver to apply to all domains in the order
146 | * @param {String} [opts.nameserver3] The third nameserver to apply to all domains in the order
147 | * @param {String} [opts.nameserver4] The fourth nameserver to apply to all domains in the order
148 | * @param {String} [opts.nameserver5] The fifth nameserver to apply to all domains in the order
149 | * @param {Array.<String>} [opts.customfields] an array of base64 encoded serialized array of product custom field values
150 | * @param {Array.<String>} [opts.configoptions] an array of base64 encoded serialized array of product configurable options values
151 | * @param {Array.<Number>} [opts.priceoverride] Override the price of the product being ordered
152 | * @param {String} [opts.promocode] The promotion code to apply to the order
153 | * @param {Boolean} [opts.promooverride] Should the promotion apply to the order even without matching promotional products
154 | * @param {Number} [opts.affid] The affiliate id to associate with the order
155 | * @param {Boolean} [opts.noinvoice] Set to true to suppress the invoice generating for the whole order
156 | * @param {Boolean} [opts.noinvoiceemail] Set to true to suppress the Invoice Created email being sent for the order
157 | * @param {Boolean} [opts.noemail] Set to true to suppress the Order Confirmation email being sent
158 | * @param {Array.<String>} [opts.addons] A comma separated list of addons to create on order with the products
159 | * @param {Array.<String>} [opts.hostname] The hostname of the server for VPS/Dedicated Server orders
160 | * @param {Array.<String>} [opts.ns1prefix] The first nameserver prefix for the VPS/Dedicated server. Eg. ns1 in ns1.hostname.com
161 | * @param {Array.<String>} [opts.ns2prefix] The second nameserver prefix for the VPS/Dedicated server. Eg. ns2 in ns2.hostname.com
162 | * @param {Array.<String>} [opts.rootpw] The desired root password for the VPS/Dedicated server.
163 | * @param {Number} [opts.contactid] The id of the contact, associated with the client, that should apply to all domains in the order
164 | * @param {Array.<Boolean>} [opts.dnsmanagement] Add DNS Management to the Domain Order
165 | * @param {Array.<String>} [opts.domainfields] an array of base64 encoded serialized array of TLD Specific Field Values
166 | * @param {Array.<Boolean>} [opts.emailforwarding] Add Email Forwarding to the Domain Order
167 | * @param {Array.<Boolean>} [opts.idprotection] Add ID Protection to the Domain Order
168 | * @param {Array.<Number>} [opts.domainpriceoverride] Override the price of the registration price on the domain being ordered
169 | * @param {Array.<Number>} [opts.domainrenewoverride] Override the price of the renewal price on the domain being ordered
170 | * @param {Array} [opts.domainrenewals] A name -> value array of $domainName -> $renewalPeriod renewals to add an order for
171 | * @param {String} [opts.clientip] The ip address to associate with the order
172 | * @param {Number} [opts.addonid] The Addon ID for an Addon Only Order
173 | * @param {Number} [opts.serviceid] The service ID for the addon only order
174 | * @param {Array.<Number>} [opts.addonids] An Array of addon ids for an Addon Only Order
175 | * @param {Array.<Number>} [opts.serviceids] An array of service ids to associate the addons for an Addon Only order
176 | */
177 | addOrder (opts) {
178 | const options = {
179 | action: 'AddOrder',
180 | ...opts
181 | }
182 | return this.callApi(options)
183 | }
184 | /**
185 | * Obtain orders matching the passed criteria - https://developers.whmcs.com/api-reference/getorders/
186 | * @param {Object} opts
187 | * @param {Number} [opts.limitstart] The offset for the returned order data (default: 0)
188 | * @param {Number} [opts.limitnum] The number of records to return (default: 25)
189 | * @param {Number} [opts.id] Find orders for a specific id
190 | * @param {Number} [opts.userid] Find orders for a specific client id
191 | * @param {String} [opts.status] Find orders for a specific status
192 | */
193 | getOrders (opts) {
194 | const options = {
195 | action: 'GetOrders',
196 | ...opts
197 | }
198 | return this.callApi(options)
199 | }
200 | /**
201 | * Run a fraud check on a passed Order ID - https://developers.whmcs.com/api-reference/orderfraudcheck/
202 | * @param {Object} opts
203 | * @param {Number} opts.orderid The order id to complete the fraud check on
204 | * @param {String} [opts.ipaddress] To override the IP address on the fraud check
205 | */
206 | orderFraudCheck (opts) {
207 | const options = {
208 | action: 'OrderFraudCheck',
209 | ...opts
210 | }
211 | return this.callApi(options)
212 | }
213 | /**
214 | * Obtain promotions matching the passed criteria - https://developers.whmcs.com/api-reference/getpromotions/
215 | * @param {Object} opts
216 | * @param {String} [opts.code] Retrieve a specific promotion code. Do not pass to retrieve all
217 | */
218 | getPromotions (opts) {
219 | const options = {
220 | action: 'GetPromotions',
221 | ...opts
222 | }
223 | return this.callApi(options)
224 | }
225 | /**
226 | * Removes an order from the system. This cannot be undone. This will remove all items associated with the order (services, addons, domains, invoices etc) - https://developers.whmcs.com/api-reference/deleteorder/
227 | * @param {Object} opts
228 | * @param {Number} opts.orderid The order to be deleted
229 | */
230 | deleteOrder (opts) {
231 | const options = {
232 | action: 'DeleteOrder',
233 | ...opts
234 | }
235 | return this.callApi(options)
236 | }
237 | }
238 |
239 | module.exports = Orders
240 |
const WHMCS = require('../whmcs')
30 |
31 | /**
32 | * Allows you to manage your Project Management module in WHMCS.
33 | * @extends WHMCS
34 | */
35 | class ProjectManagement extends WHMCS {
36 | /**
37 | * @param {Object} config Object containing your API credentials.
38 | * @param {string} config.serverUrl URL to your installation. Remember to point to /includes/api.php
39 | * @param {string} [config.username]
40 | * @param {string} [config.password]
41 | * @param {string} [config.identifier]
42 | * @param {string} [config.secret]
43 | */
44 | constructor (config) {
45 | super(config)
46 | }
47 | /**
48 | * Adds a Message to a project - https://developers.whmcs.com/api-reference/addprojectmessage/
49 | * @param {Object} opts
50 | * @param {Number} opts.projectid The id of the project the message is for
51 | * @param {String} opts.message The message to add to the project
52 | * @param {Number} [opts.adminid] Override the admin id for the message. Not passing will set to the adminid of the api request
53 | */
54 | addProjectMessage (opts) {
55 | const options = {
56 | action: 'AddProjectMessage',
57 | ...opts
58 | }
59 | return this.callApi(options)
60 | }
61 | /**
62 | * Adds a Task to a project - https://developers.whmcs.com/api-reference/updateprojecttask/
63 | * @param {Object} opts
64 | * @param {Number} opts.taskid The id of the project task to update
65 | * @param {Number} [opts.projectid] Change the project a task is assigned to
66 | * @param {String} [opts.duedate] The duedate for the task. Format YYYY-mm-dd
67 | * @param {Number} [opts.adminid] The admin id to associate the task with
68 | * @param {String} [opts.task] The task title
69 | * @param {String} [opts.notes] The notes for the task
70 | * @param {Boolean} [opts.completed] Has the task been completed
71 | */
72 | updateProjectTask (opts) {
73 | const options = {
74 | action: 'UpdateProjectTask',
75 | ...opts
76 | }
77 | return this.callApi(options)
78 | }
79 | /**
80 | * Starts a timer for a project - https://developers.whmcs.com/api-reference/starttasktimer/
81 | * @param {Object} opts
82 | * @param {Number} opts.timerid The id of the task to be ended
83 | * @param {Number} opts.projectid The id of the project for the task timer
84 | * @param {Number} [opts.adminid] The admin id to associate the timer with
85 | * @param {Number} [opts.start_time] The start time as a unix time stamp. Defaults to time() if not provided
86 | * @param {Number} [opts.end_time] The start time as a unix time stamp.
87 | */
88 | startTaskTimer (opts) {
89 | const options = {
90 | action: 'StartTaskTimer',
91 | ...opts
92 | }
93 | return this.callApi(options)
94 | }
95 | /**
96 | * Updates a project - https://developers.whmcs.com/api-reference/updateproject/
97 | * @param {Object} opts
98 | * @param {Number} opts.projectid The project ID to update
99 | * @param {Number} [opts.adminid] The adminId the project will be associated with
100 | * @param {Number} [opts.userid] The user that the project is for
101 | * @param {String} [opts.status] The status of the project as defined in Project Management Settings
102 | * @param {String} [opts.created] The created date of the project in Y-m-d format
103 | * @param {String} [opts.duedate] The due date of the project in Y-m-d format
104 | * @param {Boolean} [opts.completed] Is the project completed
105 | * @param {String} [opts.title] The title of the project
106 | * @param {String} [opts.ticketids] A comma separated list of ticket IDs to associate with the project
107 | * @param {String} [opts.invoiceids] A comma separated list of invoice IDs to associate with the project
108 | * @param {String} [opts.notes] The notes to associate with the project
109 | */
110 | updateProject (opts) {
111 | const options = {
112 | action: 'UpdateProject',
113 | ...opts
114 | }
115 | return this.callApi(options)
116 | }
117 | /**
118 | * Retrieve a specific Project - https://developers.whmcs.com/api-reference/getproject/
119 | * @param {Object} opts
120 | * @param {Number} opts.projectid The project id to obtain
121 | */
122 | getProject (opts) {
123 | const options = {
124 | action: 'GetProject',
125 | ...opts
126 | }
127 | return this.callApi(options)
128 | }
129 | /**
130 | * Creates a new project - https://developers.whmcs.com/api-reference/createproject/
131 | * @param {Object} opts
132 | * @param {String} opts.title The title of the new project
133 | * @param {Number} opts.adminid The adminId the project will be associated with
134 | * @param {Number} [opts.userid] The user that the project is for
135 | * @param {String} [opts.status] The status of the project as defined in Project Management Settings
136 | * @param {String} [opts.created] The created date of the project in Y-m-d format
137 | * @param {String} [opts.duedate] The duedate date of the project in Y-m-d format
138 | * @param {Boolean} [opts.completed] Is the project completed
139 | * @param {String} [opts.ticketids] A comma separated list of ticket IDs to associate with the project
140 | * @param {String} [opts.invoiceids] A comma separated list of invoice IDs to associate with the project
141 | */
142 | createProject (opts) {
143 | const options = {
144 | action: 'CreateProject',
145 | ...opts
146 | }
147 | return this.callApi(options)
148 | }
149 | /**
150 | * Ends a started timer for a project - https://developers.whmcs.com/api-reference/endtasktimer/
151 | * @param {Object} opts
152 | * @param {Number} opts.timerid The id of the task to be ended
153 | * @param {Number} [opts.projectid] The id of the project for the task timer
154 | * @param {Number} [opts.adminid] The admin id to associate the timer with
155 | * @param {Number} [opts.end_time] The end time as a unix time stamp. Defaults to time() if not provided
156 | */
157 | endTaskTimer (opts) {
158 | const options = {
159 | action: 'EndTaskTimer',
160 | ...opts
161 | }
162 | return this.callApi(options)
163 | }
164 | /**
165 | * Adds a Task to a project - https://developers.whmcs.com/api-reference/addprojecttask/
166 | * @param {Object} opts
167 | * @param {Number} opts.projectid The id of the project the task is for
168 | * @param {String} opts.duedate The duedate for the task. Format YYYY-mm-dd
169 | * @param {Number} [opts.adminid] The admin id to associate the task with
170 | * @param {String} [opts.task] The task title
171 | * @param {String} [opts.notes] The notes for the task
172 | * @param {Boolean} [opts.completed] Has the task been completed
173 | * @param {Boolean} [opts.billed] Has the task been billed
174 | */
175 | addProjectTask (opts) {
176 | const options = {
177 | action: 'AddProjectTask',
178 | ...opts
179 | }
180 | return this.callApi(options)
181 | }
182 | /**
183 | * Removes a task from the system. This cannot be undone - https://developers.whmcs.com/api-reference/deleteprojecttask/
184 | * @param {Object} opts
185 | * @param {Number} opts.projectid The project that owns the task being deleted
186 | * @param {Number} opts.taskid The task to be deleted
187 | */
188 | deleteProjectTask (opts) {
189 | const options = {
190 | action: 'DeleteProjectTask',
191 | ...opts
192 | }
193 | return this.callApi(options)
194 | }
195 | /**
196 | * Obtain orders matching the passed criteria - https://developers.whmcs.com/api-reference/getprojects/
197 | * @param {Object} opts
198 | * @param {Number} [opts.limitstart] The offset for the returned project data (default: 0)
199 | * @param {Number} [opts.limitnum] The number of records to return (default: 25)
200 | * @param {Number} [opts.userid] Find projects for a specific client id
201 | * @param {String} [opts.title] Find projects with a specific title
202 | * @param {String} [opts.ticketids] Find projects with specific ticketids
203 | * @param {String} [opts.invoiceids] Find projects with specific invoiceids
204 | * @param {String} [opts.notes] Find projects with specific notes
205 | * @param {Number} [opts.adminid] Find projects assigned to a specific admin id
206 | * @param {String} [opts.status] Find projects with a specific status
207 | * @param {String} [opts.created] Find projects with a specific creation date
208 | * @param {String} [opts.duedate] Find projects with a specific due date
209 | * @param {Boolean} [opts.completed] Find projects that are/aren’t completed
210 | * @param {String} [opts.lastmodified] Find projects with a specific last modified date
211 | */
212 | getProjects (opts) {
213 | const options = {
214 | action: 'GetProjects',
215 | ...opts
216 | }
217 | return this.callApi(options)
218 | }
219 | }
220 |
221 | module.exports = ProjectManagement
222 |
const WHMCS = require('../whmcs')
30 |
31 | /**
32 | * Allows you to manage your Services module in WHMCS.
33 | * @extends WHMCS
34 | */
35 | class Services extends WHMCS {
36 | /**
37 | * @param {Object} config Object containing your API credentials.
38 | * @param {string} config.serverUrl URL to your installation. Remember to point to /includes/api.php
39 | * @param {string} [config.username]
40 | * @param {string} [config.password]
41 | * @param {string} [config.identifier]
42 | * @param {string} [config.secret]
43 | */
44 | constructor (config) {
45 | super(config)
46 | }
47 | /**
48 | * Runs a change package action for a given service. - https://developers.whmcs.com/api-reference/modulechangepackage/
49 | * @param {Object} opts
50 | * @param {Number} opts.serviceid The service ID to run the action for
51 | */
52 | moduleChangePackage (opts) {
53 | const options = {
54 | action: 'ModuleChangePackage',
55 | ...opts
56 | }
57 | return this.callApi(options)
58 | }
59 | /**
60 | * Runs a change password action for a given service. - https://developers.whmcs.com/api-reference/modulechangepw/
61 | * @param {Object} opts
62 | * @param {Number} opts.serviceid The service ID to run the action for
63 | * @param {String} [opts.servicepassword] A new password to assign to the service
64 | */
65 | moduleChangePw (opts) {
66 | const options = {
67 | action: 'ModuleChangePw',
68 | ...opts
69 | }
70 | return this.callApi(options)
71 | }
72 | /**
73 | * Updates a Client Service - https://developers.whmcs.com/api-reference/updateclientproduct/
74 | * @param {Object} opts
75 | * @param {Number} opts.serviceid The id of the client service to update
76 | * @param {Number} [opts.pid] The package id to associate with the service
77 | * @param {Number} [opts.serverid] The server id to associate with the service
78 | * @param {String} [opts.nextduedate] The next due date of the service (Y-m-d)
79 | * @param {String} [opts.terminationDate] Update the termination date of the service (Y-m-d)
80 | * @param {String} [opts.completedDate] Update the completed date of the service (Y-m-d)
81 | * @param {String} [opts.domain] The domain name to be changed to
82 | * @param {Number} [opts.firstpaymentamount] The first payment amount on the service
83 | * @param {Number} [opts.recurringamount] The recurring amount for automatic renewal invoices
84 | * @param {String} [opts.paymentmethod] The payment method to associate in system format (eg paypal)
85 | * @param {String} [opts.billingcycle] The term in which the product is billed on (eg One-Time, Monthly, Quarterly, etc)
86 | * @param {String} [opts.subscriptionid] The subscription ID to associate with the service
87 | * @param {String} [opts.status] The status to change the service to
88 | * @param {String} [opts.notes] The admin notes for the service
89 | * @param {String} [opts.serviceusername] The service username
90 | * @param {String} [opts.servicepassword] The service password
91 | * @param {String} [opts.overideautosuspend] Should override auto suspend be provided (‘on’ or ‘off’)
92 | * @param {String} [opts.overidesuspenduntil] Update the Override Suspend date of the service (Y-m-d)
93 | * @param {String} [opts.ns1] (VPS/Dedicated servers only)
94 | * @param {String} [opts.ns2] (VPS/Dedicated servers only)
95 | * @param {String} [opts.dedicatedip]
96 | * @param {String} [opts.assignedips] (VPS/Dedicated servers only)
97 | * @param {Number} [opts.diskusage] The disk usage in bytes
98 | * @param {Number} [opts.disklimit] The disk limit in bytes
99 | * @param {Number} [opts.bwusage] The bandwidth usage in bytes
100 | * @param {Number} [opts.bwlimit] The bandwidth limit in bytes
101 | * @param {String} [opts.overidesuspenduntil]
102 | * @param {String} [opts.suspendreason]
103 | * @param {Number} [opts.promoid] The promotion Id to associate
104 | * @param {Array} [opts.unset] An array of items to unset. Can be one of: ‘domain’, ‘serviceusername’, ‘servicepassword’, ‘subscriptionid’, ‘ns1’, ‘ns2’, ‘dedicatedip’, ‘assignedips’, ‘notes’, ‘suspendreason’
105 | * @param {Boolean} [opts.autorecalc] Should the recurring amount of the service be automatically recalculated (this will ignore any passed $recurringamount)
106 | * @param {String} [opts.customfields] Base64 encoded serialized array of custom field values - base64_encode(serialize(array(“1”=>“Yahoo”)));
107 | * @param {String} [opts.configoptions] Base64 encoded serialized array of configurable option field values - base64_encode(serialize(array(configoptionid => dropdownoptionid, XXX => array(‘optionid’ => YYY, ‘qty’ => ZZZ)))) - XXX is the ID of the configurable option - YYY is the optionid found in tblhostingconfigoption.optionid - ZZZ is the quantity you want to use for that option
108 | */
109 | updateClientProduct (opts) {
110 | const options = {
111 | action: 'UpdateClientProduct',
112 | ...opts
113 | }
114 | return this.callApi(options)
115 | }
116 | /**
117 | * Runs a custom module action for a given service. - https://developers.whmcs.com/api-reference/modulecustom/
118 | * @param {Object} opts
119 | * @param {Number} opts.serviceid The service ID to run the action for
120 | * @param {String} opts.func_name The name of the custom function to run
121 | */
122 | moduleCustom (opts) {
123 | const options = {
124 | action: 'ModuleCustom',
125 | ...opts
126 | }
127 | return this.callApi(options)
128 | }
129 | /**
130 | * Runs the module suspend action for a given service. - https://developers.whmcs.com/api-reference/modulesuspend/
131 | * @param {Object} opts
132 | * @param {Number} opts.serviceid The service ID to run the action for
133 | * @param {String} [opts.suspendreason] A reason for the suspension
134 | */
135 | moduleSuspend (opts) {
136 | const options = {
137 | action: 'ModuleSuspend',
138 | ...opts
139 | }
140 | return this.callApi(options)
141 | }
142 | /**
143 | * Runs an unsuspend action for a given service. - https://developers.whmcs.com/api-reference/moduleunsuspend/
144 | * @param {Object} opts
145 | * @param {Number} opts.serviceid The service ID to run the action for
146 | */
147 | moduleUnsuspend (opts) {
148 | const options = {
149 | action: 'ModuleUnsuspend',
150 | ...opts
151 | }
152 | return this.callApi(options)
153 | }
154 | /**
155 | * Runs the module create action for a given service. - https://developers.whmcs.com/api-reference/modulecreate/
156 | * @param {Object} opts
157 | * @param {Number} opts.serviceid The service ID to run the action for
158 | */
159 | moduleCreate (opts) {
160 | const options = {
161 | action: 'ModuleCreate',
162 | ...opts
163 | }
164 | return this.callApi(options)
165 | }
166 | /**
167 | * Runs a terminate action for a given service. - https://developers.whmcs.com/api-reference/moduleterminate/
168 | * @param {Object} opts
169 | * @param {Number} opts.serviceid The service ID to run the action for
170 | */
171 | moduleTerminate (opts) {
172 | const options = {
173 | action: 'ModuleTerminate',
174 | ...opts
175 | }
176 | return this.callApi(options)
177 | }
178 | /**
179 | * Upgrade, or calculate an upgrade on, a product - https://developers.whmcs.com/api-reference/upgradeproduct/
180 | * @param {Object} opts
181 | * @param {Number} opts.serviceid The ID of the service to update
182 | * @param {Boolean} [opts.calconly] Only calculate the upgrade amount
183 | * @param {String} opts.paymentmethod The upgrade payment method in system format (e.g. paypal)
184 | * @param {String} opts.type The type of upgrade (‘product’, ‘configoptions’)
185 | * @param {Number} [opts.newproductid] The Id of the new product
186 | * @param {String} [opts.newproductbillingcycle] The new products billing cycle
187 | * @param {String} [opts.promocode] The promotion code to apply to the upgrade
188 | * @param {Array} [opts.configoptions] An array of config options to upgrade
189 | * @param {Number} [opts.configoptions[id]] The id of the config option
190 | * @param {Number} [opts.configoptions[optiontype]] The config option type
191 | * @param {Number} [opts.configoptions[selectedvalue]] The config option selected value
192 | * @param {Number} [opts.configoptions[selectedqty]] The config option quantity selected
193 | */
194 | upgradeProduct (opts) {
195 | const options = {
196 | action: 'UpgradeProduct',
197 | ...opts
198 | }
199 | return this.callApi(options)
200 | }
201 | }
202 |
203 | module.exports = Services
204 |
const WHMCS = require('../whmcs')
30 |
31 | /**
32 | * Allows you to manage your domains module in WHMCS.
33 | * @extends WHMCS
34 | */
35 | class Domains extends WHMCS {
36 | /**
37 | * @param {Object} config Object containing your API credentials.
38 | * @param {string} config.serverUrl URL to your installation. Remember to point to /includes/api.php
39 | * @param {string} [config.username]
40 | * @param {string} [config.password]
41 | * @param {string} [config.identifier]
42 | * @param {string} [config.secret]
43 | */
44 | constructor (config) {
45 | super(config)
46 | }
47 | /**
48 | * Connects to the registrar and obtains the nameservers for the domain - https://developers.whmcs.com/api-reference/domaingetnameservers/
49 | * @param {Object} opts
50 | * @param {Number} opts.domainid The id of the domain to obtain the nameservers for
51 | */
52 | domainGetNameservers (opts) {
53 | const options = {
54 | action: 'DomainGetNameservers',
55 | ...opts
56 | }
57 | return this.callApi(options)
58 | }
59 | /**
60 | * Connects to the registrar and attempts to toggle the ID Protect state - https://developers.whmcs.com/api-reference/domaintoggleidprotect/
61 | * @param {Object} opts
62 | * @param {Number} opts.domainid The id of the domain to toggle ID Protection for
63 | * @param {Boolean} [opts.idprotect] Should ID Protection be turned on
64 | */
65 | domainToggleIdProtect (opts) {
66 | const options = {
67 | action: 'DomainToggleIdProtect',
68 | ...opts
69 | }
70 | return this.callApi(options)
71 | }
72 | /**
73 | * Connects to the registrar and obtains the whois information for the domain - https://developers.whmcs.com/api-reference/domaingetwhoisinfo/
74 | * @param {Object} opts
75 | * @param {Number} opts.domainid The id of the domain to obtain the whois information for
76 | */
77 | domainGetWhoisInfo (opts) {
78 | const options = {
79 | action: 'DomainGetWhoisInfo',
80 | ...opts
81 | }
82 | return this.callApi(options)
83 | }
84 | /**
85 | * Connects to the registrar and attempts to register the domain. - https://developers.whmcs.com/api-reference/domainregister/
86 | * @param {Object} opts
87 | * @param {Number} [opts.domainid] The id of the domain to register recommended
88 | * @param {String} [opts.domain] The domain name to be registered. This or $domainid is required
89 | */
90 | domainRegister (opts) {
91 | const options = {
92 | action: 'DomainRegister',
93 | ...opts
94 | }
95 | return this.callApi(options)
96 | }
97 | /**
98 | * Connects to the registrar and obtains the current lock status of the domain - https://developers.whmcs.com/api-reference/domaingetlockingstatus/
99 | * @param {Object} opts
100 | * @param {Number} opts.domainid The id of the domain to obtain the lock status for
101 | */
102 | domainGetLockingStatus (opts) {
103 | const options = {
104 | action: 'DomainGetLockingStatus',
105 | ...opts
106 | }
107 | return this.callApi(options)
108 | }
109 | /**
110 | * Connects to the registrar and attempts to obtain the EPP Code for the domain.
111 | Not all registrars return the EPP code but send them directly to the client. - https://developers.whmcs.com/api-reference/domainrequestepp/
112 | * @param {Object} opts
113 | * @param {Number} opts.domainid The id of the domain to obtain the EPP for
114 | */
115 | domainRequestEPP (opts) {
116 | const options = {
117 | action: 'DomainRequestEPP',
118 | ...opts
119 | }
120 | return this.callApi(options)
121 | }
122 | /**
123 | * Connects to the registrar and attempts to update the WHOIS Information - https://developers.whmcs.com/api-reference/domainupdatewhoisinfo/
124 | * @param {Object} opts
125 | * @param {Number} opts.domainid The id of the domain to update the whois information for
126 | * @param {String} opts.xml The xml of the details to update. See DomainGetWhoisInfo
127 | */
128 | domainUpdateWhoisInfo (opts) {
129 | const options = {
130 | action: 'DomainUpdateWhoisInfo',
131 | ...opts
132 | }
133 | return this.callApi(options)
134 | }
135 | /**
136 | * Connects to the registrar and attempts to update the lock - https://developers.whmcs.com/api-reference/domainupdatelockingstatus/
137 | * @param {Object} opts
138 | * @param {Number} opts.domainid The id of the domain to update the locking status for
139 | * @param {Boolean} [opts.lockstatus] Should the domain lock be turned on
140 | */
141 | domainUpdateLockingStatus (opts) {
142 | const options = {
143 | action: 'DomainUpdateLockingStatus',
144 | ...opts
145 | }
146 | return this.callApi(options)
147 | }
148 | /**
149 | * Connects to the registrar and attempts to release the domain. - https://developers.whmcs.com/api-reference/domainrelease/
150 | * @param {Object} opts
151 | * @param {Number} [opts.domainid] The id of the domain to be released recommended
152 | * @param {String} [opts.domain] The domain name to be released. This or $domainid is required
153 | * @param {String} opts.newtag The receiving tag for the domain
154 | */
155 | domainRelease (opts) {
156 | const options = {
157 | action: 'DomainRelease',
158 | ...opts
159 | }
160 | return this.callApi(options)
161 | }
162 | /**
163 | * Retrieve domain whois information. - https://developers.whmcs.com/api-reference/domainwhois/
164 | * @param {Object} opts
165 | * @param {String} opts.domain The domain name to lookup
166 | */
167 | domainWhois (opts) {
168 | const options = {
169 | action: 'DomainWhois',
170 | ...opts
171 | }
172 | return this.callApi(options)
173 | }
174 | /**
175 | * Connects to the registrar and attempts to update the nameservers with those provided. - https://developers.whmcs.com/api-reference/domainupdatenameservers/
176 | * @param {Object} opts
177 | * @param {Number} [opts.domainid] The id of the domain to update the nameservers for recommended
178 | * @param {String} [opts.domain] The domain name to be update the nameservers for. This or $domainid is required
179 | * @param {String} opts.ns1 The first nameserver
180 | * @param {String} opts.ns2 The second nameserver
181 | * @param {String} [opts.ns3] The third nameserver
182 | * @param {String} [opts.ns4] The fourth nameserver
183 | * @param {String} [opts.ns5] The fifth nameserver
184 | */
185 | domainUpdateNameservers (opts) {
186 | const options = {
187 | action: 'DomainUpdateNameservers',
188 | ...opts
189 | }
190 | return this.callApi(options)
191 | }
192 | /**
193 | * Retrieve TLD pricing - https://developers.whmcs.com/api-reference/gettldpricing/
194 | * @param {Object} opts
195 | * @param {Number} [opts.currencyid] The currency ID to fetch pricing for
196 | * @param {Number} [opts.clientid] The id of the client to fetch pricing for. Pass one or the other. clientid being passed will override currencyid
197 | */
198 | getTLDPricing (opts) {
199 | const options = {
200 | action: 'GetTLDPricing',
201 | ...opts
202 | }
203 | return this.callApi(options)
204 | }
205 | /**
206 | * Connects to the registrar and attempts to renew the domain. - https://developers.whmcs.com/api-reference/domainrenew/
207 | * @param {Object} opts
208 | * @param {Number} [opts.domainid] The id of the domain to be renewed recommended
209 | * @param {String} [opts.domain] The domain name to be renewed. This or $domainid is required
210 | * @param {Number} [opts.regperiod] How long to renew the domain for. Defaults to the current stored value.
211 | */
212 | domainRenew (opts) {
213 | const options = {
214 | action: 'DomainRenew',
215 | ...opts
216 | }
217 | return this.callApi(options)
218 | }
219 | /**
220 | * Connects to the registrar and attempts to start the transfer process. - https://developers.whmcs.com/api-reference/domaintransfer/
221 | * @param {Object} opts
222 | * @param {Number} [opts.domainid] The id of the domain to be transferred recommended
223 | * @param {String} [opts.domain] The domain name to be transferred. This or $domainid is required
224 | * @param {Number} [opts.eppcode] Provide a new EPP Code for the Transfer Request
225 | */
226 | domainTransfer (opts) {
227 | const options = {
228 | action: 'DomainTransfer',
229 | ...opts
230 | }
231 | return this.callApi(options)
232 | }
233 | /**
234 | * Updates a Client Domain - https://developers.whmcs.com/api-reference/updateclientdomain/
235 | * @param {Object} opts
236 | * @param {Number} opts.domainid The id of the client domain to update
237 | * @param {Boolean} [opts.dnsmanagement] Enable/Disable DNS Management
238 | * @param {Boolean} [opts.emailforwarding] Enable/Disable Email Forwarding
239 | * @param {Boolean} [opts.idprotection] Enable/Disable ID Protection
240 | * @param {Boolean} [opts.donotrenew] Enable/Disable Do Not Renew
241 | * @param {String} [opts.type] The type of domain order. (‘Register’, ‘Transfer’)
242 | * @param {String} [opts.regdate] The registration date of the domain (Y-m-d)
243 | * @param {String} [opts.nextduedate] The next due date of the domain (Y-m-d)
244 | * @param {String} [opts.expirydate] The expiry date of the domain (Y-m-d)
245 | * @param {String} [opts.domain] The domain name to be changed to
246 | * @param {Number} [opts.firstpaymentamount] The first payment amount on the domain
247 | * @param {Number} [opts.recurringamount] The recurring amount for automatic renewal invoices
248 | * @param {String} [opts.registrar] The registrar to associate with the domain
249 | * @param {Number} [opts.regperiod] The registration period of the domain
250 | * @param {String} [opts.paymentmethod] The payment method to associate in system format (eg paypal)
251 | * @param {String} [opts.subscriptionid] The subscription ID to associate with the domain
252 | * @param {String} [opts.status] The status to change the domain to
253 | * @param {String} [opts.notes] The admin notes for the domain
254 | * @param {Number} [opts.promoid] The promotion Id to associate
255 | * @param {Boolean} [opts.autorecalc] Should the recurring amount of the domain be automatically recalculated (this will ignore any passed $recurringamount)
256 | * @param {Boolean} [opts.updatens] Should the nameservers be updated at the registrar
257 | * @param {String} [opts.ns1] The first nameserver to save
258 | * @param {String} [opts.ns2] The second nameserver to save
259 | * @param {String} [opts.ns3] The third nameserver to save
260 | * @param {String} [opts.ns4] The fourth nameserver to save
261 | * @param {String} [opts.ns5] The fifth nameserver to save
262 | */
263 | updateClientDomain (opts) {
264 | const options = {
265 | action: 'UpdateClientDomain',
266 | ...opts
267 | }
268 | return this.callApi(options)
269 | }
270 | }
271 |
272 | module.exports = Domains
273 |
const WHMCS = require('../whmcs')
30 |
31 | /**
32 | * Allows you to manage your products module in WHMCS.
33 | * @extends WHMCS
34 | */
35 | class Products extends WHMCS {
36 | /**
37 | * @param {Object} config Object containing your API credentials.
38 | * @param {string} config.serverUrl URL to your installation. Remember to point to /includes/api.php
39 | * @param {string} [config.username]
40 | * @param {string} [config.password]
41 | * @param {string} [config.identifier]
42 | * @param {string} [config.secret]
43 | */
44 | constructor (config) {
45 | super(config)
46 | }
47 | /**
48 | * Adds a product to the system to be available for purchase - https://developers.whmcs.com/api-reference/addproduct/
49 | * @param {Object} opts
50 | * @param {String} opts.name The name of the product to be added
51 | * @param {Number} opts.gid The id of the product group to add the product
52 | * @param {String} [opts.type] One of ‘hostingaccount’, ‘reselleraccount’, ‘server’ or ‘other’
53 | * @param {Boolean} [opts.stockcontrol] Set to true to enable stock control on the product
54 | * @param {Number} [opts.qty] How much of this product is in stock
55 | * @param {String} [opts.paytype] The payment type of the product. One of ‘free’, ‘onetime’, ‘recurring’
56 | * @param {Boolean} [opts.hidden] Should the product be hidden from the client order form
57 | * @param {Boolean} [opts.showdomainoptions] Should the product show the domain registration options.
58 | * @param {Boolean} [opts.tax] Does tax apply to the product.
59 | * @param {Boolean} [opts.isFeatured] Should the product be featured in the Product Group.
60 | * @param {Boolean} [opts.proratabilling] Is pro-rata billing enabled for this product.
61 | * @param {String} [opts.description] The description of the product to show on the product listing in the cart
62 | * @param {Number} [opts.welcomeemail] The id of the Email Template to use as the welcome email. Product/Service Messages only
63 | * @param {Number} [opts.proratadate] See https://docs.whmcs.com/Products_and_Services#Pricing_Tab
64 | * @param {Number} [opts.proratachargenextmonth] See https://docs.whmcs.com/Products_and_Services#Pricing_Tab
65 | * @param {String} [opts.subdomain] A comma separated list of subdomains to offer on the domain register page. eg: .domain1.com,.domain2.com
66 | * @param {String} [opts.autosetup] When should the product be automatically setup. One of “ (never), ‘on’ (pending order), ‘payment’ (on payment), ‘order’ (on order)
67 | * @param {String} [opts.module] The server module system name to associate with the product. eg: cpanel, autorelease, plesk
68 | * @param {Number} [opts.servergroupid] The server group id used on product creation to associate an appropriate server
69 | * @param {Mixed} [opts.configoption1] The first module configuration value
70 | * @param {Mixed} [opts.configoption2] The second module configuration value
71 | * @param {Mixed} [opts.configoption3] The third module configuration value
72 | * @param {Mixed} [opts.configoption4] The fourth module configuration value
73 | * @param {Mixed} [opts.configoption5] The fifth module configuration value
74 | * @param {Mixed} [opts.configoption6] The sixth module configuration value
75 | * @param {Number} [opts.order] The order to in which to display on the order form
76 | * @param {Array} [opts.pricing] The pricing array to associate with the product. format $pricing[currencyid]cycle
77 | */
78 | addProduct (opts) {
79 | const options = {
80 | action: 'AddProduct',
81 | ...opts
82 | }
83 | return this.callApi(options)
84 | }
85 | }
86 |
87 |
88 | module.exports = Products
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
101 |
102 |
103 |
104 |
107 |
108 |
109 |
110 |
111 |
112 |
--------------------------------------------------------------------------------
/docs/scripts/linenumber.js:
--------------------------------------------------------------------------------
1 | /*global document */
2 | (function() {
3 | var source = document.getElementsByClassName('prettyprint source linenums');
4 | var i = 0;
5 | var lineNumber = 0;
6 | var lineId;
7 | var lines;
8 | var totalLines;
9 | var anchorHash;
10 |
11 | if (source && source[0]) {
12 | anchorHash = document.location.hash.substring(1);
13 | lines = source[0].getElementsByTagName('li');
14 | totalLines = lines.length;
15 |
16 | for (; i < totalLines; i++) {
17 | lineNumber++;
18 | lineId = 'line' + lineNumber;
19 | lines[i].id = lineId;
20 | if (lineId === anchorHash) {
21 | lines[i].className += ' selected';
22 | }
23 | }
24 | }
25 | })();
26 |
--------------------------------------------------------------------------------
/docs/scripts/prettify/Apache-License-2.0.txt:
--------------------------------------------------------------------------------
1 |
2 | Apache License
3 | Version 2.0, January 2004
4 | http://www.apache.org/licenses/
5 |
6 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7 |
8 | 1. Definitions.
9 |
10 | "License" shall mean the terms and conditions for use, reproduction,
11 | and distribution as defined by Sections 1 through 9 of this document.
12 |
13 | "Licensor" shall mean the copyright owner or entity authorized by
14 | the copyright owner that is granting the License.
15 |
16 | "Legal Entity" shall mean the union of the acting entity and all
17 | other entities that control, are controlled by, or are under common
18 | control with that entity. For the purposes of this definition,
19 | "control" means (i) the power, direct or indirect, to cause the
20 | direction or management of such entity, whether by contract or
21 | otherwise, or (ii) ownership of fifty percent (50%) or more of the
22 | outstanding shares, or (iii) beneficial ownership of such entity.
23 |
24 | "You" (or "Your") shall mean an individual or Legal Entity
25 | exercising permissions granted by this License.
26 |
27 | "Source" form shall mean the preferred form for making modifications,
28 | including but not limited to software source code, documentation
29 | source, and configuration files.
30 |
31 | "Object" form shall mean any form resulting from mechanical
32 | transformation or translation of a Source form, including but
33 | not limited to compiled object code, generated documentation,
34 | and conversions to other media types.
35 |
36 | "Work" shall mean the work of authorship, whether in Source or
37 | Object form, made available under the License, as indicated by a
38 | copyright notice that is included in or attached to the work
39 | (an example is provided in the Appendix below).
40 |
41 | "Derivative Works" shall mean any work, whether in Source or Object
42 | form, that is based on (or derived from) the Work and for which the
43 | editorial revisions, annotations, elaborations, or other modifications
44 | represent, as a whole, an original work of authorship. For the purposes
45 | of this License, Derivative Works shall not include works that remain
46 | separable from, or merely link (or bind by name) to the interfaces of,
47 | the Work and Derivative Works thereof.
48 |
49 | "Contribution" shall mean any work of authorship, including
50 | the original version of the Work and any modifications or additions
51 | to that Work or Derivative Works thereof, that is intentionally
52 | submitted to Licensor for inclusion in the Work by the copyright owner
53 | or by an individual or Legal Entity authorized to submit on behalf of
54 | the copyright owner. For the purposes of this definition, "submitted"
55 | means any form of electronic, verbal, or written communication sent
56 | to the Licensor or its representatives, including but not limited to
57 | communication on electronic mailing lists, source code control systems,
58 | and issue tracking systems that are managed by, or on behalf of, the
59 | Licensor for the purpose of discussing and improving the Work, but
60 | excluding communication that is conspicuously marked or otherwise
61 | designated in writing by the copyright owner as "Not a Contribution."
62 |
63 | "Contributor" shall mean Licensor and any individual or Legal Entity
64 | on behalf of whom a Contribution has been received by Licensor and
65 | subsequently incorporated within the Work.
66 |
67 | 2. Grant of Copyright License. Subject to the terms and conditions of
68 | this License, each Contributor hereby grants to You a perpetual,
69 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70 | copyright license to reproduce, prepare Derivative Works of,
71 | publicly display, publicly perform, sublicense, and distribute the
72 | Work and such Derivative Works in Source or Object form.
73 |
74 | 3. Grant of Patent License. Subject to the terms and conditions of
75 | this License, each Contributor hereby grants to You a perpetual,
76 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77 | (except as stated in this section) patent license to make, have made,
78 | use, offer to sell, sell, import, and otherwise transfer the Work,
79 | where such license applies only to those patent claims licensable
80 | by such Contributor that are necessarily infringed by their
81 | Contribution(s) alone or by combination of their Contribution(s)
82 | with the Work to which such Contribution(s) was submitted. If You
83 | institute patent litigation against any entity (including a
84 | cross-claim or counterclaim in a lawsuit) alleging that the Work
85 | or a Contribution incorporated within the Work constitutes direct
86 | or contributory patent infringement, then any patent licenses
87 | granted to You under this License for that Work shall terminate
88 | as of the date such litigation is filed.
89 |
90 | 4. Redistribution. You may reproduce and distribute copies of the
91 | Work or Derivative Works thereof in any medium, with or without
92 | modifications, and in Source or Object form, provided that You
93 | meet the following conditions:
94 |
95 | (a) You must give any other recipients of the Work or
96 | Derivative Works a copy of this License; and
97 |
98 | (b) You must cause any modified files to carry prominent notices
99 | stating that You changed the files; and
100 |
101 | (c) You must retain, in the Source form of any Derivative Works
102 | that You distribute, all copyright, patent, trademark, and
103 | attribution notices from the Source form of the Work,
104 | excluding those notices that do not pertain to any part of
105 | the Derivative Works; and
106 |
107 | (d) If the Work includes a "NOTICE" text file as part of its
108 | distribution, then any Derivative Works that You distribute must
109 | include a readable copy of the attribution notices contained
110 | within such NOTICE file, excluding those notices that do not
111 | pertain to any part of the Derivative Works, in at least one
112 | of the following places: within a NOTICE text file distributed
113 | as part of the Derivative Works; within the Source form or
114 | documentation, if provided along with the Derivative Works; or,
115 | within a display generated by the Derivative Works, if and
116 | wherever such third-party notices normally appear. The contents
117 | of the NOTICE file are for informational purposes only and
118 | do not modify the License. You may add Your own attribution
119 | notices within Derivative Works that You distribute, alongside
120 | or as an addendum to the NOTICE text from the Work, provided
121 | that such additional attribution notices cannot be construed
122 | as modifying the License.
123 |
124 | You may add Your own copyright statement to Your modifications and
125 | may provide additional or different license terms and conditions
126 | for use, reproduction, or distribution of Your modifications, or
127 | for any such Derivative Works as a whole, provided Your use,
128 | reproduction, and distribution of the Work otherwise complies with
129 | the conditions stated in this License.
130 |
131 | 5. Submission of Contributions. Unless You explicitly state otherwise,
132 | any Contribution intentionally submitted for inclusion in the Work
133 | by You to the Licensor shall be under the terms and conditions of
134 | this License, without any additional terms or conditions.
135 | Notwithstanding the above, nothing herein shall supersede or modify
136 | the terms of any separate license agreement you may have executed
137 | with Licensor regarding such Contributions.
138 |
139 | 6. Trademarks. This License does not grant permission to use the trade
140 | names, trademarks, service marks, or product names of the Licensor,
141 | except as required for reasonable and customary use in describing the
142 | origin of the Work and reproducing the content of the NOTICE file.
143 |
144 | 7. Disclaimer of Warranty. Unless required by applicable law or
145 | agreed to in writing, Licensor provides the Work (and each
146 | Contributor provides its Contributions) on an "AS IS" BASIS,
147 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148 | implied, including, without limitation, any warranties or conditions
149 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150 | PARTICULAR PURPOSE. You are solely responsible for determining the
151 | appropriateness of using or redistributing the Work and assume any
152 | risks associated with Your exercise of permissions under this License.
153 |
154 | 8. Limitation of Liability. In no event and under no legal theory,
155 | whether in tort (including negligence), contract, or otherwise,
156 | unless required by applicable law (such as deliberate and grossly
157 | negligent acts) or agreed to in writing, shall any Contributor be
158 | liable to You for damages, including any direct, indirect, special,
159 | incidental, or consequential damages of any character arising as a
160 | result of this License or out of the use or inability to use the
161 | Work (including but not limited to damages for loss of goodwill,
162 | work stoppage, computer failure or malfunction, or any and all
163 | other commercial damages or losses), even if such Contributor
164 | has been advised of the possibility of such damages.
165 |
166 | 9. Accepting Warranty or Additional Liability. While redistributing
167 | the Work or Derivative Works thereof, You may choose to offer,
168 | and charge a fee for, acceptance of support, warranty, indemnity,
169 | or other liability obligations and/or rights consistent with this
170 | License. However, in accepting such obligations, You may act only
171 | on Your own behalf and on Your sole responsibility, not on behalf
172 | of any other Contributor, and only if You agree to indemnify,
173 | defend, and hold each Contributor harmless for any liability
174 | incurred by, or claims asserted against, such Contributor by reason
175 | of your accepting any such warranty or additional liability.
176 |
177 | END OF TERMS AND CONDITIONS
178 |
179 | APPENDIX: How to apply the Apache License to your work.
180 |
181 | To apply the Apache License to your work, attach the following
182 | boilerplate notice, with the fields enclosed by brackets "[]"
183 | replaced with your own identifying information. (Don't include
184 | the brackets!) The text should be enclosed in the appropriate
185 | comment syntax for the file format. We also recommend that a
186 | file or class name and description of purpose be included on the
187 | same "printed page" as the copyright notice for easier
188 | identification within third-party archives.
189 |
190 | Copyright [yyyy] [name of copyright owner]
191 |
192 | Licensed under the Apache License, Version 2.0 (the "License");
193 | you may not use this file except in compliance with the License.
194 | You may obtain a copy of the License at
195 |
196 | http://www.apache.org/licenses/LICENSE-2.0
197 |
198 | Unless required by applicable law or agreed to in writing, software
199 | distributed under the License is distributed on an "AS IS" BASIS,
200 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201 | See the License for the specific language governing permissions and
202 | limitations under the License.
203 |
--------------------------------------------------------------------------------
/docs/scripts/prettify/lang-css.js:
--------------------------------------------------------------------------------
1 | PR.registerLangHandler(PR.createSimpleLexer([["pln",/^[\t\n\f\r ]+/,null," \t\r\n"]],[["str",/^"(?:[^\n\f\r"\\]|\\(?:\r\n?|\n|\f)|\\[\S\s])*"/,null],["str",/^'(?:[^\n\f\r'\\]|\\(?:\r\n?|\n|\f)|\\[\S\s])*'/,null],["lang-css-str",/^url\(([^"')]*)\)/i],["kwd",/^(?:url|rgb|!important|@import|@page|@media|@charset|inherit)(?=[^\w-]|$)/i,null],["lang-css-kw",/^(-?(?:[_a-z]|\\[\da-f]+ ?)(?:[\w-]|\\\\[\da-f]+ ?)*)\s*:/i],["com",/^\/\*[^*]*\*+(?:[^*/][^*]*\*+)*\//],["com",
2 | /^(?:<\!--|--\>)/],["lit",/^(?:\d+|\d*\.\d+)(?:%|[a-z]+)?/i],["lit",/^#[\da-f]{3,6}/i],["pln",/^-?(?:[_a-z]|\\[\da-f]+ ?)(?:[\w-]|\\\\[\da-f]+ ?)*/i],["pun",/^[^\s\w"']+/]]),["css"]);PR.registerLangHandler(PR.createSimpleLexer([],[["kwd",/^-?(?:[_a-z]|\\[\da-f]+ ?)(?:[\w-]|\\\\[\da-f]+ ?)*/i]]),["css-kw"]);PR.registerLangHandler(PR.createSimpleLexer([],[["str",/^[^"')]+/]]),["css-str"]);
3 |
--------------------------------------------------------------------------------
/docs/styles/jsdoc-default.css:
--------------------------------------------------------------------------------
1 | @font-face {
2 | font-family: 'Open Sans';
3 | font-weight: normal;
4 | font-style: normal;
5 | src: url('../fonts/OpenSans-Regular-webfont.eot');
6 | src:
7 | local('Open Sans'),
8 | local('OpenSans'),
9 | url('../fonts/OpenSans-Regular-webfont.eot?#iefix') format('embedded-opentype'),
10 | url('../fonts/OpenSans-Regular-webfont.woff') format('woff'),
11 | url('../fonts/OpenSans-Regular-webfont.svg#open_sansregular') format('svg');
12 | }
13 |
14 | @font-face {
15 | font-family: 'Open Sans Light';
16 | font-weight: normal;
17 | font-style: normal;
18 | src: url('../fonts/OpenSans-Light-webfont.eot');
19 | src:
20 | local('Open Sans Light'),
21 | local('OpenSans Light'),
22 | url('../fonts/OpenSans-Light-webfont.eot?#iefix') format('embedded-opentype'),
23 | url('../fonts/OpenSans-Light-webfont.woff') format('woff'),
24 | url('../fonts/OpenSans-Light-webfont.svg#open_sanslight') format('svg');
25 | }
26 |
27 | html
28 | {
29 | overflow: auto;
30 | background-color: #fff;
31 | font-size: 14px;
32 | }
33 |
34 | body
35 | {
36 | font-family: 'Open Sans', sans-serif;
37 | line-height: 1.5;
38 | color: #4d4e53;
39 | background-color: white;
40 | }
41 |
42 | a, a:visited, a:active {
43 | color: #0095dd;
44 | text-decoration: none;
45 | }
46 |
47 | a:hover {
48 | text-decoration: underline;
49 | }
50 |
51 | header
52 | {
53 | display: block;
54 | padding: 0px 4px;
55 | }
56 |
57 | tt, code, kbd, samp {
58 | font-family: Consolas, Monaco, 'Andale Mono', monospace;
59 | }
60 |
61 | .class-description {
62 | font-size: 130%;
63 | line-height: 140%;
64 | margin-bottom: 1em;
65 | margin-top: 1em;
66 | }
67 |
68 | .class-description:empty {
69 | margin: 0;
70 | }
71 |
72 | #main {
73 | float: left;
74 | width: 70%;
75 | }
76 |
77 | article dl {
78 | margin-bottom: 40px;
79 | }
80 |
81 | article img {
82 | max-width: 100%;
83 | }
84 |
85 | section
86 | {
87 | display: block;
88 | background-color: #fff;
89 | padding: 12px 24px;
90 | border-bottom: 1px solid #ccc;
91 | margin-right: 30px;
92 | }
93 |
94 | .variation {
95 | display: none;
96 | }
97 |
98 | .signature-attributes {
99 | font-size: 60%;
100 | color: #aaa;
101 | font-style: italic;
102 | font-weight: lighter;
103 | }
104 |
105 | nav
106 | {
107 | display: block;
108 | float: right;
109 | margin-top: 28px;
110 | width: 30%;
111 | box-sizing: border-box;
112 | border-left: 1px solid #ccc;
113 | padding-left: 16px;
114 | }
115 |
116 | nav ul {
117 | font-family: 'Lucida Grande', 'Lucida Sans Unicode', arial, sans-serif;
118 | font-size: 100%;
119 | line-height: 17px;
120 | padding: 0;
121 | margin: 0;
122 | list-style-type: none;
123 | }
124 |
125 | nav ul a, nav ul a:visited, nav ul a:active {
126 | font-family: Consolas, Monaco, 'Andale Mono', monospace;
127 | line-height: 18px;
128 | color: #4D4E53;
129 | }
130 |
131 | nav h3 {
132 | margin-top: 12px;
133 | }
134 |
135 | nav li {
136 | margin-top: 6px;
137 | }
138 |
139 | footer {
140 | display: block;
141 | padding: 6px;
142 | margin-top: 12px;
143 | font-style: italic;
144 | font-size: 90%;
145 | }
146 |
147 | h1, h2, h3, h4 {
148 | font-weight: 200;
149 | margin: 0;
150 | }
151 |
152 | h1
153 | {
154 | font-family: 'Open Sans Light', sans-serif;
155 | font-size: 48px;
156 | letter-spacing: -2px;
157 | margin: 12px 24px 20px;
158 | }
159 |
160 | h2, h3.subsection-title
161 | {
162 | font-size: 30px;
163 | font-weight: 700;
164 | letter-spacing: -1px;
165 | margin-bottom: 12px;
166 | }
167 |
168 | h3
169 | {
170 | font-size: 24px;
171 | letter-spacing: -0.5px;
172 | margin-bottom: 12px;
173 | }
174 |
175 | h4
176 | {
177 | font-size: 18px;
178 | letter-spacing: -0.33px;
179 | margin-bottom: 12px;
180 | color: #4d4e53;
181 | }
182 |
183 | h5, .container-overview .subsection-title
184 | {
185 | font-size: 120%;
186 | font-weight: bold;
187 | letter-spacing: -0.01em;
188 | margin: 8px 0 3px 0;
189 | }
190 |
191 | h6
192 | {
193 | font-size: 100%;
194 | letter-spacing: -0.01em;
195 | margin: 6px 0 3px 0;
196 | font-style: italic;
197 | }
198 |
199 | table
200 | {
201 | border-spacing: 0;
202 | border: 0;
203 | border-collapse: collapse;
204 | }
205 |
206 | td, th
207 | {
208 | border: 1px solid #ddd;
209 | margin: 0px;
210 | text-align: left;
211 | vertical-align: top;
212 | padding: 4px 6px;
213 | display: table-cell;
214 | }
215 |
216 | thead tr
217 | {
218 | background-color: #ddd;
219 | font-weight: bold;
220 | }
221 |
222 | th { border-right: 1px solid #aaa; }
223 | tr > th:last-child { border-right: 1px solid #ddd; }
224 |
225 | .ancestors, .attribs { color: #999; }
226 | .ancestors a, .attribs a
227 | {
228 | color: #999 !important;
229 | text-decoration: none;
230 | }
231 |
232 | .clear
233 | {
234 | clear: both;
235 | }
236 |
237 | .important
238 | {
239 | font-weight: bold;
240 | color: #950B02;
241 | }
242 |
243 | .yes-def {
244 | text-indent: -1000px;
245 | }
246 |
247 | .type-signature {
248 | color: #aaa;
249 | }
250 |
251 | .name, .signature {
252 | font-family: Consolas, Monaco, 'Andale Mono', monospace;
253 | }
254 |
255 | .details { margin-top: 14px; border-left: 2px solid #DDD; }
256 | .details dt { width: 120px; float: left; padding-left: 10px; padding-top: 6px; }
257 | .details dd { margin-left: 70px; }
258 | .details ul { margin: 0; }
259 | .details ul { list-style-type: none; }
260 | .details li { margin-left: 30px; padding-top: 6px; }
261 | .details pre.prettyprint { margin: 0 }
262 | .details .object-value { padding-top: 0; }
263 |
264 | .description {
265 | margin-bottom: 1em;
266 | margin-top: 1em;
267 | }
268 |
269 | .code-caption
270 | {
271 | font-style: italic;
272 | font-size: 107%;
273 | margin: 0;
274 | }
275 |
276 | .prettyprint
277 | {
278 | border: 1px solid #ddd;
279 | width: 80%;
280 | overflow: auto;
281 | }
282 |
283 | .prettyprint.source {
284 | width: inherit;
285 | }
286 |
287 | .prettyprint code
288 | {
289 | font-size: 100%;
290 | line-height: 18px;
291 | display: block;
292 | padding: 4px 12px;
293 | margin: 0;
294 | background-color: #fff;
295 | color: #4D4E53;
296 | }
297 |
298 | .prettyprint code span.line
299 | {
300 | display: inline-block;
301 | }
302 |
303 | .prettyprint.linenums
304 | {
305 | padding-left: 70px;
306 | -webkit-user-select: none;
307 | -moz-user-select: none;
308 | -ms-user-select: none;
309 | user-select: none;
310 | }
311 |
312 | .prettyprint.linenums ol
313 | {
314 | padding-left: 0;
315 | }
316 |
317 | .prettyprint.linenums li
318 | {
319 | border-left: 3px #ddd solid;
320 | }
321 |
322 | .prettyprint.linenums li.selected,
323 | .prettyprint.linenums li.selected *
324 | {
325 | background-color: lightyellow;
326 | }
327 |
328 | .prettyprint.linenums li *
329 | {
330 | -webkit-user-select: text;
331 | -moz-user-select: text;
332 | -ms-user-select: text;
333 | user-select: text;
334 | }
335 |
336 | .params .name, .props .name, .name code {
337 | color: #4D4E53;
338 | font-family: Consolas, Monaco, 'Andale Mono', monospace;
339 | font-size: 100%;
340 | }
341 |
342 | .params td.description > p:first-child,
343 | .props td.description > p:first-child
344 | {
345 | margin-top: 0;
346 | padding-top: 0;
347 | }
348 |
349 | .params td.description > p:last-child,
350 | .props td.description > p:last-child
351 | {
352 | margin-bottom: 0;
353 | padding-bottom: 0;
354 | }
355 |
356 | .disabled {
357 | color: #454545;
358 | }
359 |
--------------------------------------------------------------------------------
/docs/styles/prettify-jsdoc.css:
--------------------------------------------------------------------------------
1 | /* JSDoc prettify.js theme */
2 |
3 | /* plain text */
4 | .pln {
5 | color: #000000;
6 | font-weight: normal;
7 | font-style: normal;
8 | }
9 |
10 | /* string content */
11 | .str {
12 | color: #006400;
13 | font-weight: normal;
14 | font-style: normal;
15 | }
16 |
17 | /* a keyword */
18 | .kwd {
19 | color: #000000;
20 | font-weight: bold;
21 | font-style: normal;
22 | }
23 |
24 | /* a comment */
25 | .com {
26 | font-weight: normal;
27 | font-style: italic;
28 | }
29 |
30 | /* a type name */
31 | .typ {
32 | color: #000000;
33 | font-weight: normal;
34 | font-style: normal;
35 | }
36 |
37 | /* a literal value */
38 | .lit {
39 | color: #006400;
40 | font-weight: normal;
41 | font-style: normal;
42 | }
43 |
44 | /* punctuation */
45 | .pun {
46 | color: #000000;
47 | font-weight: bold;
48 | font-style: normal;
49 | }
50 |
51 | /* lisp open bracket */
52 | .opn {
53 | color: #000000;
54 | font-weight: bold;
55 | font-style: normal;
56 | }
57 |
58 | /* lisp close bracket */
59 | .clo {
60 | color: #000000;
61 | font-weight: bold;
62 | font-style: normal;
63 | }
64 |
65 | /* a markup tag name */
66 | .tag {
67 | color: #006400;
68 | font-weight: normal;
69 | font-style: normal;
70 | }
71 |
72 | /* a markup attribute name */
73 | .atn {
74 | color: #006400;
75 | font-weight: normal;
76 | font-style: normal;
77 | }
78 |
79 | /* a markup attribute value */
80 | .atv {
81 | color: #006400;
82 | font-weight: normal;
83 | font-style: normal;
84 | }
85 |
86 | /* a declaration */
87 | .dec {
88 | color: #000000;
89 | font-weight: bold;
90 | font-style: normal;
91 | }
92 |
93 | /* a variable name */
94 | .var {
95 | color: #000000;
96 | font-weight: normal;
97 | font-style: normal;
98 | }
99 |
100 | /* a function name */
101 | .fun {
102 | color: #000000;
103 | font-weight: bold;
104 | font-style: normal;
105 | }
106 |
107 | /* Specify class=linenums on a pre to get line numbering */
108 | ol.linenums {
109 | margin-top: 0;
110 | margin-bottom: 0;
111 | }
112 |
--------------------------------------------------------------------------------
/docs/styles/prettify-tomorrow.css:
--------------------------------------------------------------------------------
1 | /* Tomorrow Theme */
2 | /* Original theme - https://github.com/chriskempson/tomorrow-theme */
3 | /* Pretty printing styles. Used with prettify.js. */
4 | /* SPAN elements with the classes below are added by prettyprint. */
5 | /* plain text */
6 | .pln {
7 | color: #4d4d4c; }
8 |
9 | @media screen {
10 | /* string content */
11 | .str {
12 | color: #718c00; }
13 |
14 | /* a keyword */
15 | .kwd {
16 | color: #8959a8; }
17 |
18 | /* a comment */
19 | .com {
20 | color: #8e908c; }
21 |
22 | /* a type name */
23 | .typ {
24 | color: #4271ae; }
25 |
26 | /* a literal value */
27 | .lit {
28 | color: #f5871f; }
29 |
30 | /* punctuation */
31 | .pun {
32 | color: #4d4d4c; }
33 |
34 | /* lisp open bracket */
35 | .opn {
36 | color: #4d4d4c; }
37 |
38 | /* lisp close bracket */
39 | .clo {
40 | color: #4d4d4c; }
41 |
42 | /* a markup tag name */
43 | .tag {
44 | color: #c82829; }
45 |
46 | /* a markup attribute name */
47 | .atn {
48 | color: #f5871f; }
49 |
50 | /* a markup attribute value */
51 | .atv {
52 | color: #3e999f; }
53 |
54 | /* a declaration */
55 | .dec {
56 | color: #f5871f; }
57 |
58 | /* a variable name */
59 | .var {
60 | color: #c82829; }
61 |
62 | /* a function name */
63 | .fun {
64 | color: #4271ae; } }
65 | /* Use higher contrast and text-weight for printable form. */
66 | @media print, projection {
67 | .str {
68 | color: #060; }
69 |
70 | .kwd {
71 | color: #006;
72 | font-weight: bold; }
73 |
74 | .com {
75 | color: #600;
76 | font-style: italic; }
77 |
78 | .typ {
79 | color: #404;
80 | font-weight: bold; }
81 |
82 | .lit {
83 | color: #044; }
84 |
85 | .pun, .opn, .clo {
86 | color: #440; }
87 |
88 | .tag {
89 | color: #006;
90 | font-weight: bold; }
91 |
92 | .atn {
93 | color: #404; }
94 |
95 | .atv {
96 | color: #060; } }
97 | /* Style */
98 | /*
99 | pre.prettyprint {
100 | background: white;
101 | font-family: Consolas, Monaco, 'Andale Mono', monospace;
102 | font-size: 12px;
103 | line-height: 1.5;
104 | border: 1px solid #ccc;
105 | padding: 10px; }
106 | */
107 |
108 | /* Specify class=linenums on a pre to get line numbering */
109 | ol.linenums {
110 | margin-top: 0;
111 | margin-bottom: 0; }
112 |
113 | /* IE indents via margin-left */
114 | li.L0,
115 | li.L1,
116 | li.L2,
117 | li.L3,
118 | li.L4,
119 | li.L5,
120 | li.L6,
121 | li.L7,
122 | li.L8,
123 | li.L9 {
124 | /* */ }
125 |
126 | /* Alternate shading for lines */
127 | li.L1,
128 | li.L3,
129 | li.L5,
130 | li.L7,
131 | li.L9 {
132 | /* */ }
133 |
--------------------------------------------------------------------------------
/docs/support.js.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | JSDoc: Source: Support.js
6 |
7 |
8 |
9 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
Source: Support.js
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
const WHMCS = require('../whmcs')
30 |
31 | /**
32 | * Allows you to manage your support module in WHMCS.
33 | * @extends WHMCS
34 | */
35 | class Support extends WHMCS {
36 | /**
37 | * @param {Object} config Object containing your API credentials.
38 | * @param {string} config.serverUrl URL to your installation. Remember to point to /includes/api.php
39 | * @param {string} [config.username]
40 | * @param {string} [config.password]
41 | * @param {string} [config.identifier]
42 | * @param {string} [config.secret]
43 | */
44 | constructor (config) {
45 | super(config)
46 | }
47 | /**
48 | * Adds an announcement. - https://developers.whmcs.com/api-reference/addannouncement/
49 | * @param {Object} opts
50 | * @param {String} opts.date Date in the format YYYY-MM-DD HH:MM:SS
51 | * @param {String} opts.title
52 | * @param {String} opts.announcement Announcement text
53 | * @param {Boolean} [opts.published] Pass as true to publish
54 | */
55 | addAnouncement (opts) {
56 | const options = {
57 | action: 'AddAnouncement',
58 | ...opts
59 | }
60 | return this.callApi(options)
61 | }
62 | /**
63 | * Adds a Cancellation Request - https://developers.whmcs.com/api-reference/addcancelrequest/
64 | * @param {Object} opts
65 | * @param {Number} opts.serviceid The Service ID to cancel
66 | * @param {String} [opts.type] The type of cancellation. ‘Immediate’ or ‘End of Billing Period’
67 | * @param {String} [opts.reason] The customer reason for cancellation
68 | */
69 | addCancelRequest (opts) {
70 | const options = {
71 | action: 'AddCancelRequest',
72 | ...opts
73 | }
74 | return this.callApi(options)
75 | }
76 | /**
77 | * Adds a Client Note - https://developers.whmcs.com/api-reference/addclientnote/
78 | * @param {Object} opts
79 | * @param {Number} opts.userid The Client ID to apply the note to
80 | * @param {String} opts.notes The note to add
81 | * @param {Boolean} [opts.sticky] Should the note be made sticky. Makes the note ‘sticky’ and displays the note throughout the client’s account and on any tickets they submit in the admin area
82 | */
83 | addClientNote (opts) {
84 | const options = {
85 | action: 'AddClientNote',
86 | ...opts
87 | }
88 | return this.callApi(options)
89 | }
90 | /**
91 | * Add a note to a ticket by Ticket ID or Ticket Number. - https://developers.whmcs.com/api-reference/addticketnote/
92 | * @param {Object} opts
93 | * @param {String} opts.message The content of the ticket note
94 | * @param {String} [opts.ticketnum] The Client Ticket Number ID to apply the note to
95 | * @param {Number} [opts.ticketid] The id of the ticket in the database. Either $ticketnum or $ticketid is required
96 | * @param {Boolean} [opts.markdown] Should markdown be used on the ticket note output
97 | * @param {Array} [opts.attachments] Optional base64 json encoded array of file attachments. Can be the direct output of a multipart-form-data form submission ($_FILES superglobal in PHP) or an array of arrays consisting of both a filename and data keys (see example below).
98 | */
99 | addTicketNote (opts) {
100 | const options = {
101 | action: 'AddTicketNote',
102 | ...opts
103 | }
104 | return this.callApi(options)
105 | }
106 | /**
107 | * Add a reply to a ticket by Ticket ID. - https://developers.whmcs.com/api-reference/addticketreply/
108 | * @param {Object} opts
109 | * @param {Number} opts.ticketid The id of the ticket in the database. Either $ticketnum or $ticketid is required
110 | * @param {String} opts.message The content of the ticket reply
111 | * @param {Boolean} [opts.markdown] Should markdown be used on the ticket reply output
112 | * @param {Number} [opts.clientid] Pass a clientid to associate the ticket reply with a specific client
113 | * @param {Number} [opts.contactid] Pass a contactid to associate the ticket reply with a specific contact belonging to $clientid
114 | * @param {String} [opts.adminusername] The admin username to associate the ticket reply with
115 | * @param {String} [opts.name] The name to associate with the ticket reply if not an admin or client response
116 | * @param {String} [opts.email] The email to associate with the ticket reply if not an admin or client response
117 | * @param {String} [opts.status] The status to set on the ticket after the reply is made if the default status on admin/client response is not required. See GetSupportStatuses API command
118 | * @param {Boolean} [opts.noemail] Set to true to stop the ticket reply email being sent
119 | * @param {String} [opts.customfields] A base64 encoded array of the custom fields to update
120 | * @param {Array} [opts.attachments] Optional base64 json encoded array of file attachments. Can be the direct output of a multipart-form-data form submission ($_FILES superglobal in PHP) or an array of arrays consisting of both a filename and data keys (see example below).
121 | */
122 | addTicketReply (opts) {
123 | const options = {
124 | action: 'AddTicketReply',
125 | ...opts
126 | }
127 | return this.callApi(options)
128 | }
129 | /**
130 | * Delete an announcement - https://developers.whmcs.com/api-reference/deleteannouncement/
131 | * @param {Object} opts
132 | * @param {Number} opts.announcementid The id of the announcement to be deleted
133 | */
134 | deleteAnnouncement (opts) {
135 | const options = {
136 | action: 'DeleteAnnouncement',
137 | ...opts
138 | }
139 | return this.callApi(options)
140 | }
141 | /**
142 | * Removes a ticket and all replies from the system. This cannot be undone. - https://developers.whmcs.com/api-reference/deleteticket/
143 | * @param {Object} opts
144 | * @param {Number} opts.ticketid The ticket to be deleted
145 | */
146 | deleteTicket (opts) {
147 | const options = {
148 | action: 'DeleteTicket ',
149 | ...opts
150 | }
151 | return this.callApi(options)
152 | }
153 | /**
154 | * Removes a ticket note from the system. This cannot be undone. - https://developers.whmcs.com/api-reference/deleteticketnote/
155 | * @param {Object} opts
156 | * @param {Number} opts.noteid The ticket note to be deleted
157 | */
158 | deleteTicketNote (opts) {
159 | const options = {
160 | action: 'DeleteTicketNote ',
161 | ...opts
162 | }
163 | return this.callApi(options)
164 | }
165 | /**
166 | * Obtain an array of announcements - https://developers.whmcs.com/api-reference/getannouncements/
167 | * @param {Object} opts
168 | * @param {Number} [opts.limitstart] The offset for the returned announcement data (default: 0)
169 | * @param {Number} [opts.limitnum] The number of records to return (default: 25)
170 | */
171 | getAnnouncements (opts) {
172 | const options = {
173 | action: 'GetAnnouncements',
174 | ...opts
175 | }
176 | return this.callApi(options)
177 | }
178 | /**
179 | * Open a new ticket - https://developers.whmcs.com/api-reference/openticket/
180 | * @param {Object} opts
181 | * @param {Number} opts.deptid The department to open the ticket in
182 | * @param {String} opts.subject The subject of the ticket
183 | * @param {String} opts.message The message of the ticket
184 | * @param {Number} [opts.clientid] If applicable, the Client ID to create the ticket for.
185 | * @param {Number} [opts.contactid] If applicable, the Contact ID to create the ticket for (only if $clientid is passed).
186 | * @param {String} [opts.name] The name of the person opening the ticket (if not a client)
187 | * @param {String} [opts.email] The email address of the person opening the ticket (if not a client)
188 | * @param {String} [opts.priority] The priority of the ticket (‘Low’, ‘Medium’, ‘High’)
189 | * @param {Number} [opts.serviceid] The service to associate the ticket with (only one of $serviceid or $domainid)
190 | * @param {Number} [opts.domainid] The domain to associate the ticket with (only one of $serviceid or $domainid)
191 | * @param {Boolean} [opts.admin] Is an Admin opening the ticket
192 | * @param {Boolean} [opts.markdown] Should markdown be used on the ticket output
193 | * @param {String} [opts.customfields] Base64 encoded serialized array of custom field values
194 | * @param {Array} [opts.attachments] Optional base64 json encoded array of file attachments. Can be the direct output of a multipart-form-data form submission ($_FILES superglobal in PHP) or an array of arrays consisting of both a filename and data keys (see example below).
195 | */
196 | openTicket (opts) {
197 | const options = {
198 | action: 'OpenTicket',
199 | ...opts
200 | }
201 | return this.callApi(options)
202 | }
203 | /**
204 | * Updates an existing ticket - https://developers.whmcs.com/api-reference/updateticket/
205 | * @param {Object} opts
206 | * @param {Number} opts.ticketid The ticket Id to update
207 | * @param {Number} [opts.deptid] The department id of the ticket
208 | * @param {String} [opts.status] The status of the ticket
209 | * @param {String} [opts.subject] The subject of the ticket
210 | * @param {Number} [opts.userid] If applicable, the Client ID to update the ticket for.
211 | * @param {String} [opts.name] The name of the person opening the ticket (if not a client)
212 | * @param {String} [opts.email] The email address of the person opening the ticket (if not a client)
213 | * @param {String} [opts.cc] The cc email addresses for the ticket
214 | * @param {String} [opts.priority] The priority of the ticket (‘Low’, ‘Medium’, ‘High’)
215 | * @param {Number} [opts.flag] The id of the admin to flag the ticket to
216 | * @param {Boolean} [opts.removeFlag] Remove the flag from the ticket
217 | * @param {String} [opts.message] Update the ticket message
218 | * @param {Boolean} [opts.markdown] Should markdown be used on the ticket output.
219 | * @param {String} [opts.customfields] Base64 encoded serialized array of custom field values
220 | */
221 | updateTicket (opts) {
222 | const options = {
223 | action: 'UpdateTicket',
224 | ...opts
225 | }
226 | return this.callApi(options)
227 | }
228 | /**
229 | * Updates a ticket reply message. - https://developers.whmcs.com/api-reference/updateticketreply/
230 | * @param {Object} opts
231 | * @param {Number} opts.replyid The reply id to update.
232 | * @param {String} opts.message The message to be updated
233 | * @param {Boolean} [opts.markdown] Should markdown be used on the ticket message. Existing value is used if not supplied.
234 | */
235 | updateTicketReply (opts) {
236 | const options = {
237 | action: 'UpdateTicketReply',
238 | ...opts
239 | }
240 | return this.callApi(options)
241 | }
242 | }
243 |
244 | module.exports = Support
245 |
246 |
247 |
248 |
249 |
250 |
251 |
252 |
253 |
254 |
257 |
258 |
259 |
260 |
263 |
264 |
265 |
266 |
267 |
268 |
--------------------------------------------------------------------------------
/index.js:
--------------------------------------------------------------------------------
1 | const Addons = require('./modules/Addons')
2 | const Affiliates = require('./modules/Affiliates')
3 | const Authentication = require('./modules/Authentication')
4 | const Billing = require('./modules/Billing')
5 | const Clients = require('./modules/Clients')
6 | const Domains = require('./modules/Domains')
7 | const Modules = require('./modules/Modules')
8 | const Orders = require('./modules/Orders')
9 | const Products = require('./modules/Products')
10 | const ProjectManagement = require('./modules/ProjectManagement')
11 | const Servers = require('./modules/Servers')
12 | const Services = require('./modules/Services')
13 | const Support = require('./modules/Support')
14 | const System = require('./modules/System')
15 | const Tickets = require('./modules/Tickets')
16 |
17 | module.exports = {
18 | Addons,
19 | Affiliates,
20 | Authentication,
21 | Billing,
22 | Clients,
23 | Domains,
24 | Modules,
25 | Orders,
26 | Products,
27 | ProjectManagement,
28 | Servers,
29 | Services,
30 | Support,
31 | System,
32 | Tickets
33 | }
34 |
--------------------------------------------------------------------------------
/modules/Addons.js:
--------------------------------------------------------------------------------
1 | const WHMCS = require('../whmcs')
2 |
3 | /**
4 | * Allows you to manage your Addons module in WHMCS.
5 | * @extends WHMCS
6 | */
7 | class Addons extends WHMCS {
8 | /**
9 | * @param {Object} config Object containing your API credentials.
10 | * @param {string} config.serverUrl URL to your installation. Remember to point to /includes/api.php
11 | * @param {string} [config.username]
12 | * @param {string} [config.password]
13 | * @param {string} [config.identifier]
14 | * @param {string} [config.secret]
15 | */
16 | constructor (config) {
17 | super(config)
18 | }
19 | /**
20 | * Updates a Client Addon - https://developers.whmcs.com/api-reference/updateclientaddon/
21 | * @param {Object} opts
22 | * @param {Number} opts.id The id of the client addon to update
23 | * @param {String} [opts.status] The status to change the addon to
24 | * @param {String} [opts.terminationDate] The termination date of the addon Y-m-d
25 | * @param {Number} [opts.addonid] The configured addon id to update the client addon to
26 | * @param {String} [opts.name] The custom name to apply to the addon
27 | * @param {Number} [opts.setupfee] The setup fee for the client addon
28 | * @param {Number} [opts.recurring] The recurring amount for the client addon
29 | * @param {String} [opts.billingcycle] The billing cycle for the addon
30 | * @param {String} [opts.nextduedate] The next due date for the addon Y-m-d
31 | * @param {String} [opts.nextinvoicedate] The next invoice date for the addon Y-m-d
32 | * @param {String} [opts.terminationDate] The termination date of the addon Y-m-d
33 | * @param {String} [opts.notes] The admin notes to associate with the addon
34 | */
35 | updateClientAddon (opts) {
36 | const options = {
37 | action: 'UpdateClientAddon',
38 | ...opts
39 | }
40 | return this.callApi(options)
41 | }
42 | }
43 |
44 | module.exports = Addons
45 |
--------------------------------------------------------------------------------
/modules/Affiliates.js:
--------------------------------------------------------------------------------
1 | const WHMCS = require('../whmcs')
2 |
3 | /**
4 | * Allows you to manage your Project Management module in WHMCS.
5 | * @extends WHMCS
6 | */
7 | class Affiliates extends WHMCS {
8 | /**
9 | * @param {Object} config Object containing your API credentials.
10 | * @param {string} config.serverUrl URL to your installation. Remember to point to /includes/api.php
11 | * @param {string} [config.username]
12 | * @param {string} [config.password]
13 | * @param {string} [config.identifier]
14 | * @param {string} [config.secret]
15 | */
16 | constructor (config) {
17 | super(config)
18 | }
19 | /**
20 | * Activate affiliate referrals for a client. - https://developers.whmcs.com/api-reference/affiliateactivate/
21 | * @param {Object} opts
22 | * @param {Number} opts.userid The client ID to activate affiliate status for
23 | */
24 | affiliateActivate (opts) {
25 | const options = {
26 | action: 'AffiliateActivate',
27 | ...opts
28 | }
29 | return this.callApi(options)
30 | }
31 | /**
32 | * Obtain an array of affiliates - https://developers.whmcs.com/api-reference/getaffiliates/
33 | * @param {Object} opts
34 | * @param {Number} [opts.limitstart] The offset for the returned affiliate data (default: 0)
35 | * @param {Number} [opts.limitnum] The number of records to return (default: 25)
36 | * @param {Number} [opts.userid] Obtain affiliate data for a specific client account
37 | * @param {Number} [opts.visitors] Provide affiliates that match a specific visitor count
38 | * @param {String} [opts.paytype] Provide affiliates matching the paytype provided. One of “, ‘percentage’, ‘fixedamount’
39 | * @param {Number} [opts.payamount] Provide affiliates matching a specific overridden payout amount
40 | * @param {Number} [opts.onetime] Provide affiliates configured to receive one time affiliates
41 | * @param {Number} [opts.balance] Provide affiliates that have this balance
42 | * @param {Number} [opts.withdrawn] Provide affiliates that have withdrawn this amount
43 | */
44 | getAffiliates (opts) {
45 | const options = {
46 | action: 'GetAffiliates',
47 | ...opts
48 | }
49 | return this.callApi(options)
50 | }
51 | }
52 |
53 | module.exports = Affiliates
54 |
--------------------------------------------------------------------------------
/modules/Authentication.js:
--------------------------------------------------------------------------------
1 | const WHMCS = require('../whmcs')
2 |
3 | /**
4 | * Allows you to manage your Authentication module in WHMCS.
5 | * @extends WHMCS
6 | */
7 | class Authentication extends WHMCS {
8 | /**
9 | * @param {Object} config Object containing your API credentials.
10 | * @param {string} config.serverUrl URL to your installation. Remember to point to /includes/api.php
11 | * @param {string} [config.username]
12 | * @param {string} [config.password]
13 | * @param {string} [config.identifier]
14 | * @param {string} [config.secret]
15 | */
16 | constructor (config) {
17 | super(config)
18 | }
19 | /**
20 | * Create an OAuth Credential - https://developers.whmcs.com/api-reference/createoauthcredential/
21 | * @param {Object} opts
22 | * @param {String} opts.grantType One of ‘authorization_code’ or ‘single_sign_on’
23 | * @param {String} opts.scope A space separated list of valid scopes from tbloauthserver_scopes
24 | * @param {String} [opts.name] The name to give the oAuth Credential for the authorization_code $grantType
25 | * @param {Number} [opts.serviceId] The id of the service for the single_sign_on $grantType
26 | * @param {String} [opts.description] The description of the OAuth Credential
27 | * @param {String} [opts.logoUri] URL or Path Relative to the Base WHMCS Client Area Directory to a logo image file for this application.
28 | * @param {String} [opts.redirectUri] Authorised Redirect URIs
29 | */
30 | createOAuthCredential (opts) {
31 | const options = {
32 | action: 'CreateOAuthCredential',
33 | ...opts
34 | }
35 | return this.callApi(options)
36 | }
37 | /**
38 | * Removes OAuth Credential record. This action cannot be undone. - https://developers.whmcs.com/api-reference/deleteoauthcredential/
39 | * @param {Object} opts
40 | * @param {Number} opts.credentialId The credential id to be deleted
41 | */
42 | deleteOAuthCredential (opts) {
43 | const options = {
44 | action: 'DeleteOAuthCredential',
45 | ...opts
46 | }
47 | return this.callApi(options)
48 | }
49 | /**
50 | * This command can be used to validate an email address and password against
51 | a registered user in WHMCS. On success, the userid and password hash will
52 | be returned which can be used to create an authenticated session by setting
53 | the session key ‘uid’ to the userid and the session key ‘upw’ to the
54 | passwordhash. Note: if session IP validation is enabled, this API call
55 | must be executed via the local API to receive a valid hash. - https://developers.whmcs.com/api-reference/validatelogin/
56 | * @param {Object} opts
57 | * @param {String} opts.email Client or Sub-Account Email Address
58 | * @param {String} opts.password2 Password to validate
59 | */
60 | validateLogin (opts) {
61 | const options = {
62 | action: 'ValidateLogin',
63 | ...opts
64 | }
65 | return this.callApi(options)
66 | }
67 | /**
68 | * Updates a given OAuth API Client Credential. - https://developers.whmcs.com/api-reference/updateoauthcredential/
69 | * @param {Object} opts
70 | * @param {Number} opts.credentialId The auto increment ID of the credential set to be updated
71 | * @param {String} [opts.clientApiIdentifier] The OAuth API Client Credential Unique Identifier (Client ID) to be updated. Only required if credentialId is not known/passed.
72 | * @param {String} [opts.name] The name to assign
73 | * @param {String} [opts.description] The description to assign
74 | * @param {String} [opts.grantType] The grant type for which the credential set is valid for. Possible values include: authorization_code or single_sign_on
75 | * @param {String} [opts.scope] A space delimited list of the scopes for which the credential set is valid. See CreateOAuthCredential for permitted values
76 | * @param {Number} [opts.serviceId] The service ID for which the credential relates to
77 | * @param {Array.} [opts.logoUri] he logoUri to assign
78 | * @param {String} [opts.redirectUri] An array of Authorized Redirect URIs
79 | * @param {Boolean} [opts.resetSecret] Set to true to reset the OAuth API Client Credential Secret
80 | */
81 | updateOAuthCredential (opts) {
82 | const options = {
83 | action: 'UpdateOAuthCredential',
84 | ...opts
85 | }
86 | return this.callApi(options)
87 | }
88 | /**
89 | * List OAuth Credentials matching passed criteria - https://developers.whmcs.com/api-reference/listoauthcredentials/
90 | * @param {Object} opts
91 | * @param {String} [opts.grantType] Find credentials for a specific grant type
92 | * @param {String} [opts.sortField] Sort the response using the passed field
93 | * @param {String} [opts.sortOrder] The direction of the sort order (‘ASC’, ‘DESC’)
94 | * @param {Number} [opts.limit] To limit the number of returned credentials
95 | */
96 | listOAuthCredentials (opts) {
97 | const options = {
98 | action: 'ListOAuthCredentials',
99 | ...opts
100 | }
101 | return this.callApi(options)
102 | }
103 | }
104 |
105 | module.exports = Authentication
106 |
--------------------------------------------------------------------------------
/modules/Domains.js:
--------------------------------------------------------------------------------
1 | const WHMCS = require('../whmcs')
2 |
3 | /**
4 | * Allows you to manage your domains module in WHMCS.
5 | * @extends WHMCS
6 | */
7 | class Domains extends WHMCS {
8 | /**
9 | * @param {Object} config Object containing your API credentials.
10 | * @param {string} config.serverUrl URL to your installation. Remember to point to /includes/api.php
11 | * @param {string} [config.username]
12 | * @param {string} [config.password]
13 | * @param {string} [config.identifier]
14 | * @param {string} [config.secret]
15 | */
16 | constructor (config) {
17 | super(config)
18 | }
19 | /**
20 | * Connects to the registrar and obtains the nameservers for the domain - https://developers.whmcs.com/api-reference/domaingetnameservers/
21 | * @param {Object} opts
22 | * @param {Number} opts.domainid The id of the domain to obtain the nameservers for
23 | */
24 | domainGetNameservers (opts) {
25 | const options = {
26 | action: 'DomainGetNameservers',
27 | ...opts
28 | }
29 | return this.callApi(options)
30 | }
31 | /**
32 | * Connects to the registrar and attempts to toggle the ID Protect state - https://developers.whmcs.com/api-reference/domaintoggleidprotect/
33 | * @param {Object} opts
34 | * @param {Number} opts.domainid The id of the domain to toggle ID Protection for
35 | * @param {Boolean} [opts.idprotect] Should ID Protection be turned on
36 | */
37 | domainToggleIdProtect (opts) {
38 | const options = {
39 | action: 'DomainToggleIdProtect',
40 | ...opts
41 | }
42 | return this.callApi(options)
43 | }
44 | /**
45 | * Connects to the registrar and obtains the whois information for the domain - https://developers.whmcs.com/api-reference/domaingetwhoisinfo/
46 | * @param {Object} opts
47 | * @param {Number} opts.domainid The id of the domain to obtain the whois information for
48 | */
49 | domainGetWhoisInfo (opts) {
50 | const options = {
51 | action: 'DomainGetWhoisInfo',
52 | ...opts
53 | }
54 | return this.callApi(options)
55 | }
56 | /**
57 | * Connects to the registrar and attempts to register the domain. - https://developers.whmcs.com/api-reference/domainregister/
58 | * @param {Object} opts
59 | * @param {Number} [opts.domainid] The id of the domain to register recommended
60 | * @param {String} [opts.domain] The domain name to be registered. This or $domainid is required
61 | */
62 | domainRegister (opts) {
63 | const options = {
64 | action: 'DomainRegister',
65 | ...opts
66 | }
67 | return this.callApi(options)
68 | }
69 | /**
70 | * Connects to the registrar and obtains the current lock status of the domain - https://developers.whmcs.com/api-reference/domaingetlockingstatus/
71 | * @param {Object} opts
72 | * @param {Number} opts.domainid The id of the domain to obtain the lock status for
73 | */
74 | domainGetLockingStatus (opts) {
75 | const options = {
76 | action: 'DomainGetLockingStatus',
77 | ...opts
78 | }
79 | return this.callApi(options)
80 | }
81 | /**
82 | * Connects to the registrar and attempts to obtain the EPP Code for the domain.
83 | Not all registrars return the EPP code but send them directly to the client. - https://developers.whmcs.com/api-reference/domainrequestepp/
84 | * @param {Object} opts
85 | * @param {Number} opts.domainid The id of the domain to obtain the EPP for
86 | */
87 | domainRequestEPP (opts) {
88 | const options = {
89 | action: 'DomainRequestEPP',
90 | ...opts
91 | }
92 | return this.callApi(options)
93 | }
94 | /**
95 | * Connects to the registrar and attempts to update the WHOIS Information - https://developers.whmcs.com/api-reference/domainupdatewhoisinfo/
96 | * @param {Object} opts
97 | * @param {Number} opts.domainid The id of the domain to update the whois information for
98 | * @param {String} opts.xml The xml of the details to update. See DomainGetWhoisInfo
99 | */
100 | domainUpdateWhoisInfo (opts) {
101 | const options = {
102 | action: 'DomainUpdateWhoisInfo',
103 | ...opts
104 | }
105 | return this.callApi(options)
106 | }
107 | /**
108 | * Connects to the registrar and attempts to update the lock - https://developers.whmcs.com/api-reference/domainupdatelockingstatus/
109 | * @param {Object} opts
110 | * @param {Number} opts.domainid The id of the domain to update the locking status for
111 | * @param {Boolean} [opts.lockstatus] Should the domain lock be turned on
112 | */
113 | domainUpdateLockingStatus (opts) {
114 | const options = {
115 | action: 'DomainUpdateLockingStatus',
116 | ...opts
117 | }
118 | return this.callApi(options)
119 | }
120 | /**
121 | * Connects to the registrar and attempts to release the domain. - https://developers.whmcs.com/api-reference/domainrelease/
122 | * @param {Object} opts
123 | * @param {Number} [opts.domainid] The id of the domain to be released recommended
124 | * @param {String} [opts.domain] The domain name to be released. This or $domainid is required
125 | * @param {String} opts.newtag The receiving tag for the domain
126 | */
127 | domainRelease (opts) {
128 | const options = {
129 | action: 'DomainRelease',
130 | ...opts
131 | }
132 | return this.callApi(options)
133 | }
134 | /**
135 | * Retrieve domain whois information. - https://developers.whmcs.com/api-reference/domainwhois/
136 | * @param {Object} opts
137 | * @param {String} opts.domain The domain name to lookup
138 | */
139 | domainWhois (opts) {
140 | const options = {
141 | action: 'DomainWhois',
142 | ...opts
143 | }
144 | return this.callApi(options)
145 | }
146 | /**
147 | * Connects to the registrar and attempts to update the nameservers with those provided. - https://developers.whmcs.com/api-reference/domainupdatenameservers/
148 | * @param {Object} opts
149 | * @param {Number} [opts.domainid] The id of the domain to update the nameservers for recommended
150 | * @param {String} [opts.domain] The domain name to be update the nameservers for. This or $domainid is required
151 | * @param {String} opts.ns1 The first nameserver
152 | * @param {String} opts.ns2 The second nameserver
153 | * @param {String} [opts.ns3] The third nameserver
154 | * @param {String} [opts.ns4] The fourth nameserver
155 | * @param {String} [opts.ns5] The fifth nameserver
156 | */
157 | domainUpdateNameservers (opts) {
158 | const options = {
159 | action: 'DomainUpdateNameservers',
160 | ...opts
161 | }
162 | return this.callApi(options)
163 | }
164 | /**
165 | * Retrieve TLD pricing - https://developers.whmcs.com/api-reference/gettldpricing/
166 | * @param {Object} opts
167 | * @param {Number} [opts.currencyid] The currency ID to fetch pricing for
168 | * @param {Number} [opts.clientid] The id of the client to fetch pricing for. Pass one or the other. clientid being passed will override currencyid
169 | */
170 | getTLDPricing (opts) {
171 | const options = {
172 | action: 'GetTLDPricing',
173 | ...opts
174 | }
175 | return this.callApi(options)
176 | }
177 | /**
178 | * Connects to the registrar and attempts to renew the domain. - https://developers.whmcs.com/api-reference/domainrenew/
179 | * @param {Object} opts
180 | * @param {Number} [opts.domainid] The id of the domain to be renewed recommended
181 | * @param {String} [opts.domain] The domain name to be renewed. This or $domainid is required
182 | * @param {Number} [opts.regperiod] How long to renew the domain for. Defaults to the current stored value.
183 | */
184 | domainRenew (opts) {
185 | const options = {
186 | action: 'DomainRenew',
187 | ...opts
188 | }
189 | return this.callApi(options)
190 | }
191 | /**
192 | * Connects to the registrar and attempts to start the transfer process. - https://developers.whmcs.com/api-reference/domaintransfer/
193 | * @param {Object} opts
194 | * @param {Number} [opts.domainid] The id of the domain to be transferred recommended
195 | * @param {String} [opts.domain] The domain name to be transferred. This or $domainid is required
196 | * @param {Number} [opts.eppcode] Provide a new EPP Code for the Transfer Request
197 | */
198 | domainTransfer (opts) {
199 | const options = {
200 | action: 'DomainTransfer',
201 | ...opts
202 | }
203 | return this.callApi(options)
204 | }
205 | /**
206 | * Updates a Client Domain - https://developers.whmcs.com/api-reference/updateclientdomain/
207 | * @param {Object} opts
208 | * @param {Number} opts.domainid The id of the client domain to update
209 | * @param {Boolean} [opts.dnsmanagement] Enable/Disable DNS Management
210 | * @param {Boolean} [opts.emailforwarding] Enable/Disable Email Forwarding
211 | * @param {Boolean} [opts.idprotection] Enable/Disable ID Protection
212 | * @param {Boolean} [opts.donotrenew] Enable/Disable Do Not Renew
213 | * @param {String} [opts.type] The type of domain order. (‘Register’, ‘Transfer’)
214 | * @param {String} [opts.regdate] The registration date of the domain (Y-m-d)
215 | * @param {String} [opts.nextduedate] The next due date of the domain (Y-m-d)
216 | * @param {String} [opts.expirydate] The expiry date of the domain (Y-m-d)
217 | * @param {String} [opts.domain] The domain name to be changed to
218 | * @param {Number} [opts.firstpaymentamount] The first payment amount on the domain
219 | * @param {Number} [opts.recurringamount] The recurring amount for automatic renewal invoices
220 | * @param {String} [opts.registrar] The registrar to associate with the domain
221 | * @param {Number} [opts.regperiod] The registration period of the domain
222 | * @param {String} [opts.paymentmethod] The payment method to associate in system format (eg paypal)
223 | * @param {String} [opts.subscriptionid] The subscription ID to associate with the domain
224 | * @param {String} [opts.status] The status to change the domain to
225 | * @param {String} [opts.notes] The admin notes for the domain
226 | * @param {Number} [opts.promoid] The promotion Id to associate
227 | * @param {Boolean} [opts.autorecalc] Should the recurring amount of the domain be automatically recalculated (this will ignore any passed $recurringamount)
228 | * @param {Boolean} [opts.updatens] Should the nameservers be updated at the registrar
229 | * @param {String} [opts.ns1] The first nameserver to save
230 | * @param {String} [opts.ns2] The second nameserver to save
231 | * @param {String} [opts.ns3] The third nameserver to save
232 | * @param {String} [opts.ns4] The fourth nameserver to save
233 | * @param {String} [opts.ns5] The fifth nameserver to save
234 | */
235 | updateClientDomain (opts) {
236 | const options = {
237 | action: 'UpdateClientDomain',
238 | ...opts
239 | }
240 | return this.callApi(options)
241 | }
242 | }
243 |
244 | module.exports = Domains
245 |
--------------------------------------------------------------------------------
/modules/Modules.js:
--------------------------------------------------------------------------------
1 | const WHMCS = require('../whmcs')
2 |
3 | /**
4 | * Allows you to manage your Modules in WHMCS.
5 | * @extends WHMCS
6 | */
7 | class Modules extends WHMCS {
8 | /**
9 | * @param {Object} config Object containing your API credentials.
10 | * @param {string} config.serverUrl URL to your installation. Remember to point to /includes/api.php
11 | * @param {string} [config.username]
12 | * @param {string} [config.password]
13 | * @param {string} [config.identifier]
14 | * @param {string} [config.secret]
15 | */
16 | constructor (config) {
17 | super(config)
18 | }
19 | /**
20 | * Activates a given module. - https://developers.whmcs.com/api-reference/activatemodule/
21 | * @param {Object} opts
22 | * @param {String} opts.moduleType The module type to be activated
23 | * @param {String} opts.moduleName The module name to be activated
24 | * @param {Array} [opts.parameters] An array of configuration parameters to set for the given module. Use GetModuleConfigurationParameters to obtain a list of fields for a given module.
25 | */
26 | activateModule (opts) {
27 | const options = {
28 | action: 'ActivateModule',
29 | ...opts
30 | }
31 | return this.callApi(options)
32 | }
33 | /**
34 | * Deactivates a given module. - https://developers.whmcs.com/api-reference/deactivatemodule/
35 | * @param {Object} opts
36 | * @param {String} opts.moduleType The module type to be deactivated
37 | * @param {String} opts.moduleName The module name to be deactivated
38 | */
39 | deactivateModule (opts) {
40 | const options = {
41 | action: 'DeactivateModule',
42 | ...opts
43 | }
44 | return this.callApi(options)
45 | }
46 | /**
47 | * Obtains the Module Configuration Parameters - https://developers.whmcs.com/api-reference/getmoduleconfigurationparameters/
48 | * @param {Object} opts
49 | * @param {String} opts.moduleType The module type to be activated
50 | * @param {String} opts.moduleName The module name to be activated
51 | */
52 | getModuleConfigurationParameters (opts) {
53 | const options = {
54 | action: 'GetModuleConfigurationParameters',
55 | ...opts
56 | }
57 | return this.callApi(options)
58 | }
59 | /**
60 | * Obtains the Module Queue for Incomplete Failed Actions - https://developers.whmcs.com/api-reference/getmodulequeue/
61 | * @param {Object} opts
62 | * @param {String} [opts.serviceType] The type of service to load (‘domain’, ‘service’ or “))
63 | * @param {String} [opts.moduleName] The module name to obtain the queue for in system format. eg cpanel
64 | * @param {String} [opts.moduleAction] The module action to obtain the queue for. eg CreateAccount, SuspendAccount
65 | * @param {String} [opts.since] The date/time since to obtain the items. Format Y-m-d Can include H:i:s
66 | */
67 | getModuleQueue (opts) {
68 | const options = {
69 | action: 'GetModuleQueue',
70 | ...opts
71 | }
72 | return this.callApi(options)
73 | }
74 | /**
75 | * Activates a given module. - https://developers.whmcs.com/api-reference/updatemoduleconfiguration/
76 | * @param {Object} opts
77 | * @param {String} opts.moduleType The module type to be activated
78 | * @param {String} opts.moduleName The module name to be activated
79 | * @param {Array} [opts.parameters] An array of configuration parameters to set for the given module. Use GetModuleConfigurationParameters to obtain a list of fields for a given module.
80 | */
81 | updateModuleConfiguration (opts) {
82 | const options = {
83 | action: 'UpdateModuleConfiguration',
84 | ...opts
85 | }
86 | return this.callApi(options)
87 | }
88 | }
89 |
90 | module.exports = Modules
91 |
--------------------------------------------------------------------------------
/modules/Orders.js:
--------------------------------------------------------------------------------
1 | const WHMCS = require('../whmcs')
2 |
3 | /**
4 | * Allows you to manage your orders module in WHMCS.
5 | * @extends WHMCS
6 | */
7 |
8 | class Orders extends WHMCS {
9 | /**
10 | * @param {Object} config Object containing your API credentials.
11 | * @param {string} config.serverUrl URL to your installation. Remember to point to /includes/api.php
12 | * @param {string} [config.username]
13 | * @param {string} [config.password]
14 | * @param {string} [config.identifier]
15 | * @param {string} [config.secret]
16 | */
17 | constructor (config) {
18 | super(config)
19 | }
20 | /**
21 | * Retrieve Order Status and number in those statuses - https://developers.whmcs.com/api-reference/getorderstatuses/
22 | * @param {Object} opts
23 | */
24 | getOrderStatuses (opts) {
25 | const options = {
26 | action: 'GetOrderStatuses',
27 | ...opts
28 | }
29 | return this.callApi(options)
30 | }
31 | /**
32 | * NOTE: This API method is designed to be used in the building of custom order
33 | forms. As a result, only custom fields that have the ‘Show on Order Form’
34 | setting enabled will be returned for a given product. - https://developers.whmcs.com/api-reference/getproducts/
35 | * @param {Object} opts
36 | * @param {Number} [opts.pid] string
37 | * @param {Number} [opts.gid] Retrieve products in a specific group id
38 | * @param {String} [opts.module] Retrieve products utilising a specific module
39 | */
40 | getProducts (opts) {
41 | const options = {
42 | action: 'GetProducts',
43 | ...opts
44 | }
45 | return this.callApi(options)
46 | }
47 | /**
48 | * Accepts a pending order - https://developers.whmcs.com/api-reference/acceptorder/
49 | * @param {Object} opts
50 | * @param {Number} opts.orderid The order id to be accepted
51 | * @param {Number} [opts.serverid] The specific server to assign to products within the order
52 | * @param {String} [opts.serviceusername] The specific username to assign to products within the order
53 | * @param {String} [opts.servicepassword] The specific password to assign to products within the order
54 | * @param {String} [opts.registrar] The specific registrar to assign to domains within the order
55 | * @param {Boolean} [opts.sendregistrar] Send the request to the registrar to register the domain.
56 | * @param {Boolean} [opts.autosetup] Send the request to the product module to activate the service. This can override the product configuration.
57 | * @param {Boolean} [opts.sendemail] Send any automatic emails. This can be Product Welcome, Domain Renewal, Domain Transfer etc.
58 | */
59 | acceptOrder (opts) {
60 | const options = {
61 | action: 'AcceptOrder',
62 | ...opts
63 | }
64 | return this.callApi(options)
65 | }
66 | /**
67 | * Sets an order, and all associated order items to Pending status - https://developers.whmcs.com/api-reference/pendingorder/
68 | * @param {Object} opts
69 | * @param {Number} opts.orderid The order id to be accepted
70 | */
71 | pendingOrder (opts) {
72 | const options = {
73 | action: 'PendingOrder',
74 | ...opts
75 | }
76 | return this.callApi(options)
77 | }
78 | /**
79 | * Marks an order as fraudulent. - https://developers.whmcs.com/api-reference/fraudorder/
80 | * @param {Object} opts
81 | * @param {Number} opts.orderid The Order ID to set as fraud
82 | * @param {Boolean} [opts.cancelsub] Pass as true to cancel any PayPal Subscription(s) associated with the products & services that belong to the given order.
83 | */
84 | fraudOrder (opts) {
85 | const options = {
86 | action: 'FraudOrder',
87 | ...opts
88 | }
89 | return this.callApi(options)
90 | }
91 | /**
92 | * Cancel a Pending Order - https://developers.whmcs.com/api-reference/cancelorder/
93 | * @param {Object} opts
94 | * @param {Number} opts.orderid The ID of the pending order
95 | * @param {Boolean} [opts.cancelsub] Attempt to cancel the subscription associated with the products
96 | * @param {Boolean} [opts.noemail] Set to true to stop the invoice payment email being sent if the invoice becomes paid
97 | */
98 | cancelOrder (opts) {
99 | const options = {
100 | action: 'CancelOrder',
101 | ...opts
102 | }
103 | return this.callApi(options)
104 | }
105 | /**
106 | * Adds an order to a client. - https://developers.whmcs.com/api-reference/addorder/
107 | * @param {Object} opts
108 | * @param {Number} opts.clientid
109 | * @param {String} opts.paymentmethod The payment method for the order in the system format. eg. paypal, mailin
110 | * @param {Array.} [opts.pid] The array of product ids to add the order for
111 | * @param {Array.} [opts.domain] The array of domain names associated with the products/domains
112 | * @param {Array.} [opts.billingcycle] The array of billing cycles for the products
113 | * @param {Array.} [opts.domaintype] For domain registrations, an array of register or transfer values
114 | * @param {Array.} [opts.regperiod] For domain registrations, the registration periods for the domains in the order
115 | * @param {Array.} [opts.eppcode] For domain transfers. The epp codes for the domains being transferred in the order
116 | * @param {String} [opts.nameserver1] The first nameserver to apply to all domains in the order
117 | * @param {String} [opts.nameserver2] The second nameserver to apply to all domains in the order
118 | * @param {String} [opts.nameserver3] The third nameserver to apply to all domains in the order
119 | * @param {String} [opts.nameserver4] The fourth nameserver to apply to all domains in the order
120 | * @param {String} [opts.nameserver5] The fifth nameserver to apply to all domains in the order
121 | * @param {Array.} [opts.customfields] an array of base64 encoded serialized array of product custom field values
122 | * @param {Array.} [opts.configoptions] an array of base64 encoded serialized array of product configurable options values
123 | * @param {Array.} [opts.priceoverride] Override the price of the product being ordered
124 | * @param {String} [opts.promocode] The promotion code to apply to the order
125 | * @param {Boolean} [opts.promooverride] Should the promotion apply to the order even without matching promotional products
126 | * @param {Number} [opts.affid] The affiliate id to associate with the order
127 | * @param {Boolean} [opts.noinvoice] Set to true to suppress the invoice generating for the whole order
128 | * @param {Boolean} [opts.noinvoiceemail] Set to true to suppress the Invoice Created email being sent for the order
129 | * @param {Boolean} [opts.noemail] Set to true to suppress the Order Confirmation email being sent
130 | * @param {Array.} [opts.addons] A comma separated list of addons to create on order with the products
131 | * @param {Array.} [opts.hostname] The hostname of the server for VPS/Dedicated Server orders
132 | * @param {Array.} [opts.ns1prefix] The first nameserver prefix for the VPS/Dedicated server. Eg. ns1 in ns1.hostname.com
133 | * @param {Array.} [opts.ns2prefix] The second nameserver prefix for the VPS/Dedicated server. Eg. ns2 in ns2.hostname.com
134 | * @param {Array.} [opts.rootpw] The desired root password for the VPS/Dedicated server.
135 | * @param {Number} [opts.contactid] The id of the contact, associated with the client, that should apply to all domains in the order
136 | * @param {Array.} [opts.dnsmanagement] Add DNS Management to the Domain Order
137 | * @param {Array.} [opts.domainfields] an array of base64 encoded serialized array of TLD Specific Field Values
138 | * @param {Array.} [opts.emailforwarding] Add Email Forwarding to the Domain Order
139 | * @param {Array.} [opts.idprotection] Add ID Protection to the Domain Order
140 | * @param {Array.} [opts.domainpriceoverride] Override the price of the registration price on the domain being ordered
141 | * @param {Array.} [opts.domainrenewoverride] Override the price of the renewal price on the domain being ordered
142 | * @param {Array} [opts.domainrenewals] A name -> value array of $domainName -> $renewalPeriod renewals to add an order for
143 | * @param {String} [opts.clientip] The ip address to associate with the order
144 | * @param {Number} [opts.addonid] The Addon ID for an Addon Only Order
145 | * @param {Number} [opts.serviceid] The service ID for the addon only order
146 | * @param {Array.} [opts.addonids] An Array of addon ids for an Addon Only Order
147 | * @param {Array.} [opts.serviceids] An array of service ids to associate the addons for an Addon Only order
148 | */
149 | addOrder (opts) {
150 | const options = {
151 | action: 'AddOrder',
152 | ...opts
153 | }
154 | return this.callApi(options)
155 | }
156 | /**
157 | * Obtain orders matching the passed criteria - https://developers.whmcs.com/api-reference/getorders/
158 | * @param {Object} opts
159 | * @param {Number} [opts.limitstart] The offset for the returned order data (default: 0)
160 | * @param {Number} [opts.limitnum] The number of records to return (default: 25)
161 | * @param {Number} [opts.id] Find orders for a specific id
162 | * @param {Number} [opts.userid] Find orders for a specific client id
163 | * @param {String} [opts.status] Find orders for a specific status
164 | */
165 | getOrders (opts) {
166 | const options = {
167 | action: 'GetOrders',
168 | ...opts
169 | }
170 | return this.callApi(options)
171 | }
172 | /**
173 | * Run a fraud check on a passed Order ID - https://developers.whmcs.com/api-reference/orderfraudcheck/
174 | * @param {Object} opts
175 | * @param {Number} opts.orderid The order id to complete the fraud check on
176 | * @param {String} [opts.ipaddress] To override the IP address on the fraud check
177 | */
178 | orderFraudCheck (opts) {
179 | const options = {
180 | action: 'OrderFraudCheck',
181 | ...opts
182 | }
183 | return this.callApi(options)
184 | }
185 | /**
186 | * Obtain promotions matching the passed criteria - https://developers.whmcs.com/api-reference/getpromotions/
187 | * @param {Object} opts
188 | * @param {String} [opts.code] Retrieve a specific promotion code. Do not pass to retrieve all
189 | */
190 | getPromotions (opts) {
191 | const options = {
192 | action: 'GetPromotions',
193 | ...opts
194 | }
195 | return this.callApi(options)
196 | }
197 | /**
198 | * Removes an order from the system. This cannot be undone. This will remove all items associated with the order (services, addons, domains, invoices etc) - https://developers.whmcs.com/api-reference/deleteorder/
199 | * @param {Object} opts
200 | * @param {Number} opts.orderid The order to be deleted
201 | */
202 | deleteOrder (opts) {
203 | const options = {
204 | action: 'DeleteOrder',
205 | ...opts
206 | }
207 | return this.callApi(options)
208 | }
209 | }
210 |
211 | module.exports = Orders
212 |
--------------------------------------------------------------------------------
/modules/Products.js:
--------------------------------------------------------------------------------
1 | const WHMCS = require('../whmcs')
2 |
3 | /**
4 | * Allows you to manage your products module in WHMCS.
5 | * @extends WHMCS
6 | */
7 | class Products extends WHMCS {
8 | /**
9 | * @param {Object} config Object containing your API credentials.
10 | * @param {string} config.serverUrl URL to your installation. Remember to point to /includes/api.php
11 | * @param {string} [config.username]
12 | * @param {string} [config.password]
13 | * @param {string} [config.identifier]
14 | * @param {string} [config.secret]
15 | */
16 | constructor (config) {
17 | super(config)
18 | }
19 | /**
20 | * Adds a product to the system to be available for purchase - https://developers.whmcs.com/api-reference/addproduct/
21 | * @param {Object} opts
22 | * @param {String} opts.name The name of the product to be added
23 | * @param {Number} opts.gid The id of the product group to add the product
24 | * @param {String} [opts.type] One of ‘hostingaccount’, ‘reselleraccount’, ‘server’ or ‘other’
25 | * @param {Boolean} [opts.stockcontrol] Set to true to enable stock control on the product
26 | * @param {Number} [opts.qty] How much of this product is in stock
27 | * @param {String} [opts.paytype] The payment type of the product. One of ‘free’, ‘onetime’, ‘recurring’
28 | * @param {Boolean} [opts.hidden] Should the product be hidden from the client order form
29 | * @param {Boolean} [opts.showdomainoptions] Should the product show the domain registration options.
30 | * @param {Boolean} [opts.tax] Does tax apply to the product.
31 | * @param {Boolean} [opts.isFeatured] Should the product be featured in the Product Group.
32 | * @param {Boolean} [opts.proratabilling] Is pro-rata billing enabled for this product.
33 | * @param {String} [opts.description] The description of the product to show on the product listing in the cart
34 | * @param {Number} [opts.welcomeemail] The id of the Email Template to use as the welcome email. Product/Service Messages only
35 | * @param {Number} [opts.proratadate] See https://docs.whmcs.com/Products_and_Services#Pricing_Tab
36 | * @param {Number} [opts.proratachargenextmonth] See https://docs.whmcs.com/Products_and_Services#Pricing_Tab
37 | * @param {String} [opts.subdomain] A comma separated list of subdomains to offer on the domain register page. eg: .domain1.com,.domain2.com
38 | * @param {String} [opts.autosetup] When should the product be automatically setup. One of “ (never), ‘on’ (pending order), ‘payment’ (on payment), ‘order’ (on order)
39 | * @param {String} [opts.module] The server module system name to associate with the product. eg: cpanel, autorelease, plesk
40 | * @param {Number} [opts.servergroupid] The server group id used on product creation to associate an appropriate server
41 | * @param {Mixed} [opts.configoption1] The first module configuration value
42 | * @param {Mixed} [opts.configoption2] The second module configuration value
43 | * @param {Mixed} [opts.configoption3] The third module configuration value
44 | * @param {Mixed} [opts.configoption4] The fourth module configuration value
45 | * @param {Mixed} [opts.configoption5] The fifth module configuration value
46 | * @param {Mixed} [opts.configoption6] The sixth module configuration value
47 | * @param {Number} [opts.order] The order to in which to display on the order form
48 | * @param {Array} [opts.pricing] The pricing array to associate with the product. format $pricing[currencyid]cycle
49 | */
50 | addProduct (opts) {
51 | const options = {
52 | action: 'AddProduct',
53 | ...opts
54 | }
55 | return this.callApi(options)
56 | }
57 | }
58 |
59 |
60 | module.exports = Products
61 |
--------------------------------------------------------------------------------
/modules/ProjectManagement.js:
--------------------------------------------------------------------------------
1 | const WHMCS = require('../whmcs')
2 |
3 | /**
4 | * Allows you to manage your Project Management module in WHMCS.
5 | * @extends WHMCS
6 | */
7 | class ProjectManagement extends WHMCS {
8 | /**
9 | * @param {Object} config Object containing your API credentials.
10 | * @param {string} config.serverUrl URL to your installation. Remember to point to /includes/api.php
11 | * @param {string} [config.username]
12 | * @param {string} [config.password]
13 | * @param {string} [config.identifier]
14 | * @param {string} [config.secret]
15 | */
16 | constructor (config) {
17 | super(config)
18 | }
19 | /**
20 | * Adds a Message to a project - https://developers.whmcs.com/api-reference/addprojectmessage/
21 | * @param {Object} opts
22 | * @param {Number} opts.projectid The id of the project the message is for
23 | * @param {String} opts.message The message to add to the project
24 | * @param {Number} [opts.adminid] Override the admin id for the message. Not passing will set to the adminid of the api request
25 | */
26 | addProjectMessage (opts) {
27 | const options = {
28 | action: 'AddProjectMessage',
29 | ...opts
30 | }
31 | return this.callApi(options)
32 | }
33 | /**
34 | * Adds a Task to a project - https://developers.whmcs.com/api-reference/updateprojecttask/
35 | * @param {Object} opts
36 | * @param {Number} opts.taskid The id of the project task to update
37 | * @param {Number} [opts.projectid] Change the project a task is assigned to
38 | * @param {String} [opts.duedate] The duedate for the task. Format YYYY-mm-dd
39 | * @param {Number} [opts.adminid] The admin id to associate the task with
40 | * @param {String} [opts.task] The task title
41 | * @param {String} [opts.notes] The notes for the task
42 | * @param {Boolean} [opts.completed] Has the task been completed
43 | */
44 | updateProjectTask (opts) {
45 | const options = {
46 | action: 'UpdateProjectTask',
47 | ...opts
48 | }
49 | return this.callApi(options)
50 | }
51 | /**
52 | * Starts a timer for a project - https://developers.whmcs.com/api-reference/starttasktimer/
53 | * @param {Object} opts
54 | * @param {Number} opts.timerid The id of the task to be ended
55 | * @param {Number} opts.projectid The id of the project for the task timer
56 | * @param {Number} [opts.adminid] The admin id to associate the timer with
57 | * @param {Number} [opts.start_time] The start time as a unix time stamp. Defaults to time() if not provided
58 | * @param {Number} [opts.end_time] The start time as a unix time stamp.
59 | */
60 | startTaskTimer (opts) {
61 | const options = {
62 | action: 'StartTaskTimer',
63 | ...opts
64 | }
65 | return this.callApi(options)
66 | }
67 | /**
68 | * Updates a project - https://developers.whmcs.com/api-reference/updateproject/
69 | * @param {Object} opts
70 | * @param {Number} opts.projectid The project ID to update
71 | * @param {Number} [opts.adminid] The adminId the project will be associated with
72 | * @param {Number} [opts.userid] The user that the project is for
73 | * @param {String} [opts.status] The status of the project as defined in Project Management Settings
74 | * @param {String} [opts.created] The created date of the project in Y-m-d format
75 | * @param {String} [opts.duedate] The due date of the project in Y-m-d format
76 | * @param {Boolean} [opts.completed] Is the project completed
77 | * @param {String} [opts.title] The title of the project
78 | * @param {String} [opts.ticketids] A comma separated list of ticket IDs to associate with the project
79 | * @param {String} [opts.invoiceids] A comma separated list of invoice IDs to associate with the project
80 | * @param {String} [opts.notes] The notes to associate with the project
81 | */
82 | updateProject (opts) {
83 | const options = {
84 | action: 'UpdateProject',
85 | ...opts
86 | }
87 | return this.callApi(options)
88 | }
89 | /**
90 | * Retrieve a specific Project - https://developers.whmcs.com/api-reference/getproject/
91 | * @param {Object} opts
92 | * @param {Number} opts.projectid The project id to obtain
93 | */
94 | getProject (opts) {
95 | const options = {
96 | action: 'GetProject',
97 | ...opts
98 | }
99 | return this.callApi(options)
100 | }
101 | /**
102 | * Creates a new project - https://developers.whmcs.com/api-reference/createproject/
103 | * @param {Object} opts
104 | * @param {String} opts.title The title of the new project
105 | * @param {Number} opts.adminid The adminId the project will be associated with
106 | * @param {Number} [opts.userid] The user that the project is for
107 | * @param {String} [opts.status] The status of the project as defined in Project Management Settings
108 | * @param {String} [opts.created] The created date of the project in Y-m-d format
109 | * @param {String} [opts.duedate] The duedate date of the project in Y-m-d format
110 | * @param {Boolean} [opts.completed] Is the project completed
111 | * @param {String} [opts.ticketids] A comma separated list of ticket IDs to associate with the project
112 | * @param {String} [opts.invoiceids] A comma separated list of invoice IDs to associate with the project
113 | */
114 | createProject (opts) {
115 | const options = {
116 | action: 'CreateProject',
117 | ...opts
118 | }
119 | return this.callApi(options)
120 | }
121 | /**
122 | * Ends a started timer for a project - https://developers.whmcs.com/api-reference/endtasktimer/
123 | * @param {Object} opts
124 | * @param {Number} opts.timerid The id of the task to be ended
125 | * @param {Number} [opts.projectid] The id of the project for the task timer
126 | * @param {Number} [opts.adminid] The admin id to associate the timer with
127 | * @param {Number} [opts.end_time] The end time as a unix time stamp. Defaults to time() if not provided
128 | */
129 | endTaskTimer (opts) {
130 | const options = {
131 | action: 'EndTaskTimer',
132 | ...opts
133 | }
134 | return this.callApi(options)
135 | }
136 | /**
137 | * Adds a Task to a project - https://developers.whmcs.com/api-reference/addprojecttask/
138 | * @param {Object} opts
139 | * @param {Number} opts.projectid The id of the project the task is for
140 | * @param {String} opts.duedate The duedate for the task. Format YYYY-mm-dd
141 | * @param {Number} [opts.adminid] The admin id to associate the task with
142 | * @param {String} [opts.task] The task title
143 | * @param {String} [opts.notes] The notes for the task
144 | * @param {Boolean} [opts.completed] Has the task been completed
145 | * @param {Boolean} [opts.billed] Has the task been billed
146 | */
147 | addProjectTask (opts) {
148 | const options = {
149 | action: 'AddProjectTask',
150 | ...opts
151 | }
152 | return this.callApi(options)
153 | }
154 | /**
155 | * Removes a task from the system. This cannot be undone - https://developers.whmcs.com/api-reference/deleteprojecttask/
156 | * @param {Object} opts
157 | * @param {Number} opts.projectid The project that owns the task being deleted
158 | * @param {Number} opts.taskid The task to be deleted
159 | */
160 | deleteProjectTask (opts) {
161 | const options = {
162 | action: 'DeleteProjectTask',
163 | ...opts
164 | }
165 | return this.callApi(options)
166 | }
167 | /**
168 | * Obtain orders matching the passed criteria - https://developers.whmcs.com/api-reference/getprojects/
169 | * @param {Object} opts
170 | * @param {Number} [opts.limitstart] The offset for the returned project data (default: 0)
171 | * @param {Number} [opts.limitnum] The number of records to return (default: 25)
172 | * @param {Number} [opts.userid] Find projects for a specific client id
173 | * @param {String} [opts.title] Find projects with a specific title
174 | * @param {String} [opts.ticketids] Find projects with specific ticketids
175 | * @param {String} [opts.invoiceids] Find projects with specific invoiceids
176 | * @param {String} [opts.notes] Find projects with specific notes
177 | * @param {Number} [opts.adminid] Find projects assigned to a specific admin id
178 | * @param {String} [opts.status] Find projects with a specific status
179 | * @param {String} [opts.created] Find projects with a specific creation date
180 | * @param {String} [opts.duedate] Find projects with a specific due date
181 | * @param {Boolean} [opts.completed] Find projects that are/aren’t completed
182 | * @param {String} [opts.lastmodified] Find projects with a specific last modified date
183 | */
184 | getProjects (opts) {
185 | const options = {
186 | action: 'GetProjects',
187 | ...opts
188 | }
189 | return this.callApi(options)
190 | }
191 | }
192 |
193 | module.exports = ProjectManagement
194 |
--------------------------------------------------------------------------------
/modules/Servers.js:
--------------------------------------------------------------------------------
1 | const WHMCS = require('../whmcs')
2 |
3 | /**
4 | * Allows you to manage your Servers module in WHMCS.
5 | * @extends WHMCS
6 | */
7 | class Servers extends WHMCS {
8 | /**
9 | * @param {Object} config Object containing your API credentials.
10 | * @param {string} config.serverUrl URL to your installation. Remember to point to /includes/api.php
11 | * @param {string} [config.username]
12 | * @param {string} [config.password]
13 | * @param {string} [config.identifier]
14 | * @param {string} [config.secret]
15 | */
16 | constructor (config) {
17 | super(config)
18 | }
19 | /**
20 | * Get health status. - https://developers.whmcs.com/api-reference/gethealthstatus/
21 | * @param {Object} opts
22 | * @param {Boolean} [opts.fetchStatus] Pass as true to attempt to fetch server status values.
23 | */
24 | getHealthStatus (opts) {
25 | const options = {
26 | action: 'GetHealthStatus',
27 | ...opts
28 | }
29 | return this.callApi(options)
30 | }
31 | /**
32 | * Get servers. - https://developers.whmcs.com/api-reference/getservers/
33 | * @param {Object} opts
34 | * @param {Boolean} [opts.fetchStatus] Pass as true to attempt to fetch server status values.
35 | */
36 | getServers (opts) {
37 | const options = {
38 | action: 'GetServers',
39 | ...opts
40 | }
41 | return this.callApi(options)
42 | }
43 | }
44 |
45 | module.exports = Servers
46 |
--------------------------------------------------------------------------------
/modules/Services.js:
--------------------------------------------------------------------------------
1 | const WHMCS = require('../whmcs')
2 |
3 | /**
4 | * Allows you to manage your Services module in WHMCS.
5 | * @extends WHMCS
6 | */
7 | class Services extends WHMCS {
8 | /**
9 | * @param {Object} config Object containing your API credentials.
10 | * @param {string} config.serverUrl URL to your installation. Remember to point to /includes/api.php
11 | * @param {string} [config.username]
12 | * @param {string} [config.password]
13 | * @param {string} [config.identifier]
14 | * @param {string} [config.secret]
15 | */
16 | constructor (config) {
17 | super(config)
18 | }
19 | /**
20 | * Runs a change package action for a given service. - https://developers.whmcs.com/api-reference/modulechangepackage/
21 | * @param {Object} opts
22 | * @param {Number} opts.serviceid The service ID to run the action for
23 | */
24 | moduleChangePackage (opts) {
25 | const options = {
26 | action: 'ModuleChangePackage',
27 | ...opts
28 | }
29 | return this.callApi(options)
30 | }
31 | /**
32 | * Runs a change password action for a given service. - https://developers.whmcs.com/api-reference/modulechangepw/
33 | * @param {Object} opts
34 | * @param {Number} opts.serviceid The service ID to run the action for
35 | * @param {String} [opts.servicepassword] A new password to assign to the service
36 | */
37 | moduleChangePw (opts) {
38 | const options = {
39 | action: 'ModuleChangePw',
40 | ...opts
41 | }
42 | return this.callApi(options)
43 | }
44 | /**
45 | * Updates a Client Service - https://developers.whmcs.com/api-reference/updateclientproduct/
46 | * @param {Object} opts
47 | * @param {Number} opts.serviceid The id of the client service to update
48 | * @param {Number} [opts.pid] The package id to associate with the service
49 | * @param {Number} [opts.serverid] The server id to associate with the service
50 | * @param {String} [opts.nextduedate] The next due date of the service (Y-m-d)
51 | * @param {String} [opts.terminationDate] Update the termination date of the service (Y-m-d)
52 | * @param {String} [opts.completedDate] Update the completed date of the service (Y-m-d)
53 | * @param {String} [opts.domain] The domain name to be changed to
54 | * @param {Number} [opts.firstpaymentamount] The first payment amount on the service
55 | * @param {Number} [opts.recurringamount] The recurring amount for automatic renewal invoices
56 | * @param {String} [opts.paymentmethod] The payment method to associate in system format (eg paypal)
57 | * @param {String} [opts.billingcycle] The term in which the product is billed on (eg One-Time, Monthly, Quarterly, etc)
58 | * @param {String} [opts.subscriptionid] The subscription ID to associate with the service
59 | * @param {String} [opts.status] The status to change the service to
60 | * @param {String} [opts.notes] The admin notes for the service
61 | * @param {String} [opts.serviceusername] The service username
62 | * @param {String} [opts.servicepassword] The service password
63 | * @param {String} [opts.overideautosuspend] Should override auto suspend be provided (‘on’ or ‘off’)
64 | * @param {String} [opts.overidesuspenduntil] Update the Override Suspend date of the service (Y-m-d)
65 | * @param {String} [opts.ns1] (VPS/Dedicated servers only)
66 | * @param {String} [opts.ns2] (VPS/Dedicated servers only)
67 | * @param {String} [opts.dedicatedip]
68 | * @param {String} [opts.assignedips] (VPS/Dedicated servers only)
69 | * @param {Number} [opts.diskusage] The disk usage in bytes
70 | * @param {Number} [opts.disklimit] The disk limit in bytes
71 | * @param {Number} [opts.bwusage] The bandwidth usage in bytes
72 | * @param {Number} [opts.bwlimit] The bandwidth limit in bytes
73 | * @param {String} [opts.overidesuspenduntil]
74 | * @param {String} [opts.suspendreason]
75 | * @param {Number} [opts.promoid] The promotion Id to associate
76 | * @param {Array} [opts.unset] An array of items to unset. Can be one of: ‘domain’, ‘serviceusername’, ‘servicepassword’, ‘subscriptionid’, ‘ns1’, ‘ns2’, ‘dedicatedip’, ‘assignedips’, ‘notes’, ‘suspendreason’
77 | * @param {Boolean} [opts.autorecalc] Should the recurring amount of the service be automatically recalculated (this will ignore any passed $recurringamount)
78 | * @param {String} [opts.customfields] Base64 encoded serialized array of custom field values - base64_encode(serialize(array(“1”=>“Yahoo”)));
79 | * @param {String} [opts.configoptions] Base64 encoded serialized array of configurable option field values - base64_encode(serialize(array(configoptionid => dropdownoptionid, XXX => array(‘optionid’ => YYY, ‘qty’ => ZZZ)))) - XXX is the ID of the configurable option - YYY is the optionid found in tblhostingconfigoption.optionid - ZZZ is the quantity you want to use for that option
80 | */
81 | updateClientProduct (opts) {
82 | const options = {
83 | action: 'UpdateClientProduct',
84 | ...opts
85 | }
86 | return this.callApi(options)
87 | }
88 | /**
89 | * Runs a custom module action for a given service. - https://developers.whmcs.com/api-reference/modulecustom/
90 | * @param {Object} opts
91 | * @param {Number} opts.serviceid The service ID to run the action for
92 | * @param {String} opts.func_name The name of the custom function to run
93 | */
94 | moduleCustom (opts) {
95 | const options = {
96 | action: 'ModuleCustom',
97 | ...opts
98 | }
99 | return this.callApi(options)
100 | }
101 | /**
102 | * Runs the module suspend action for a given service. - https://developers.whmcs.com/api-reference/modulesuspend/
103 | * @param {Object} opts
104 | * @param {Number} opts.serviceid The service ID to run the action for
105 | * @param {String} [opts.suspendreason] A reason for the suspension
106 | */
107 | moduleSuspend (opts) {
108 | const options = {
109 | action: 'ModuleSuspend',
110 | ...opts
111 | }
112 | return this.callApi(options)
113 | }
114 | /**
115 | * Runs an unsuspend action for a given service. - https://developers.whmcs.com/api-reference/moduleunsuspend/
116 | * @param {Object} opts
117 | * @param {Number} opts.serviceid The service ID to run the action for
118 | */
119 | moduleUnsuspend (opts) {
120 | const options = {
121 | action: 'ModuleUnsuspend',
122 | ...opts
123 | }
124 | return this.callApi(options)
125 | }
126 | /**
127 | * Runs the module create action for a given service. - https://developers.whmcs.com/api-reference/modulecreate/
128 | * @param {Object} opts
129 | * @param {Number} opts.serviceid The service ID to run the action for
130 | */
131 | moduleCreate (opts) {
132 | const options = {
133 | action: 'ModuleCreate',
134 | ...opts
135 | }
136 | return this.callApi(options)
137 | }
138 | /**
139 | * Runs a terminate action for a given service. - https://developers.whmcs.com/api-reference/moduleterminate/
140 | * @param {Object} opts
141 | * @param {Number} opts.serviceid The service ID to run the action for
142 | */
143 | moduleTerminate (opts) {
144 | const options = {
145 | action: 'ModuleTerminate',
146 | ...opts
147 | }
148 | return this.callApi(options)
149 | }
150 | /**
151 | * Upgrade, or calculate an upgrade on, a product - https://developers.whmcs.com/api-reference/upgradeproduct/
152 | * @param {Object} opts
153 | * @param {Number} opts.serviceid The ID of the service to update
154 | * @param {Boolean} [opts.calconly] Only calculate the upgrade amount
155 | * @param {String} opts.paymentmethod The upgrade payment method in system format (e.g. paypal)
156 | * @param {String} opts.type The type of upgrade (‘product’, ‘configoptions’)
157 | * @param {Number} [opts.newproductid] The Id of the new product
158 | * @param {String} [opts.newproductbillingcycle] The new products billing cycle
159 | * @param {String} [opts.promocode] The promotion code to apply to the upgrade
160 | * @param {Array} [opts.configoptions] An array of config options to upgrade
161 | * @param {Number} [opts.configoptions[id]] The id of the config option
162 | * @param {Number} [opts.configoptions[optiontype]] The config option type
163 | * @param {Number} [opts.configoptions[selectedvalue]] The config option selected value
164 | * @param {Number} [opts.configoptions[selectedqty]] The config option quantity selected
165 | */
166 | upgradeProduct (opts) {
167 | const options = {
168 | action: 'UpgradeProduct',
169 | ...opts
170 | }
171 | return this.callApi(options)
172 | }
173 | }
174 |
175 | module.exports = Services
176 |
--------------------------------------------------------------------------------
/modules/Support.js:
--------------------------------------------------------------------------------
1 | const WHMCS = require('../whmcs')
2 |
3 | /**
4 | * Allows you to manage your support module in WHMCS.
5 | * @extends WHMCS
6 | */
7 | class Support extends WHMCS {
8 | /**
9 | * @param {Object} config Object containing your API credentials.
10 | * @param {string} config.serverUrl URL to your installation. Remember to point to /includes/api.php
11 | * @param {string} [config.username]
12 | * @param {string} [config.password]
13 | * @param {string} [config.identifier]
14 | * @param {string} [config.secret]
15 | */
16 | constructor (config) {
17 | super(config)
18 | }
19 | /**
20 | * Adds an announcement. - https://developers.whmcs.com/api-reference/addannouncement/
21 | * @param {Object} opts
22 | * @param {String} opts.date Date in the format YYYY-MM-DD HH:MM:SS
23 | * @param {String} opts.title
24 | * @param {String} opts.announcement Announcement text
25 | * @param {Boolean} [opts.published] Pass as true to publish
26 | */
27 | addAnouncement (opts) {
28 | const options = {
29 | action: 'AddAnouncement',
30 | ...opts
31 | }
32 | return this.callApi(options)
33 | }
34 | /**
35 | * Adds a Cancellation Request - https://developers.whmcs.com/api-reference/addcancelrequest/
36 | * @param {Object} opts
37 | * @param {Number} opts.serviceid The Service ID to cancel
38 | * @param {String} [opts.type] The type of cancellation. ‘Immediate’ or ‘End of Billing Period’
39 | * @param {String} [opts.reason] The customer reason for cancellation
40 | */
41 | addCancelRequest (opts) {
42 | const options = {
43 | action: 'AddCancelRequest',
44 | ...opts
45 | }
46 | return this.callApi(options)
47 | }
48 | /**
49 | * Adds a Client Note - https://developers.whmcs.com/api-reference/addclientnote/
50 | * @param {Object} opts
51 | * @param {Number} opts.userid The Client ID to apply the note to
52 | * @param {String} opts.notes The note to add
53 | * @param {Boolean} [opts.sticky] Should the note be made sticky. Makes the note ‘sticky’ and displays the note throughout the client’s account and on any tickets they submit in the admin area
54 | */
55 | addClientNote (opts) {
56 | const options = {
57 | action: 'AddClientNote',
58 | ...opts
59 | }
60 | return this.callApi(options)
61 | }
62 | /**
63 | * Add a note to a ticket by Ticket ID or Ticket Number. - https://developers.whmcs.com/api-reference/addticketnote/
64 | * @param {Object} opts
65 | * @param {String} opts.message The content of the ticket note
66 | * @param {String} [opts.ticketnum] The Client Ticket Number ID to apply the note to
67 | * @param {Number} [opts.ticketid] The id of the ticket in the database. Either $ticketnum or $ticketid is required
68 | * @param {Boolean} [opts.markdown] Should markdown be used on the ticket note output
69 | * @param {Array} [opts.attachments] Optional base64 json encoded array of file attachments. Can be the direct output of a multipart-form-data form submission ($_FILES superglobal in PHP) or an array of arrays consisting of both a filename and data keys (see example below).
70 | */
71 | addTicketNote (opts) {
72 | const options = {
73 | action: 'AddTicketNote',
74 | ...opts
75 | }
76 | return this.callApi(options)
77 | }
78 | /**
79 | * Add a reply to a ticket by Ticket ID. - https://developers.whmcs.com/api-reference/addticketreply/
80 | * @param {Object} opts
81 | * @param {Number} opts.ticketid The id of the ticket in the database. Either $ticketnum or $ticketid is required
82 | * @param {String} opts.message The content of the ticket reply
83 | * @param {Boolean} [opts.markdown] Should markdown be used on the ticket reply output
84 | * @param {Number} [opts.clientid] Pass a clientid to associate the ticket reply with a specific client
85 | * @param {Number} [opts.contactid] Pass a contactid to associate the ticket reply with a specific contact belonging to $clientid
86 | * @param {String} [opts.adminusername] The admin username to associate the ticket reply with
87 | * @param {String} [opts.name] The name to associate with the ticket reply if not an admin or client response
88 | * @param {String} [opts.email] The email to associate with the ticket reply if not an admin or client response
89 | * @param {String} [opts.status] The status to set on the ticket after the reply is made if the default status on admin/client response is not required. See GetSupportStatuses API command
90 | * @param {Boolean} [opts.noemail] Set to true to stop the ticket reply email being sent
91 | * @param {String} [opts.customfields] A base64 encoded array of the custom fields to update
92 | * @param {Array} [opts.attachments] Optional base64 json encoded array of file attachments. Can be the direct output of a multipart-form-data form submission ($_FILES superglobal in PHP) or an array of arrays consisting of both a filename and data keys (see example below).
93 | */
94 | addTicketReply (opts) {
95 | const options = {
96 | action: 'AddTicketReply',
97 | ...opts
98 | }
99 | return this.callApi(options)
100 | }
101 | /**
102 | * Delete an announcement - https://developers.whmcs.com/api-reference/deleteannouncement/
103 | * @param {Object} opts
104 | * @param {Number} opts.announcementid The id of the announcement to be deleted
105 | */
106 | deleteAnnouncement (opts) {
107 | const options = {
108 | action: 'DeleteAnnouncement',
109 | ...opts
110 | }
111 | return this.callApi(options)
112 | }
113 | /**
114 | * Removes a ticket and all replies from the system. This cannot be undone. - https://developers.whmcs.com/api-reference/deleteticket/
115 | * @param {Object} opts
116 | * @param {Number} opts.ticketid The ticket to be deleted
117 | */
118 | deleteTicket (opts) {
119 | const options = {
120 | action: 'DeleteTicket ',
121 | ...opts
122 | }
123 | return this.callApi(options)
124 | }
125 | /**
126 | * Removes a ticket note from the system. This cannot be undone. - https://developers.whmcs.com/api-reference/deleteticketnote/
127 | * @param {Object} opts
128 | * @param {Number} opts.noteid The ticket note to be deleted
129 | */
130 | deleteTicketNote (opts) {
131 | const options = {
132 | action: 'DeleteTicketNote ',
133 | ...opts
134 | }
135 | return this.callApi(options)
136 | }
137 | /**
138 | * Obtain an array of announcements - https://developers.whmcs.com/api-reference/getannouncements/
139 | * @param {Object} opts
140 | * @param {Number} [opts.limitstart] The offset for the returned announcement data (default: 0)
141 | * @param {Number} [opts.limitnum] The number of records to return (default: 25)
142 | */
143 | getAnnouncements (opts) {
144 | const options = {
145 | action: 'GetAnnouncements',
146 | ...opts
147 | }
148 | return this.callApi(options)
149 | }
150 | /**
151 | * Open a new ticket - https://developers.whmcs.com/api-reference/openticket/
152 | * @param {Object} opts
153 | * @param {Number} opts.deptid The department to open the ticket in
154 | * @param {String} opts.subject The subject of the ticket
155 | * @param {String} opts.message The message of the ticket
156 | * @param {Number} [opts.clientid] If applicable, the Client ID to create the ticket for.
157 | * @param {Number} [opts.contactid] If applicable, the Contact ID to create the ticket for (only if $clientid is passed).
158 | * @param {String} [opts.name] The name of the person opening the ticket (if not a client)
159 | * @param {String} [opts.email] The email address of the person opening the ticket (if not a client)
160 | * @param {String} [opts.priority] The priority of the ticket (‘Low’, ‘Medium’, ‘High’)
161 | * @param {Number} [opts.serviceid] The service to associate the ticket with (only one of $serviceid or $domainid)
162 | * @param {Number} [opts.domainid] The domain to associate the ticket with (only one of $serviceid or $domainid)
163 | * @param {Boolean} [opts.admin] Is an Admin opening the ticket
164 | * @param {Boolean} [opts.markdown] Should markdown be used on the ticket output
165 | * @param {String} [opts.customfields] Base64 encoded serialized array of custom field values
166 | * @param {Array} [opts.attachments] Optional base64 json encoded array of file attachments. Can be the direct output of a multipart-form-data form submission ($_FILES superglobal in PHP) or an array of arrays consisting of both a filename and data keys (see example below).
167 | */
168 | openTicket (opts) {
169 | const options = {
170 | action: 'OpenTicket',
171 | ...opts
172 | }
173 | return this.callApi(options)
174 | }
175 | /**
176 | * Updates an existing ticket - https://developers.whmcs.com/api-reference/updateticket/
177 | * @param {Object} opts
178 | * @param {Number} opts.ticketid The ticket Id to update
179 | * @param {Number} [opts.deptid] The department id of the ticket
180 | * @param {String} [opts.status] The status of the ticket
181 | * @param {String} [opts.subject] The subject of the ticket
182 | * @param {Number} [opts.userid] If applicable, the Client ID to update the ticket for.
183 | * @param {String} [opts.name] The name of the person opening the ticket (if not a client)
184 | * @param {String} [opts.email] The email address of the person opening the ticket (if not a client)
185 | * @param {String} [opts.cc] The cc email addresses for the ticket
186 | * @param {String} [opts.priority] The priority of the ticket (‘Low’, ‘Medium’, ‘High’)
187 | * @param {Number} [opts.flag] The id of the admin to flag the ticket to
188 | * @param {Boolean} [opts.removeFlag] Remove the flag from the ticket
189 | * @param {String} [opts.message] Update the ticket message
190 | * @param {Boolean} [opts.markdown] Should markdown be used on the ticket output.
191 | * @param {String} [opts.customfields] Base64 encoded serialized array of custom field values
192 | */
193 | updateTicket (opts) {
194 | const options = {
195 | action: 'UpdateTicket',
196 | ...opts
197 | }
198 | return this.callApi(options)
199 | }
200 | /**
201 | * Updates a ticket reply message. - https://developers.whmcs.com/api-reference/updateticketreply/
202 | * @param {Object} opts
203 | * @param {Number} opts.replyid The reply id to update.
204 | * @param {String} opts.message The message to be updated
205 | * @param {Boolean} [opts.markdown] Should markdown be used on the ticket message. Existing value is used if not supplied.
206 | */
207 | updateTicketReply (opts) {
208 | const options = {
209 | action: 'UpdateTicketReply',
210 | ...opts
211 | }
212 | return this.callApi(options)
213 | }
214 | }
215 |
216 | module.exports = Support
217 |
--------------------------------------------------------------------------------
/modules/System.js:
--------------------------------------------------------------------------------
1 | const WHMCS = require('../whmcs')
2 |
3 | class System extends WHMCS {
4 | /**
5 | * @param {Object} config Object containing your API credentials.
6 | * @param {string} config.serverUrl URL to your installation. Remember to point to /includes/api.php
7 | * @param {string} [config.username]
8 | * @param {string} [config.password]
9 | * @param {string} [config.identifier]
10 | * @param {string} [config.secret]
11 | */
12 | constructor (config) {
13 | super(config)
14 | }
15 | /**
16 | * Encrypting the same string twice will return different values. You will need to decrypt an encrypted string to compare values. - https://developers.whmcs.com/api-reference/encryptpassword/
17 | * @param {Object} opts
18 | * @param {String} opts.password2 The string to encrypt
19 | */
20 | encryptPassword (opts) {
21 | const options = {
22 | action: 'EncryptPassword',
23 | ...opts
24 | }
25 | return this.callApi(options)
26 | }
27 | /**
28 | * Get Automation Task Log. - https://developers.whmcs.com/api-reference/getautomationlog/
29 | * @param {Object} opts
30 | * @param {String} [opts.startdate] Defaults to today
31 | * @param {String} [opts.enddate] Defaults to today
32 | * @param {String} [opts.namespace] Optional filter for a specific namespace
33 | */
34 | getAutomationLog (opts) {
35 | const options = {
36 | action: 'GetAutomationLog',
37 | ...opts
38 | }
39 | return this.callApi(options)
40 | }
41 | /**
42 | * Obtain the Currencies configured in the System - https://developers.whmcs.com/api-reference/getcurrencies/
43 | * @param {Object} opts
44 | */
45 | getCurrencies (opts) {
46 | const options = {
47 | action: 'GetCurrencies',
48 | ...opts
49 | }
50 | return this.callApi(options)
51 | }
52 | /**
53 | * Obtain a list of email templates from the system - https://developers.whmcs.com/api-reference/getemailtemplates/
54 | * @param {Object} opts
55 | * @param {String} [opts.type] The type of email template to retrieve
56 | * @param {String} [opts.language] The language of the email template to retrieve, if none provided will return default language templates.
57 | */
58 | getEmailTemplates (opts) {
59 | const options = {
60 | action: 'GetEmailTemplates',
61 | ...opts
62 | }
63 | return this.callApi(options)
64 | }
65 | /**
66 | * Retrieve Activated Payment Methods - https://developers.whmcs.com/api-reference/getpaymentmethods/
67 | * @param {Object} opts
68 | */
69 | getPaymentMethods (opts) {
70 | const options = {
71 | action: 'GetPaymentMethods',
72 | ...opts
73 | }
74 | return this.callApi(options)
75 | }
76 | /**
77 | * Obtain the details for the current Admin User - https://developers.whmcs.com/api-reference/getadmindetails/
78 | * @param {Object} opts
79 | */
80 | getAdminDetails (opts) {
81 | const options = {
82 | action: 'GetAdminDetails',
83 | ...opts
84 | }
85 | return this.callApi(options)
86 | }
87 | /**
88 | * Retrieve a list of administrator user accounts. - https://developers.whmcs.com/api-reference/getadminusers/
89 | * @param {Object} opts
90 | * @param {Number} [opts.roleid] An administrative role ID to filter for.
91 | * @param {String} [opts.email] An email address to filter for. Partial matching supported.
92 | * @param {Boolean} [opts.include_disabled] Pass as true to include disabled administrator user accounts in response.
93 | */
94 | getAdminUsers (opts) {
95 | const options = {
96 | action: 'GetAdminUsers',
97 | ...opts
98 | }
99 | return this.callApi(options)
100 | }
101 | /**
102 | * Retrieve a System Configuration Value. - https://developers.whmcs.com/api-reference/getconfigurationvalue/
103 | * @param {Object} opts
104 | * @param {String} opts.setting The name of the setting to be obtained
105 | */
106 | getConfigurationValue (opts) {
107 | const options = {
108 | action: 'GetConfigurationValue',
109 | ...opts
110 | }
111 | return this.callApi(options)
112 | }
113 | /**
114 | * Adds an IP to the ban list. - https://developers.whmcs.com/api-reference/addbannedip/
115 | * @param {Object} opts
116 | * @param {String} opts.ip
117 | * @param {String} opts.reason Admin only reason
118 | * @param {Number} opts.days If passed, expires date is auto calculated
119 | * @param {String} [opts.expires] YYYY-MM-DD HH:MM:SS
120 | */
121 | addBannedIp (opts) {
122 | const options = {
123 | action: 'AddBannedIp',
124 | ...opts
125 | }
126 | return this.callApi(options)
127 | }
128 | /**
129 | * Obtain the Activity Log that matches passed criteria - https://developers.whmcs.com/api-reference/getactivitylog/
130 | * @param {Object} opts
131 | * @param {Number} [opts.limitstart] The offset for the returned log data (default: 0)
132 | * @param {Number} [opts.limitnum] The number of records to return (default: 25)
133 | * @param {Number} [opts.userid] The ID of the user to obtain the log for
134 | * @param {String} [opts.date] The date of the activity log to retrieve in localised format (eg 01/01/2016)
135 | * @param {String} [opts.user] The name of the user to retrieve the log entries for
136 | * @param {String} [opts.description] Search the log for a specific string
137 | * @param {String} [opts.ipaddress] The IP Address to search the activity log for
138 | */
139 | getActivityLog (opts) {
140 | const options = {
141 | action: 'GetActivityLog',
142 | ...opts
143 | }
144 | return this.callApi(options)
145 | }
146 | /**
147 | * Creates an activity log entry. - https://developers.whmcs.com/api-reference/logactivity/
148 | * @param {Object} opts
149 | * @param {Number} [opts.userid]
150 | * @param {String} opts.description
151 | */
152 | logActivity (opts) {
153 | const options = {
154 | action: 'LogActivity',
155 | ...opts
156 | }
157 | return this.callApi(options)
158 | }
159 | /**
160 | * Retrieve a list of currently logged in admin users. - https://developers.whmcs.com/api-reference/getstaffonline/
161 | * @param {Object} opts
162 | */
163 | getStaffOnline (opts) {
164 | const options = {
165 | action: 'GetStaffOnline',
166 | ...opts
167 | }
168 | return this.callApi(options)
169 | }
170 | /**
171 | * Obtain To Do item statuses and counts - https://developers.whmcs.com/api-reference/gettodoitemstatuses/
172 | * @param {Object} opts
173 | */
174 | getToDoItemStatuses (opts) {
175 | const options = {
176 | action: 'GetToDoItemStatuses',
177 | ...opts
178 | }
179 | return this.callApi(options)
180 | }
181 | /**
182 | * Send an Admin Email Notification - https://developers.whmcs.com/api-reference/sendadminemail/
183 | * @param {Object} opts
184 | * @param {String} [opts.messagename] The name of the admin email template to send
185 | * @param {String} [opts.custommessage] The HTML message body to send for a custom email
186 | * @param {String} [opts.customsubject] The subject to send for a custom email
187 | * @param {String} [opts.type] Which type of admin notification will be send (‘system’, ‘account’, ‘support’)
188 | * @param {Number} [opts.deptid] The Id of the department the notification is for if ‘support’ $type
189 | * @param {Array} [opts.mergefields] The merge fields to be used in the email template
190 | */
191 | sendAdminEmail (opts) {
192 | const options = {
193 | action: 'SendAdminEmail',
194 | ...opts
195 | }
196 | return this.callApi(options)
197 | }
198 | /**
199 | * Get business performance metrics and statistics. - https://developers.whmcs.com/api-reference/getstats/
200 | * @param {Object} opts
201 | * @param {Number} [opts.timeline_days] (Optional) The number of days to retrieve timeline values for (max 90).
202 | */
203 | getStats (opts) {
204 | const options = {
205 | action: 'GetStats',
206 | ...opts
207 | }
208 | return this.callApi(options)
209 | }
210 | /**
211 | * Set a System Configuration Value via the local API only. - https://developers.whmcs.com/api-reference/setconfigurationvalue/
212 | * @param {Object} opts
213 | * @param {String} opts.setting The setting name to change
214 | * @param {String} opts.value The value to set. Leave value blank to unset.
215 | */
216 | setConfigurationValue (opts) {
217 | const options = {
218 | action: 'SetConfigurationValue',
219 | ...opts
220 | }
221 | return this.callApi(options)
222 | }
223 | /**
224 | * Update a specific announcement - https://developers.whmcs.com/api-reference/updateannouncement/
225 | * @param {Object} opts
226 | * @param {String} opts.announcementid The id of the announcement to update
227 | * @param {String} [opts.title] The title of the announcement (if required to change)
228 | * @param {String} [opts.announcement] The message of the announcement (if required to change)
229 | * @param {String} [opts.date] The date of the announcement (if required to change) (Y-m-d H:i:s)
230 | * @param {Boolean} [opts.published] Publish the announcement 1⁄0 (if required to change)
231 | */
232 | updateAnnouncement (opts) {
233 | const options = {
234 | action: 'UpdateAnnouncement',
235 | ...opts
236 | }
237 | return this.callApi(options)
238 | }
239 | /**
240 | * Update To-Do Item. - https://developers.whmcs.com/api-reference/updatetodoitem/
241 | * @param {Object} opts
242 | * @param {Number} [opts.itemid] The id of the To-Do item to be updated.
243 | * @param {Number} [opts.adminid] The admin id performing the update.
244 | * @param {String} [opts.status] The status of the to-do item.
245 | */
246 | updateToDoItem (opts) {
247 | const options = {
248 | action: 'UpdateToDoItem',
249 | ...opts
250 | }
251 | return this.callApi(options)
252 | }
253 | /**
254 | * Send a client Email Notification. See more details and restrictions at: - https://developers.whmcs.com/api-reference/sendemail/
255 | * @param {Object} opts
256 | * @param {String} [opts.messagename] The name of the client email template to send
257 | * @param {Number} [opts.id] The related id for the type of email template. Eg this should be the client id for a general type email
258 | * @param {String} [opts.customtype] The type of custom email template to send (‘general’, ‘product’, ‘domain’, ‘invoice’, ‘support’, ‘affiliate’)
259 | * @param {String} [opts.custommessage] The HTML message body to send for a custom email
260 | * @param {String} [opts.customsubject] The subject to send for a custom email
261 | * @param {Array} [opts.customvars] The custom variables to provide to the email template. Can be used for existing and custom emails.
262 | */
263 | sendEmail (opts) {
264 | const options = {
265 | action: 'SendEmail',
266 | ...opts
267 | }
268 | return this.callApi(options)
269 | }
270 | /**
271 | * Get To-Do List Items. - https://developers.whmcs.com/api-reference/gettodoitems/
272 | * @param {Object} opts
273 | * @param {Number} [opts.limitstart] The offset for the returned log data (default: 0)
274 | * @param {Number} [opts.limitnum] The number of records to return (default: 25)
275 | * @param {String} [opts.status] Status to filter for. Possible values include: Incomplete, New, Pending, In Progress, Completed
276 | */
277 | getToDoItems (opts) {
278 | const options = {
279 | action: 'GetToDoItems',
280 | ...opts
281 | }
282 | return this.callApi(options)
283 | }
284 | /**
285 | * Trigger a Custom Notification Event. - https://developers.whmcs.com/api-reference/triggernotificationevent/
286 | * @param {Object} opts
287 | * @param {String} [opts.notification_identifier] A unique identifier string, used as a condition when making a notification rule.
288 | * @param {String} [opts.title] The title for the notification
289 | * @param {String} [opts.message] The message body for the notification
290 | * @param {String} [opts.url] The follow up URL for the notification
291 | * @param {String} [opts.status] A status description for the notification
292 | * @param {String} [opts.statusStyle] A formatting style for the status of the notification, currently supports “success”, “danger”, and “info”
293 | * @param {Array} [opts.attributes] An array of Attributes to include in the notification. Requires at least label and value parameters. Other parameters are optional. See WHMCS\Notification\NotificationAttribute.
294 | */
295 | triggerNotificationEvent (opts) {
296 | const options = {
297 | action: 'TriggerNotificationEvent',
298 | ...opts
299 | }
300 | return this.callApi(options)
301 | }
302 | /**
303 | * Update the admin notes - https://developers.whmcs.com/api-reference/updateadminnotes/
304 | * @param {Object} opts
305 | * @param {String} opts.notes The new value for the admin notes
306 | */
307 | updateAdminNotes (opts) {
308 | const options = {
309 | action: 'UpdateAdminNotes',
310 | ...opts
311 | }
312 | return this.callApi(options)
313 | }
314 | /**
315 | * Decrypt an encrypted string - https://developers.whmcs.com/api-reference/decryptpassword/
316 | * @param {Object} opts
317 | * @param {String} opts.password2 The string to decrypt
318 | */
319 | decryptPassword (opts) {
320 | const options = {
321 | action: 'DecryptPassword',
322 | ...opts
323 | }
324 | return this.callApi(options)
325 | }
326 | }
327 |
328 | module.exports = System
329 |
--------------------------------------------------------------------------------
/modules/Tickets.js:
--------------------------------------------------------------------------------
1 | const WHMCS = require('../whmcs')
2 |
3 | /**
4 | * Allows you to manage your Tickets module in WHMCS.
5 | * @extends WHMCS
6 | */
7 | class Tickets extends WHMCS {
8 | /**
9 | * @param {Object} config Object containing your API credentials.
10 | * @param {string} config.serverUrl URL to your installation. Remember to point to /includes/api.php
11 | * @param {string} [config.username]
12 | * @param {string} [config.password]
13 | * @param {string} [config.identifier]
14 | * @param {string} [config.secret]
15 | */
16 | constructor (config) {
17 | super(config)
18 | }
19 | /**
20 | * Obtain a specific ticket - https://developers.whmcs.com/api-reference/getticket/
21 | * @param {Object} opts
22 | * @param {String} [opts.ticketnum] Obtain the ticket for the specific Client Ticket Number
23 | * @param {Number} [opts.ticketid] Obtain the ticket for the specific ticket id (Either $ticketnum or $ticketid is required)
24 | * @param {String} [opts.repliessort] ASC or DESC. Which order to organise the ticket replies
25 | */
26 | getTicket (opts) {
27 | const options = {
28 | action: 'GetTicket',
29 | ...opts
30 | }
31 | return this.callApi(options)
32 | }
33 | /**
34 | * Get the support statuses and number of tickets in each status - https://developers.whmcs.com/api-reference/getsupportstatuses/
35 | * @param {Object} opts
36 | * @param {Number} [opts.deptid] Obtain counts for a specific department id
37 | */
38 | getSupportStatuses (opts) {
39 | const options = {
40 | action: 'GetSupportStatuses',
41 | ...opts
42 | }
43 | return this.callApi(options)
44 | }
45 | /**
46 | * Obtain a specific ticket notes - https://developers.whmcs.com/api-reference/getticketnotes/
47 | * @param {Object} opts
48 | * @param {Number} opts.ticketid Obtain the ticket for the specific ticket id
49 | */
50 | getTicketNotes (opts) {
51 | const options = {
52 | action: 'GetTicketNotes',
53 | ...opts
54 | }
55 | return this.callApi(options)
56 | }
57 | /**
58 | * Get ticket counts. - https://developers.whmcs.com/api-reference/getticketcounts/
59 | * @param {Object} opts
60 | * @param {Boolean} [opts.ignoreDepartmentAssignments] Pass as true to not adhere to the departments the API user is a member of.
61 | * @param {Boolean} [opts.includeCountsByStatus] Pass as true to not adhere to the departments the API user is a member of.
62 | */
63 | getTicketCounts (opts) {
64 | const options = {
65 | action: 'GetTicketCounts',
66 | ...opts
67 | }
68 | return this.callApi(options)
69 | }
70 | /**
71 | * Obtain the Predefined Ticket Reply Categories - https://developers.whmcs.com/api-reference/getticketpredefinedcats/
72 | * @param {Object} opts
73 | */
74 | getTicketPredefinedCats (opts) {
75 | const options = {
76 | action: 'GetTicketPredefinedCats',
77 | ...opts
78 | }
79 | return this.callApi(options)
80 | }
81 | /**
82 | * Get the support departments and associated ticket counts - https://developers.whmcs.com/api-reference/getsupportdepartments/
83 | * @param {Object} opts
84 | * @param {Boolean} [opts.ignore_dept_assignments] Pass as true to not adhere to the departments the API user is a member of.
85 | */
86 | getSupportDepartments (opts) {
87 | const options = {
88 | action: 'GetSupportDepartments',
89 | ...opts
90 | }
91 | return this.callApi(options)
92 | }
93 | /**
94 | * Obtain the Predefined Ticket Replies - https://developers.whmcs.com/api-reference/getticketpredefinedreplies/
95 | * @param {Object} opts
96 | * @param {Number} [opts.catid] Obtain predefined replies for a specific category id
97 | */
98 | getTicketPredefinedReplies (opts) {
99 | const options = {
100 | action: 'GetTicketPredefinedReplies',
101 | ...opts
102 | }
103 | return this.callApi(options)
104 | }
105 | /**
106 | * Obtain tickets matching the passed criteria - https://developers.whmcs.com/api-reference/gettickets/
107 | * @param {Object} opts
108 | * @param {Number} [opts.limitstart] The offset for the returned quote data (default: 0)
109 | * @param {Number} [opts.limitnum] The number of records to return (default: 25)
110 | * @param {Number} [opts.deptid] Obtain tickets in a specific department
111 | * @param {Number} [opts.clientid] Find tickets for a specific client id
112 | * @param {String} [opts.email] Find tickets for a specific non-client email address
113 | * @param {String} [opts.status] Find tickets matching a specific status. Any configured status plus: Awaiting Reply, All Active Tickets, My Flagged Tickets
114 | * @param {String} [opts.subject] Find tickets containing a specific subject - uses approximate string matching.
115 | * @param {Boolean} [opts.ignore_dept_assignments] Pass as true to not adhere to the departments the API user is a member of.
116 | */
117 | getTickets (opts) {
118 | const options = {
119 | action: 'GetTickets',
120 | ...opts
121 | }
122 | return this.callApi(options)
123 | }
124 | }
125 |
126 | module.exports = Tickets
127 |
--------------------------------------------------------------------------------
/package-lock.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "whmcs-js",
3 | "version": "2.0.0",
4 | "lockfileVersion": 1,
5 | "requires": true,
6 | "dependencies": {
7 | "node-fetch": {
8 | "version": "2.3.0",
9 | "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.3.0.tgz",
10 | "integrity": "sha512-MOd8pV3fxENbryESLgVIeaGKrdl+uaYhCSSVkjeOb/31/njTpcis5aWfdqgNlHIrKOLRbMnfPINPOML2CIFeXA=="
11 | }
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "whmcs-js",
3 | "description": "WHMCS API JavaScript Client",
4 | "version": "2.0.1",
5 | "author": "Víctor Campos ",
6 | "maintainers": [
7 | "DamageESP "
8 | ],
9 | "contributors": [
10 | "Víctor Campos "
11 | ],
12 | "repository": {
13 | "type": "git",
14 | "url": "https://github.com/DamageESP/whmcs-js.git"
15 | },
16 | "keywords": [
17 | "whmcs",
18 | "hosting",
19 | "js"
20 | ],
21 | "dependencies": {
22 | "node-fetch": "^2.3.0"
23 | },
24 | "main": "./index"
25 | }
26 |
--------------------------------------------------------------------------------
/whmcs.js:
--------------------------------------------------------------------------------
1 | /**
2 | * WHMCS client
3 | * @param options {{username:[String], serverUrl:String, password:[String], secret:[String], identifier:[String]}}
4 | */
5 | class WHMCS {
6 | constructor ({ serverUrl, ...credentials }) {
7 | this.serverUrl = serverUrl
8 | this.credentials = credentials
9 | }
10 |
11 | callApi (options) {
12 | const fetch = require('node-fetch')
13 |
14 | const data = {
15 | ...this.credentials,
16 | ...options,
17 | responsetype: 'json'
18 | }
19 |
20 | // Convert from JS Object to URLSearchParams
21 | const params = new URLSearchParams()
22 | for (let key in data) {
23 | params.append(key, data[key])
24 | }
25 |
26 | return fetch(this.serverUrl, {
27 | method: 'POST',
28 | body: params
29 | }).then(r => r.json())
30 | }
31 | }
32 |
33 | module.exports = WHMCS
34 |
--------------------------------------------------------------------------------