Skip to content

Commit 2ae5cf5

Browse files
committed
feat: Add GetClients API endpoint and related models
- Implemented the GetClients API endpoint in the OpenAPI specification. - Created models for GetClientsResponse, GetClientsResponseAllOfClients, and ClientInfo. - Added example usage for the new models in the documentation. - Updated the API client to include the new GetClients method. - Added unit tests for the new models and API functionality. - Bumped version to 1.0.8 in setup.py and pyproject.toml.
1 parent f136eee commit 2ae5cf5

21 files changed

+1216
-7
lines changed

.openapi-generator/FILES

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,10 @@
55
README.md
66
docs/AddClientResponse.md
77
docs/AddOrderResponse.md
8+
docs/ClientInfo.md
89
docs/DefaultApi.md
10+
docs/GetClientsResponse.md
11+
docs/GetClientsResponseAllOfClients.md
912
docs/UpdateClientResponse.md
1013
docs/WHMCSBaseResponse.md
1114
docs/WHMCSErrorResponse.md
@@ -28,6 +31,9 @@ whmcs_client/exceptions.py
2831
whmcs_client/models/__init__.py
2932
whmcs_client/models/add_client_response.py
3033
whmcs_client/models/add_order_response.py
34+
whmcs_client/models/client_info.py
35+
whmcs_client/models/get_clients_response.py
36+
whmcs_client/models/get_clients_response_all_of_clients.py
3137
whmcs_client/models/update_client_response.py
3238
whmcs_client/models/whmcs_base_response.py
3339
whmcs_client/models/whmcs_error_response.py

README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ each action as an independent path while routing all requests to the /api.php en
99
This Python package is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project:
1010

1111
- API version: 1.0.0
12-
- Package version: 1.0.7
12+
- Package version: 1.0.8
1313
- Generator version: 7.13.0
1414
- Build package: org.openapitools.codegen.languages.PythonClientCodegen
1515

@@ -120,13 +120,17 @@ Class | Method | HTTP request | Description
120120
------------ | ------------- | ------------- | -------------
121121
*DefaultApi* | [**add_client**](docs/DefaultApi.md#add_client) | **POST** /api.php?action=AddClient | Add a new client
122122
*DefaultApi* | [**add_order**](docs/DefaultApi.md#add_order) | **POST** /api.php?action=AddOrder | Create a new order
123+
*DefaultApi* | [**get_clients**](docs/DefaultApi.md#get_clients) | **POST** /api.php?action=GetClients | Get clients
123124
*DefaultApi* | [**update_client**](docs/DefaultApi.md#update_client) | **POST** /api.php?action=UpdateClient | Update client details
124125

125126

126127
## Documentation For Models
127128

128129
- [AddClientResponse](docs/AddClientResponse.md)
129130
- [AddOrderResponse](docs/AddOrderResponse.md)
131+
- [ClientInfo](docs/ClientInfo.md)
132+
- [GetClientsResponse](docs/GetClientsResponse.md)
133+
- [GetClientsResponseAllOfClients](docs/GetClientsResponseAllOfClients.md)
130134
- [UpdateClientResponse](docs/UpdateClientResponse.md)
131135
- [WHMCSBaseResponse](docs/WHMCSBaseResponse.md)
132136
- [WHMCSErrorResponse](docs/WHMCSErrorResponse.md)

config.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"packageName": "whmcs_client",
33
"projectName": "whmcs-api-client",
4-
"packageVersion": "1.0.7",
4+
"packageVersion": "1.0.8",
55
"packageUrl": "https://github.com/truehostcloud/whmcs-python-client",
66
"packageCompany": "Truehost",
77
"packageAuthor": "William Mwai",

docs/ClientInfo.md

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# ClientInfo
2+
3+
4+
## Properties
5+
6+
Name | Type | Description | Notes
7+
------------ | ------------- | ------------- | -------------
8+
**id** | **int** | The client ID | [optional]
9+
**firstname** | **str** | The client's first name | [optional]
10+
**lastname** | **str** | The client's last name | [optional]
11+
**companyname** | **str** | The client's company name | [optional]
12+
**email** | **str** | The client's email address | [optional]
13+
**datecreated** | **date** | The date the client was created | [optional]
14+
**groupid** | **int** | The client's group ID | [optional]
15+
**status** | **str** | The client's status (Active, Inactive, Closed) | [optional]
16+
17+
## Example
18+
19+
```python
20+
from whmcs_client.models.client_info import ClientInfo
21+
22+
# TODO update the JSON string below
23+
json = "{}"
24+
# create an instance of ClientInfo from a JSON string
25+
client_info_instance = ClientInfo.from_json(json)
26+
# print the JSON string representation of the object
27+
print(ClientInfo.to_json())
28+
29+
# convert the object into a dict
30+
client_info_dict = client_info_instance.to_dict()
31+
# create an instance of ClientInfo from a dict
32+
client_info_from_dict = ClientInfo.from_dict(client_info_dict)
33+
```
34+
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
35+
36+

docs/DefaultApi.md

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ Method | HTTP request | Description
66
------------- | ------------- | -------------
77
[**add_client**](DefaultApi.md#add_client) | **POST** /api.php?action=AddClient | Add a new client
88
[**add_order**](DefaultApi.md#add_order) | **POST** /api.php?action=AddOrder | Create a new order
9+
[**get_clients**](DefaultApi.md#get_clients) | **POST** /api.php?action=GetClients | Get clients
910
[**update_client**](DefaultApi.md#update_client) | **POST** /api.php?action=UpdateClient | Update client details
1011

1112

@@ -299,6 +300,93 @@ No authorization required
299300

300301
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
301302

303+
# **get_clients**
304+
> GetClientsResponse get_clients(username, password, accesskey=accesskey, responsetype=responsetype, limitstart=limitstart, limitnum=limitnum, sorting=sorting, status=status, search=search, orderby=orderby)
305+
306+
Get clients
307+
308+
Obtain the clients that match passed criteria
309+
310+
### Example
311+
312+
313+
```python
314+
import whmcs_client
315+
from whmcs_client.models.get_clients_response import GetClientsResponse
316+
from whmcs_client.rest import ApiException
317+
from pprint import pprint
318+
319+
# Defining the host is optional and defaults to https://your-whmcs-instance.com/includes
320+
# See configuration.py for a list of all supported configuration parameters.
321+
configuration = whmcs_client.Configuration(
322+
host = "https://your-whmcs-instance.com/includes"
323+
)
324+
325+
326+
# Enter a context with an instance of the API client
327+
with whmcs_client.ApiClient(configuration) as api_client:
328+
# Create an instance of the API class
329+
api_instance = whmcs_client.DefaultApi(api_client)
330+
username = 'username_example' # str | Admin username/API identifier
331+
password = 'password_example' # str | Admin password/API secret
332+
accesskey = 'accesskey_example' # str | Optional API access key (optional)
333+
responsetype = json # str | Response format (optional) (default to json)
334+
limitstart = 0 # int | The offset for the returned log data (optional) (default to 0)
335+
limitnum = 25 # int | The number of records to return (optional) (default to 25)
336+
sorting = ASC # str | The direction to sort the results. ASC or DESC. (optional) (default to ASC)
337+
status = 'status_example' # str | Optional desired Client Status. 'Active', 'Inactive', or 'Closed'. (optional)
338+
search = 'search_example' # str | The search term to look for at the start of email, firstname, lastname, fullname or companyname (optional)
339+
orderby = 'orderby_example' # str | The column to order by. id, firstname, lastname, companyname, email, groupid, datecreated, status (optional)
340+
341+
try:
342+
# Get clients
343+
api_response = api_instance.get_clients(username, password, accesskey=accesskey, responsetype=responsetype, limitstart=limitstart, limitnum=limitnum, sorting=sorting, status=status, search=search, orderby=orderby)
344+
print("The response of DefaultApi->get_clients:\n")
345+
pprint(api_response)
346+
except Exception as e:
347+
print("Exception when calling DefaultApi->get_clients: %s\n" % e)
348+
```
349+
350+
351+
352+
### Parameters
353+
354+
355+
Name | Type | Description | Notes
356+
------------- | ------------- | ------------- | -------------
357+
**username** | **str**| Admin username/API identifier |
358+
**password** | **str**| Admin password/API secret |
359+
**accesskey** | **str**| Optional API access key | [optional]
360+
**responsetype** | **str**| Response format | [optional] [default to json]
361+
**limitstart** | **int**| The offset for the returned log data | [optional] [default to 0]
362+
**limitnum** | **int**| The number of records to return | [optional] [default to 25]
363+
**sorting** | **str**| The direction to sort the results. ASC or DESC. | [optional] [default to ASC]
364+
**status** | **str**| Optional desired Client Status. 'Active', 'Inactive', or 'Closed'. | [optional]
365+
**search** | **str**| The search term to look for at the start of email, firstname, lastname, fullname or companyname | [optional]
366+
**orderby** | **str**| The column to order by. id, firstname, lastname, companyname, email, groupid, datecreated, status | [optional]
367+
368+
### Return type
369+
370+
[**GetClientsResponse**](GetClientsResponse.md)
371+
372+
### Authorization
373+
374+
No authorization required
375+
376+
### HTTP request headers
377+
378+
- **Content-Type**: application/x-www-form-urlencoded
379+
- **Accept**: application/json
380+
381+
### HTTP response details
382+
383+
| Status code | Description | Response headers |
384+
|-------------|-------------|------------------|
385+
**200** | Clients retrieved successfully | - |
386+
**0** | Error response | - |
387+
388+
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
389+
302390
# **update_client**
303391
> UpdateClientResponse update_client(username, password, clientid, accesskey=accesskey, responsetype=responsetype, clientemail=clientemail, firstname=firstname, lastname=lastname, companyname=companyname, email=email, address1=address1, address2=address2, city=city, state=state, postcode=postcode, country=country, phonenumber=phonenumber, tax_id=tax_id, password2=password2, securityqid=securityqid, securityqans=securityqans, currency=currency, groupid=groupid, customfields=customfields, language=language, clientip=clientip, notes=notes, status=status, paymentmethod=paymentmethod, email_preferences_general=email_preferences_general, email_preferences_product=email_preferences_product, email_preferences_domain=email_preferences_domain, email_preferences_invoice=email_preferences_invoice, email_preferences_support=email_preferences_support, email_preferences_affiliate=email_preferences_affiliate, clearcreditcard=clearcreditcard, latefeeoveride=latefeeoveride, overideduenotices=overideduenotices, taxexempt=taxexempt, separateinvoices=separateinvoices, disableautocc=disableautocc, overrideautoclose=overrideautoclose)
304392

docs/GetClientsResponse.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# GetClientsResponse
2+
3+
4+
## Properties
5+
6+
Name | Type | Description | Notes
7+
------------ | ------------- | ------------- | -------------
8+
**result** | **str** | | [optional]
9+
**message** | **str** | Response message | [optional]
10+
**totalresults** | **int** | The total number of results available | [optional]
11+
**startnumber** | **int** | The starting number for the returned results | [optional]
12+
**numreturned** | **int** | The number of results returned | [optional]
13+
**clients** | [**GetClientsResponseAllOfClients**](GetClientsResponseAllOfClients.md) | | [optional]
14+
15+
## Example
16+
17+
```python
18+
from whmcs_client.models.get_clients_response import GetClientsResponse
19+
20+
# TODO update the JSON string below
21+
json = "{}"
22+
# create an instance of GetClientsResponse from a JSON string
23+
get_clients_response_instance = GetClientsResponse.from_json(json)
24+
# print the JSON string representation of the object
25+
print(GetClientsResponse.to_json())
26+
27+
# convert the object into a dict
28+
get_clients_response_dict = get_clients_response_instance.to_dict()
29+
# create an instance of GetClientsResponse from a dict
30+
get_clients_response_from_dict = GetClientsResponse.from_dict(get_clients_response_dict)
31+
```
32+
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
33+
34+
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# GetClientsResponseAllOfClients
2+
3+
4+
## Properties
5+
6+
Name | Type | Description | Notes
7+
------------ | ------------- | ------------- | -------------
8+
**client** | [**List[ClientInfo]**](ClientInfo.md) | Array of client information | [optional]
9+
10+
## Example
11+
12+
```python
13+
from whmcs_client.models.get_clients_response_all_of_clients import GetClientsResponseAllOfClients
14+
15+
# TODO update the JSON string below
16+
json = "{}"
17+
# create an instance of GetClientsResponseAllOfClients from a JSON string
18+
get_clients_response_all_of_clients_instance = GetClientsResponseAllOfClients.from_json(json)
19+
# print the JSON string representation of the object
20+
print(GetClientsResponseAllOfClients.to_json())
21+
22+
# convert the object into a dict
23+
get_clients_response_all_of_clients_dict = get_clients_response_all_of_clients_instance.to_dict()
24+
# create an instance of GetClientsResponseAllOfClients from a dict
25+
get_clients_response_all_of_clients_from_dict = GetClientsResponseAllOfClients.from_dict(get_clients_response_all_of_clients_dict)
26+
```
27+
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
28+
29+

openapi.yaml

Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,29 @@ paths:
8383
default:
8484
$ref: '#/components/responses/Error'
8585

86+
/api.php?action=GetClients:
87+
post:
88+
summary: Get clients
89+
description: Obtain the clients that match passed criteria
90+
operationId: getClients
91+
requestBody:
92+
required: true
93+
content:
94+
application/x-www-form-urlencoded:
95+
schema:
96+
allOf:
97+
- $ref: '#/components/schemas/WHMCSBaseRequest'
98+
- $ref: '#/components/schemas/GetClientsRequest'
99+
responses:
100+
'200':
101+
description: Clients retrieved successfully
102+
content:
103+
application/json:
104+
schema:
105+
$ref: '#/components/schemas/GetClientsResponse'
106+
default:
107+
$ref: '#/components/responses/Error'
108+
86109
components:
87110
schemas:
88111
WHMCSBaseRequest:
@@ -518,6 +541,34 @@ components:
518541
type: integer
519542
description: Array of service addon IDs to be on-demand renewed
520543

544+
GetClientsRequest:
545+
type: object
546+
properties:
547+
limitstart:
548+
type: integer
549+
description: The offset for the returned log data
550+
default: 0
551+
limitnum:
552+
type: integer
553+
description: The number of records to return
554+
default: 25
555+
sorting:
556+
type: string
557+
enum: [ASC, DESC]
558+
default: ASC
559+
description: The direction to sort the results. ASC or DESC.
560+
status:
561+
type: string
562+
enum: [Active, Inactive, Closed]
563+
description: Optional desired Client Status. 'Active', 'Inactive', or 'Closed'.
564+
search:
565+
type: string
566+
description: The search term to look for at the start of email, firstname, lastname, fullname or companyname
567+
orderby:
568+
type: string
569+
enum: [id, firstname, lastname, companyname, email, groupid, datecreated, status]
570+
description: The column to order by. id, firstname, lastname, companyname, email, groupid, datecreated, status
571+
521572
WHMCSBaseResponse:
522573
type: object
523574
properties:
@@ -594,6 +645,58 @@ components:
594645
type: string
595646
description: The invoice ID if an invoice was generated
596647

648+
GetClientsResponse:
649+
allOf:
650+
- $ref: '#/components/schemas/WHMCSSuccessResponse'
651+
- type: object
652+
properties:
653+
totalresults:
654+
type: integer
655+
description: The total number of results available
656+
startnumber:
657+
type: integer
658+
description: The starting number for the returned results
659+
numreturned:
660+
type: integer
661+
description: The number of results returned
662+
clients:
663+
type: object
664+
properties:
665+
client:
666+
type: array
667+
items:
668+
$ref: '#/components/schemas/ClientInfo'
669+
description: Array of client information
670+
671+
ClientInfo:
672+
type: object
673+
properties:
674+
id:
675+
type: integer
676+
description: The client ID
677+
firstname:
678+
type: string
679+
description: The client's first name
680+
lastname:
681+
type: string
682+
description: The client's last name
683+
companyname:
684+
type: string
685+
description: The client's company name
686+
email:
687+
type: string
688+
description: The client's email address
689+
datecreated:
690+
type: string
691+
format: date
692+
description: The date the client was created
693+
groupid:
694+
type: integer
695+
description: The client's group ID
696+
status:
697+
type: string
698+
description: The client's status (Active, Inactive, Closed)
699+
597700
responses:
598701
Error:
599702
description: Error response

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "whmcs_client"
3-
version = "1.0.7"
3+
version = "1.0.8"
44
description = "WHMCS API"
55
authors = ["OpenAPI Generator Community <team@openapitools.org>"]
66
license = "NoLicense"

0 commit comments

Comments
 (0)