Class GistStore

Hierarchy

  • GistStore

Constructors

Properties

Methods

Constructors

  • new GistStore(KV: KVNamespace<string>, PAT: string, registry_key?: string): GistStore
  • Parameters

    • KV: KVNamespace<string>

      The KV store to use, it will be used to store the registry. Only write on you create or delete a gist.

    • PAT: string

      Your GitHub Personal Access Token, to be used to update, create, or delete a gist.

    • registry_key: string = "gists"

      The key to use to store the registry in the KV store.

    Returns GistStore

Properties

registry: null | Record<string, string> = null

Cached registry. You can simply set it to null to force a refresh in the next lookup call.

Methods

  • create(key: string, value: string): Promise<boolean>
  • Create a new gist for the given key. Fail if the key already exists.

    Returns

    true if the gist was created, false if not.

    Parameters

    • key: string

      The key to create the gist for

    • value: string

      The value to set for the gist

    Returns Promise<boolean>

  • delete(key: string): Promise<boolean>
  • Delete the gist for the given key.

    Returns

    true if the gist was deleted, false if not.

    Parameters

    • key: string

      The key to delete the gist for

    Returns Promise<boolean>

  • get(key: string): Promise<undefined | string>
  • Get the content of the gist for the given key.

    Returns

    The content of the gist or undefined if not found.

    Parameters

    • key: string

      The key to get the value for

    Returns Promise<undefined | string>

  • lookup(key: string): Promise<undefined | string>
  • Lookup the gist id for the given key.

    Returns

    The gist id or undefined if not found.

    Parameters

    • key: string

      The key to lookup

    Returns Promise<undefined | string>

  • set(key: string, value: string): Promise<boolean>
  • Set the value for the given key.

    Returns

    true if the value was set, false if not.

    Parameters

    • key: string

      The key to set the value for

    • value: string

      The value to set

    Returns Promise<boolean>

Generated using TypeDoc