Skip to content

Commit f6b1a6d

Browse files
committed
fix sdk
1 parent 4bf158d commit f6b1a6d

File tree

363 files changed

+1493
-30841
lines changed

Some content is hidden

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

363 files changed

+1493
-30841
lines changed

.github/workflows/python.yml

Lines changed: 2 additions & 2 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

@@ -28,4 +28,4 @@ jobs:
2828
pip install -r test-requirements.txt
2929
- name: Test with pytest
3030
run: |
31-
pytest --cov=helloasso-python
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-ignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,5 @@
2121
#docs/*.md
2222
# Then explicitly reverse the ignore rule for a single file:
2323
#!docs/README.md
24+
25+
README.md

.openapi-generator/FILES

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

.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: 115 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,6 @@
11
# helloasso-python
2-
HelloAsso auto-generated SDK
32

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
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.
104

115
## Requirements.
126

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

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

2519
Then import the package:
2620
```python
27-
import helloasso-python
21+
import helloasso_python
2822
```
2923

3024
### Setuptools
@@ -38,7 +32,7 @@ python setup.py install --user
3832

3933
Then import the package:
4034
```python
41-
import helloasso-python
35+
import helloasso_python
4236
```
4337

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

5246
```python
5347

54-
import helloasso-python
55-
from helloasso-python.rest import ApiException
48+
import helloasso_python
49+
from helloasso_python.rest import ApiException
5650
from pprint import pprint
5751

5852
# Defining the host is optional and defaults to https://api.helloasso.com/v5
5953
# See configuration.py for a list of all supported configuration parameters.
60-
configuration = helloasso-python.Configuration(
54+
configuration = helloasso_python.Configuration(
6155
host = "https://api.helloasso.com/v5"
6256
)
6357

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

7165

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

8074
try:
8175
# Récupérer les formulaires
@@ -238,22 +232,116 @@ Class | Method | HTTP request | Description
238232
- [ResultsWithPaginationModelSynchronizableOrganizationModel](docs/ResultsWithPaginationModelSynchronizableOrganizationModel.md)
239233

240234

241-
<a id="documentation-for-authorization"></a>
242-
## Documentation For Authorization
235+
## Authorization
243236

237+
We use OAuth2 for authentication, so to avoid reinventing the wheel, we recommend using the [Authlib](https://pypi.org/project/Authlib) package
244238

245-
Authentication schemes defined for the API:
246-
<a id="OAuth2"></a>
247-
### OAuth2
239+
### Prerequisite
240+
Install the Authlib package:
248241

249-
- **Type**: OAuth
250-
- **Flow**: application
251-
- **Authorization URL**:
252-
- **Scopes**: N/A
242+
```bash
243+
pip install requests
244+
pip install Authlib
245+
```
253246

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

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

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

342+
## About this package
258343

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

346+
- Generator version: 7.10.0
347+
- 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

docs/CheckoutApi.md

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

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

@@ -20,14 +20,14 @@ Retourne aussi la commande associée. Uniquement dans le cas ou le paiement est
2020
* OAuth Authentication (OAuth2):
2121

2222
```python
23-
import helloasso-python
24-
from helloasso-python.models.hello_asso_api_v5_models_carts_checkout_intent_response import HelloAssoApiV5ModelsCartsCheckoutIntentResponse
25-
from helloasso-python.rest import ApiException
23+
import helloasso_python
24+
from helloasso_python.models.hello_asso_api_v5_models_carts_checkout_intent_response import HelloAssoApiV5ModelsCartsCheckoutIntentResponse
25+
from helloasso_python.rest import ApiException
2626
from pprint import pprint
2727

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

@@ -39,9 +39,9 @@ configuration = helloasso-python.Configuration(
3939
configuration.access_token = os.environ["ACCESS_TOKEN"]
4040

4141
# Enter a context with an instance of the API client
42-
with helloasso-python.ApiClient(configuration) as api_client:
42+
with helloasso_python.ApiClient(configuration) as api_client:
4343
# Create an instance of the API class
44-
api_instance = helloasso-python.CheckoutApi(api_client)
44+
api_instance = helloasso_python.CheckoutApi(api_client)
4545
organization_slug = 'organization_slug_example' # str |
4646
checkout_intent_id = 56 # int |
4747
with_failed_refund_operation = False # bool | (optional) (default to False)
@@ -101,15 +101,15 @@ Pour tout savoir sur Checkout consultez d'abord notre <a href="https://dev.hello
101101
* OAuth Authentication (OAuth2):
102102

103103
```python
104-
import helloasso-python
105-
from helloasso-python.models.hello_asso_api_v5_models_carts_init_checkout_body import HelloAssoApiV5ModelsCartsInitCheckoutBody
106-
from helloasso-python.models.hello_asso_api_v5_models_carts_init_checkout_response import HelloAssoApiV5ModelsCartsInitCheckoutResponse
107-
from helloasso-python.rest import ApiException
104+
import helloasso_python
105+
from helloasso_python.models.hello_asso_api_v5_models_carts_init_checkout_body import HelloAssoApiV5ModelsCartsInitCheckoutBody
106+
from helloasso_python.models.hello_asso_api_v5_models_carts_init_checkout_response import HelloAssoApiV5ModelsCartsInitCheckoutResponse
107+
from helloasso_python.rest import ApiException
108108
from pprint import pprint
109109

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

@@ -121,11 +121,11 @@ configuration = helloasso-python.Configuration(
121121
configuration.access_token = os.environ["ACCESS_TOKEN"]
122122

123123
# Enter a context with an instance of the API client
124-
with helloasso-python.ApiClient(configuration) as api_client:
124+
with helloasso_python.ApiClient(configuration) as api_client:
125125
# Create an instance of the API class
126-
api_instance = helloasso-python.CheckoutApi(api_client)
126+
api_instance = helloasso_python.CheckoutApi(api_client)
127127
organization_slug = 'organization_slug_example' # str |
128-
hello_asso_api_v5_models_carts_init_checkout_body = helloasso-python.HelloAssoApiV5ModelsCartsInitCheckoutBody() # HelloAssoApiV5ModelsCartsInitCheckoutBody | (optional)
128+
hello_asso_api_v5_models_carts_init_checkout_body = helloasso_python.HelloAssoApiV5ModelsCartsInitCheckoutBody() # HelloAssoApiV5ModelsCartsInitCheckoutBody | (optional)
129129

130130
try:
131131
# Initialisation d'un Checkout

0 commit comments

Comments
 (0)