Skip to content

Repository files navigation

helloasso-node

The HelloAsso node library offers a straightforward way to interact with the HelloAsso API in node 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.

Installation

npm

Install it via:

npm install helloasso-node --save

Finally, you need to build the module:

npm run build
Local development

To use the library locally without publishing to a remote npm registry, first install the dependencies by changing into the directory containing package.json (and this README). Let's call this JAVASCRIPT_CLIENT_DIR. Then run:

npm install

Next, link it globally in npm with the following, also from JAVASCRIPT_CLIENT_DIR:

npm link

To use the link you just defined in your project, switch to the directory you want to use your hello_asso_api from, and run:

npm link /path/to/<JAVASCRIPT_CLIENT_DIR>

Finally, you need to build the module:

npm run build

git

If the library is hosted at a git repository, e.g.https://github.com/helloasso/helloasso-node then install it via:

 npm install helloasso/helloasso-node --save

For browser

The library also works in the browser environment via npm and browserify. After following the above steps with Node.js and installing browserify with npm install -g browserify, perform the following (assuming main.js is your entry file):

browserify main.js > bundle.js

Then include bundle.js in the HTML pages.

Webpack Configuration

Using Webpack you may encounter the following error: "Module not found: Error: Cannot resolve module", most certainly you should disable AMD loader. Add/merge the following section to your webpack config:

module: {rules: [{parser: {amd: false}}]}

Getting Started

Please follow the installation instruction and execute the following JS code:

varhelloasso=require('helloasso-node');vardefaultClient=helloasso.ApiClient.instance;// Configure OAuth2 access token for authorization: OAuth2varOAuth2=defaultClient.authentications['OAuth2'];OAuth2.accessToken="YOUR ACCESS TOKEN"varapi=newhelloasso.AnnuaireApi()varopts={'pageSize': 20,// {Number} The number of items per page'continuationToken': "continuationToken_example",// {String} Continuation Token from which we wish to retrieve results'helloAssoApiV5ModelsDirectoryListFormsRequest': newhelloasso.HelloAssoApiV5ModelsDirectoryListFormsRequest()// {HelloAssoApiV5ModelsDirectoryListFormsRequest} Body which contains the filters to apply};varcallback=function(error,data,response){if(error){console.error(error);}else{console.log('API called successfully. Returned data: '+data);}};api.directoryFormsPost(opts,callback);

Documentation for API Endpoints

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

ClassMethodHTTP requestDescription
HelloAssoApi.AnnuaireApidirectoryFormsPostPOST /directory/formsRécupérer les formulaires
HelloAssoApi.AnnuaireApidirectoryOrganizationsPostPOST /directory/organizationsRécupérer les organisations
HelloAssoApi.CheckoutApiorganizationsOrganizationSlugCheckoutIntentsCheckoutIntentIdGetGET /organizations/{organizationSlug}/checkout-intents/{checkoutIntentId}Récupérer une intention de paiement
HelloAssoApi.CheckoutApiorganizationsOrganizationSlugCheckoutIntentsPostPOST /organizations/{organizationSlug}/checkout-intentsInitialisation d'un Checkout
HelloAssoApi.CommandesApiitemsItemIdGetGET /items/{itemId}Obtenir le détail d'un article contenu dans une commande
HelloAssoApi.CommandesApiordersOrderIdCancelPostPOST /orders/{orderId}/cancelAnnuler les paiements futurs pour une commande (pas de remboursement).
HelloAssoApi.CommandesApiordersOrderIdGetGET /orders/{orderId}Obtenir des informations détaillées sur une commande
HelloAssoApi.CommandesApiorganizationsOrganizationSlugFormsFormTypeFormSlugItemsGetGET /organizations/{organizationSlug}/forms/{formType}/{formSlug}/itemsObtenir une liste d'articles vendus dans un formulaire
HelloAssoApi.CommandesApiorganizationsOrganizationSlugFormsFormTypeFormSlugOrdersGetGET /organizations/{organizationSlug}/forms/{formType}/{formSlug}/ordersObtenir les commandes d'un formulaire
HelloAssoApi.CommandesApiorganizationsOrganizationSlugItemsGetGET /organizations/{organizationSlug}/itemsObtenir une liste d'articles vendus par une organisation
HelloAssoApi.CommandesApiorganizationsOrganizationSlugOrdersGetGET /organizations/{organizationSlug}/ordersObtenir les commandes d'une organisation
HelloAssoApi.FormulairesApiorganizationsOrganizationSlugFormTypesGetGET /organizations/{organizationSlug}/formTypesObtenir une liste des types de formulaires pour une organisation
HelloAssoApi.FormulairesApiorganizationsOrganizationSlugFormsFormTypeActionQuickCreatePostPOST /organizations/{organizationSlug}/forms/{formType}/action/quick-createCréer un événement simplifié pour un organisme
HelloAssoApi.FormulairesApiorganizationsOrganizationSlugFormsFormTypeFormSlugPublicGetGET /organizations/{organizationSlug}/forms/{formType}/{formSlug}/publicObtenir des données publiques détaillées sur un formulaire
HelloAssoApi.FormulairesApiorganizationsOrganizationSlugFormsGetGET /organizations/{organizationSlug}/formsObtenir les formulaires d'une organisation
HelloAssoApi.ListeDeValeursApivaluesCompanyLegalStatusGetGET /values/company-legal-statusObtenir la liste des statuts juridiques
HelloAssoApi.ListeDeValeursApivaluesOrganizationCategoriesGetGET /values/organization/categoriesObtenir la liste des catégories du JO
HelloAssoApi.ListeDeValeursApivaluesTagsGetGET /values/tagsObtenir la liste des tags publiques
HelloAssoApi.OrganisationApiorganizationsLegalInformationsLegalStructuresGetGET /organizations/legal-informations/legal-structuresObtenir la structure juridique d'une organisation visible.
HelloAssoApi.OrganisationApiorganizationsLegalInformationsOrganizationSlugConfigurationGetGET /organizations/legal-informations/{organizationSlug}/configurationObtenir la configuration des informations juridiques de l'organisation.
HelloAssoApi.OrganisationApiorganizationsLegalInformationsOrganizationSlugConfigurationPutPUT /organizations/legal-informations/{organizationSlug}/configurationMettre à jour la configuration des informations juridiques de l'organisation.
HelloAssoApi.OrganisationApiorganizationsLegalInformationsTaxInformationTextsGetGET /organizations/legal-informations/tax-information-textsObtenir les textes d'information fiscale de l'organisation.
HelloAssoApi.OrganisationApiorganizationsOrganizationSlugGetGET /organizations/{organizationSlug}Obtenir le détail d'une organisation
HelloAssoApi.PaiementsApiorganizationsOrganizationSlugFormsFormTypeFormSlugPaymentsGetGET /organizations/{organizationSlug}/forms/{formType}/{formSlug}/paymentsObtenir les informations des paiements effectués sur un formulaire
HelloAssoApi.PaiementsApiorganizationsOrganizationSlugPaymentsGetGET /organizations/{organizationSlug}/paymentsObtenir les informations des paiements effectués sur une organisation
HelloAssoApi.PaiementsApiorganizationsOrganizationSlugPaymentsSearchGetGET /organizations/{organizationSlug}/payments/searchRechercher des paiements.
HelloAssoApi.PaiementsApipaymentsPaymentIdGetGET /payments/{paymentId}Obtenir les informations détaillées d'un paiement.
HelloAssoApi.PaiementsApipaymentsPaymentIdRefundPostPOST /payments/{paymentId}/refundRembourser un paiement.
HelloAssoApi.PartenairesApipartnersMeApiClientsPutPUT /partners/me/api-clientsMise à jour du domaine
HelloAssoApi.PartenairesApipartnersMeApiNotificationsDeleteDELETE /partners/me/api-notificationsSuppression de l'URL de notification principale
HelloAssoApi.PartenairesApipartnersMeApiNotificationsOrganizationsOrganizationSlugDeleteDELETE /partners/me/api-notifications/organizations/{organizationSlug}Suppression d'une URL de notification liée à une organisation
HelloAssoApi.PartenairesApipartnersMeApiNotificationsOrganizationsOrganizationSlugPutPUT /partners/me/api-notifications/organizations/{organizationSlug}Mise à jour d'une URL de notification liée à une organisation
HelloAssoApi.PartenairesApipartnersMeApiNotificationsPutPUT /partners/me/api-notificationsMise à jour de l'URL de notification principale
HelloAssoApi.PartenairesApipartnersMeGetGET /partners/meRécupération des informations
HelloAssoApi.PartenairesApipartnersMeOrganizationsGetGET /partners/me/organizationsObtenir toutes les organisations
HelloAssoApi.ReusFiscauxApiorganizationsOrganizationSlugTaxReceiptConfigurationGetGET /organizations/{organizationSlug}/tax-receipt/configurationObtenir la configuration des reçus fiscaux
HelloAssoApi.ReusFiscauxApiorganizationsOrganizationSlugTaxReceiptConfigurationPutPUT /organizations/{organizationSlug}/tax-receipt/configurationMettre à jour la configuration des reçus fiscaux
HelloAssoApi.ReusFiscauxApiorganizationsOrganizationSlugTaxReceiptFiscalReceiptTransmitterPutPUT /organizations/{organizationSlug}/tax-receipt/fiscal-receipt-transmitterMettre à jour l'émetteur des reçus fiscaux
HelloAssoApi.ReusFiscauxApiorganizationsOrganizationSlugTaxReceiptPreviewPostPOST /organizations/{organizationSlug}/tax-receipt/previewPrévisualiser les reçus fiscaux
HelloAssoApi.TagsApitagsTagNameGetGET /tags/{tagName}Obtenir le détail d'un tag interne
HelloAssoApi.UtilisateursApiusersMeOrganizationsGetGET /users/me/organizationsObtenir mes organisations

Documentation for Models

Authorization

We use OAuth2 for authentication, so to avoid reinventing the wheel, we recommend using the simple-oauth2 package

Prerequisite

Install the simple-oauth2 package:

npm i simple-oauth2

Client Credentials Flow

const{ ClientCredentials }=require('simple-oauth2');// Create the client credentials instanceconstclient=newClientCredentials({client: {id: 'your_client_id',secret: 'your_client_secret',},auth: {tokenHost: 'https://api.helloasso.com',tokenPath: '/oauth2/token',},});// Get an access tokenasyncfunctiongetAccessToken(){try{consttoken=awaitclient.getToken();console.log('Access Token:',token.token);returntoken.token;}catch(error){console.error('Error getting access token:',error.message);}}// UsagegetAccessToken();

Refresh Token Flow

const{ AuthorizationCode }=require('simple-oauth2');// Create the authorization code instanceconstclient=newAuthorizationCode({client: {id: 'your_client_id',secret: 'your_client_secret',},auth: {tokenHost: 'https://api.helloasso.com',tokenPath: '/oauth2/token',},});// Refresh the tokenasyncfunctionrefreshAccessToken(refreshToken){try{consttokenObject=client.createToken({refresh_token: refreshToken});constnewToken=awaittokenObject.refresh();console.log('New Access Token:',newToken.token);returnnewToken.token;}catch(error){console.error('Error refreshing token:',error.message);}}// UsagerefreshAccessToken('your_refresh_token');

Authorization Code Flow

const{ AuthorizationCode }=require('simple-oauth2');constcrypto=require('crypto');// Create the authorization code instanceconstauthorisationClient=newAuthorizationCode({client: {id: 'your_client_id',secret: 'your_client_secret',},auth: {tokenHost: 'https://auth.helloasso.com/',authorizePath: '/authorize',},});consttokenClient=newAuthorizationCode({client: {id: 'your_client_id',secret: 'your_client_secret',},auth: {tokenHost: 'https://api.helloasso.com/',tokenPath: '/oauth2/token'},});// Generate a Code Verifier and Code ChallengefunctiongeneratePKCE(){constcodeVerifier=crypto.randomBytes(32).toString('hex');// Create a random stringconstcodeChallenge=crypto.createHash('sha256').update(codeVerifier).digest('base64').replace(/\+/g,'-').replace(/\//g,'_').replace(/=+$/,'');// Base64 URL encodereturn{ codeVerifier, codeChallenge };}// Step 1: Generate the authorization URLfunctiongetAuthorizationUrl(){const{ codeVerifier, codeChallenge }=generatePKCE();constauthorizationUri=client.authorizeURL({redirect_uri: 'https://your-app.com/callback',state: 'random_state_string',code_challenge: codeChallenge,code_challenge_method: 'S256',});console.log('Authorization URL:',authorizationUri);console.log('Code verifier:',codeVerifier);// Save the codeVerifier for later (e.g., in session or database)return{ authorizationUri, codeVerifier };}// Step 2: Exchange the authorization code for an access tokenasyncfunctiongetAccessTokenFromCode(authorizationCode,codeVerifier){try{consttoken=awaittokenClient.getToken({code: authorizationCode,redirect_uri: 'https://your-app.com/callback',code_verifier: codeVerifier});console.log('Access Token:',token.token);returntoken.token;}catch(error){console.error('Error getting access token:',error.message);}}// Usageconst{ authorizationUri, codeVerifier }=getAuthorizationUrl();// After user authorizes, exchange the code (passed in the redirect URL callback)// getAccessTokenFromCode('your_authorization_code', 'your_code_verifier');

About this package

This SDK is automatically generated by the OpenAPI Generator project:

  • Generator version: 7.10.0
  • Build package: org.openapitools.codegen.languages.JavascriptClientCodegen

About

SDK node pour l'API HelloAsso

Resources

Stars

1 star

Watchers

2 watching

Forks

Releases

Packages

Used by

Contributors

Languages