UNPKG

ebay-api

Version:

eBay API for Node and Browser

79 lines (78 loc) 2.97 kB
import Restful from '../../index.js'; /** * The Feed API provides the ability to download TSV_GZIP feed files containing eBay items and an hourly snapshot file * of the items that have changed within an hour for a specific category, date and marketplace. */ export default class Feed extends Restful { get basePath() { return '/buy/feed/v1_beta'; } /** * This method lets you download a TSV_GZIP (tab separated value gzip) Item feed file. * * @param {BuyFeedParams} params * @param range his header specifies the range in bytes of the chunks of the gzip file being returned. * Format: bytes=startpos-endpos For example, the following retrieves the first 10 MBs of the feed file. */ getItemFeed(params, range) { return this.get(`/item`, { params, headers: { 'Range': range } }); } /** * This method lets you download a TSV_GZIP (tab separated value gzip) Item Group feed file. * @param {BuyFeedParams} params * @param range his header specifies the range in bytes of the chunks of the gzip file being returned. * Format: bytes=startpos-endpos For example, the following retrieves the first 10 MBs of the feed file. */ getItemGroupFeed(params, range) { return this.get(`/item_group`, { params, headers: { 'Range': range } }); } /** * The Hourly Snapshot feed file is generated each hour every day for all categories. * * @param {BuyFeedParams} params * @param {String} snapshotDate * @param range his header specifies the range in bytes of the chunks of the gzip file being returned. * Format: bytes=startpos-endpos For example, the following retrieves the first 10 MBs of the feed file. */ getItemSnapshotFeed(params, snapshotDate, range) { return this.get(`/item_snapshot`, { params: { ...params, snapshot_date: snapshotDate }, headers: { 'Range': range } }); } /** * The Hourly Snapshot feed file is generated each hour every day for all categories. * * @param {BuyFeedParams} params * @param {String} snapshotDate * @param range his header specifies the range in bytes of the chunks of the gzip file being returned. * Format: bytes=startpos-endpos For example, the following retrieves the first 10 MBs of the feed file. */ getProductFeed(params, snapshotDate, range) { return this.get(`/product`, { params: { ...params, snapshot_date: snapshotDate }, headers: { 'Range': range } }); } } Feed.id = 'Feed';