Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface KvsService

Hierarchy

  • KvsService

Index

Methods

delete

  • delete(key: string): Promise<void>
  • Deletes the specified key

    example

    bp.kvs.forBot('bot123').delete('hello/whatsup')

    Parameters

    • key: string

    Returns Promise<void>

exists

  • exists(key: string): Promise<boolean>
  • Whether or not the specified key exists

    example

    bp.kvs.forBot('bot123').exists('hello/whatsup')

    Parameters

    • key: string

    Returns Promise<boolean>

get

  • get(key: string, path?: undefined | string): Promise<any>
  • Returns the specified key as JSON object

    example

    bp.kvs.forBot('bot123').get('hello/whatsup')

    Parameters

    • key: string
    • Optional path: undefined | string

    Returns Promise<any>

getConversationStorageKey

  • getConversationStorageKey(sessionId: string, variable: string): string
  • Parameters

    • sessionId: string
    • variable: string

    Returns string

getGlobalStorageKey

  • getGlobalStorageKey(variable: string): string

getStorageWithExpiry

  • getStorageWithExpiry(key: string): any
  • deprecated

    Use bp.kvs.forBot().get() which handles expiry automatically

    Parameters

    • key: string

    Returns any

getUserStorageKey

  • getUserStorageKey(userId: string, variable: string): string

removeStorageKeysStartingWith

  • removeStorageKeysStartingWith(key: any): Promise<void>

set

  • set(key: string, value: any, path?: undefined | string, expiry?: undefined | string): Promise<void>
  • Saves the specified key as JSON object

    example

    bp.kvs.forBot('bot123').set('hello/whatsup', { msg: 'i love you' })

    Parameters

    • key: string
    • value: any
    • Optional path: undefined | string
    • Optional expiry: undefined | string

      The key will expire in X (eg: 10m, 1d, 30 days) - refer to https://www.npmjs.com/package/ms for options

    Returns Promise<void>

setStorageWithExpiry

  • setStorageWithExpiry(key: string, value: any, expiry?: undefined | string): any
  • deprecated

    Use bp.kvs.forBot().set() and set an expiry as the last parameter

    Parameters

    • key: string
    • value: any
    • Optional expiry: undefined | string

    Returns any

Generated using TypeDoc