https://github.com/maelgangloff/sfrmobile-api
Support non-officiel de l'API mobile du FAI français SFR/RED
https://github.com/maelgangloff/sfrmobile-api
consommation data giga mobile phone sfr
Last synced: 3 months ago
JSON representation
Support non-officiel de l'API mobile du FAI français SFR/RED
- Host: GitHub
- URL: https://github.com/maelgangloff/sfrmobile-api
- Owner: maelgangloff
- License: gpl-3.0
- Created: 2022-02-13T19:53:51.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2022-02-18T19:21:13.000Z (over 4 years ago)
- Last Synced: 2025-08-09T15:53:09.204Z (11 months ago)
- Topics: consommation, data, giga, mobile, phone, sfr
- Language: TypeScript
- Homepage: https://www.npmjs.com/package/sfrmobile-api
- Size: 114 KB
- Stars: 5
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
## SfrMobile
Support non-officiel de l'API mobile de SFR/RED.
Les identifiants utilisés sont les mêmes que pour se connecter sur le site de l'opérateur.
**Kind**: global class
* [SfrMobile](#SfrMobile)
* [new SfrMobile(casauthenticationtoken)](#new_SfrMobile_new)
* _instance_
* [.getConso(line)](#SfrMobile+getConso) ⇒ Promise.<Consumption>
* [.getConsoNationale(line)](#SfrMobile+getConsoNationale) ⇒ Promise.<ConsumptionNationale>
* [.getFacturationMobile(line, duration)](#SfrMobile+getFacturationMobile) ⇒ Promise.<Facturation>
* [.downloadFactureMobile(line, numeroFacture, fadet)](#SfrMobile+downloadFactureMobile) ⇒ Promise.<Stream>
* [.getFacturationFixe(line, duration)](#SfrMobile+getFacturationFixe) ⇒ Promise.<FacturationFixe>
* [.downloadFactureFixe(line, idFact)](#SfrMobile+downloadFactureFixe) ⇒ Promise.<Stream>
* [.getInfosClientFixe(line)](#SfrMobile+getInfosClientFixe) ⇒ Promise.<InfosClientFixe>
* [.getFicheMonCompte()](#SfrMobile+getFicheMonCompte) ⇒ Promise.<FicheMonCompte>
* [.getDashboard(line)](#SfrMobile+getDashboard) ⇒ Promise.<Dashboard>
* [.getInfosPersonnelles(line)](#SfrMobile+getInfosPersonnelles) ⇒ Promise.<InfoPersonnelles>
* [.getNotificationsCount()](#SfrMobile+getNotificationsCount) ⇒ Promise.<NotificationsCount>
* [.getNotifications()](#SfrMobile+getNotifications) ⇒ Promise.<{notifications: Array.<Notification>}>
* [.getEquipements(line, universe)](#SfrMobile+getEquipements) ⇒ Promise.<Equipement>
* [.getOptionDetail(line, universe, environment, option)](#SfrMobile+getOptionDetail) ⇒ Promise.<OptionDetail>
* [.getOptionsCatalog(line)](#SfrMobile+getOptionsCatalog) ⇒ Promise.<OptionsCatalog>
* [.getOptionsCatalogDetail(line)](#SfrMobile+getOptionsCatalogDetail) ⇒ Promise.<OptionsCatalogDetail>
* [.getOptions(line, category)](#SfrMobile+getOptions) ⇒ Promise.<OptionsList>
* [.getEquipementDetail(line, optionCode, universe)](#SfrMobile+getEquipementDetail) ⇒ Promise.<EquipementDetail>
* [.getParc(line, universe, environment)](#SfrMobile+getParc) ⇒ Promise.<Parc>
* [.getPaiementTiersAchatsAbonnements(line)](#SfrMobile+getPaiementTiersAchatsAbonnements) ⇒ Promise.<AchatsAbonnements>
* [.getPaiementTiersOptionsAchat(line)](#SfrMobile+getPaiementTiersOptionsAchat) ⇒ Promise.<OptionsAchat>
* [.postPaiementTiersOptionsAchat(selectedLine, otp, data)](#SfrMobile+postPaiementTiersOptionsAchat)
* [.getOTPSMS(line)](#SfrMobile+getOTPSMS) ⇒ Promise.<OTPSMSResponse>
* [.getOffreAMES(line)](#SfrMobile+getOffreAMES) ⇒ Promise.<OffreAmes>
* _static_
* [.login(username, password, duration, universe)](#SfrMobile.login) ⇒ Promise.<LoginResponse>
* [.verifyUsername(username, universe)](#SfrMobile.verifyUsername) ⇒ Promise.<VerifyUsernameResponse>
* [.getTerminalInfoIMEI(imei)](#SfrMobile.getTerminalInfoIMEI) ⇒ Promise.<InfosTerminalIMEI>
* [.getTerminalInfo(id, type)](#SfrMobile.getTerminalInfo) ⇒ Promise.<InfosTerminal>
* [.getTerminauxInfo(ids, type)](#SfrMobile.getTerminauxInfo) ⇒ Promise.<Array.<InfosTerminal>>
### new SfrMobile(casauthenticationtoken)
| Param | Type | Description |
| --- | --- | --- |
| casauthenticationtoken | string | Jeton temporaire d'authentification |
**Example**
```js
const { SfrMobile } = require('sfrmobile-api')
SfrMobile.login(username, password).then(({ token }) => {
const user = new SfrMobile(token)
// Votre code
})
```
### sfrMobile.getConso(line) ⇒ Promise.<Consumption>
Consommation générale de la ligne
**Kind**: instance method of [SfrMobile](#SfrMobile)
| Param | Type | Description |
| --- | --- | --- |
| line | string | MSISDN de la ligne à sélectionner |
### sfrMobile.getConsoNationale(line) ⇒ Promise.<ConsumptionNationale>
Historique de la consommation sur le territoire national
**Kind**: instance method of [SfrMobile](#SfrMobile)
| Param | Description |
| --- | --- |
| line | MSISDN de la ligne à sélectionner |
### sfrMobile.getFacturationMobile(line, duration) ⇒ Promise.<Facturation>
Historique de facturation d'une ligne mobile
**Kind**: instance method of [SfrMobile](#SfrMobile)
| Param | Type | Default | Description |
| --- | --- | --- | --- |
| line | string | | MSISDN de la ligne mobile à sélectionner |
| duration | number | 6 | Nombre de périodes de facturation (6,12,18,24) |
### sfrMobile.downloadFactureMobile(line, numeroFacture, fadet) ⇒ Promise.<Stream>
Télécharger la facture d'une ligne mobile
**Kind**: instance method of [SfrMobile](#SfrMobile)
| Param | Type | Default | Description |
| --- | --- | --- | --- |
| line | string | | MSISDN de la ligne mobile à sélectionner |
| numeroFacture | string | | Identifiant de la facture de la ligne mobile |
| fadet | boolean | false | Facture détaillée |
### sfrMobile.getFacturationFixe(line, duration) ⇒ Promise.<FacturationFixe>
Historique de facturation d'une ligne fixe
**Kind**: instance method of [SfrMobile](#SfrMobile)
| Param | Type | Default | Description |
| --- | --- | --- | --- |
| line | string | | NDI de la ligne fixe |
| duration | number | 6 | Nombre de périodes de facturation (6,12,18,24) |
### sfrMobile.downloadFactureFixe(line, idFact) ⇒ Promise.<Stream>
Télécharger la facture d'une ligne fixe
**Kind**: instance method of [SfrMobile](#SfrMobile)
| Param | Type | Description |
| --- | --- | --- |
| line | string | NDI de la ligne fixe |
| idFact | string | Identifiant de la facture de la ligne fixe |
### sfrMobile.getInfosClientFixe(line) ⇒ Promise.<InfosClientFixe>
Détails de la ligne fixe
**Kind**: instance method of [SfrMobile](#SfrMobile)
| Param | Type | Description |
| --- | --- | --- |
| line | string \| undefined | NDI de la ligne fixe |
### sfrMobile.getFicheMonCompte() ⇒ Promise.<FicheMonCompte>
Fiche descriptive du compte de l'utilisateur courant
**Kind**: instance method of [SfrMobile](#SfrMobile)
### sfrMobile.getDashboard(line) ⇒ Promise.<Dashboard>
Informations générales de la ligne
**Kind**: instance method of [SfrMobile](#SfrMobile)
| Param | Description |
| --- | --- |
| line | MSISDN de la ligne à sélectionner |
### sfrMobile.getInfosPersonnelles(line) ⇒ Promise.<InfoPersonnelles>
Informations personnelles concernant la ligne
**Kind**: instance method of [SfrMobile](#SfrMobile)
| Param | Description |
| --- | --- |
| line | MSISDN de la ligne à sélectionner |
### sfrMobile.getNotificationsCount() ⇒ Promise.<NotificationsCount>
Nombre de notifications de l'utilisateur
**Kind**: instance method of [SfrMobile](#SfrMobile)
### sfrMobile.getNotifications() ⇒ Promise.<{notifications: Array.<Notification>}>
Lister les notifications de l'utilisateur
**Kind**: instance method of [SfrMobile](#SfrMobile)
### sfrMobile.getEquipements(line, universe) ⇒ Promise.<Equipement>
Liste des équipements mis à disposition pour une ligne
**Kind**: instance method of [SfrMobile](#SfrMobile)
| Param | Type | Description |
| --- | --- | --- |
| line | string | MSISDN de la ligne à sélectionner |
| universe | Universe \| string | SFR/RED |
### sfrMobile.getOptionDetail(line, universe, environment, option) ⇒ Promise.<OptionDetail>
Détail d'une option souscrite
**Kind**: instance method of [SfrMobile](#SfrMobile)
| Param | Type | Description |
| --- | --- | --- |
| line | string | MSISDN de la ligne à sélectionner |
| universe | Universe \| string | SFR/RED |
| environment | Environment \| string | Type de ligne |
| option | string | Identifiant de l'option |
### sfrMobile.getOptionsCatalog(line) ⇒ Promise.<OptionsCatalog>
Catalogue des catégories d'options disponibles pour une ligne
**Kind**: instance method of [SfrMobile](#SfrMobile)
| Param | Type | Description |
| --- | --- | --- |
| line | string | MSISDN de la ligne à sélectionner |
### sfrMobile.getOptionsCatalogDetail(line) ⇒ Promise.<OptionsCatalogDetail>
Catalogue détaillé des catégories d'options disponibles pour une ligne
**Kind**: instance method of [SfrMobile](#SfrMobile)
| Param | Type | Description |
| --- | --- | --- |
| line | string | MSISDN de la ligne à sélectionner |
### sfrMobile.getOptions(line, category) ⇒ Promise.<OptionsList>
Lister les options disponibles dans une catégorie
**Kind**: instance method of [SfrMobile](#SfrMobile)
| Param | Type | Description |
| --- | --- | --- |
| line | string | MSISDN de la ligne à sélectionner |
| category | string | Catégorie d'option |
### sfrMobile.getEquipementDetail(line, optionCode, universe) ⇒ Promise.<EquipementDetail>
Obtenir la description complète de l'équipement
**Kind**: instance method of [SfrMobile](#SfrMobile)
| Param | Type | Description |
| --- | --- | --- |
| line | string | MSISDN de la ligne à sélectionner |
| optionCode | string | Identifiant de l'option d'équipement |
| universe | Universe \| string | SFR/RED |
### sfrMobile.getParc(line, universe, environment) ⇒ Promise.<Parc>
Détails de l'offre d'une ligne
**Kind**: instance method of [SfrMobile](#SfrMobile)
| Param | Type | Description |
| --- | --- | --- |
| line | string | MSISDN de la ligne à sélectionner |
| universe | Universe \| string | SFR/RED |
| environment | Environment \| string | Type de ligne |
### sfrMobile.getPaiementTiersAchatsAbonnements(line) ⇒ Promise.<AchatsAbonnements>
Liste des achats et abonnements (hors forfait) sur la ligne
**Kind**: instance method of [SfrMobile](#SfrMobile)
| Param | Description |
| --- | --- |
| line | MSISDN de la ligne à sélectionner |
### sfrMobile.getPaiementTiersOptionsAchat(line) ⇒ Promise.<OptionsAchat>
Droits d'achat sur la ligne (Stores, jeux, ...)
**Kind**: instance method of [SfrMobile](#SfrMobile)
| Param | Description |
| --- | --- |
| line | MSISDN de la ligne à sélectionner |
### sfrMobile.postPaiementTiersOptionsAchat(selectedLine, otp, data)
Mettre à jour les droits d'achat sur la ligne
**Kind**: instance method of [SfrMobile](#SfrMobile)
| Param | Type | Description |
| --- | --- | --- |
| selectedLine | string | MSISDN de la ligne à sélectionner |
| otp | string | Code à usage unique obtenu avec getOTPSMS() |
| data | OptionsAchat | Droits d'achats à permuter |
### sfrMobile.getOTPSMS(line) ⇒ Promise.<OTPSMSResponse>
Obtenir un code à usage unique pour effectuer une opération
**Kind**: instance method of [SfrMobile](#SfrMobile)
| Param | Description |
| --- | --- |
| line | MSISDN de la ligne à sélectionner |
### sfrMobile.getOffreAMES(line) ⇒ Promise.<OffreAmes>
Informations sur les remises Multi-Pack
**Kind**: instance method of [SfrMobile](#SfrMobile)
| Param | Description |
| --- | --- |
| line | MSISDN de la ligne à sélectionner |
### SfrMobile.login(username, password, duration, universe) ⇒ Promise.<LoginResponse>
Obtenir un jeton d'authentification auprès du CAS de SFR
**Kind**: static method of [SfrMobile](#SfrMobile)
| Param | Type | Default | Description |
| --- | --- | --- | --- |
| username | string | | Identifiant du compte |
| password | string | | Mot de passe du compte |
| duration | number | 86400 | Durée de validité du jeton demandé en secondes |
| universe | Universe | | SFR/RED |
### SfrMobile.verifyUsername(username, universe) ⇒ Promise.<VerifyUsernameResponse>
Tester la validité d'un nom d'utilisateur
**Kind**: static method of [SfrMobile](#SfrMobile)
| Param | Type | Description |
| --- | --- | --- |
| username | string | Nom d'utilisateur à tester |
| universe | Universe | SFR/RED |
### SfrMobile.getTerminalInfoIMEI(imei) ⇒ Promise.<InfosTerminalIMEI>
Description du terminal associé à un IMEI
**Kind**: static method of [SfrMobile](#SfrMobile)
| Param | Type | Description |
| --- | --- | --- |
| imei | string | Identifiant du terminal mobile |
### SfrMobile.getTerminalInfo(id, type) ⇒ Promise.<InfosTerminal>
Description du terminal associé à un identifiant
**Kind**: static method of [SfrMobile](#SfrMobile)
| Param | Type | Description |
| --- | --- | --- |
| id | string | Identifiant |
| type | 'BACARAT' \| 'TAC' | Type d'identifiant |
### SfrMobile.getTerminauxInfo(ids, type) ⇒ Promise.<Array.<InfosTerminal>>
Description des terminaux associés à leur identifiant
**Kind**: static method of [SfrMobile](#SfrMobile)
| Param | Type | Description |
| --- | --- | --- |
| ids | Array.<string> | Identifiants |
| type | 'BACARAT' \| 'TAC' | Type d'identifiant |