/** * Storage Resource * * Access crude oil storage data including total US inventory, Cushing hub levels, * Strategic Petroleum Reserve (SPR), and regional breakdowns. */ import type { OilPriceAPI } from "../client.js"; /** * Storage level data */ export interface StorageData { /** Storage location code */ code: string; /** Location name */ name?: string; /** Current storage level */ level: number; /** Unit of measurement (typically "thousand_barrels" or "million_barrels") */ unit: string; /** ISO timestamp when data was recorded */ timestamp: string; /** Change from previous period */ change?: number; /** Percentage change */ change_percent?: number; /** Additional metadata */ metadata?: Record; } /** * Historical storage data point */ export interface HistoricalStorageData { /** Date in YYYY-MM-DD format */ date: string; /** Storage level */ level: number; /** Unit of measurement */ unit: string; /** Week-over-week change */ change?: number; } /** * Options for historical storage query */ export interface HistoricalStorageOptions { /** * Lookback period. The API reads a `period` token, one of * '7d' | '30d' | '90d' (default) | '1y' | 'all' — not arbitrary date ranges. */ period?: "7d" | "30d" | "90d" | "1y" | "all"; } /** * Storage Resource * * Access crude oil storage data for US inventory levels, Cushing hub, * Strategic Petroleum Reserve, and regional breakdowns. * * @example * ```typescript * import { OilPriceAPI } from 'oilpriceapi'; * * const client = new OilPriceAPI({ apiKey: 'your_key' }); * * // Get all storage data * const storage = await client.storage.all(); * console.log(`Total US inventory: ${storage.level} ${storage.unit}`); * * // Get Cushing levels * const cushing = await client.storage.cushing(); * console.log(`Cushing: ${cushing.level} ${cushing.unit}`); * * // Get SPR levels * const spr = await client.storage.spr(); * console.log(`SPR: ${spr.level} ${spr.unit}`); * ``` */ export declare class StorageResource { private client; constructor(client: OilPriceAPI); /** * Get all current storage levels * * Returns total US commercial crude oil inventory. * * @returns Current storage data * * @throws {OilPriceAPIError} If API request fails * @throws {AuthenticationError} If API key is invalid * * @example * ```typescript * const storage = await client.storage.all(); * console.log(`Total inventory: ${storage.level} ${storage.unit}`); * if (storage.change) { * console.log(`Change: ${storage.change > 0 ? '+' : ''}${storage.change}`); * } * ``` */ all(): Promise; /** * Get Cushing, OK storage levels * * Returns current inventory at Cushing, Oklahoma - the key delivery point * for WTI crude oil futures. * * @returns Cushing storage data * * @throws {OilPriceAPIError} If API request fails * @throws {AuthenticationError} If API key is invalid * * @example * ```typescript * const cushing = await client.storage.cushing(); * console.log(`Cushing inventory: ${cushing.level} ${cushing.unit}`); * console.log(`Week-over-week change: ${cushing.change_percent}%`); * ``` */ cushing(): Promise; /** * Get Strategic Petroleum Reserve (SPR) levels * * Returns current US Strategic Petroleum Reserve inventory. * * @returns SPR storage data * * @throws {OilPriceAPIError} If API request fails * @throws {AuthenticationError} If API key is invalid * * @example * ```typescript * const spr = await client.storage.spr(); * console.log(`SPR inventory: ${spr.level} ${spr.unit}`); * ``` */ spr(): Promise; /** * Get regional storage breakdown * * Returns storage levels by region (PADD districts) or a specific region. * * @param region - Optional region code (e.g., "PADD1", "PADD2", "PADD3") * @returns Regional storage data * * @throws {OilPriceAPIError} If API request fails * @throws {AuthenticationError} If API key is invalid * * @example * ```typescript * // Get all regions * const regions = await client.storage.regional(); * * // Get specific region (Gulf Coast) * const gulfCoast = await client.storage.regional('PADD3'); * console.log(`PADD 3 (Gulf Coast): ${gulfCoast.level} ${gulfCoast.unit}`); * ``` */ regional(region?: string): Promise; /** * Get historical storage data * * Returns time series of storage levels for a specific location. * * @param code - Storage location code (e.g., "US", "CUSHING", "SPR") * @param options - Date range filters * @returns Array of historical storage data * * @throws {NotFoundError} If location code not found * @throws {OilPriceAPIError} If API request fails * * @example * ```typescript * const history = await client.storage.history('CUSHING', { * startDate: '2024-01-01', * endDate: '2024-12-31' * }); * * history.forEach(point => { * console.log(`${point.date}: ${point.level} ${point.unit}`); * }); * ``` */ history(code: string, options?: HistoricalStorageOptions): Promise; }