figbus/elm-urbit-api/2.0.0

NOTE: the latest version is 4.0.1

Urbit.Graph

Store

type Store

A collection of Graphs identified by Resources.

type alias Resource =
{ ship : String
, name : String
}

A pair of a ship and a name uniquely identifying a graph.

Create an empty Store.

getFromStore : Resource -> Store -> Maybe Graph

Get a graph from a Store using a resource.

Graph

type alias Graph =
Dict String Node

An ordered dict of nodes.

type Node

A node in a graph. Contains a Post and possibly children.

Get the children of a node.

getNodePost : Node -> Post

Get the post associated with a node.

type alias Post =
{ index : Index
, author : String
, timeSent : Posix
, contents : List Value
, hash : Maybe String
}

A post in a graph. The contents are a list of JSON values.

type alias Index =
List String

An index uniquely identifying a node within a graph.

newNode : Post -> Node

Create a new node from a post.

textContent : String -> Value

Create a text content type for a post.

urlContent : String -> Value

Create a url content type for a post.

mentionContent : String -> Value

Create a mention content type for a post.

{ expression : String
, output : String
}
-> Value

Create a code content type for a post.

Requests

{ url : String
, resource : Resource
}
-> (Result Error Update -> msg)
-> Cmd msg

Get a graph from the graph store.

{ ship : String
, session : Session
}
-> (Result Error () -> msg)
-> ( Session, Cmd msg )

Subscribe to changes to the graph store.

{ resource : Resource
, nodes : List Node
, session : Session
}
-> (Result Error () -> msg)
-> ( Session, Cmd msg )

Add nodes to the graph store.

{ url : String
, resource : Resource
, nodes : List Node
}
-> (Result Error Value -> msg)
-> Cmd msg

Add nodes to the graph store via a spider thread.

{ url : String
, group : Resource
, resource : Resource
, title : String
, description : String
, graphModule : String
, mark : String
}
-> (Result Error Value -> msg)
-> Cmd msg

Create a new graph associated with an existing group.

{ url : String
, resource : Resource
, title : String
, description : String
, invites : List String
, graphModule : String
, mark : String
}
-> (Result Error Value -> msg)
-> Cmd msg

Create a new graph unassociated with any group.

{ url : String
, resource : Resource
}
-> (Result Error Value -> msg)
-> Cmd msg

Delete a graph from the graph store via a spider thread.

Updates

type Update

Represents a change to the graph store.

Decode a graph store update, typically from an incoming diff or scry request.

Apply a change to the graph store.