Longport OpenAPI SDK
    Preparing search index...

    Class HttpClient

    Index

    Constructors

    Methods

    • Create a new HttpClient using API Key authentication

      LONGPORT_HTTP_URL is read from the environment automatically. Passing httpUrl overrides that value.

      Parameters

      • appKey: string

        App key

      • appSecret: string

        App secret

      • accessToken: string

        Access token

      • OptionalhttpUrl: string | null

        HTTP endpoint url override (reads LONGPORT_HTTP_URL from env if omitted; falls back to https://openapi.longportapp.com)

      Returns HttpClient

    • Create a new HttpClient from environment variables (API Key mode)

      It first reads the .env file in the current directory.

      Variables

      • LONGPORT_HTTP_URL - HTTP endpoint url
      • LONGPORT_APP_KEY - App key
      • LONGPORT_APP_SECRET - App secret
      • LONGPORT_ACCESS_TOKEN - Access token

      Returns HttpClient

    • Create a new HttpClient from an OAuth handle

      LONGPORT_HTTP_URL is read from the environment automatically. Passing httpUrl overrides that value.

      Parameters

      • oauth: OAuth

        OAuth handle obtained from OAuth.build(...)

      • OptionalhttpUrl: string | null

        HTTP endpoint url override (reads LONGPORT_HTTP_URL from env if omitted; falls back to https://openapi.longportapp.com)

      Returns HttpClient

    • Performs a HTTP request

      Parameters

      • method: string
      • path: string
      • Optionalheaders: Record<string, string> | null
      • Optionalbody: any

      Returns Promise<any>