GET Spaces Data

Static

Stateful

Static

Box.getSpace(address, name, opts)

Get the public data in a space of a given address with the given name

Kind: static method of Box Returns: Object - a json object with the public space data

Param

Type

Description

address

String

An ethereum address

name

String

A space name

opts

Object

Optional parameters

opts.blocklist

function

A function that takes an address and returns true if the user has been blocked

opts.metadata

String

flag to retrieve metadata

opts.profileServer

String

URL of Profile API server

Box.listSpaces(address, opts)

Get the names of all spaces a user has

Kind: static method of Box Returns: Object - an array with all spaces as strings

Param

Type

Description

address

String

An ethereum address

opts

Object

Optional parameters

opts.profileServer

String

URL of Profile API server

Stateful

The space object is an instance of a particular space. See the Auth section for how to create an instance of a space.

space.all(opts)

Get all values and optionally metadata

Kind: instance method of KeyValueStore Returns: Array.<(String|{value: String, timestamp: Number})> - the values

Param

Type

Description

opts

Object

optional parameters

opts.metadata

Boolean

return both values and metadata

space.public.get(key, opts)

Get the value and optionally metadata of the given key

Kind: instance method of KeyValueStore Returns: String | Object - the value associated with the key, undefined if there's no such key

Param

Type

Description

key

String

the key

opts

Object

optional parameters

opts.metadata

Boolean

return both value and metadata

space.private.get(key, opts)

Get the value and optionally metadata of the given key

Kind: instance method of KeyValueStore Returns: String | Object - the value associated with the key, undefined if there's no such key

Param

Type

Description

key

String

the key

opts

Object

optional parameters

opts.metadata

Boolean

return both value and metadata

space.public.getMetadata(key)

Get metadata for for a given key

Kind: instance method of KeyValueStore Returns: Metadata - Metadata for the key, undefined if there's no such key

Param

Type

Description

key

String

the key

space.private.getMetadata(key)

Get metadata for for a given key

Kind: instance method of KeyValueStore Returns: Metadata - Metadata for the key, undefined if there's no such key

Param

Type

Description

key

String

the key

space.public.log

Returns array of underlying log entries. In linearized order according to their Lamport clocks. Useful for generating a complete history of all operations on store.

Kind: instance property of KeyValueStore Returns: Array.<Object> - Array of ordered log entry objects

const log = store.log
const entry = log[0]
console.log(entry)
// { op: 'PUT', key: 'Name', value: 'Botbot', timeStamp: '1538575416068' }

space.private.log

Returns array of underlying log entries. In linearized order according to their Lamport clocks. Useful for generating a complete history of all operations on store.

Kind: instance property of KeyValueStore Returns: Array.<Object> - Array of ordered log entry objects

const log = store.log
const entry = log[0]
console.log(entry)
// { op: 'PUT', key: 'Name', value: 'Botbot', timeStamp: '1538575416068' }