classcamAxonPlugin::Client

sys::Obj
  camAxonPlugin::Client

Client manages a network connection to a haystack server.

about

Source

Dict about()

Call "about" operation to query server summary info.

call

Source

Grid call(Str op, Grid? req := null, Bool checked := true)

Call the given REST operation with its request grid and return the response grid. If req is null, then an empty grid used for request. If the checked flag is true and server returns an error grid, then raise CallErr, otherwise return the grid itself.

commit

Source

Grid commit(Grid req)

Commit a set of diffs. The req parameter must be a grid with a "commit" tag in the grid.meta. The rows are the items to commit. Return result as Grid or or raise CallErr if server returns error grid.

Also see Rest API.

Examples:

// add new record
tags := ["site":Marker.val, "dis":"Example Site"])
toCommit := Etc.makeDictGrid(["commit":"add"], tags)
client.commit(toCommit)

// update dis tag
changes := ["id": orig->id, "mod":orig->mod, "dis": "New dis"]
toCommit := Etc.makeDictGrid(["commit":"update"], changes)
client.commit(toCommit)
eval

Source

Grid eval(Str expr)

Evaluate an Axon expression and return results as Grid. Raise CallErr if server returns error grid. Also see Rest API.

evalAll

Source

Grid[] evalAll(Obj req, Bool checked := true)

Evaluate a list of expressions. The req parameter must be Str[] of Axon expressions or a correctly formatted Grid with expr column.

A separate grid is returned for each row in the request. If checked is false, then this call does not automatically check for error grids - client code must individual check each grid for partial failures using Grid.isErr. If checked is true and one of the requests failed, then raise CallErr for first failure.

Also see Rest API.

open

Source

static Client open(Uri uri, Str username, Str password)

Open with URI of project such as "http://host/api/myProj/". Throw IOErr for network/connection error or AuthErr if credentials are not authenticated.

read

Source

Dict? read(Str filter, Bool checked := true)

Call "read" operation to read a record that matches the given filter. If there is more than one record, then it is undefined which one is returned. If there are no matches then return null or raise UnknownRecException based on checked flag. Raise CallErr if server returns error grid. Also see Rest API.

readAll

Source

Grid readAll(Str filter)

Call "read" operation to read a record all recs which match the given filter. Raise CallErr if server returns error grid. Also see Rest API.

readById

Source

Dict? readById(Ref id, Bool checked := true)

Call "read" operation to read a record by its identifier. If the record is not found then return null or raise UnknownRecException based on checked flag. Raise CallErr if server returns error grid. Also see Rest API.

readByIds

Source

Grid readByIds(Ref[] ids, Bool checked := true)

Call "read" operation to read a list of records by their identifiers. Return a grid where each row of the grid maps to the respective id list (indexes line up). If checked is true and any one of the ids cannot be resolved then raise UnknownRecErr for first id not resolved. If checked is false, then each id not found has a row where every cell is null. Raise CallErr if server returns error grid. Also see Rest API.

toStr

Source

virtual override Str toStr()

Return uri.toStr

uri

Source

const Uri uri

URI of project path such as "http://host/api/myProj/". This URI always ends in a trailing slash.

username

Source

const Str username

Username used for authentication

version

Source

Str version := "1.0"

Haystack version of the server (set in make upon connection)