diff --git a/desk/app/bark.hoon b/desk/app/bark.hoon index f70599fc..bdebea42 100644 --- a/desk/app/bark.hoon +++ b/desk/app/bark.hoon @@ -76,7 +76,13 @@ %bark-remove-recipient =+ !<(=ship vase) ?> =(src.bowl ship) - `this(recipients (~(del in recipients) ship)) + :_ this(recipients (~(del in recipients) ship)) + :_ ~ + :* %pass /save-summary/(scot %p src.bowl)/(scot %da now.bowl) + %arvo %k %fard + %landscape %save-summary %noun + !>(`[tlon.api mailchimp.api src.bowl %wipe ~]) + == :: %bark-generate-summaries ?> =(src.bowl our.bowl) @@ -107,7 +113,7 @@ == == vase ?~ result - `this(recipients (~(del in recipients) src.bowl)) + $(mark %bark-remove-recipient, vase !>(src.bowl)) ::TODO maybe drop the result (or re-request) if the timestamp is too old? :_ this :~ :* %pass /save-summary/(scot %p src.bowl)/(scot %da requested.u.result) diff --git a/desk/app/growl.hoon b/desk/app/growl.hoon index 998c340e..9a328bca 100644 --- a/desk/app/growl.hoon +++ b/desk/app/growl.hoon @@ -3,15 +3,12 @@ :: |% +$ card card:agent:gall -+$ versioned-state - $% state-0 - == -+$ state-0 [%0 enabled=_| bark-host=_~rilfet-palsum] ++$ state-1 [%1 enabled=_| bark-host=_~rilfet-palsum] -- :: :: This agent should eventually go into landscape :: -=| state-0 +=| state-1 =* state - %- agent:dbug %+ verb | @@ -42,6 +39,26 @@ 'logActivity' [%b |] :: +++ on-save !>(state) +++ on-load + |= old-state=vase + |^ ^- (quip card _this) + =+ !<(old=versioned-state old-state) + ?- -.old + %0 + =^ caz this on-init :: %0 dropped the ball, re-initialize + :_ this + :_ caz + [%pass /settings %agent [our.bowl %settings] %leave ~] + :: + %1 + [~ this(state old)] + == + :: + +$ versioned-state $%(state-0 state-1) + +$ state-0 [%0 enabled=_| bark-host=_~rilfet-palsum] + -- +:: ++ on-poke |= [=mark =vase] ^- (quip card _this) @@ -91,17 +108,19 @@ %fact ?. =(%settings-event p.cage.sign) (on-agent:def wire sign) =+ !<(=event:settings q.cage.sign) - =/ new=? - =; =val:settings - ?:(?=(%b -.val) p.val |) - ?+ event b+| - [%put-bucket %groups %groups *] (~(gut by bucket.event) 'logActivity' b+|) - [%del-bucket %groups %groups] b+| - [%put-entry %groups %groups %'logActivity' *] val.event - [%del-entry %groups %groups %'logActivity'] b+| + =/ new=(unit ?) + =; val=(unit val:settings) + ?~ val ~ + `?:(?=(%b -.u.val) p.u.val |) + ?+ event ~ + [%put-bucket %groups %groups *] `(~(gut by bucket.event) 'logActivity' b+|) + [%del-bucket %groups %groups] `b+| + [%put-entry %groups %groups %'logActivity' *] `val.event + [%del-entry %groups %groups %'logActivity'] `b+| == - ?: =(new enabled) [~ this] - (on-poke ?:(new %enable %disable) !>(~)) + ?~ new [~ this] + ?: =(u.new enabled) [~ this] + (on-poke ?:(u.new %enable %disable) !>(~)) == :: ++ on-watch on-watch:def @@ -111,15 +130,6 @@ ++ on-leave |= =path `this -++ on-save !>(state) -++ on-load - |= old-state=vase - ^- (quip card _this) - =/ old !<(versioned-state old-state) - ?- -.old - %0 - `this(state old) - == ++ on-arvo on-arvo:def ++ on-peek on-peek:def -- diff --git a/desk/ted/mailchimp/update-merge-fields.hoon b/desk/ted/mailchimp/update-merge-fields.hoon index e68ab9cb..643b8513 100644 --- a/desk/ted/mailchimp/update-merge-fields.hoon +++ b/desk/ted/mailchimp/update-merge-fields.hoon @@ -5,7 +5,8 @@ :: :: > -bark!mailchimp-update-merge-fields 'apikey' 'list-id' 'sampel@example.com' fields :: where fields is a (map cord json) -:: and the list-id is most easily discovered through the /lists api +:: and the list-id is most easily discovered through the /lists api: +:: curl -X GET 'https://us14.api.mailchimp.com/3.0/lists?count=99&offset=0' --user "anystring:${apikey}" :: /- spider /+ *strandio @@ -26,7 +27,7 @@ :: ^= body %- some - %- as-octt:mimes:html + %- as-octs:mimes:html %- en:json:html %- pairs:enjs:format ['merge_fields' o+vars]~ diff --git a/desk/ted/save-summary.hoon b/desk/ted/save-summary.hoon index 4d2022a2..0f569d49 100644 --- a/desk/ted/save-summary.hoon +++ b/desk/ted/save-summary.hoon @@ -18,6 +18,7 @@ :: $= summary $% [%life [sen=@ud rec=@ud gro=@t] [dms=@ud etc=@ud group=@t chat=@t]] + [%wipe ~] == == =/ args !<([~ arg-mold] arg) @@ -45,6 +46,9 @@ =; vars=(map @t json) !>(`[mailchimp.args u.mail vars]) %- ~(gas by *(map @t json)) + =? summary.args ?=(%wipe -.summary.args) + [%life [0 0 ''] [0 0 '' '']] + ?> ?=(%life -.summary.args) =, summary.args :~ ['MSGS_SENT' (numb:enjs:format sen)] ['MSGS_RECD' (numb:enjs:format rec)] @@ -63,5 +67,5 @@ :: =/ [%khan %arow %.y %noun vs=vase] simp =+ !<([gud=? msg=@t] vs) -?. gud ~|(msg !!) +?. gud ~|([ship=ship.args mail=u.mail msg] !!) (pure:m !>(msg))