Options
All
  • Public
  • Public/Protected
  • All
Menu

Hierarchy

  • AmazonOrderReportsApi

Index

Constructors

constructor

  • new AmazonOrderReportsApi(options: { baseUrl?: undefined | string; cookies?: undefined | Cookie[]; logLevel?: undefined | DEBUG | INFO | ERROR | NONE | SILLY; otpFn?: undefined | (() => string | Promise<string>); otpSecret?: undefined | string; password: string | (() => string | Promise<string>); puppeteerOpts?: undefined | LaunchOptions; saveCookiesFn?: undefined | ((cookies: Cookie[]) => void | Promise<void>); username: string | (() => string | Promise<string>) }): AmazonOrderReportsApi
  • Parameters

    • options: { baseUrl?: undefined | string; cookies?: undefined | Cookie[]; logLevel?: undefined | DEBUG | INFO | ERROR | NONE | SILLY; otpFn?: undefined | (() => string | Promise<string>); otpSecret?: undefined | string; password: string | (() => string | Promise<string>); puppeteerOpts?: undefined | LaunchOptions; saveCookiesFn?: undefined | ((cookies: Cookie[]) => void | Promise<void>); username: string | (() => string | Promise<string>) }
      • Optional baseUrl?: undefined | string

        Base URL to use for Amazon.

        default

        https://www.amazon.com

      • Optional cookies?: undefined | Cookie[]

        Cookies from a previous run. These can be acquired using saveCookiesFn to avoid unnecessary repeated authentications.

      • Optional logLevel?: undefined | DEBUG | INFO | ERROR | NONE | SILLY

        Emit log messages at this level. Currently only LogLevel.DEBUG is used.

        default

        LogLevel.NONE

      • Optional otpFn?: undefined | (() => string | Promise<string>)

        If provided, otpFn will be called during login if a OTP code is required. This option will be ignored if otpSecret is provided.

      • Optional otpSecret?: undefined | string

        If provided, otpSecret will be used to generate an OTP code during login. This is the code you get during the Authenticator App setup on the 2SV Settings page. Care should be taken to store this securely. An insecurely stored OTP secret is the same as not having OTP at all.

      • password: string | (() => string | Promise<string>)

        Amazon account password. This may be a string or a provider function.

      • Optional puppeteerOpts?: undefined | LaunchOptions

        Puppeteer launch options. See the Puppeteer docs for more info.

      • Optional saveCookiesFn?: undefined | ((cookies: Cookie[]) => void | Promise<void>)

        If provided, this function will be called with Puppeteer's cookies after login which can be provided to cookies when creating a new instance of AmazonOrderReportsApi.

      • username: string | (() => string | Promise<string>)

        Amazon account username. This may be a string or a provider function.

    Returns AmazonOrderReportsApi

Methods

getItems

  • getItems(options?: { endDate: Date; startDate: Date }): AsyncGenerator<OrderItem, any, unknown>
  • Retrieve ordered items in the given date range. If no date range is given, the previous 30 days will be used.

    Parameters

    • options: { endDate: Date; startDate: Date } = ...
      • endDate: Date

        End of date range to report.

      • startDate: Date

        Start of date range to report.

    Returns AsyncGenerator<OrderItem, any, unknown>

getRefunds

  • getRefunds(options?: { endDate: Date; startDate: Date }): AsyncGenerator<Refund, any, unknown>
  • Retrieve refunds in the given date range. If no date range is given, the previous 30 days will be used.

    Parameters

    • options: { endDate: Date; startDate: Date } = ...
      • endDate: Date

        End of date range to report.

      • startDate: Date

        Start of date range to report.

    Returns AsyncGenerator<Refund, any, unknown>

getShipments

  • getShipments(options?: { endDate: Date; startDate: Date }): AsyncGenerator<Shipment, any, unknown>
  • Retrieve shipments in the given date range. If no date range is given, the previous 30 days will be used.

    Parameters

    • options: { endDate: Date; startDate: Date } = ...
      • endDate: Date

        End of date range to report.

      • startDate: Date

        Start of date range to report.

    Returns AsyncGenerator<Shipment, any, unknown>

start

  • start(): Promise<void>

stop

  • stop(): Promise<void>
  • Stop the internal Puppeteer instance.

    Returns Promise<void>

Legend

  • Constructor
  • Method
  • Property

Generated using TypeDoc