UrbitEx.Utils (UrbitEx v0.7.0) View Source

Utils module with some useful functions, such as a tokenizer for graph store, regex for urls and @ps, etc.

Link to this section Summary

Functions

Abbreviates comet and moon names following Landscape practice. Takes a string. Returns a string.

Adds tilde to an Urbit ship name if it lacks one. Takes a string. Returns a string.

Eyre endpoints which return a boolean are rather weird. Instead of returning true or false, they return a 200 with null body if true, or a 500 if false. See API.Graph.exists? or API.Settings.has_bucket? and others.

Produces an Urbit permalink as used by Landscape. Takes a group Resource struct, a channel Resource struct, and an index string. Returns an Urbit web+urbitgraph permalink.

Breaks an integer into a string resembling the hoon @ud type (long integer with a period every three digits, e.g. "170.123.456") Takes an integer, returns a string.

Checks whether the passed ship name belongs to a comet. Takes a string, returns :ok if not a comet, :gtfo if a comet.

Produces a reference map as used by graph store from a permalink string. Takes a permalink string. Returns a reference map.

Removes tilde from an Urbit ship name if it has one. Takes a string. Returns a string.

Returns the ship type given a ship name. Takes a string, returns an atom with the ship class.

Takes a long string and breaks it up into tokens to be stored into graph-store. Graph-store tokens can be text, url, mention, reference or code. Returns a list of token maps to pass to any graph-store post function.

Validates that a string is a valid Urbit shipname. It ignores tildes and other punctuation. Takes a string, returns a clean shipname if valid, false if invalid.

Link to this section Functions

Abbreviates comet and moon names following Landscape practice. Takes a string. Returns a string.

Adds tilde to an Urbit ship name if it lacks one. Takes a string. Returns a string.

Link to this function

break_index(index_string)

View Source
Link to this function

calculate_index(unix_time)

View Source
Link to this function

extract2(arg, match, atom)

View Source
Link to this function

eyre_boolean?(response_status_code)

View Source

Eyre endpoints which return a boolean are rather weird. Instead of returning true or false, they return a 200 with null body if true, or a 500 if false. See API.Graph.exists? or API.Settings.has_bucket? and others.

Link to this function

get_permalink(group, channel, index)

View Source

Produces an Urbit permalink as used by Landscape. Takes a group Resource struct, a channel Resource struct, and an index string. Returns an Urbit web+urbitgraph permalink.

Breaks an integer into a string resembling the hoon @ud type (long integer with a period every three digits, e.g. "170.123.456") Takes an integer, returns a string.

Checks whether the passed ship name belongs to a comet. Takes a string, returns :ok if not a comet, :gtfo if a comet.

Link to this function

parse_permalink(permalink)

View Source

Produces a reference map as used by graph store from a permalink string. Takes a permalink string. Returns a reference map.

Removes tilde from an Urbit ship name if it has one. Takes a string. Returns a string.

Returns the ship type given a ship name. Takes a string, returns an atom with the ship class.

Takes a long string and breaks it up into tokens to be stored into graph-store. Graph-store tokens can be text, url, mention, reference or code. Returns a list of token maps to pass to any graph-store post function.

Validates that a string is a valid Urbit shipname. It ignores tildes and other punctuation. Takes a string, returns a clean shipname if valid, false if invalid.