urbit/mar/collections/action.hoon

102 lines
2.5 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
2018-06-04 20:09:04 +03:00
::(action a)
2017-12-15 04:42:12 +03:00
|%
++ action
2018-06-04 20:09:04 +03:00
|= a/json
^- action
%. a
2017-12-15 04:42:12 +03:00
%- of :~
create+create
2017-12-19 01:55:49 +03:00
delete+(ot col+(se %da) ~)
2018-06-04 20:09:04 +03:00
submit+submit
comment+comment
2017-12-21 06:50:00 +03:00
resubmit+(ot col+(se %da) top+(se %da) tit+so wat+wain ~)
2017-12-21 04:28:13 +03:00
delete-topic+(ot col+(se %da) top+(se %da) ~)
delete-comment+(ot col+(se %da) top+(se %da) com+(se %da) ~)
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)
::
2018-06-04 20:09:04 +03:00
++ submit
|= a=json
^- [coll-full @t wain]
=/ host
%. a
(ot:dejs-soft:format hos+(se-soft %p) ~)
=+ ^- [col=@da tit=@t wat=wain]
%. a
(ot col+(se %da) tit+so wat+wain ~)
[[host col] tit wat]
::
++ comment
|= a=json
=/ host
%. a
(ot:dejs-soft:format hos+(se-soft %p) ~)
=+ ^- [col=@da top=@da com=?(~ @da) wat=wain]
%. a
(ot col+(se %da) top+(se %da) com+null-or-da wat+wain ~)
[[host col] top com wat]
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
2018-02-05 23:49:24 +03:00
=+ ^- [desc=cord publ=? visi=? comm=? xeno=? ses=(set @p)]
%. a
:: change this to accept an array of @p
2018-02-02 02:56:02 +03:00
%- ot
2018-02-05 23:49:24 +03:00
:::~ wat+(cu (hard kind) so)
:~ desc+so
publ+bo
visi+bo
comm+bo
xeno+bo
2018-02-02 02:56:02 +03:00
ses+(su (cook sy (more ace fed:ag)))
==
2018-02-05 23:49:24 +03:00
[desc publ visi comm xeno ses]
2017-12-15 04:42:12 +03:00
::
2017-12-21 06:55:10 +03:00
++ wain (su (more newline (cook crip (star prn))))
:: ++ newline (just '\0a')
::XX getting sent \r by frontend
++ newline ;~(pfix (punt (just '\0d')) (just '\0a'))
2017-12-15 04:42:12 +03:00
::
::
++ 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
2018-06-04 20:09:04 +03:00
++ se-soft :: string as aura
=, wired
|* a=term
%+ cu
|= b=(unit cord) ^- (unit (odo:raid a))
?~ b ~
`(slav a (need b))
so:dejs-soft:format
2017-12-15 04:42:12 +03:00
-- --
--