open-index/open-npm huggingface dataset:
npm package: @resellerinterface/api-client-nodejs
Latest version: 1.0.3

# api-client-nodejs


## Installation

```bash
npm i @resellerinterface/api-client-nodejs
```

## Example
```js
const apiclient = require('@resellerinterface/api-client-nodejs');

// create a new client
const client = new apiclient();

// login
await client.login("username", "password", 1234)

// make a request
const response = await client.request("reseller/details", {resellerID: 'own'}, "RESPONSE_RESPONSE");
console.log(response.getData());
// response
// {
//     "time": 12,
//     "state": 1000,
//     "stateName": "OK",
//     "stateParam": "",
//     "reseller": {
//     "resellerID": 23456,
//         "parentID": 23455,
//         "state": "ACTIVE",
//         "company": "Acme Corp.",
//         "firstname": "John",
//         "lastname": "Doe",
//         "street": "Mainstreet",
//         "number": "1223",
//         "postcode": "10115",
//         "city": "Berlin",
//         "country": "DE",
//         "mail": "info@example.org",
//         "phone": "+491234567890",
//         "fax": "",
//         "parents": [
//         23455
//     ],
//         "settings": {
//         "group": {
//             "name": "value"
//         }
//     }
// },
//     "user": {
//     "userID": 12345,
//         "state": "ACTIVE",
//         "username": "User",
//         "password": "****",
//         "settings": {
//         "group": {
//             "name": "value"
//         }
//     },
//     "rightsCategory": 51,
//         "rightsGroups": [
//         912,
//         913
//     ],
//         "directRights": {
//         "category": {
//             "group": {
//                 "function": true
//             }
//         }
//     },
//     "rights": {
//         "category": {
//             "group": {
//                 "function": true
//             }
//         }
//     }
// }
// }
```
npm package: @resellos/resellos-sdk
Description: The official Node.js SDK for Resellos Developer API
Author: Resellos Team
Latest version: 1.0.1

# Resellos Node.js SDK

The official Node.js SDK for the Resellos Developer API.

## Installation

```bash
npm install resellos-sdk
```

## Usage

```javascript
const { Resellos } = require("resellos-sdk");

// Initialize with your API Key, Store ID, and optional log level
const client = new Resellos("sk_live_...", {
  storeId: "your-store-slug",
  logLevel: "DEBUG", // Options: "DEBUG", "INFO", "NONE"
});

// Use built-in utilities
const requestId = client.utils.generateRequestId("vtPass");
const phone = "08031234567";

// New Utilities
const isValid = client.utils.isValidPhoneNumber(phone); // true
const network = client.utils.detectNetwork(phone); // "MTN"
const formattedPrice = client.utils.formatCurrency(5000); // "₦5,000"

/**
 * Fetch Service Plans (Flexible & Paged)
 */
async function fetchPlans() {
  const response = await client.getPlans({
    type: "DATA",
    network: "MTN",
    search: "1GB",
    limit: 10, // Results per page
    page: 1, // Current page
    status: "active", // Only active plans
  });

  console.log(response.data); // Array of plans
  console.log(response.pagination); // { total: 45, page: 1, limit: 10, totalPages: 5 }
}

async function buyData() {
  try {
    const response = await client.purchase.data({
      planId: "plan_123",
      phoneNumber: phone,
      requestId: requestId,
    });

    if (response.success) {
      console.log("Success:", response.data.transactionId);
    } else {
      console.log("Error:", response.message);
    }
  } catch (err) {
    console.error("SDK Error:", err);
  }
}
```

## Features

- **Logging**: Built-in support for `DEBUG` and `INFO` levels with automatic masking of sensitive data (pins, keys).
- **Utilities**: `ResellosUtils` for generating compliant request IDs (VTpass, General) and formatting phone numbers.
- **Type-safe requests**: Full IntelliSense support for all Resellos services.
- **Automated environment detection**: Automatically handles `sk_live` and `sk_test` keys.

## License

MIT