Options
All
  • Public
  • Public/Protected
  • All
Menu

Class wrapping @graphistry/js-upload-api::ClientPKey for client->server File and Dataset uploads using personal key authentication.

global

Hierarchy

  • ClientPKey
    • ClientPKey

Index

Methods

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

    • personalKeyId: string
    • personalKeySecret: string
    • protocol: string
    • host: string
    • Optional clientProtocolHostname: string

    Returns boolean

  • fetchToken(personalKeyId: string, personalKeySecret: string, org?: string, protocol?: string, host?: string): Promise<string>
  • Parameters

    • personalKeyId: string
    • personalKeySecret: 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.

  • 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
personalKeyId: string
protocol: string
version?: string
_getAuthTokenPromise?: Promise<string>
_token?: string
fetch: any

Constructors

  • new ClientPKey(personalKeyId: string, personalKeySecret: string, org?: string, protocol?: string, host?: string, clientProtocolHostname?: string, version?: string): ClientPKey
  • Create a Client

    example

    Authenticate against Graphistry Hub

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

    Parameters

    • personalKeyId: string

      Graphistry server personal key ID

    • personalKeySecret: string

      Graphistry server personal key secret

    • Optional org: string

      Graphistry organization (optional)

    • 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 ClientPKey