urbit/mar/collections/action.hoon

58 lines
1.3 KiB
Plaintext
Raw Normal View History

2017-12-15 04:42:12 +03:00
:: /action/collections/mar
::
2017-12-16 01:52:30 +03:00
/- collections
=, api:collections
2017-12-15 04:42:12 +03:00
|_ act=action
::
++ grow
|%
++ tank >act<
--
::
++ grab
|%
++ noun action
++ json
=, dejs:format
:: %+ cu |=(action +<)
2017-12-15 04:42:12 +03:00
=< action
|%
++ action
%- of :~
create+create
2017-12-19 01:55:49 +03:00
delete+(ot col+(se %da) ~)
2017-12-15 04:42:12 +03:00
submit+(ot col+(se %da) tit+so wat+wain ~)
2017-12-19 03:50:21 +03:00
comment+(ot col+(se %da) top+(se %da) com+null-or-da wat+wain ~)
2017-12-15 04:42:12 +03:00
==
::
2017-12-19 03:50:21 +03:00
++ null-or-da
%+ cu |=(a=dime ?+(a !! [%n ~] ~, [%da @da] q.a))
%+ cu |=(a=coin ?+(a !! [%$ ^] p.a))
(su nuck:so.hoon)
::
2017-12-15 04:42:12 +03:00
++ create
:: (ot wat+(cu (hard kind) so) des+so pub+bo vis+bo ses+(as (se %p)) ~)
|= a=json
~| a
=+ ^- [wat=kind des=cord ses=(set @p)]
%. a
(ot kind+(cu (hard kind) so) desc+so mems+(su (cook sy (more ace fed:ag))) ~)
?> ?=([%o *] a)
=/ pub (~(has by p.a) %publ)
=/ vis (~(has by p.a) %visi)
[wat des pub vis ses]
2017-12-15 04:42:12 +03:00
::
++ wain (su (more (just '\0a') (cook crip (star prn))))
::
::
++ as |*(a=fist (cu sy (ar a))) :: array as set
++ se :: string as aura
=, wired
|* a=term
%+ cu
|= b=cord ^- (odo:raid a)
(slav a b)
so
-- --
--