1ot nodejs connector
Connector for https://1ot.com api
Installation
yarn
yarn add 1ot-api
npm
npm install 1ot-api
Usage
const username = '...'const password = '...' ;async { const connector = /* tokenData if it was saved */ // Happen every time new access token received connector await connector const sims = await connector for let sim of sims const status: primary secondary = sim if primary === primaryStatusesON if secondary === secondaryStatusesLIVE // put sim to sleep mode await sim else // resume sim from sleep mode await sim }}
Description
Common methods
/** GET /auth* when accessToken will be expired, token refreshes automatically*/ // GET /get_account_balance // GET /get_account_groups /** GET /get_available_profiles* Account must supports esims*//*if groupName is defined - GET /get_group_alertsothers - GET /get_account_alerts*/
Sims selection
// GET /get_sim /** Alternative way, without loading sim data* Usefull for actions on known sims*/// It's not necessaryawait sim.load /*if iccid or eid are defined - GET /get_simsif groupName is defined - GET /get_gpoup_simsothers - GET /get_account_sims*/ /** Selecting all sims in several requests if it needed (more than 1000 sims)* Filtering - same as getSim*/
Sim info
// GET /get_sim_alerts // GET /get_sim_cost // GET /get_sim_sessions
Actions
// PUT /closeawait sim.close /** PUT /diagnostics* Only when feature is enabled in App Store*/await sim.diagnostics // PUT /esim_profileawait sim.esimProfileprofile: string, action: string // PUT /resetawait sim.reset // PUT /resumeawait sim.resume // PUT /sendSmsawait sim.sendSmssms: string // PUT /set_data_limitawait sim.setDataLimitdataLimit: number // PUT /set_groupawait sim.setGrouptgroupName: string // PUT /set_nameawait sim.setNamename: string // PUT /suspendawait sim.suspend // PUT /testawait sim.test // PUT /activateawait sim.activate // PUT /deactivateawait sim.deactivate
For Sims object (connector.getAllSims()
) all actions are available (will be apply for every sim inside). For example:
await sims.suspend