smspva-sdk 0.1.0-alpha.1 → 0.1.0-alpha.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/METHODS.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # SDK method index
2
2
 
3
- All six packages cover these same 56 methods. Both Python clients use the Python names. PHP and Java use the JavaScript camelCase method names, with their own resource access syntax. Go capitalizes the first letter (for example, `GetBalance`); C# also appends `Async` (`GetBalanceAsync`). See each package README for request types and working usage. Parameters retain their API spelling.
3
+ All six packages cover these same 58 methods. Both Python clients use the Python names. PHP and Java use the JavaScript camelCase method names, with their own resource access syntax. Go capitalizes the first letter (for example, `GetBalance`); C# also appends `Async` (`GetBalanceAsync`). See each package README for request types and working usage. Parameters retain their API spelling.
4
4
 
5
5
  ## activation
6
6
 
@@ -13,6 +13,8 @@ All six packages cover these same 56 methods. Both Python clients use the Python
13
13
  | `client.activation.get_message_type_settings` | `client.activation.getMessageTypeSettings` | `GET /activation/countryservicesettings` |
14
14
  | `client.activation.get_all_number_counts` | `client.activation.getAllNumberCounts` | `GET /activation/countnumbers` |
15
15
  | `client.activation.get_country_number_counts` | `client.activation.getCountryNumberCounts` | `GET /activation/countnumbers/{country}` |
16
+ | `client.activation.get_all_number_counts_compact` | `client.activation.getAllNumberCountsCompact` | `GET /activation/countnumberscompact` |
17
+ | `client.activation.get_country_number_counts_compact` | `client.activation.getCountryNumberCountsCompact` | `GET /activation/countnumberscompact/{country}` |
16
18
  | `client.activation.get_service_price` | `client.activation.getServicePrice` | `GET /activation/serviceprice/{country}/{service}` |
17
19
  | `client.activation.get_country_operator_prices` | `client.activation.getCountryOperatorPrices` | `GET /activation/serviceprice/{country}` |
18
20
  | `client.activation.get_service_prices` | `client.activation.getServicePrices` | `GET /activation/serviceprices/{service}` |
package/README.md CHANGED
@@ -1,27 +1,36 @@
1
- # SMSPVA JavaScript / TypeScript SDK
1
+ # SMSPVA JavaScript and TypeScript SDK
2
2
 
3
- [![CI](https://github.com/SMSPVA/smspva-js/actions/workflows/ci.yml/badge.svg)](https://github.com/SMSPVA/smspva-js/actions/workflows/ci.yml) [![License: MIT](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE) ![Status: alpha](https://img.shields.io/badge/status-alpha-orange.svg)
3
+ [![CI](https://github.com/SMSPVA/smspva-js/actions/workflows/ci.yml/badge.svg)](https://github.com/SMSPVA/smspva-js/actions/workflows/ci.yml) [![License: MIT](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/SMSPVA/smspva-js/blob/main/LICENSE) ![Status: alpha](https://img.shields.io/badge/status-alpha-orange.svg)
4
4
 
5
- Node.js 22.16+, ESM and CommonJS, with TypeScript declarations. Covers all 56 methods: Activation V2 (20), Rental (22) and Private Email (14). Alternative API is excluded. This is an alpha release. Use the explicit version or the `alpha` tag when installing.
5
+ Official JavaScript and TypeScript client for [SMSPVA](https://smspva.com/), a service for receiving verification SMS, renting phone numbers and renting private email addresses. Use the asynchronous client in Node.js applications, with ESM and CommonJS builds and TypeScript declarations included.
6
+
7
+ Requires Node.js 22.16 or later. Uses native fetch and has no runtime dependencies. This package is an alpha release.
6
8
 
7
9
  ## Installation
8
10
 
9
11
  ```sh
10
12
  npm install smspva-sdk@alpha
11
- # Or pin the first alpha:
12
- npm install smspva-sdk@0.1.0-alpha.1
13
+ # Or pin this release:
14
+ npm install smspva-sdk@0.1.0-alpha.2
13
15
  ```
14
16
 
15
- Build and install from source:
17
+ ## API coverage
16
18
 
17
- ```sh
18
- git clone https://github.com/SMSPVA/smspva-js.git
19
- cd smspva-js
20
- npm ci
21
- npm run build
22
- # In the application that will use the SDK:
23
- npm install /absolute/path/to/smspva-js
24
- ```
19
+ The SDK provides 58 methods across three APIs:
20
+
21
+ | API | Methods | Use it to |
22
+ | --- | --- | --- |
23
+ | Activation V2 | 20 | Request a number, check availability and receive verification SMS. |
24
+ | Rental | 22 | Manage [phone number rentals](https://smspva.com/rent) and retrieve messages for existing orders. |
25
+ | Private Email | 14 | Check providers and services, manage [private email rentals](https://smspva.com/rent-mail.html), and read incoming messages. |
26
+
27
+ Country, service and provider lists come from the live API. Availability and prices can change. Alternative API is not included.
28
+
29
+ ## Quickstart
30
+
31
+ [Sign in to your SMSPVA account](https://smspva.com/signin.html) and open **Profile and ApiKey** from the account menu. Set the key as the **SMSPVA_API_KEY** environment variable before running a protected request. Keep it on your server and out of source control.
32
+
33
+ The examples below read your balance and reference data; they do not create an order.
25
34
 
26
35
  ```js
27
36
  import { SMSPVA } from 'smspva-sdk';
@@ -105,13 +114,13 @@ The default request timeout is 30 seconds, covering fetch and body reading. Set
105
114
 
106
115
  All generated request and response types are exported from the package. The complete method index is in `METHODS.md`. The generated source is committed. `npm run build` compiles it without needing the documentation source.
107
116
 
108
- ## License
109
-
110
- MIT. See [LICENSE](LICENSE).
111
-
112
117
  ## Development
113
118
 
119
+ To build from source and run the local checks:
120
+
114
121
  ```sh
122
+ git clone https://github.com/SMSPVA/smspva-js.git
123
+ cd smspva-js
115
124
  npm ci
116
125
  npm run build
117
126
  npm test
@@ -121,10 +130,25 @@ npm pack
121
130
 
122
131
  Tests use synthetic fixtures and local HTTP servers; they do not buy numbers or call the production API.
123
132
 
124
- ## Documentation
133
+ ## Documentation and support
125
134
 
126
- [API documentation](https://docs.smspva.com)
135
+ Read the [SMSPVA API documentation](https://docs.smspva.com/) for endpoint parameters, response codes and the activation, rental and email workflows. The [method index](https://github.com/SMSPVA/smspva-js/blob/main/METHODS.md) maps every SDK method to its API operation.
136
+
137
+ For account, billing or service questions, visit the [SMSPVA help center](https://smspva.com/help.html). Report SDK bugs through this repository's issues, without API keys or private message content.
138
+
139
+ ## License
140
+
141
+ MIT. See [LICENSE](https://github.com/SMSPVA/smspva-js/blob/main/LICENSE).
142
+
143
+ ## Compact number counts and operator ratings
144
+
145
+ Using an already configured client:
146
+
147
+ ```ts
148
+ const allCounts = await client.activation.getAllNumberCountsCompact();
149
+ const uaCounts = await client.activation.getCountryNumberCountsCompact({ country: "ua" });
150
+ ```
127
151
 
128
- The new documentation is being prepared in English, Spanish and Chinese. Localized links will be added when it is deployed.
152
+ Both requests use GET and the account API key in the `apikey` header. Country codes are case-insensitive; an unknown country returns `data: []`. No extra query parameters are required. Results are cached by the API for 60 seconds, independently for all countries and for each country.
129
153
 
130
- The SDK covers Activation V2, Rental and Private Email. Alternative API is not supported.
154
+ The SDK preserves `Operator`, `Country`, `Services`, `Rating` and `ServiceRatings` exactly as returned, including negative counts and missing or invalid ratings. It does not insert computed rating fields. For non-`Donor*` operators, the effective rating is 1. For `Donor*` operators, use a service rating if it is an integer from 1 to 10, then a valid overall rating; otherwise the rating is undefined. Lower is better.
@@ -127,6 +127,43 @@ exports.operations = {
127
127
  "noStock": false,
128
128
  "stateful": false
129
129
  },
130
+ "activation.getAllNumberCountsCompact": {
131
+ "family": "activation",
132
+ "jsName": "getAllNumberCountsCompact",
133
+ "pyName": "get_all_number_counts_compact",
134
+ "slug": "countnumberscompact",
135
+ "path": "/activation/countnumberscompact",
136
+ "method": "GET",
137
+ "baseUrl": "https://api.smspva.com",
138
+ "auth": "required",
139
+ "params": [],
140
+ "pending": false,
141
+ "noStock": false,
142
+ "stateful": false
143
+ },
144
+ "activation.getCountryNumberCountsCompact": {
145
+ "family": "activation",
146
+ "jsName": "getCountryNumberCountsCompact",
147
+ "pyName": "get_country_number_counts_compact",
148
+ "slug": "country-countnumberscompact",
149
+ "path": "/activation/countnumberscompact/{country}",
150
+ "method": "GET",
151
+ "baseUrl": "https://api.smspva.com",
152
+ "auth": "required",
153
+ "params": [
154
+ {
155
+ "name": "country",
156
+ "in": "path",
157
+ "required": true,
158
+ "schema": {
159
+ "type": "string"
160
+ }
161
+ }
162
+ ],
163
+ "pending": false,
164
+ "noStock": false,
165
+ "stateful": false
166
+ },
130
167
  "activation.getServicePrice": {
131
168
  "family": "activation",
132
169
  "jsName": "getServicePrice",