Options
All
  • Public
  • Public/Protected
  • All
Menu

Class wrapping @graphistry/js-upload-api::Client for client->server File and Dataset uploads.

global

Hierarchy

  • Client
    • Client

Index

Methods

  • isConfigurationValid(userId: string, secret: string, host: string): boolean
  • authTokenValid(): boolean
  • checkStale(username: string, password: string, protocol: string, host: string, clientProtocolHostname?: string): boolean
  • Parameters

    • username: string
    • password: string
    • protocol: string
    • host: string
    • Optional clientProtocolHostname: string

    Returns boolean

  • fetchToken(username: string, password: string, org?: string, protocol?: string, host?: string): Promise<string>
  • Parameters

    • username: string
    • password: string
    • Optional org: string
    • Optional protocol: string
    • Optional host: string

    Returns Promise<string>

    Promise for the authentication token

    Helper to fetch a token for a given user

  • isServerConfigured(): boolean
  • post(uri: string, payload: any, baseHeaders?: any): Promise<any>
  • internal

    Internal helper

    Parameters

    • uri: string

      The URI to upload to.

    • payload: any

      The payload to upload.

    • Optional baseHeaders: any

      Optionally override base header object to mix with auth header for the upload.

    Returns Promise<any>

    The response from the server.

  • setToken(token: string): Client
  • getAuthToken(force?: boolean): Promise<string>
  • Get the authentication token for the current user. By default, reuses current token if available.

    Parameters

    • Optional force: boolean

      If true, forces a new token to be generated; defaults to false

    Returns Promise<string>

    The authentication token

  • getBaseHeaders(): { Accept: string; Content-Type: string }
  • getBaseUrl(): string
  • getToApi(url: string, headers: any, baseUrl?: string): Promise<any>
  • postToApi(url: string, data: any, headers: any, baseUrl?: string): Promise<any>

Properties

agent: string
clientProtocolHostname: string
host: string
org?: string
protocol: string
username: string
version?: string
_getAuthTokenPromise?: Promise<string>
_token?: string
fetch: any

Constructors

  • new Client(username: string, password: string, org?: string, protocol?: string, host?: string, clientProtocolHostname?: string, version?: string): Client
  • Create a Client

    example

    Authenticate against Graphistry Hub

    import { Client } from '@graphistry/client-api';
    const client = new Client('my_username', 'my_password');

    Parameters

    • username: string

      Graphistry server username

    • password: string

      Graphistry server password

    • Optional org: string
    • protocol: string = 'https'
    • host: string = 'hub.graphistry.com'
    • Optional clientProtocolHostname: string

      Override URL base path shown in browsers. By default uses protocol/host combo, e.g., https://hub.graphistry.com

      For more examples, see @graphistry/node-api and @graphistry/js-upload-api docs

    • version: string = VERSION

    Returns Client