Skip to content

Commit 7600622

Browse files
committed
feat: Update package version to 1.0.9 and add currency-related API functionality
- Updated package version in config.json, pyproject.toml, setup.py, and __init__.py to 1.0.9. - Added CurrencyInfo model to represent currency details. - Introduced GetCurrenciesResponse and GetCurrenciesResponseAllOfCurrencies models for handling currency API responses. - Implemented get_currencies API endpoint in DefaultApi to retrieve configured currencies. - Added documentation for the new currency models and API endpoint. - Created unit tests for CurrencyInfo, GetCurrenciesResponse, and GetCurrenciesResponseAllOfCurrencies models. - Updated openapi.yaml to include new endpoint and response schemas.
1 parent 2ae5cf5 commit 7600622

21 files changed

+1053
-7
lines changed

.openapi-generator/FILES

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,12 @@ README.md
66
docs/AddClientResponse.md
77
docs/AddOrderResponse.md
88
docs/ClientInfo.md
9+
docs/CurrencyInfo.md
910
docs/DefaultApi.md
1011
docs/GetClientsResponse.md
1112
docs/GetClientsResponseAllOfClients.md
13+
docs/GetCurrenciesResponse.md
14+
docs/GetCurrenciesResponseAllOfCurrencies.md
1215
docs/UpdateClientResponse.md
1316
docs/WHMCSBaseResponse.md
1417
docs/WHMCSErrorResponse.md
@@ -20,6 +23,9 @@ setup.cfg
2023
setup.py
2124
test-requirements.txt
2225
test/__init__.py
26+
test/test_currency_info.py
27+
test/test_get_currencies_response.py
28+
test/test_get_currencies_response_all_of_currencies.py
2329
tox.ini
2430
whmcs_client/__init__.py
2531
whmcs_client/api/__init__.py
@@ -32,8 +38,11 @@ whmcs_client/models/__init__.py
3238
whmcs_client/models/add_client_response.py
3339
whmcs_client/models/add_order_response.py
3440
whmcs_client/models/client_info.py
41+
whmcs_client/models/currency_info.py
3542
whmcs_client/models/get_clients_response.py
3643
whmcs_client/models/get_clients_response_all_of_clients.py
44+
whmcs_client/models/get_currencies_response.py
45+
whmcs_client/models/get_currencies_response_all_of_currencies.py
3746
whmcs_client/models/update_client_response.py
3847
whmcs_client/models/whmcs_base_response.py
3948
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.8
12+
- Package version: 1.0.9
1313
- Generator version: 7.13.0
1414
- Build package: org.openapitools.codegen.languages.PythonClientCodegen
1515

@@ -121,6 +121,7 @@ Class | Method | HTTP request | Description
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
123123
*DefaultApi* | [**get_clients**](docs/DefaultApi.md#get_clients) | **POST** /api.php?action=GetClients | Get clients
124+
*DefaultApi* | [**get_currencies**](docs/DefaultApi.md#get_currencies) | **POST** /api.php?action=GetCurrencies | Get currencies
124125
*DefaultApi* | [**update_client**](docs/DefaultApi.md#update_client) | **POST** /api.php?action=UpdateClient | Update client details
125126

126127

@@ -129,8 +130,11 @@ Class | Method | HTTP request | Description
129130
- [AddClientResponse](docs/AddClientResponse.md)
130131
- [AddOrderResponse](docs/AddOrderResponse.md)
131132
- [ClientInfo](docs/ClientInfo.md)
133+
- [CurrencyInfo](docs/CurrencyInfo.md)
132134
- [GetClientsResponse](docs/GetClientsResponse.md)
133135
- [GetClientsResponseAllOfClients](docs/GetClientsResponseAllOfClients.md)
136+
- [GetCurrenciesResponse](docs/GetCurrenciesResponse.md)
137+
- [GetCurrenciesResponseAllOfCurrencies](docs/GetCurrenciesResponseAllOfCurrencies.md)
134138
- [UpdateClientResponse](docs/UpdateClientResponse.md)
135139
- [WHMCSBaseResponse](docs/WHMCSBaseResponse.md)
136140
- [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.8",
4+
"packageVersion": "1.0.9",
55
"packageUrl": "https://github.com/truehostcloud/whmcs-python-client",
66
"packageCompany": "Truehost",
77
"packageAuthor": "William Mwai",

docs/CurrencyInfo.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# CurrencyInfo
2+
3+
4+
## Properties
5+
6+
Name | Type | Description | Notes
7+
------------ | ------------- | ------------- | -------------
8+
**id** | **int** | The currency ID | [optional]
9+
**code** | **str** | The currency code (e.g., USD, EUR, GBP) | [optional]
10+
**prefix** | **str** | The currency prefix symbol (e.g., $, €, £) | [optional]
11+
**suffix** | **str** | The currency suffix (e.g., \" USD\") | [optional]
12+
**format** | **int** | The currency format setting | [optional]
13+
**rate** | **str** | The currency exchange rate | [optional]
14+
15+
## Example
16+
17+
```python
18+
from whmcs_client.models.currency_info import CurrencyInfo
19+
20+
# TODO update the JSON string below
21+
json = "{}"
22+
# create an instance of CurrencyInfo from a JSON string
23+
currency_info_instance = CurrencyInfo.from_json(json)
24+
# print the JSON string representation of the object
25+
print(CurrencyInfo.to_json())
26+
27+
# convert the object into a dict
28+
currency_info_dict = currency_info_instance.to_dict()
29+
# create an instance of CurrencyInfo from a dict
30+
currency_info_from_dict = CurrencyInfo.from_dict(currency_info_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+

docs/DefaultApi.md

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ Method | HTTP request | Description
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
99
[**get_clients**](DefaultApi.md#get_clients) | **POST** /api.php?action=GetClients | Get clients
10+
[**get_currencies**](DefaultApi.md#get_currencies) | **POST** /api.php?action=GetCurrencies | Get currencies
1011
[**update_client**](DefaultApi.md#update_client) | **POST** /api.php?action=UpdateClient | Update client details
1112

1213

@@ -387,6 +388,81 @@ No authorization required
387388

388389
[[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)
389390

391+
# **get_currencies**
392+
> GetCurrenciesResponse get_currencies(username, password, accesskey=accesskey, responsetype=responsetype)
393+
394+
Get currencies
395+
396+
Obtain the currencies configured in the system
397+
398+
### Example
399+
400+
401+
```python
402+
import whmcs_client
403+
from whmcs_client.models.get_currencies_response import GetCurrenciesResponse
404+
from whmcs_client.rest import ApiException
405+
from pprint import pprint
406+
407+
# Defining the host is optional and defaults to https://your-whmcs-instance.com/includes
408+
# See configuration.py for a list of all supported configuration parameters.
409+
configuration = whmcs_client.Configuration(
410+
host = "https://your-whmcs-instance.com/includes"
411+
)
412+
413+
414+
# Enter a context with an instance of the API client
415+
with whmcs_client.ApiClient(configuration) as api_client:
416+
# Create an instance of the API class
417+
api_instance = whmcs_client.DefaultApi(api_client)
418+
username = 'username_example' # str | Admin username/API identifier
419+
password = 'password_example' # str | Admin password/API secret
420+
accesskey = 'accesskey_example' # str | Optional API access key (optional)
421+
responsetype = json # str | Response format (optional) (default to json)
422+
423+
try:
424+
# Get currencies
425+
api_response = api_instance.get_currencies(username, password, accesskey=accesskey, responsetype=responsetype)
426+
print("The response of DefaultApi->get_currencies:\n")
427+
pprint(api_response)
428+
except Exception as e:
429+
print("Exception when calling DefaultApi->get_currencies: %s\n" % e)
430+
```
431+
432+
433+
434+
### Parameters
435+
436+
437+
Name | Type | Description | Notes
438+
------------- | ------------- | ------------- | -------------
439+
**username** | **str**| Admin username/API identifier |
440+
**password** | **str**| Admin password/API secret |
441+
**accesskey** | **str**| Optional API access key | [optional]
442+
**responsetype** | **str**| Response format | [optional] [default to json]
443+
444+
### Return type
445+
446+
[**GetCurrenciesResponse**](GetCurrenciesResponse.md)
447+
448+
### Authorization
449+
450+
No authorization required
451+
452+
### HTTP request headers
453+
454+
- **Content-Type**: application/x-www-form-urlencoded
455+
- **Accept**: application/json
456+
457+
### HTTP response details
458+
459+
| Status code | Description | Response headers |
460+
|-------------|-------------|------------------|
461+
**200** | Currencies retrieved successfully | - |
462+
**0** | Error response | - |
463+
464+
[[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)
465+
390466
# **update_client**
391467
> 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)
392468

docs/GetCurrenciesResponse.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# GetCurrenciesResponse
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 currencies available | [optional]
11+
**currencies** | [**GetCurrenciesResponseAllOfCurrencies**](GetCurrenciesResponseAllOfCurrencies.md) | | [optional]
12+
13+
## Example
14+
15+
```python
16+
from whmcs_client.models.get_currencies_response import GetCurrenciesResponse
17+
18+
# TODO update the JSON string below
19+
json = "{}"
20+
# create an instance of GetCurrenciesResponse from a JSON string
21+
get_currencies_response_instance = GetCurrenciesResponse.from_json(json)
22+
# print the JSON string representation of the object
23+
print(GetCurrenciesResponse.to_json())
24+
25+
# convert the object into a dict
26+
get_currencies_response_dict = get_currencies_response_instance.to_dict()
27+
# create an instance of GetCurrenciesResponse from a dict
28+
get_currencies_response_from_dict = GetCurrenciesResponse.from_dict(get_currencies_response_dict)
29+
```
30+
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
31+
32+
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# GetCurrenciesResponseAllOfCurrencies
2+
3+
4+
## Properties
5+
6+
Name | Type | Description | Notes
7+
------------ | ------------- | ------------- | -------------
8+
**currency** | [**List[CurrencyInfo]**](CurrencyInfo.md) | Array of currency information | [optional]
9+
10+
## Example
11+
12+
```python
13+
from whmcs_client.models.get_currencies_response_all_of_currencies import GetCurrenciesResponseAllOfCurrencies
14+
15+
# TODO update the JSON string below
16+
json = "{}"
17+
# create an instance of GetCurrenciesResponseAllOfCurrencies from a JSON string
18+
get_currencies_response_all_of_currencies_instance = GetCurrenciesResponseAllOfCurrencies.from_json(json)
19+
# print the JSON string representation of the object
20+
print(GetCurrenciesResponseAllOfCurrencies.to_json())
21+
22+
# convert the object into a dict
23+
get_currencies_response_all_of_currencies_dict = get_currencies_response_all_of_currencies_instance.to_dict()
24+
# create an instance of GetCurrenciesResponseAllOfCurrencies from a dict
25+
get_currencies_response_all_of_currencies_from_dict = GetCurrenciesResponseAllOfCurrencies.from_dict(get_currencies_response_all_of_currencies_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: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,27 @@ paths:
106106
default:
107107
$ref: '#/components/responses/Error'
108108

109+
/api.php?action=GetCurrencies:
110+
post:
111+
summary: Get currencies
112+
description: Obtain the currencies configured in the system
113+
operationId: getCurrencies
114+
requestBody:
115+
required: true
116+
content:
117+
application/x-www-form-urlencoded:
118+
schema:
119+
$ref: '#/components/schemas/WHMCSBaseRequest'
120+
responses:
121+
'200':
122+
description: Currencies retrieved successfully
123+
content:
124+
application/json:
125+
schema:
126+
$ref: '#/components/schemas/GetCurrenciesResponse'
127+
default:
128+
$ref: '#/components/responses/Error'
129+
109130
components:
110131
schemas:
111132
WHMCSBaseRequest:
@@ -668,6 +689,23 @@ components:
668689
$ref: '#/components/schemas/ClientInfo'
669690
description: Array of client information
670691

692+
GetCurrenciesResponse:
693+
allOf:
694+
- $ref: '#/components/schemas/WHMCSSuccessResponse'
695+
- type: object
696+
properties:
697+
totalresults:
698+
type: integer
699+
description: The total number of currencies available
700+
currencies:
701+
type: object
702+
properties:
703+
currency:
704+
type: array
705+
items:
706+
$ref: '#/components/schemas/CurrencyInfo'
707+
description: Array of currency information
708+
671709
ClientInfo:
672710
type: object
673711
properties:
@@ -697,6 +735,28 @@ components:
697735
type: string
698736
description: The client's status (Active, Inactive, Closed)
699737

738+
CurrencyInfo:
739+
type: object
740+
properties:
741+
id:
742+
type: integer
743+
description: The currency ID
744+
code:
745+
type: string
746+
description: The currency code (e.g., USD, EUR, GBP)
747+
prefix:
748+
type: string
749+
description: The currency prefix symbol (e.g., $, €, £)
750+
suffix:
751+
type: string
752+
description: The currency suffix (e.g., " USD")
753+
format:
754+
type: integer
755+
description: The currency format setting
756+
rate:
757+
type: string
758+
description: The currency exchange rate
759+
700760
responses:
701761
Error:
702762
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.8"
3+
version = "1.0.9"
44
description = "WHMCS API"
55
authors = ["OpenAPI Generator Community <team@openapitools.org>"]
66
license = "NoLicense"

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
# prerequisite: setuptools
2222
# http://pypi.python.org/pypi/setuptools
2323
NAME = "whmcs-api-client"
24-
VERSION = "1.0.8"
24+
VERSION = "1.0.9"
2525
PYTHON_REQUIRES = ">= 3.9"
2626
REQUIRES = [
2727
"urllib3 >= 2.1.0, < 3.0.0",

0 commit comments

Comments
 (0)