Skip to content

Commit 86c249f

Browse files
committed
Add WHMCS API client models and refactor REST client implementation
- Introduced WHMCSBaseRequest model for API request handling. - Created WHMCSBaseResponse, WHMCSErrorResponse, and WHMCSSuccessResponse models for structured API responses. - Refactored REST client to support query parameters and improved error handling. - Removed deprecated py.typed file. - Updated documentation and comments for clarity.
1 parent ec57bc2 commit 86c249f

67 files changed

Lines changed: 9512 additions & 5466 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitignore

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,7 @@ coverage.xml
4545
*,cover
4646
.hypothesis/
4747
venv/
48-
.venv/
4948
.python-version
50-
.pytest_cache
5149

5250
# Translations
5351
*.mo

.gitlab-ci.yml

Lines changed: 0 additions & 31 deletions
This file was deleted.

.openapi-generator/FILES

Lines changed: 0 additions & 44 deletions
This file was deleted.

.openapi-generator/VERSION

Lines changed: 0 additions & 1 deletion
This file was deleted.
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
# OpenAPI Generator Ignore
2-
# Generated by openapi-generator https://github.com/openapitools/openapi-generator
1+
# Swagger Codegen Ignore
2+
# Generated by swagger-codegen https://github.com/swagger-api/swagger-codegen
33

44
# Use this file to prevent files from being overwritten by the generator.
55
# The patterns follow closely to .gitignore or .dockerignore.
66

77
# As an example, the C# client generator defines ApiClient.cs.
8-
# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line:
8+
# You can make changes and tell Swagger Codgen to ignore just this file by uncommenting the following line:
99
#ApiClient.cs
1010

1111
# You can match any string of characters against a directory, file or extension with a single asterisk (*):

.swagger-codegen/VERSION

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
3.0.68

.travis.yml

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,13 @@
11
# ref: https://docs.travis-ci.com/user/languages/python
22
language: python
33
python:
4-
- "3.9"
5-
- "3.10"
6-
- "3.11"
7-
- "3.12"
8-
- "3.13"
9-
# uncomment the following if needed
10-
#- "3.13-dev" # 3.13 development branch
11-
#- "nightly" # nightly build
4+
- "3.2"
5+
- "3.3"
6+
- "3.4"
7+
- "3.5"
8+
#- "3.5-dev" # 3.5 development branch
9+
#- "nightly" # points to the latest development branch e.g. 3.6-dev
1210
# command to install dependencies
13-
install:
14-
- "pip install -r requirements.txt"
15-
- "pip install -r test-requirements.txt"
11+
install: "pip install -r requirements.txt"
1612
# command to run tests
17-
script: pytest --cov=whmcs_client
13+
script: nosetests

README.md

Lines changed: 47 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,20 @@
1-
# whmcs-client
2-
Python client for the WHMCS API.
1+
# whmcs-api-client
2+
Python client for the WHMCS API. WHMCS (Web Host Manager Complete Solution) provides a single API endpoint that handles multiple operations through different 'action' parameters. This specification presents each action as an independent path while routing all requests to the /api.php endpoint.
33

4-
WHMCS (Web Host Manager Complete Solution) provides a single API endpoint that handles
5-
multiple operations through different 'action' parameters. This specification presents
6-
each action as an independent path while routing all requests to the /api.php endpoint.
7-
8-
9-
This Python package is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project:
4+
This Python package is automatically generated by the [Swagger Codegen](https://github.com/swagger-api/swagger-codegen) project:
105

116
- API version: 1.0.0
12-
- Package version: 1.0.0
13-
- Generator version: 7.13.0
14-
- Build package: org.openapitools.codegen.languages.PythonClientCodegen
7+
- Package version: 1.0.4
8+
- Build package: io.swagger.codegen.v3.generators.python.PythonClientCodegen
159

1610
## Requirements.
1711

18-
Python 3.9+
12+
Python 2.7 and 3.4+
1913

2014
## Installation & Usage
2115
### pip install
2216

23-
If the python package is hosted on a repository, you can install directly using:
17+
If the python package is hosted on Github, you can install directly from Github
2418

2519
```sh
2620
pip install git+https://github.com/GIT_USER_ID/GIT_REPO_ID.git
@@ -29,7 +23,7 @@ pip install git+https://github.com/GIT_USER_ID/GIT_REPO_ID.git
2923

3024
Then import the package:
3125
```python
32-
import whmcs_client
26+
import whmcs_client
3327
```
3428

3529
### Setuptools
@@ -46,71 +40,46 @@ Then import the package:
4640
import whmcs_client
4741
```
4842

49-
### Tests
50-
51-
Execute `pytest` to run the tests.
52-
5343
## Getting Started
5444

5545
Please follow the [installation procedure](#installation--usage) and then run the following:
5646

5747
```python
58-
48+
from __future__ import print_function
49+
import time
5950
import whmcs_client
6051
from whmcs_client.rest import ApiException
6152
from pprint import pprint
6253

63-
# Defining the host is optional and defaults to https://your-whmcs-instance.com/includes
64-
# See configuration.py for a list of all supported configuration parameters.
65-
configuration = whmcs_client.Configuration(
66-
host = "https://your-whmcs-instance.com/includes"
67-
)
68-
69-
70-
71-
# Enter a context with an instance of the API client
72-
with whmcs_client.ApiClient(configuration) as api_client:
73-
# Create an instance of the API class
74-
api_instance = whmcs_client.DefaultApi(api_client)
75-
username = 'username_example' # str | Admin username/API identifier
76-
password = 'password_example' # str | Admin password/API secret
77-
action = AddClient # str | Must be 'AddClient' (default to AddClient)
78-
firstname = 'firstname_example' # str | First name of the client
79-
lastname = 'lastname_example' # str | Last name of the client
80-
email = 'email_example' # str | Email address of the client
81-
address1 = 'address1_example' # str | Address line 1
82-
city = 'city_example' # str | City
83-
state = 'state_example' # str | State
84-
postcode = 'postcode_example' # str | Postal code
85-
country = 'country_example' # str | 2 character ISO country code
86-
phonenumber = 'phonenumber_example' # str | Phone number
87-
accesskey = 'accesskey_example' # str | Optional API access key (optional)
88-
responsetype = json # str | Response format (optional) (default to json)
89-
owner_user_id = 56 # int | The ID of the user that should own the client (optional)
90-
companyname = 'companyname_example' # str | Company name (optional)
91-
address2 = 'address2_example' # str | Address line 2 (optional)
92-
tax_id = 'tax_id_example' # str | Client's tax ID (optional)
93-
password2 = 'password2_example' # str | Password for the new user account (optional)
94-
securityqid = 56 # int | Security question ID (optional)
95-
securityqans = 'securityqans_example' # str | Security question answer (optional)
96-
currency = 56 # int | Currency ID (optional)
97-
groupid = 56 # int | Client group ID (optional)
98-
customfields = 'customfields_example' # str | Base64 encoded serialized array of custom field values (optional)
99-
language = 'language_example' # str | Default language setting (optional)
100-
clientip = 'clientip_example' # str | Originating IP address (optional)
101-
notes = 'notes_example' # str | Admin only notes (optional)
102-
marketingoptin = True # bool | Opt-in to marketing emails (optional)
103-
noemail = True # bool | Set to true to suppress the Order Confirmation email being sent (optional)
104-
skipvalidation = True # bool | Ignore required field validation (optional)
105-
106-
try:
107-
# Add a new client
108-
api_response = api_instance.add_client(username, password, action, firstname, lastname, email, address1, city, state, postcode, country, phonenumber, accesskey=accesskey, responsetype=responsetype, owner_user_id=owner_user_id, companyname=companyname, address2=address2, tax_id=tax_id, password2=password2, securityqid=securityqid, securityqans=securityqans, currency=currency, groupid=groupid, customfields=customfields, language=language, clientip=clientip, notes=notes, marketingoptin=marketingoptin, noemail=noemail, skipvalidation=skipvalidation)
109-
print("The response of DefaultApi->add_client:\n")
110-
pprint(api_response)
111-
except ApiException as e:
112-
print("Exception when calling DefaultApi->add_client: %s\n" % e)
113-
54+
# create an instance of the API class
55+
api_instance = whmcs_client.DefaultApi(whmcs_client.ApiClient(configuration))
56+
57+
try:
58+
# Add a new client
59+
api_response = api_instance.add_client()
60+
pprint(api_response)
61+
except ApiException as e:
62+
print("Exception when calling DefaultApi->add_client: %s\n" % e)
63+
64+
# create an instance of the API class
65+
api_instance = whmcs_client.DefaultApi(whmcs_client.ApiClient(configuration))
66+
67+
try:
68+
# Create a new order
69+
api_response = api_instance.add_order()
70+
pprint(api_response)
71+
except ApiException as e:
72+
print("Exception when calling DefaultApi->add_order: %s\n" % e)
73+
74+
# create an instance of the API class
75+
api_instance = whmcs_client.DefaultApi(whmcs_client.ApiClient(configuration))
76+
77+
try:
78+
# Update client details
79+
api_response = api_instance.update_client()
80+
pprint(api_response)
81+
except ApiException as e:
82+
print("Exception when calling DefaultApi->update_client: %s\n" % e)
11483
```
11584

11685
## Documentation for API Endpoints
@@ -123,25 +92,27 @@ Class | Method | HTTP request | Description
12392
*DefaultApi* | [**add_order**](docs/DefaultApi.md#add_order) | **POST** /AddOrder | Create a new order
12493
*DefaultApi* | [**update_client**](docs/DefaultApi.md#update_client) | **POST** /UpdateClient | Update client details
12594

126-
12795
## Documentation For Models
12896

97+
- [AddClientBody](docs/AddClientBody.md)
98+
- [AddClientRequest](docs/AddClientRequest.md)
12999
- [AddClientResponse](docs/AddClientResponse.md)
100+
- [AddOrderBody](docs/AddOrderBody.md)
101+
- [AddOrderRequest](docs/AddOrderRequest.md)
130102
- [AddOrderResponse](docs/AddOrderResponse.md)
103+
- [UpdateClientBody](docs/UpdateClientBody.md)
104+
- [UpdateClientRequest](docs/UpdateClientRequest.md)
131105
- [UpdateClientResponse](docs/UpdateClientResponse.md)
106+
- [WHMCSBaseRequest](docs/WHMCSBaseRequest.md)
132107
- [WHMCSBaseResponse](docs/WHMCSBaseResponse.md)
133108
- [WHMCSErrorResponse](docs/WHMCSErrorResponse.md)
134109
- [WHMCSSuccessResponse](docs/WHMCSSuccessResponse.md)
135110

136-
137-
<a id="documentation-for-authorization"></a>
138111
## Documentation For Authorization
139112

140-
Endpoints do not require authorization.
113+
All endpoints do not require authorization.
141114

142115

143116
## Author
144117

145118

146-
147-

docs/AddClientBody.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# AddClientBody
2+
3+
## Properties
4+
Name | Type | Description | Notes
5+
------------ | ------------- | ------------- | -------------
6+
**action** | **str** | Must be &#x27;AddClient&#x27; | [default to 'AddClient']
7+
**owner_user_id** | **int** | The ID of the user that should own the client | [optional]
8+
**firstname** | **str** | First name of the client |
9+
**lastname** | **str** | Last name of the client |
10+
**companyname** | **str** | Company name | [optional]
11+
**email** | **str** | Email address of the client |
12+
**address1** | **str** | Address line 1 |
13+
**address2** | **str** | Address line 2 | [optional]
14+
**city** | **str** | City |
15+
**state** | **str** | State |
16+
**postcode** | **str** | Postal code |
17+
**country** | **str** | 2 character ISO country code |
18+
**phonenumber** | **str** | Phone number |
19+
**tax_id** | **str** | Client&#x27;s tax ID | [optional]
20+
**password2** | **str** | Password for the new user account | [optional]
21+
**securityqid** | **int** | Security question ID | [optional]
22+
**securityqans** | **str** | Security question answer | [optional]
23+
**currency** | **int** | Currency ID | [optional]
24+
**groupid** | **int** | Client group ID | [optional]
25+
**customfields** | **str** | Base64 encoded serialized array of custom field values | [optional]
26+
**language** | **str** | Default language setting | [optional]
27+
**clientip** | **str** | Originating IP address | [optional]
28+
**notes** | **str** | Admin only notes | [optional]
29+
**marketingoptin** | **bool** | Opt-in to marketing emails | [optional]
30+
**noemail** | **bool** | Set to true to suppress the Order Confirmation email being sent | [optional]
31+
**skipvalidation** | **bool** | Ignore required field validation | [optional]
32+
33+
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
34+

docs/AddClientRequest.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# AddClientRequest
2+
3+
## Properties
4+
Name | Type | Description | Notes
5+
------------ | ------------- | ------------- | -------------
6+
**action** | **str** | Must be &#x27;AddClient&#x27; | [default to 'AddClient']
7+
**owner_user_id** | **int** | The ID of the user that should own the client | [optional]
8+
**firstname** | **str** | First name of the client |
9+
**lastname** | **str** | Last name of the client |
10+
**companyname** | **str** | Company name | [optional]
11+
**email** | **str** | Email address of the client |
12+
**address1** | **str** | Address line 1 |
13+
**address2** | **str** | Address line 2 | [optional]
14+
**city** | **str** | City |
15+
**state** | **str** | State |
16+
**postcode** | **str** | Postal code |
17+
**country** | **str** | 2 character ISO country code |
18+
**phonenumber** | **str** | Phone number |
19+
**tax_id** | **str** | Client&#x27;s tax ID | [optional]
20+
**password2** | **str** | Password for the new user account | [optional]
21+
**securityqid** | **int** | Security question ID | [optional]
22+
**securityqans** | **str** | Security question answer | [optional]
23+
**currency** | **int** | Currency ID | [optional]
24+
**groupid** | **int** | Client group ID | [optional]
25+
**customfields** | **str** | Base64 encoded serialized array of custom field values | [optional]
26+
**language** | **str** | Default language setting | [optional]
27+
**clientip** | **str** | Originating IP address | [optional]
28+
**notes** | **str** | Admin only notes | [optional]
29+
**marketingoptin** | **bool** | Opt-in to marketing emails | [optional]
30+
**noemail** | **bool** | Set to true to suppress the Order Confirmation email being sent | [optional]
31+
**skipvalidation** | **bool** | Ignore required field validation | [optional]
32+
33+
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
34+

0 commit comments

Comments
 (0)