oilpriceapi 0.3.1 → 0.3.2

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 CHANGED
@@ -51,13 +51,12 @@ const prices = await client.getLatestPrices();
51
51
  // [
52
52
  // {
53
53
  // code: 'WTI_USD',
54
- // name: 'WTI Crude Oil',
55
- // value: 74.25,
54
+ // price: 74.25,
55
+ // formatted: '$74.25',
56
56
  // currency: 'USD',
57
- // unit: 'barrel',
58
- // timestamp: '2024-11-24T12:00:00Z',
57
+ // type: 'spot_price',
59
58
  // created_at: '2024-11-24T12:01:00Z',
60
- // updated_at: '2024-11-24T12:01:00Z'
59
+ // source: 'oilprice.investing_com'
61
60
  // },
62
61
  // // ... more prices
63
62
  // ]
@@ -68,11 +67,11 @@ const prices = await client.getLatestPrices();
68
67
  ```typescript
69
68
  // Get only WTI crude oil price
70
69
  const wti = await client.getLatestPrices({ commodity: 'WTI_USD' });
71
- console.log(`WTI: $${wti[0].value} per barrel`);
70
+ console.log(`WTI: ${wti[0].formatted} per barrel`);
72
71
 
73
72
  // Get only Brent crude price
74
73
  const brent = await client.getLatestPrices({ commodity: 'BRENT_CRUDE_USD' });
75
- console.log(`Brent: $${brent[0].value} per barrel`);
74
+ console.log(`Brent: ${brent[0].formatted} per barrel`);
76
75
  ```
77
76
 
78
77
  ### Get Historical Prices (Past Week)
package/dist/client.js CHANGED
@@ -121,7 +121,10 @@ export class OilPriceAPI {
121
121
  headers: {
122
122
  'Authorization': `Bearer ${this.apiKey}`,
123
123
  'Content-Type': 'application/json',
124
- 'User-Agent': 'oilpriceapi-node/0.3.1',
124
+ 'User-Agent': 'oilpriceapi-node/0.3.2',
125
+ 'X-SDK-Language': 'javascript',
126
+ 'X-SDK-Version': '0.3.2',
127
+ 'X-Client-Type': 'sdk',
125
128
  },
126
129
  signal: controller.signal,
127
130
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "oilpriceapi",
3
- "version": "0.3.1",
3
+ "version": "0.3.2",
4
4
  "description": "Official Node.js SDK for Oil Price API - Real-time and historical oil & commodity prices",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",