@allratestoday/sdk 1.1.0 → 1.2.1
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/README.md +23 -23
- package/package.json +3 -2
package/README.md
CHANGED
|
@@ -12,12 +12,12 @@ npm install @allratestoday/sdk
|
|
|
12
12
|
|
|
13
13
|
## Quick Start
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
Get your free API key at [allratestoday.com/register](https://allratestoday.com/register) (300 requests/month free).
|
|
16
16
|
|
|
17
17
|
```typescript
|
|
18
18
|
import AllRatesToday from '@allratestoday/sdk';
|
|
19
19
|
|
|
20
|
-
const client = new AllRatesToday();
|
|
20
|
+
const client = new AllRatesToday({ apiKey: 'art_live_your_key_here' });
|
|
21
21
|
|
|
22
22
|
// Get exchange rate
|
|
23
23
|
const rate = await client.getRate('USD', 'EUR');
|
|
@@ -26,18 +26,6 @@ console.log(`1 USD = ${rate.rate} EUR`);
|
|
|
26
26
|
// Convert amount
|
|
27
27
|
const result = await client.convert('USD', 'EUR', 100);
|
|
28
28
|
console.log(`$100 = €${result.result}`);
|
|
29
|
-
```
|
|
30
|
-
|
|
31
|
-
### Authenticated Rates (API Key Required)
|
|
32
|
-
|
|
33
|
-
```typescript
|
|
34
|
-
import AllRatesToday from '@allratestoday/sdk';
|
|
35
|
-
|
|
36
|
-
const client = new AllRatesToday({ apiKey: 'art_live_your_key_here' });
|
|
37
|
-
|
|
38
|
-
// Get authenticated rates
|
|
39
|
-
const rates = await client.getRates('USD', 'EUR');
|
|
40
|
-
console.log(rates);
|
|
41
29
|
|
|
42
30
|
// Get historical rates
|
|
43
31
|
const history = await client.getHistoricalRates('USD', 'EUR', '30d');
|
|
@@ -46,22 +34,24 @@ console.log(history.rates);
|
|
|
46
34
|
|
|
47
35
|
## API Reference
|
|
48
36
|
|
|
49
|
-
### `new AllRatesToday(options
|
|
37
|
+
### `new AllRatesToday(options)`
|
|
50
38
|
|
|
51
39
|
| Option | Type | Default | Description |
|
|
52
40
|
|--------|------|---------|-------------|
|
|
53
|
-
| `apiKey` | `string` |
|
|
41
|
+
| `apiKey` | `string` | **required** | Your API key ([register free](https://allratestoday.com/register)) |
|
|
54
42
|
| `baseUrl` | `string` | `https://allratestoday.com` | API base URL |
|
|
55
43
|
| `timeout` | `number` | `10000` | Request timeout in ms |
|
|
56
44
|
|
|
57
45
|
### Methods
|
|
58
46
|
|
|
59
|
-
| Method |
|
|
60
|
-
|
|
61
|
-
| `getRate(from, to, amount?)` |
|
|
62
|
-
| `convert(from, to, amount)` |
|
|
63
|
-
| `getRates(source, target)` |
|
|
64
|
-
| `getHistoricalRates(source, target, period)` |
|
|
47
|
+
| Method | Description |
|
|
48
|
+
|--------|-------------|
|
|
49
|
+
| `getRate(from, to, amount?)` | Get exchange rate between two currencies |
|
|
50
|
+
| `convert(from, to, amount)` | Convert amount between currencies |
|
|
51
|
+
| `getRates(source, target)` | Get rate data with metadata |
|
|
52
|
+
| `getHistoricalRates(source, target, period)` | Historical rates (1d/7d/30d/1y) |
|
|
53
|
+
|
|
54
|
+
All methods require an API key.
|
|
65
55
|
|
|
66
56
|
### Error Handling
|
|
67
57
|
|
|
@@ -78,10 +68,20 @@ try {
|
|
|
78
68
|
}
|
|
79
69
|
```
|
|
80
70
|
|
|
71
|
+
## Pricing
|
|
72
|
+
|
|
73
|
+
| Plan | Requests/Month | Price |
|
|
74
|
+
|------|---------------|-------|
|
|
75
|
+
| Free | 300 | Free |
|
|
76
|
+
| Small | 5,000 | €4.99/mo |
|
|
77
|
+
| Medium | 10,000 | €9.99/mo |
|
|
78
|
+
| Large | 100,000 | €49.99/mo |
|
|
79
|
+
|
|
81
80
|
## Links
|
|
82
81
|
|
|
83
82
|
- [API Documentation](https://allratestoday.com/docs)
|
|
84
|
-
- [
|
|
83
|
+
- [Register (Free)](https://allratestoday.com/register)
|
|
84
|
+
- [Dashboard](https://allratestoday.com/profile)
|
|
85
85
|
- [Pricing](https://allratestoday.com/pricing)
|
|
86
86
|
- [Status](https://allratestoday.com/status)
|
|
87
87
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@allratestoday/sdk",
|
|
3
|
-
"version": "1.1
|
|
3
|
+
"version": "1.2.1",
|
|
4
4
|
"description": "Official JavaScript/TypeScript SDK for AllRatesToday exchange rate API",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -32,7 +32,8 @@
|
|
|
32
32
|
"homepage": "https://allratestoday.com",
|
|
33
33
|
"repository": {
|
|
34
34
|
"type": "git",
|
|
35
|
-
"url": "https://github.com/allratestoday/
|
|
35
|
+
"url": "https://github.com/allratestoday/exchange-rates-api",
|
|
36
|
+
"directory": "sdks/javascript"
|
|
36
37
|
},
|
|
37
38
|
"devDependencies": {
|
|
38
39
|
"tsup": "^8.0.0",
|