oilpriceapi 0.5.3 → 0.7.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 +395 -110
- package/dist/client.d.ts +83 -3
- package/dist/client.js +118 -38
- package/dist/index.d.ts +31 -6
- package/dist/index.js +17 -3
- package/dist/resources/alerts.d.ts +52 -15
- package/dist/resources/alerts.js +143 -85
- package/dist/resources/analytics.d.ts +325 -0
- package/dist/resources/analytics.js +221 -0
- package/dist/resources/bunker-fuels.d.ts +270 -0
- package/dist/resources/bunker-fuels.js +191 -0
- package/dist/resources/commodities.d.ts +148 -0
- package/dist/resources/commodities.js +110 -0
- package/dist/resources/data-quality.d.ts +229 -0
- package/dist/resources/data-quality.js +139 -0
- package/dist/resources/data-sources.d.ts +365 -0
- package/dist/resources/data-sources.js +349 -0
- package/dist/resources/drilling.d.ts +403 -0
- package/dist/resources/drilling.js +264 -0
- package/dist/resources/ei/drilling-productivity.d.ts +173 -0
- package/dist/resources/ei/drilling-productivity.js +103 -0
- package/dist/resources/ei/forecasts.d.ts +177 -0
- package/dist/resources/ei/forecasts.js +101 -0
- package/dist/resources/ei/frac-focus.d.ts +212 -0
- package/dist/resources/ei/frac-focus.js +150 -0
- package/dist/resources/ei/index.d.ts +140 -0
- package/dist/resources/ei/index.js +87 -0
- package/dist/resources/ei/oil-inventories.d.ts +155 -0
- package/dist/resources/ei/oil-inventories.js +92 -0
- package/dist/resources/ei/opec-production.d.ts +146 -0
- package/dist/resources/ei/opec-production.js +92 -0
- package/dist/resources/ei/rig-counts.d.ts +131 -0
- package/dist/resources/ei/rig-counts.js +88 -0
- package/dist/resources/ei/well-permits.d.ts +178 -0
- package/dist/resources/ei/well-permits.js +119 -0
- package/dist/resources/forecasts.d.ts +200 -0
- package/dist/resources/forecasts.js +157 -0
- package/dist/resources/futures.d.ts +322 -0
- package/dist/resources/futures.js +228 -0
- package/dist/resources/rig-counts.d.ts +221 -0
- package/dist/resources/rig-counts.js +157 -0
- package/dist/resources/storage.d.ts +182 -0
- package/dist/resources/storage.js +161 -0
- package/dist/resources/webhooks.d.ts +290 -0
- package/dist/resources/webhooks.js +297 -0
- package/dist/types.d.ts +106 -6
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +3 -3
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Storage Resource
|
|
3
|
+
*
|
|
4
|
+
* Access crude oil storage data including total US inventory, Cushing hub levels,
|
|
5
|
+
* Strategic Petroleum Reserve (SPR), and regional breakdowns.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Storage Resource
|
|
9
|
+
*
|
|
10
|
+
* Access crude oil storage data for US inventory levels, Cushing hub,
|
|
11
|
+
* Strategic Petroleum Reserve, and regional breakdowns.
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```typescript
|
|
15
|
+
* import { OilPriceAPI } from 'oilpriceapi';
|
|
16
|
+
*
|
|
17
|
+
* const client = new OilPriceAPI({ apiKey: 'your_key' });
|
|
18
|
+
*
|
|
19
|
+
* // Get all storage data
|
|
20
|
+
* const storage = await client.storage.all();
|
|
21
|
+
* console.log(`Total US inventory: ${storage.level} ${storage.unit}`);
|
|
22
|
+
*
|
|
23
|
+
* // Get Cushing levels
|
|
24
|
+
* const cushing = await client.storage.cushing();
|
|
25
|
+
* console.log(`Cushing: ${cushing.level} ${cushing.unit}`);
|
|
26
|
+
*
|
|
27
|
+
* // Get SPR levels
|
|
28
|
+
* const spr = await client.storage.spr();
|
|
29
|
+
* console.log(`SPR: ${spr.level} ${spr.unit}`);
|
|
30
|
+
* ```
|
|
31
|
+
*/
|
|
32
|
+
export class StorageResource {
|
|
33
|
+
constructor(client) {
|
|
34
|
+
this.client = client;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Get all current storage levels
|
|
38
|
+
*
|
|
39
|
+
* Returns total US commercial crude oil inventory.
|
|
40
|
+
*
|
|
41
|
+
* @returns Current storage data
|
|
42
|
+
*
|
|
43
|
+
* @throws {OilPriceAPIError} If API request fails
|
|
44
|
+
* @throws {AuthenticationError} If API key is invalid
|
|
45
|
+
*
|
|
46
|
+
* @example
|
|
47
|
+
* ```typescript
|
|
48
|
+
* const storage = await client.storage.all();
|
|
49
|
+
* console.log(`Total inventory: ${storage.level} ${storage.unit}`);
|
|
50
|
+
* if (storage.change) {
|
|
51
|
+
* console.log(`Change: ${storage.change > 0 ? '+' : ''}${storage.change}`);
|
|
52
|
+
* }
|
|
53
|
+
* ```
|
|
54
|
+
*/
|
|
55
|
+
async all() {
|
|
56
|
+
return this.client["request"]("/v1/storage", {});
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Get Cushing, OK storage levels
|
|
60
|
+
*
|
|
61
|
+
* Returns current inventory at Cushing, Oklahoma - the key delivery point
|
|
62
|
+
* for WTI crude oil futures.
|
|
63
|
+
*
|
|
64
|
+
* @returns Cushing storage data
|
|
65
|
+
*
|
|
66
|
+
* @throws {OilPriceAPIError} If API request fails
|
|
67
|
+
* @throws {AuthenticationError} If API key is invalid
|
|
68
|
+
*
|
|
69
|
+
* @example
|
|
70
|
+
* ```typescript
|
|
71
|
+
* const cushing = await client.storage.cushing();
|
|
72
|
+
* console.log(`Cushing inventory: ${cushing.level} ${cushing.unit}`);
|
|
73
|
+
* console.log(`Week-over-week change: ${cushing.change_percent}%`);
|
|
74
|
+
* ```
|
|
75
|
+
*/
|
|
76
|
+
async cushing() {
|
|
77
|
+
return this.client["request"]("/v1/storage/cushing", {});
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Get Strategic Petroleum Reserve (SPR) levels
|
|
81
|
+
*
|
|
82
|
+
* Returns current US Strategic Petroleum Reserve inventory.
|
|
83
|
+
*
|
|
84
|
+
* @returns SPR storage data
|
|
85
|
+
*
|
|
86
|
+
* @throws {OilPriceAPIError} If API request fails
|
|
87
|
+
* @throws {AuthenticationError} If API key is invalid
|
|
88
|
+
*
|
|
89
|
+
* @example
|
|
90
|
+
* ```typescript
|
|
91
|
+
* const spr = await client.storage.spr();
|
|
92
|
+
* console.log(`SPR inventory: ${spr.level} ${spr.unit}`);
|
|
93
|
+
* ```
|
|
94
|
+
*/
|
|
95
|
+
async spr() {
|
|
96
|
+
return this.client["request"]("/v1/storage/spr", {});
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Get regional storage breakdown
|
|
100
|
+
*
|
|
101
|
+
* Returns storage levels by region (PADD districts) or a specific region.
|
|
102
|
+
*
|
|
103
|
+
* @param region - Optional region code (e.g., "PADD1", "PADD2", "PADD3")
|
|
104
|
+
* @returns Regional storage data
|
|
105
|
+
*
|
|
106
|
+
* @throws {OilPriceAPIError} If API request fails
|
|
107
|
+
* @throws {AuthenticationError} If API key is invalid
|
|
108
|
+
*
|
|
109
|
+
* @example
|
|
110
|
+
* ```typescript
|
|
111
|
+
* // Get all regions
|
|
112
|
+
* const regions = await client.storage.regional();
|
|
113
|
+
*
|
|
114
|
+
* // Get specific region (Gulf Coast)
|
|
115
|
+
* const gulfCoast = await client.storage.regional('PADD3');
|
|
116
|
+
* console.log(`PADD 3 (Gulf Coast): ${gulfCoast.level} ${gulfCoast.unit}`);
|
|
117
|
+
* ```
|
|
118
|
+
*/
|
|
119
|
+
async regional(region) {
|
|
120
|
+
const params = {};
|
|
121
|
+
if (region)
|
|
122
|
+
params.region = region;
|
|
123
|
+
return this.client["request"]("/v1/storage/regional", params);
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Get historical storage data
|
|
127
|
+
*
|
|
128
|
+
* Returns time series of storage levels for a specific location.
|
|
129
|
+
*
|
|
130
|
+
* @param code - Storage location code (e.g., "US", "CUSHING", "SPR")
|
|
131
|
+
* @param options - Date range filters
|
|
132
|
+
* @returns Array of historical storage data
|
|
133
|
+
*
|
|
134
|
+
* @throws {NotFoundError} If location code not found
|
|
135
|
+
* @throws {OilPriceAPIError} If API request fails
|
|
136
|
+
*
|
|
137
|
+
* @example
|
|
138
|
+
* ```typescript
|
|
139
|
+
* const history = await client.storage.history('CUSHING', {
|
|
140
|
+
* startDate: '2024-01-01',
|
|
141
|
+
* endDate: '2024-12-31'
|
|
142
|
+
* });
|
|
143
|
+
*
|
|
144
|
+
* history.forEach(point => {
|
|
145
|
+
* console.log(`${point.date}: ${point.level} ${point.unit}`);
|
|
146
|
+
* });
|
|
147
|
+
* ```
|
|
148
|
+
*/
|
|
149
|
+
async history(code, options) {
|
|
150
|
+
if (!code || typeof code !== "string") {
|
|
151
|
+
throw new Error("Storage location code must be a non-empty string");
|
|
152
|
+
}
|
|
153
|
+
const params = {};
|
|
154
|
+
if (options?.startDate)
|
|
155
|
+
params.start_date = options.startDate;
|
|
156
|
+
if (options?.endDate)
|
|
157
|
+
params.end_date = options.endDate;
|
|
158
|
+
const response = await this.client["request"](`/v1/storage/${code}/history`, params);
|
|
159
|
+
return Array.isArray(response) ? response : response.data;
|
|
160
|
+
}
|
|
161
|
+
}
|
|
@@ -0,0 +1,290 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Webhooks Resource
|
|
3
|
+
*
|
|
4
|
+
* Manage webhook endpoints for real-time event notifications.
|
|
5
|
+
*/
|
|
6
|
+
import type { OilPriceAPI } from "../client.js";
|
|
7
|
+
/**
|
|
8
|
+
* Webhook endpoint configuration
|
|
9
|
+
*/
|
|
10
|
+
export interface WebhookEndpoint {
|
|
11
|
+
/** Unique webhook identifier */
|
|
12
|
+
id: string;
|
|
13
|
+
/** User-friendly webhook name */
|
|
14
|
+
name: string;
|
|
15
|
+
/** Webhook URL (must be HTTPS) */
|
|
16
|
+
url: string;
|
|
17
|
+
/** Event types to subscribe to */
|
|
18
|
+
events: string[];
|
|
19
|
+
/** Whether the webhook is active */
|
|
20
|
+
enabled: boolean;
|
|
21
|
+
/** Optional secret for signature verification */
|
|
22
|
+
secret?: string;
|
|
23
|
+
/** Optional metadata */
|
|
24
|
+
metadata?: Record<string, unknown>;
|
|
25
|
+
/** Number of successful deliveries */
|
|
26
|
+
successful_deliveries: number;
|
|
27
|
+
/** Number of failed deliveries */
|
|
28
|
+
failed_deliveries: number;
|
|
29
|
+
/** Last delivery status */
|
|
30
|
+
last_delivery_status?: "success" | "failed";
|
|
31
|
+
/** ISO timestamp of last delivery attempt */
|
|
32
|
+
last_delivery_at?: string;
|
|
33
|
+
/** ISO timestamp when webhook was created */
|
|
34
|
+
created_at: string;
|
|
35
|
+
/** ISO timestamp when webhook was last updated */
|
|
36
|
+
updated_at: string;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Parameters for creating a webhook
|
|
40
|
+
*/
|
|
41
|
+
export interface CreateWebhookParams {
|
|
42
|
+
/** User-friendly webhook name */
|
|
43
|
+
name: string;
|
|
44
|
+
/** Webhook URL (must be HTTPS) */
|
|
45
|
+
url: string;
|
|
46
|
+
/** Event types to subscribe to */
|
|
47
|
+
events: string[];
|
|
48
|
+
/** Whether to enable immediately (default: true) */
|
|
49
|
+
enabled?: boolean;
|
|
50
|
+
/** Optional secret for signature verification */
|
|
51
|
+
secret?: string;
|
|
52
|
+
/** Optional metadata */
|
|
53
|
+
metadata?: Record<string, unknown>;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Parameters for updating a webhook
|
|
57
|
+
*/
|
|
58
|
+
export interface UpdateWebhookParams {
|
|
59
|
+
/** User-friendly webhook name */
|
|
60
|
+
name?: string;
|
|
61
|
+
/** Webhook URL */
|
|
62
|
+
url?: string;
|
|
63
|
+
/** Event types to subscribe to */
|
|
64
|
+
events?: string[];
|
|
65
|
+
/** Whether the webhook is active */
|
|
66
|
+
enabled?: boolean;
|
|
67
|
+
/** Secret for signature verification */
|
|
68
|
+
secret?: string;
|
|
69
|
+
/** Metadata */
|
|
70
|
+
metadata?: Record<string, unknown>;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Webhook test response
|
|
74
|
+
*/
|
|
75
|
+
export interface WebhookTestResponse {
|
|
76
|
+
/** Test result status */
|
|
77
|
+
success: boolean;
|
|
78
|
+
/** HTTP status code from webhook endpoint */
|
|
79
|
+
status_code: number;
|
|
80
|
+
/** Response time in milliseconds */
|
|
81
|
+
response_time_ms: number;
|
|
82
|
+
/** Response body from webhook endpoint */
|
|
83
|
+
response_body?: string;
|
|
84
|
+
/** Error message if test failed */
|
|
85
|
+
error?: string;
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Webhook event record
|
|
89
|
+
*/
|
|
90
|
+
export interface WebhookEvent {
|
|
91
|
+
/** Event ID */
|
|
92
|
+
id: string;
|
|
93
|
+
/** Webhook endpoint ID */
|
|
94
|
+
webhook_id: string;
|
|
95
|
+
/** Event type */
|
|
96
|
+
event_type: string;
|
|
97
|
+
/** Event payload */
|
|
98
|
+
payload: Record<string, unknown>;
|
|
99
|
+
/** Delivery status */
|
|
100
|
+
status: "pending" | "success" | "failed";
|
|
101
|
+
/** Number of delivery attempts */
|
|
102
|
+
attempts: number;
|
|
103
|
+
/** HTTP status code from delivery */
|
|
104
|
+
status_code?: number;
|
|
105
|
+
/** Error message if delivery failed */
|
|
106
|
+
error?: string;
|
|
107
|
+
/** ISO timestamp when event was created */
|
|
108
|
+
created_at: string;
|
|
109
|
+
/** ISO timestamp of last delivery attempt */
|
|
110
|
+
delivered_at?: string;
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* Webhooks Resource
|
|
114
|
+
*
|
|
115
|
+
* Manage webhook endpoints for real-time notifications about price changes,
|
|
116
|
+
* alerts, and other events.
|
|
117
|
+
*
|
|
118
|
+
* @example
|
|
119
|
+
* ```typescript
|
|
120
|
+
* import { OilPriceAPI } from 'oilpriceapi';
|
|
121
|
+
*
|
|
122
|
+
* const client = new OilPriceAPI({ apiKey: 'your_key' });
|
|
123
|
+
*
|
|
124
|
+
* // Create a webhook
|
|
125
|
+
* const webhook = await client.webhooks.create({
|
|
126
|
+
* name: 'Price Updates',
|
|
127
|
+
* url: 'https://myapp.com/webhooks/prices',
|
|
128
|
+
* events: ['price.updated', 'alert.triggered'],
|
|
129
|
+
* enabled: true
|
|
130
|
+
* });
|
|
131
|
+
*
|
|
132
|
+
* // Test the webhook
|
|
133
|
+
* const test = await client.webhooks.test(webhook.id);
|
|
134
|
+
* console.log(`Test result: ${test.success ? 'passed' : 'failed'}`);
|
|
135
|
+
*
|
|
136
|
+
* // List all webhooks
|
|
137
|
+
* const webhooks = await client.webhooks.list();
|
|
138
|
+
* webhooks.forEach(wh => {
|
|
139
|
+
* console.log(`${wh.name}: ${wh.successful_deliveries} successful`);
|
|
140
|
+
* });
|
|
141
|
+
*
|
|
142
|
+
* // Update webhook
|
|
143
|
+
* await client.webhooks.update(webhook.id, {
|
|
144
|
+
* enabled: false
|
|
145
|
+
* });
|
|
146
|
+
*
|
|
147
|
+
* // Delete webhook
|
|
148
|
+
* await client.webhooks.delete(webhook.id);
|
|
149
|
+
* ```
|
|
150
|
+
*/
|
|
151
|
+
export declare class WebhooksResource {
|
|
152
|
+
private client;
|
|
153
|
+
constructor(client: OilPriceAPI);
|
|
154
|
+
/**
|
|
155
|
+
* List all webhook endpoints
|
|
156
|
+
*
|
|
157
|
+
* @returns Array of webhook endpoints
|
|
158
|
+
*
|
|
159
|
+
* @throws {OilPriceAPIError} If API request fails
|
|
160
|
+
* @throws {AuthenticationError} If API key is invalid
|
|
161
|
+
*
|
|
162
|
+
* @example
|
|
163
|
+
* ```typescript
|
|
164
|
+
* const webhooks = await client.webhooks.list();
|
|
165
|
+
* webhooks.forEach(wh => {
|
|
166
|
+
* console.log(`${wh.name} (${wh.enabled ? 'enabled' : 'disabled'})`);
|
|
167
|
+
* console.log(` Events: ${wh.events.join(', ')}`);
|
|
168
|
+
* });
|
|
169
|
+
* ```
|
|
170
|
+
*/
|
|
171
|
+
list(): Promise<WebhookEndpoint[]>;
|
|
172
|
+
/**
|
|
173
|
+
* Get a specific webhook endpoint
|
|
174
|
+
*
|
|
175
|
+
* @param id - Webhook ID
|
|
176
|
+
* @returns Webhook endpoint details
|
|
177
|
+
*
|
|
178
|
+
* @throws {NotFoundError} If webhook not found
|
|
179
|
+
* @throws {OilPriceAPIError} If API request fails
|
|
180
|
+
*
|
|
181
|
+
* @example
|
|
182
|
+
* ```typescript
|
|
183
|
+
* const webhook = await client.webhooks.get('webhook-id');
|
|
184
|
+
* console.log(`${webhook.name}: ${webhook.url}`);
|
|
185
|
+
* console.log(`Success rate: ${webhook.successful_deliveries}/${webhook.successful_deliveries + webhook.failed_deliveries}`);
|
|
186
|
+
* ```
|
|
187
|
+
*/
|
|
188
|
+
get(id: string): Promise<WebhookEndpoint>;
|
|
189
|
+
/**
|
|
190
|
+
* Create a new webhook endpoint
|
|
191
|
+
*
|
|
192
|
+
* @param params - Webhook configuration
|
|
193
|
+
* @returns Created webhook endpoint
|
|
194
|
+
*
|
|
195
|
+
* @throws {OilPriceAPIError} If API request fails
|
|
196
|
+
* @throws {AuthenticationError} If API key is invalid
|
|
197
|
+
*
|
|
198
|
+
* @example
|
|
199
|
+
* ```typescript
|
|
200
|
+
* const webhook = await client.webhooks.create({
|
|
201
|
+
* name: 'Production Alerts',
|
|
202
|
+
* url: 'https://api.myapp.com/webhooks',
|
|
203
|
+
* events: ['alert.triggered', 'price.updated'],
|
|
204
|
+
* secret: 'my-webhook-secret',
|
|
205
|
+
* enabled: true
|
|
206
|
+
* });
|
|
207
|
+
* console.log(`Webhook created: ${webhook.id}`);
|
|
208
|
+
* ```
|
|
209
|
+
*/
|
|
210
|
+
create(params: CreateWebhookParams): Promise<WebhookEndpoint>;
|
|
211
|
+
/**
|
|
212
|
+
* Update a webhook endpoint
|
|
213
|
+
*
|
|
214
|
+
* @param id - Webhook ID
|
|
215
|
+
* @param params - Fields to update
|
|
216
|
+
* @returns Updated webhook endpoint
|
|
217
|
+
*
|
|
218
|
+
* @throws {NotFoundError} If webhook not found
|
|
219
|
+
* @throws {OilPriceAPIError} If API request fails
|
|
220
|
+
*
|
|
221
|
+
* @example
|
|
222
|
+
* ```typescript
|
|
223
|
+
* // Disable a webhook
|
|
224
|
+
* await client.webhooks.update(webhookId, { enabled: false });
|
|
225
|
+
*
|
|
226
|
+
* // Change events
|
|
227
|
+
* await client.webhooks.update(webhookId, {
|
|
228
|
+
* events: ['alert.triggered']
|
|
229
|
+
* });
|
|
230
|
+
* ```
|
|
231
|
+
*/
|
|
232
|
+
update(id: string, params: UpdateWebhookParams): Promise<WebhookEndpoint>;
|
|
233
|
+
/**
|
|
234
|
+
* Delete a webhook endpoint
|
|
235
|
+
*
|
|
236
|
+
* @param id - Webhook ID
|
|
237
|
+
*
|
|
238
|
+
* @throws {NotFoundError} If webhook not found
|
|
239
|
+
* @throws {OilPriceAPIError} If API request fails
|
|
240
|
+
*
|
|
241
|
+
* @example
|
|
242
|
+
* ```typescript
|
|
243
|
+
* await client.webhooks.delete(webhookId);
|
|
244
|
+
* console.log('Webhook deleted');
|
|
245
|
+
* ```
|
|
246
|
+
*/
|
|
247
|
+
delete(id: string): Promise<void>;
|
|
248
|
+
/**
|
|
249
|
+
* Test a webhook endpoint
|
|
250
|
+
*
|
|
251
|
+
* Sends a test payload to the webhook URL to verify it's reachable.
|
|
252
|
+
*
|
|
253
|
+
* @param id - Webhook ID
|
|
254
|
+
* @returns Test results
|
|
255
|
+
*
|
|
256
|
+
* @throws {NotFoundError} If webhook not found
|
|
257
|
+
* @throws {OilPriceAPIError} If API request fails
|
|
258
|
+
*
|
|
259
|
+
* @example
|
|
260
|
+
* ```typescript
|
|
261
|
+
* const test = await client.webhooks.test(webhookId);
|
|
262
|
+
* console.log(`Test ${test.success ? 'passed' : 'failed'}`);
|
|
263
|
+
* console.log(`Response time: ${test.response_time_ms}ms`);
|
|
264
|
+
* if (!test.success) {
|
|
265
|
+
* console.log(`Error: ${test.error}`);
|
|
266
|
+
* }
|
|
267
|
+
* ```
|
|
268
|
+
*/
|
|
269
|
+
test(id: string): Promise<WebhookTestResponse>;
|
|
270
|
+
/**
|
|
271
|
+
* Get webhook event history
|
|
272
|
+
*
|
|
273
|
+
* Returns recent delivery events for a webhook.
|
|
274
|
+
*
|
|
275
|
+
* @param id - Webhook ID
|
|
276
|
+
* @returns Array of webhook events
|
|
277
|
+
*
|
|
278
|
+
* @throws {NotFoundError} If webhook not found
|
|
279
|
+
* @throws {OilPriceAPIError} If API request fails
|
|
280
|
+
*
|
|
281
|
+
* @example
|
|
282
|
+
* ```typescript
|
|
283
|
+
* const events = await client.webhooks.events(webhookId);
|
|
284
|
+
* events.forEach(event => {
|
|
285
|
+
* console.log(`${event.event_type}: ${event.status} (${event.attempts} attempts)`);
|
|
286
|
+
* });
|
|
287
|
+
* ```
|
|
288
|
+
*/
|
|
289
|
+
events(id: string): Promise<WebhookEvent[]>;
|
|
290
|
+
}
|