oilpriceapi 0.7.0 → 0.9.0
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 +244 -30
- package/dist/cjs/client.js +610 -0
- package/dist/cjs/errors.js +80 -0
- package/dist/cjs/index.js +96 -0
- package/dist/cjs/package.json +1 -0
- package/dist/cjs/resources/alerts.js +387 -0
- package/dist/cjs/resources/analytics.js +188 -0
- package/dist/cjs/resources/bunker-fuels.js +210 -0
- package/dist/cjs/resources/commodities.js +115 -0
- package/dist/cjs/resources/data-quality.js +144 -0
- package/dist/cjs/resources/data-sources.js +298 -0
- package/dist/cjs/resources/diesel.js +119 -0
- package/dist/cjs/resources/drilling.js +269 -0
- package/dist/cjs/resources/ei/drilling-productivity.js +108 -0
- package/dist/cjs/resources/ei/forecasts.js +106 -0
- package/dist/cjs/resources/ei/frac-focus.js +165 -0
- package/dist/cjs/resources/ei/index.js +98 -0
- package/dist/cjs/resources/ei/oil-inventories.js +97 -0
- package/dist/cjs/resources/ei/opec-production.js +97 -0
- package/dist/cjs/resources/ei/rig-counts.js +93 -0
- package/dist/cjs/resources/ei/well-permits.js +136 -0
- package/dist/cjs/resources/forecasts.js +168 -0
- package/dist/cjs/resources/futures.js +424 -0
- package/dist/cjs/resources/indicators.js +79 -0
- package/dist/cjs/resources/raw.js +128 -0
- package/dist/cjs/resources/rig-counts.js +164 -0
- package/dist/cjs/resources/spreads.js +105 -0
- package/dist/cjs/resources/storage.js +166 -0
- package/dist/cjs/resources/streaming.js +350 -0
- package/dist/cjs/resources/webhooks.js +283 -0
- package/dist/cjs/types.js +2 -0
- package/dist/cjs/version.js +24 -0
- package/dist/client.d.ts +130 -3
- package/dist/client.js +206 -30
- package/dist/errors.d.ts +6 -0
- package/dist/errors.js +25 -16
- package/dist/index.d.ts +28 -5
- package/dist/index.js +29 -1
- package/dist/resources/alerts.js +31 -77
- package/dist/resources/analytics.d.ts +147 -214
- package/dist/resources/analytics.js +104 -141
- package/dist/resources/bunker-fuels.d.ts +35 -12
- package/dist/resources/bunker-fuels.js +41 -26
- package/dist/resources/commodities.js +2 -1
- package/dist/resources/data-quality.js +2 -1
- package/dist/resources/data-sources.d.ts +31 -31
- package/dist/resources/data-sources.js +30 -85
- package/dist/resources/diesel.d.ts +1 -1
- package/dist/resources/diesel.js +9 -38
- package/dist/resources/drilling.js +2 -1
- package/dist/resources/ei/drilling-productivity.js +2 -1
- package/dist/resources/ei/forecasts.js +2 -1
- package/dist/resources/ei/frac-focus.d.ts +23 -9
- package/dist/resources/ei/frac-focus.js +20 -9
- package/dist/resources/ei/index.js +2 -1
- package/dist/resources/ei/oil-inventories.js +2 -1
- package/dist/resources/ei/opec-production.js +2 -1
- package/dist/resources/ei/rig-counts.js +2 -1
- package/dist/resources/ei/well-permits.d.ts +25 -9
- package/dist/resources/ei/well-permits.js +20 -7
- package/dist/resources/forecasts.d.ts +4 -1
- package/dist/resources/forecasts.js +13 -6
- package/dist/resources/futures.d.ts +178 -1
- package/dist/resources/futures.js +199 -8
- package/dist/resources/indicators.d.ts +170 -0
- package/dist/resources/indicators.js +75 -0
- package/dist/resources/raw.d.ts +94 -0
- package/dist/resources/raw.js +124 -0
- package/dist/resources/rig-counts.js +5 -2
- package/dist/resources/spreads.d.ts +121 -0
- package/dist/resources/spreads.js +101 -0
- package/dist/resources/storage.d.ts +5 -4
- package/dist/resources/storage.js +7 -6
- package/dist/resources/streaming.d.ts +272 -0
- package/dist/resources/streaming.js +342 -0
- package/dist/resources/webhooks.d.ts +73 -23
- package/dist/resources/webhooks.js +59 -77
- package/dist/types.d.ts +43 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +2 -2
- package/package.json +21 -6
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Energy Intelligence - Rig Counts Resource
|
|
4
|
+
*
|
|
5
|
+
* Access Baker Hughes rig count data with basin, state, and historical breakdowns.
|
|
6
|
+
*/
|
|
7
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
+
exports.EIRigCountsResource = void 0;
|
|
9
|
+
const errors_js_1 = require("../../errors.js");
|
|
10
|
+
/**
|
|
11
|
+
* EI Rig Counts Resource
|
|
12
|
+
*
|
|
13
|
+
* Access Baker Hughes rig count data with comprehensive breakdowns.
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```typescript
|
|
17
|
+
* const client = new OilPriceAPI({ apiKey: 'your_key' });
|
|
18
|
+
*
|
|
19
|
+
* // Get latest rig count
|
|
20
|
+
* const latest = await client.ei.rigCounts.latest();
|
|
21
|
+
* console.log(`Total rigs: ${latest.total_rigs}`);
|
|
22
|
+
*
|
|
23
|
+
* // Get by basin
|
|
24
|
+
* const basins = await client.ei.rigCounts.byBasin();
|
|
25
|
+
* basins.forEach(b => console.log(`${b.basin}: ${b.rig_count} rigs`));
|
|
26
|
+
* ```
|
|
27
|
+
*/
|
|
28
|
+
class EIRigCountsResource {
|
|
29
|
+
constructor(client) {
|
|
30
|
+
this.client = client;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* List all rig count records
|
|
34
|
+
*
|
|
35
|
+
* @returns Array of rig count records
|
|
36
|
+
*
|
|
37
|
+
* @throws {OilPriceAPIError} If API request fails
|
|
38
|
+
*/
|
|
39
|
+
async list() {
|
|
40
|
+
const response = await this.client["request"]("/v1/ei/rig_counts", {});
|
|
41
|
+
return Array.isArray(response) ? response : response.data;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Get a specific rig count record
|
|
45
|
+
*
|
|
46
|
+
* @param id - Record ID
|
|
47
|
+
* @returns Rig count record
|
|
48
|
+
*
|
|
49
|
+
* @throws {NotFoundError} If record not found
|
|
50
|
+
*/
|
|
51
|
+
async get(id) {
|
|
52
|
+
if (!id || typeof id !== "string") {
|
|
53
|
+
throw new errors_js_1.ValidationError("Record ID must be a non-empty string");
|
|
54
|
+
}
|
|
55
|
+
return this.client["request"](`/v1/ei/rig_counts/${id}`, {});
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Get latest rig count
|
|
59
|
+
*
|
|
60
|
+
* @returns Latest rig count data
|
|
61
|
+
*/
|
|
62
|
+
async latest() {
|
|
63
|
+
return this.client["request"]("/v1/ei/rig_counts/latest", {});
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Get rig counts by basin
|
|
67
|
+
*
|
|
68
|
+
* @returns Array of rig counts by basin
|
|
69
|
+
*/
|
|
70
|
+
async byBasin() {
|
|
71
|
+
const response = await this.client["request"]("/v1/ei/rig_counts/by_basin", {});
|
|
72
|
+
return Array.isArray(response) ? response : response.data;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Get rig counts by state
|
|
76
|
+
*
|
|
77
|
+
* @returns Array of rig counts by state
|
|
78
|
+
*/
|
|
79
|
+
async byState() {
|
|
80
|
+
const response = await this.client["request"]("/v1/ei/rig_counts/by_state", {});
|
|
81
|
+
return Array.isArray(response) ? response : response.data;
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Get historical rig count data
|
|
85
|
+
*
|
|
86
|
+
* @returns Array of historical rig counts
|
|
87
|
+
*/
|
|
88
|
+
async historical() {
|
|
89
|
+
const response = await this.client["request"]("/v1/ei/rig_counts/historical", {});
|
|
90
|
+
return Array.isArray(response) ? response : response.data;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
exports.EIRigCountsResource = EIRigCountsResource;
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Energy Intelligence - Well Permits Resource
|
|
4
|
+
*
|
|
5
|
+
* Access oil and gas well permit data by state, operator, and formation.
|
|
6
|
+
*/
|
|
7
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
+
exports.EIWellPermitsResource = void 0;
|
|
9
|
+
const errors_js_1 = require("../../errors.js");
|
|
10
|
+
/**
|
|
11
|
+
* EI Well Permits Resource
|
|
12
|
+
*
|
|
13
|
+
* Access oil and gas well permit data with detailed breakdowns.
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```typescript
|
|
17
|
+
* const client = new OilPriceAPI({ apiKey: 'your_key' });
|
|
18
|
+
*
|
|
19
|
+
* // Get latest permits
|
|
20
|
+
* const latest = await client.ei.wellPermits.latest();
|
|
21
|
+
* console.log(`Permit: ${latest.permit_number} - ${latest.operator}`);
|
|
22
|
+
*
|
|
23
|
+
* // Get permits by state
|
|
24
|
+
* const states = await client.ei.wellPermits.byState();
|
|
25
|
+
* states.forEach(s => console.log(`${s.state}: ${s.permit_count} permits`));
|
|
26
|
+
*
|
|
27
|
+
* // Search permits
|
|
28
|
+
* const results = await client.ei.wellPermits.search({
|
|
29
|
+
* state: 'Texas',
|
|
30
|
+
* operator: 'ConocoPhillips'
|
|
31
|
+
* });
|
|
32
|
+
* ```
|
|
33
|
+
*/
|
|
34
|
+
class EIWellPermitsResource {
|
|
35
|
+
constructor(client) {
|
|
36
|
+
this.client = client;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* List all well permit records
|
|
40
|
+
*
|
|
41
|
+
* @returns Array of well permit records
|
|
42
|
+
*/
|
|
43
|
+
async list() {
|
|
44
|
+
const response = await this.client["request"]("/v1/ei/well-permits", {});
|
|
45
|
+
return Array.isArray(response) ? response : response.data;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Get a specific well permit record
|
|
49
|
+
*
|
|
50
|
+
* @param id - Record ID
|
|
51
|
+
* @returns Well permit record
|
|
52
|
+
*/
|
|
53
|
+
async get(id) {
|
|
54
|
+
if (!id || typeof id !== "string") {
|
|
55
|
+
throw new errors_js_1.ValidationError("Record ID must be a non-empty string");
|
|
56
|
+
}
|
|
57
|
+
return this.client["request"](`/v1/ei/well-permits/${id}`, {});
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Get latest well permit
|
|
61
|
+
*
|
|
62
|
+
* @returns Latest well permit record
|
|
63
|
+
*/
|
|
64
|
+
async latest() {
|
|
65
|
+
return this.client["request"]("/v1/ei/well-permits/latest", {});
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Get well permit summary
|
|
69
|
+
*
|
|
70
|
+
* @returns Well permit summary statistics
|
|
71
|
+
*/
|
|
72
|
+
async summary() {
|
|
73
|
+
return this.client["request"]("/v1/ei/well-permits/summary", {});
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Get permits by state
|
|
77
|
+
*
|
|
78
|
+
* @returns Array of permits grouped by state
|
|
79
|
+
*/
|
|
80
|
+
async byState() {
|
|
81
|
+
const response = await this.client["request"]("/v1/ei/well-permits/by-state", {});
|
|
82
|
+
return Array.isArray(response) ? response : response.data;
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Get permits by operator
|
|
86
|
+
*
|
|
87
|
+
* @returns Array of permits grouped by operator
|
|
88
|
+
*/
|
|
89
|
+
async byOperator() {
|
|
90
|
+
const response = await this.client["request"]("/v1/ei/well-permits/by-operator", {});
|
|
91
|
+
return Array.isArray(response) ? response : response.data;
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Get permits by formation
|
|
95
|
+
*
|
|
96
|
+
* @returns Array of permits grouped by formation
|
|
97
|
+
*/
|
|
98
|
+
async byFormation() {
|
|
99
|
+
const response = await this.client["request"]("/v1/ei/well-permits/by-formation", {});
|
|
100
|
+
return Array.isArray(response) ? response : response.data;
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Search well permits
|
|
104
|
+
*
|
|
105
|
+
* @param query - Search query parameters
|
|
106
|
+
* @returns Array of matching well permit records
|
|
107
|
+
*/
|
|
108
|
+
async search(query) {
|
|
109
|
+
const params = {};
|
|
110
|
+
if (query.states)
|
|
111
|
+
params.states = query.states;
|
|
112
|
+
if (query.county)
|
|
113
|
+
params.county = query.county;
|
|
114
|
+
if (query.well_name)
|
|
115
|
+
params.well_name = query.well_name;
|
|
116
|
+
if (query.permit_type)
|
|
117
|
+
params.permit_type = query.permit_type;
|
|
118
|
+
if (query.well_type)
|
|
119
|
+
params.well_type = query.well_type;
|
|
120
|
+
if (query.address)
|
|
121
|
+
params.address = query.address;
|
|
122
|
+
if (query.latitude !== undefined)
|
|
123
|
+
params.latitude = query.latitude.toString();
|
|
124
|
+
if (query.longitude !== undefined)
|
|
125
|
+
params.longitude = query.longitude.toString();
|
|
126
|
+
if (query.radius_miles !== undefined)
|
|
127
|
+
params.radius_miles = query.radius_miles.toString();
|
|
128
|
+
if (query.start_date)
|
|
129
|
+
params.start_date = query.start_date;
|
|
130
|
+
if (query.end_date)
|
|
131
|
+
params.end_date = query.end_date;
|
|
132
|
+
const response = await this.client["request"]("/v1/ei/well-permits/search", params);
|
|
133
|
+
return Array.isArray(response) ? response : response.data;
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
exports.EIWellPermitsResource = EIWellPermitsResource;
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Forecasts Resource
|
|
4
|
+
*
|
|
5
|
+
* Access official price forecasts from EIA, IEA, and other agencies including
|
|
6
|
+
* monthly outlooks, accuracy metrics, and historical archives.
|
|
7
|
+
*/
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.ForecastsResource = void 0;
|
|
10
|
+
const errors_js_1 = require("../errors.js");
|
|
11
|
+
/**
|
|
12
|
+
* Forecasts Resource
|
|
13
|
+
*
|
|
14
|
+
* Access official price forecasts from government agencies and research
|
|
15
|
+
* organizations including EIA, IEA, and others.
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* ```typescript
|
|
19
|
+
* import { OilPriceAPI } from 'oilpriceapi';
|
|
20
|
+
*
|
|
21
|
+
* const client = new OilPriceAPI({ apiKey: 'your_key' });
|
|
22
|
+
*
|
|
23
|
+
* // Get monthly forecasts
|
|
24
|
+
* const forecasts = await client.forecasts.monthly();
|
|
25
|
+
* forecasts.forEach(f => {
|
|
26
|
+
* console.log(`${f.period}: $${f.forecast_price} (${f.source})`);
|
|
27
|
+
* });
|
|
28
|
+
*
|
|
29
|
+
* // Check forecast accuracy
|
|
30
|
+
* const accuracy = await client.forecasts.accuracy();
|
|
31
|
+
* console.log(`EIA MAPE: ${accuracy.mape}%`);
|
|
32
|
+
* ```
|
|
33
|
+
*/
|
|
34
|
+
class ForecastsResource {
|
|
35
|
+
constructor(client) {
|
|
36
|
+
this.client = client;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Get monthly price forecasts
|
|
40
|
+
*
|
|
41
|
+
* Returns official monthly forecasts from EIA, IEA, and other agencies.
|
|
42
|
+
*
|
|
43
|
+
* @param commodity - Optional commodity code filter
|
|
44
|
+
* @returns Array of monthly forecasts
|
|
45
|
+
*
|
|
46
|
+
* @throws {OilPriceAPIError} If API request fails
|
|
47
|
+
* @throws {AuthenticationError} If API key is invalid
|
|
48
|
+
*
|
|
49
|
+
* @example
|
|
50
|
+
* ```typescript
|
|
51
|
+
* // Get all forecasts
|
|
52
|
+
* const allForecasts = await client.forecasts.monthly();
|
|
53
|
+
*
|
|
54
|
+
* // Get WTI forecasts only
|
|
55
|
+
* const wtiForecasts = await client.forecasts.monthly('WTI_USD');
|
|
56
|
+
*
|
|
57
|
+
* wtiForecasts.forEach(forecast => {
|
|
58
|
+
* console.log(`${forecast.period}: $${forecast.forecast_price}`);
|
|
59
|
+
* console.log(` Range: $${forecast.lower_bound} - $${forecast.upper_bound}`);
|
|
60
|
+
* console.log(` Source: ${forecast.source}`);
|
|
61
|
+
* });
|
|
62
|
+
* ```
|
|
63
|
+
*/
|
|
64
|
+
async monthly(commodity) {
|
|
65
|
+
const params = {};
|
|
66
|
+
if (commodity)
|
|
67
|
+
params.commodity = commodity;
|
|
68
|
+
const response = await this.client["request"]("/v1/forecasts/monthly", params);
|
|
69
|
+
return Array.isArray(response) ? response : response.forecasts;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Get forecast accuracy metrics
|
|
73
|
+
*
|
|
74
|
+
* Returns historical accuracy measurements for forecast sources.
|
|
75
|
+
*
|
|
76
|
+
* @returns Forecast accuracy data
|
|
77
|
+
*
|
|
78
|
+
* @throws {OilPriceAPIError} If API request fails
|
|
79
|
+
* @throws {AuthenticationError} If API key is invalid
|
|
80
|
+
*
|
|
81
|
+
* @example
|
|
82
|
+
* ```typescript
|
|
83
|
+
* const accuracy = await client.forecasts.accuracy();
|
|
84
|
+
* console.log(`Source: ${accuracy.source}`);
|
|
85
|
+
* console.log(`MAPE: ${accuracy.mape}%`);
|
|
86
|
+
* console.log(`RMSE: ${accuracy.rmse}`);
|
|
87
|
+
* console.log(`Sample size: ${accuracy.sample_size} forecasts`);
|
|
88
|
+
* ```
|
|
89
|
+
*/
|
|
90
|
+
async accuracy() {
|
|
91
|
+
// Route is /v1/forecasts/monthly/accuracy (the bare /accuracy 404s).
|
|
92
|
+
return this.client["request"]("/v1/forecasts/monthly/accuracy", {});
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Get archived forecasts
|
|
96
|
+
*
|
|
97
|
+
* Returns historical forecasts with actual outcomes for accuracy analysis.
|
|
98
|
+
*
|
|
99
|
+
* @param year - Optional year filter
|
|
100
|
+
* @returns Array of archived forecasts
|
|
101
|
+
*
|
|
102
|
+
* @throws {OilPriceAPIError} If API request fails
|
|
103
|
+
* @throws {AuthenticationError} If API key is invalid
|
|
104
|
+
*
|
|
105
|
+
* @example
|
|
106
|
+
* ```typescript
|
|
107
|
+
* // Get all archived forecasts
|
|
108
|
+
* const archive = await client.forecasts.archive();
|
|
109
|
+
*
|
|
110
|
+
* // Get forecasts from specific year
|
|
111
|
+
* const archive2024 = await client.forecasts.archive(2024);
|
|
112
|
+
*
|
|
113
|
+
* archive2024.forEach(forecast => {
|
|
114
|
+
* if (forecast.actual_price) {
|
|
115
|
+
* console.log(`${forecast.year}-${forecast.month}:`);
|
|
116
|
+
* console.log(` Forecast: $${forecast.forecast_price}`);
|
|
117
|
+
* console.log(` Actual: $${forecast.actual_price}`);
|
|
118
|
+
* console.log(` Error: ${forecast.error}%`);
|
|
119
|
+
* }
|
|
120
|
+
* });
|
|
121
|
+
* ```
|
|
122
|
+
*/
|
|
123
|
+
async archive(options) {
|
|
124
|
+
// Route is /v1/forecasts/monthly/archive (the bare /archive 404s). The
|
|
125
|
+
// controller reads only `page` / `per_page` — it does NOT filter by year,
|
|
126
|
+
// so the previous `year` argument was silently ignored.
|
|
127
|
+
const params = {};
|
|
128
|
+
if (options?.page !== undefined)
|
|
129
|
+
params.page = options.page.toString();
|
|
130
|
+
if (options?.perPage !== undefined)
|
|
131
|
+
params.per_page = options.perPage.toString();
|
|
132
|
+
const response = await this.client["request"]("/v1/forecasts/monthly/archive", params);
|
|
133
|
+
return Array.isArray(response) ? response : response.forecasts;
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* Get forecast for a specific period
|
|
137
|
+
*
|
|
138
|
+
* @param period - Period identifier (e.g., "2024-03", "2024-Q2")
|
|
139
|
+
* @param commodity - Optional commodity code filter
|
|
140
|
+
* @returns Monthly forecast data
|
|
141
|
+
*
|
|
142
|
+
* @throws {NotFoundError} If period not found
|
|
143
|
+
* @throws {OilPriceAPIError} If API request fails
|
|
144
|
+
*
|
|
145
|
+
* @example
|
|
146
|
+
* ```typescript
|
|
147
|
+
* // Get March 2024 forecast
|
|
148
|
+
* const march2024 = await client.forecasts.get('2024-03');
|
|
149
|
+
*
|
|
150
|
+
* // Get Q2 2024 WTI forecast
|
|
151
|
+
* const q2Wti = await client.forecasts.get('2024-Q2', 'WTI_USD');
|
|
152
|
+
*
|
|
153
|
+
* console.log(`Period: ${march2024.period}`);
|
|
154
|
+
* console.log(`Forecast: $${march2024.forecast_price}`);
|
|
155
|
+
* console.log(`Published: ${march2024.published_at}`);
|
|
156
|
+
* ```
|
|
157
|
+
*/
|
|
158
|
+
async get(period, commodity) {
|
|
159
|
+
if (!period || typeof period !== "string") {
|
|
160
|
+
throw new errors_js_1.ValidationError("Period must be a non-empty string");
|
|
161
|
+
}
|
|
162
|
+
const params = {};
|
|
163
|
+
if (commodity)
|
|
164
|
+
params.commodity = commodity;
|
|
165
|
+
return this.client["request"](`/v1/forecasts/monthly/${period}`, params);
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
exports.ForecastsResource = ForecastsResource;
|