Skip to content

Commit 59cc916

Browse files
committed
Update python SDK from OpenAPI Generator
1 parent 868d83d commit 59cc916

File tree

215 files changed

+26925
-659
lines changed

Some content is hidden

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

215 files changed

+26925
-659
lines changed

.github/workflows/python.yml

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
#
44
# ref: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python
55

6-
name: helloasso_python Python package
6+
name: helloasso-python Python package
77

88
on: [push, pull_request]
99

@@ -26,12 +26,6 @@ jobs:
2626
python -m pip install --upgrade pip
2727
pip install -r requirements.txt
2828
pip install -r test-requirements.txt
29-
- name: build
29+
- name: Test with pytest
3030
run: |
31-
pip install build
32-
python -m build
33-
- name: publish
34-
run: |
35-
pip install twine
36-
twine upload -u __token__ -p ${{ secrets.PYPI_TOKEN }} dist/*
37-
31+
pytest --cov=helloasso-python

.gitlab-ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ stages:
1212
script:
1313
- pip install -r requirements.txt
1414
- pip install -r test-requirements.txt
15-
- pytest --cov=helloasso_python
15+
- pytest --cov=helloasso-python
1616

1717
pytest-3.8:
1818
extends: .pytest

.openapi-generator/FILES

Lines changed: 118 additions & 118 deletions
Large diffs are not rendered by default.

.openapi-generator/VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
7.10.0
1+
7.12.0

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,4 @@ install:
1414
- "pip install -r requirements.txt"
1515
- "pip install -r test-requirements.txt"
1616
# command to run tests
17-
script: pytest --cov=helloasso_python
17+
script: pytest --cov=helloasso-python

README.md

Lines changed: 28 additions & 115 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
# helloasso-python
2+
HelloAsso auto-generated SDK
23

3-
The HelloAsso Python library offers a straightforward way to interact with the HelloAsso API in Python applications. It features a collection of pre-built classes for API resources that automatically adapt to API responses, ensuring flexibility across different versions of the HelloAsso API.
4+
This Python package is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project:
5+
6+
- API version: public
7+
- Package version: 1.0.0
8+
- Generator version: 7.12.0
9+
- Build package: org.openapitools.codegen.languages.PythonClientCodegen
410

511
## Requirements.
612

@@ -12,13 +18,13 @@ Python 3.8+
1218
If the python package is hosted on a repository, you can install directly using:
1319

1420
```sh
15-
pip install helloasso-python
21+
pip install git+https://github.com/GIT_USER_ID/GIT_REPO_ID.git
1622
```
17-
(you may need to run `pip` with root permission: `sudo pip install helloasso-python`)
23+
(you may need to run `pip` with root permission: `sudo pip install git+https://github.com/GIT_USER_ID/GIT_REPO_ID.git`)
1824

1925
Then import the package:
2026
```python
21-
import helloasso_python
27+
import helloasso-python
2228
```
2329

2430
### Setuptools
@@ -32,7 +38,7 @@ python setup.py install --user
3238

3339
Then import the package:
3440
```python
35-
import helloasso_python
41+
import helloasso-python
3642
```
3743

3844
### Tests
@@ -45,13 +51,13 @@ Please follow the [installation procedure](#installation--usage) and then run th
4551

4652
```python
4753

48-
import helloasso_python
49-
from helloasso_python.rest import ApiException
54+
import helloasso-python
55+
from helloasso-python.rest import ApiException
5056
from pprint import pprint
5157

5258
# Defining the host is optional and defaults to https://api.helloasso.com/v5
5359
# See configuration.py for a list of all supported configuration parameters.
54-
configuration = helloasso_python.Configuration(
60+
configuration = helloasso-python.Configuration(
5561
host = "https://api.helloasso.com/v5"
5662
)
5763

@@ -64,12 +70,12 @@ configuration.access_token = os.environ["ACCESS_TOKEN"]
6470

6571

6672
# Enter a context with an instance of the API client
67-
with helloasso_python.ApiClient(configuration) as api_client:
73+
with helloasso-python.ApiClient(configuration) as api_client:
6874
# Create an instance of the API class
69-
api_instance = helloasso_python.AnnuaireApi(api_client)
75+
api_instance = helloasso-python.AnnuaireApi(api_client)
7076
page_size = 20 # int | The number of items per page (optional) (default to 20)
7177
continuation_token = 'continuation_token_example' # str | Continuation Token from which we wish to retrieve results (optional)
72-
hello_asso_api_v5_models_directory_list_forms_request = helloasso_python.HelloAssoApiV5ModelsDirectoryListFormsRequest() # HelloAssoApiV5ModelsDirectoryListFormsRequest | Body which contains the filters to apply (optional)
78+
hello_asso_api_v5_models_directory_list_forms_request = helloasso-python.HelloAssoApiV5ModelsDirectoryListFormsRequest() # HelloAssoApiV5ModelsDirectoryListFormsRequest | Body which contains the filters to apply (optional)
7379

7480
try:
7581
# Récupérer les formulaires
@@ -229,116 +235,23 @@ Class | Method | HTTP request | Description
229235
- [ResultsWithPaginationModelSynchronizableFormModel](docs/ResultsWithPaginationModelSynchronizableFormModel.md)
230236
- [ResultsWithPaginationModelSynchronizableOrganizationModel](docs/ResultsWithPaginationModelSynchronizableOrganizationModel.md)
231237

232-
## Authorization
233238

234-
We use OAuth2 for authentication, so to avoid reinventing the wheel, we recommend using the [Authlib](https://pypi.org/project/Authlib) package
239+
<a id="documentation-for-authorization"></a>
240+
## Documentation For Authorization
235241

236-
### Prerequisite
237-
Install the Authlib package:
238242

239-
```bash
240-
pip install requests
241-
pip install Authlib
242-
```
243+
Authentication schemes defined for the API:
244+
<a id="OAuth2"></a>
245+
### OAuth2
243246

244-
### Client Credentials Flow
245-
```python
246-
from authlib.integrations.requests_client import OAuth2Session
247-
248-
# Configuration
249-
client_id = 'your_client_id'
250-
client_secret = 'your_client_secret'
251-
token_url = 'https://api.helloasso.com/oauth2/token'
252-
253-
# Create an OAuth2 session
254-
client = OAuth2Session(client_id, client_secret)
255-
256-
# Get an access token
257-
def get_access_token():
258-
token = client.fetch_token(token_url, grant_type='client_credentials')
259-
print("Access Token:", token['access_token'])
260-
print("Expires In:", token['expires_in'])
261-
print("Refresh Token:", token['refresh_token'])
262-
return token
263-
264-
# Usage
265-
get_access_token()
266-
```
247+
- **Type**: OAuth
248+
- **Flow**: application
249+
- **Authorization URL**:
250+
- **Scopes**: N/A
267251

268-
### Refresh Token Flow
269-
```python
270-
from authlib.integrations.requests_client import OAuth2Session
271-
272-
# Configuration
273-
client_id = 'your_client_id'
274-
client_secret = 'your_client_secret'
275-
token_url = 'https://api.helloasso.com/oauth2/token'
276-
277-
# Refresh the token
278-
def refresh_access_token(refresh_token):
279-
client = OAuth2Session(client_id, client_secret)
280-
token = client.refresh_token(token_url, refresh_token=refresh_token)
281-
print("New Access Token:", token['access_token'])
282-
print("Expires In:", token['expires_in'])
283-
print("New Refresh Token:", token['refresh_token'])
284-
return token
285-
286-
# Usage
287-
refresh_access_token('your_refresh_token')
288-
```
289252

290-
### Authorization Code Flow
291-
```python
292-
import base64
293-
import hashlib
294-
import os
295-
from authlib.integrations.requests_client import OAuth2Session
296-
297-
# Configuration
298-
client_id = 'your_client_id'
299-
client_secret = 'your_client_secret'
300-
authorize_url = 'https://auth.helloasso.com/authorize'
301-
token_url = 'https://api.helloasso.com/oauth2/token'
302-
redirect_uri = 'https://your-app.com/callback'
303-
304-
# PKCE Helper Functions
305-
def generate_code_verifier():
306-
"""Generate a high-entropy code_verifier."""
307-
return base64.urlsafe_b64encode(os.urandom(32)).rstrip(b'=').decode('utf-8')
308-
309-
def generate_code_challenge(code_verifier):
310-
"""Generate a code_challenge based on the code_verifier."""
311-
code_challenge = hashlib.sha256(code_verifier.encode('utf-8')).digest()
312-
return base64.urlsafe_b64encode(code_challenge).rstrip(b'=').decode('utf-8')
313-
314-
# Step 1: Generate the Authorization URL
315-
def get_authorization_url():
316-
# Generate PKCE parameters
317-
code_verifier = generate_code_verifier()
318-
code_challenge = generate_code_challenge(code_verifier)
319-
320-
client = OAuth2Session(client_id, client_secret, redirect_uri=redirect_uri)
321-
authorization_url, state = client.create_authorization_url(authorize_url, code_challenge=code_challenge, code_challenge_method='S256')
322-
print("Authorization URL: ", authorization_url)
323-
print("Code verifier: ", code_verifier)
324-
325-
# Step 2: Exchange the authorization code for an access token
326-
def get_access_token_from_code(authorization_response, code_verifier):
327-
client = OAuth2Session(client_id, client_secret, redirect_uri=redirect_uri)
328-
token = client.fetch_token(token_url, authorization_response=authorization_response, code_verifier=code_verifier)
329-
print("Access Token: ", token['access_token'])
330-
print("Expires In: ", token['expires_in'])
331-
print("Refresh Token: ", token['refresh_token'])
332-
333-
# Usage
334-
get_authorization_url()
335-
# After user authorizes, exchange the code (passed in the redirect URL callback)
336-
#get_access_token_from_code('your_authorization_code', 'your_code_verifier')
337-
```
253+
## Author
254+
338255

339-
## About this package
340256

341-
This SDK is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project:
342257

343-
- Generator version: 7.10.0
344-
- Build package: org.openapitools.codegen.languages.PythonClientCodegen

docs/AnnuaireApi.md

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# helloasso_python.AnnuaireApi
1+
# helloasso-python.AnnuaireApi
22

33
All URIs are relative to *https://api.helloasso.com/v5*
44

@@ -20,15 +20,15 @@ Permet de récupérer une liste de tous les formulaires visibles correspondant
2020
* OAuth Authentication (OAuth2):
2121

2222
```python
23-
import helloasso_python
24-
from helloasso_python.models.hello_asso_api_v5_models_directory_list_forms_request import HelloAssoApiV5ModelsDirectoryListFormsRequest
25-
from helloasso_python.models.results_with_pagination_model_synchronizable_form_model import ResultsWithPaginationModelSynchronizableFormModel
26-
from helloasso_python.rest import ApiException
23+
import helloasso-python
24+
from helloasso-python.models.hello_asso_api_v5_models_directory_list_forms_request import HelloAssoApiV5ModelsDirectoryListFormsRequest
25+
from helloasso-python.models.results_with_pagination_model_synchronizable_form_model import ResultsWithPaginationModelSynchronizableFormModel
26+
from helloasso-python.rest import ApiException
2727
from pprint import pprint
2828

2929
# Defining the host is optional and defaults to https://api.helloasso.com/v5
3030
# See configuration.py for a list of all supported configuration parameters.
31-
configuration = helloasso_python.Configuration(
31+
configuration = helloasso-python.Configuration(
3232
host = "https://api.helloasso.com/v5"
3333
)
3434

@@ -40,12 +40,12 @@ configuration = helloasso_python.Configuration(
4040
configuration.access_token = os.environ["ACCESS_TOKEN"]
4141

4242
# Enter a context with an instance of the API client
43-
with helloasso_python.ApiClient(configuration) as api_client:
43+
with helloasso-python.ApiClient(configuration) as api_client:
4444
# Create an instance of the API class
45-
api_instance = helloasso_python.AnnuaireApi(api_client)
45+
api_instance = helloasso-python.AnnuaireApi(api_client)
4646
page_size = 20 # int | The number of items per page (optional) (default to 20)
4747
continuation_token = 'continuation_token_example' # str | Continuation Token from which we wish to retrieve results (optional)
48-
hello_asso_api_v5_models_directory_list_forms_request = helloasso_python.HelloAssoApiV5ModelsDirectoryListFormsRequest() # HelloAssoApiV5ModelsDirectoryListFormsRequest | Body which contains the filters to apply (optional)
48+
hello_asso_api_v5_models_directory_list_forms_request = helloasso-python.HelloAssoApiV5ModelsDirectoryListFormsRequest() # HelloAssoApiV5ModelsDirectoryListFormsRequest | Body which contains the filters to apply (optional)
4949

5050
try:
5151
# Récupérer les formulaires
@@ -102,15 +102,15 @@ Permet de récupérer une liste de toutes les organisations visibles corresponda
102102
* OAuth Authentication (OAuth2):
103103

104104
```python
105-
import helloasso_python
106-
from helloasso_python.models.hello_asso_api_v5_models_directory_list_organizations_request import HelloAssoApiV5ModelsDirectoryListOrganizationsRequest
107-
from helloasso_python.models.results_with_pagination_model_synchronizable_organization_model import ResultsWithPaginationModelSynchronizableOrganizationModel
108-
from helloasso_python.rest import ApiException
105+
import helloasso-python
106+
from helloasso-python.models.hello_asso_api_v5_models_directory_list_organizations_request import HelloAssoApiV5ModelsDirectoryListOrganizationsRequest
107+
from helloasso-python.models.results_with_pagination_model_synchronizable_organization_model import ResultsWithPaginationModelSynchronizableOrganizationModel
108+
from helloasso-python.rest import ApiException
109109
from pprint import pprint
110110

111111
# Defining the host is optional and defaults to https://api.helloasso.com/v5
112112
# See configuration.py for a list of all supported configuration parameters.
113-
configuration = helloasso_python.Configuration(
113+
configuration = helloasso-python.Configuration(
114114
host = "https://api.helloasso.com/v5"
115115
)
116116

@@ -122,12 +122,12 @@ configuration = helloasso_python.Configuration(
122122
configuration.access_token = os.environ["ACCESS_TOKEN"]
123123

124124
# Enter a context with an instance of the API client
125-
with helloasso_python.ApiClient(configuration) as api_client:
125+
with helloasso-python.ApiClient(configuration) as api_client:
126126
# Create an instance of the API class
127-
api_instance = helloasso_python.AnnuaireApi(api_client)
127+
api_instance = helloasso-python.AnnuaireApi(api_client)
128128
page_size = 20 # int | The number of items per page (optional) (default to 20)
129129
continuation_token = 'continuation_token_example' # str | Continuation Token from which we wish to retrieve results (optional)
130-
hello_asso_api_v5_models_directory_list_organizations_request = helloasso_python.HelloAssoApiV5ModelsDirectoryListOrganizationsRequest() # HelloAssoApiV5ModelsDirectoryListOrganizationsRequest | Body which contains the filters to apply (optional)
130+
hello_asso_api_v5_models_directory_list_organizations_request = helloasso-python.HelloAssoApiV5ModelsDirectoryListOrganizationsRequest() # HelloAssoApiV5ModelsDirectoryListOrganizationsRequest | Body which contains the filters to apply (optional)
131131

132132
try:
133133
# Récupérer les organisations

0 commit comments

Comments
 (0)