Merge branch 'twit-app' into dot-plan

Pull in working :twit and various fixes it depends on, to add write-plan-account logic to it
This commit is contained in:
Anton Dyudin 2016-03-29 16:31:27 -07:00
commit a3781a4777
24 changed files with 484 additions and 413 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
/sec/**/*.atom

View File

@ -32,7 +32,7 @@
{$pill p/path} :: noun to unix pill {$pill p/path} :: noun to unix pill
:: {$tree p/path} :: noun to unix tree :: {$tree p/path} :: noun to unix tree
{$file p/beam} :: save to clay {$file p/beam} :: save to clay
{$http p/?($post $put) q/iden r/purl} :: http outbound {$http p/?($post $put) q/(unit iden) r/purl} :: http outbound
{$poke p/goal} :: poke app {$poke p/goal} :: poke app
{$show p/?($0 $1 $2 $3)} :: print val+span+twig {$show p/?($0 $1 $2 $3)} :: print val+span+twig
{$verb p/term} :: store variable {$verb p/term} :: store variable
@ -42,7 +42,7 @@
q/dojo-build :: general build q/dojo-build :: general build
== :: == ::
++ dojo-build :: one arvo step ++ dojo-build :: one arvo step
$% {$ur p/iden q/purl} :: http GET request $% {$ur p/(unit iden) q/purl} :: http GET request
{$ge p/dojo-model} :: generator {$ge p/dojo-model} :: generator
{$dv p/path} :: core from source {$dv p/path} :: core from source
{$ex p/twig} :: hoon expression {$ex p/twig} :: hoon expression
@ -87,7 +87,7 @@
++ card :: general card ++ card :: general card
$% {$diff $sole-effect sole-effect} :: $% {$diff $sole-effect sole-effect} ::
{$send wire {ship term} clap} :: {$send wire {ship term} clap} ::
{$hiss wire {$~ iden} mark {$hiss hiss}} :: {$hiss wire (unit iden) mark {$hiss hiss}} ::
{$exec wire @p (unit {beak silk})} :: {$exec wire @p (unit {beak silk})} ::
{$deal wire sock term club} :: {$deal wire sock term club} ::
{$info wire @p toro} :: {$info wire @p toro} ::
@ -167,8 +167,8 @@
;~(plug (cold %file tar) dp-beam) ;~(plug (cold %file tar) dp-beam)
;~(plug (cold %flat pat) (most fas qut)) ;~(plug (cold %flat pat) (most fas qut))
;~(plug (cold %pill dot) (most fas sym)) ;~(plug (cold %pill dot) (most fas sym))
;~(plug (cold %http lus) (easy %post) dp-iden-url) ;~(plug (cold %http lus) (stag %post dp-iden-url))
;~(plug (cold %http hep) (easy %put) dp-iden-url) ;~(plug (cold %http hep) (stag %put dp-iden-url))
(stag %show (cook $?($1 $2 $3) (cook lent (stun [1 3] wut)))) (stag %show (cook $?($1 $2 $3) (cook lent (stun [1 3] wut))))
== ==
++ dp-hooves :: hoof list ++ dp-hooves :: hoof list
@ -221,7 +221,7 @@
(sear plex:vez (stag %conl poor:vez)) (sear plex:vez (stag %conl poor:vez))
:: ::
++ dp-iden-url ++ dp-iden-url
(cook |=({a/(unit iden) b/purl} [(fall a *iden) b]) auru:epur) (cook |=({a/(unit iden) b/purl} [`(fall a *iden) b]) auru:epur)
:: ::
++ dp-model ;~(plug dp-server dp-config) :: ++dojo-model ++ dp-model ;~(plug dp-server dp-config) :: ++dojo-model
++ dp-path (tope he-beam) :: ++path ++ dp-path (tope he-beam) :: ++path
@ -269,10 +269,10 @@
(he-card(poy `+>+<(pux `way)) %exec way our.hid `[he-beak kas]) (he-card(poy `+>+<(pux `way)) %exec way our.hid `[he-beak kas])
:: ::
++ dy-eyre :: send work to eyre ++ dy-eyre :: send work to eyre
|= {way/wire usr/iden req/hiss} |= {way/wire usr/(unit iden) req/hiss}
^+ +>+> ^+ +>+>
?> ?=($~ pux) ?> ?=($~ pux)
(he-card(poy `+>+<(pux `way)) %hiss way `usr %httr %hiss req) (he-card(poy `+>+<(pux `way)) %hiss way usr %httr %hiss req)
:: ::
++ dy-stop :: stop work ++ dy-stop :: stop work
^+ +> ^+ +>
@ -415,6 +415,7 @@
++ dy-cast ++ dy-cast
|* {typ/_* bun/vase} |* {typ/_* bun/vase}
|= a/vase ^- typ |= a/vase ^- typ
~| [p.bun p.a]
?> (~(nest ut p.bun) & p.a) ?> (~(nest ut p.bun) & p.a)
;;(typ q.a) ;;(typ q.a)
:: ::
@ -537,7 +538,7 @@
++ dy-shown ++ dy-shown
$? twig $? twig
$^ {dy-shown dy-shown} $^ {dy-shown dy-shown}
$% {$ur iden purl} $% {$ur (unit iden) purl}
{$dv path} {$dv path}
{$as mark dy-shown} {$as mark dy-shown}
{$do twig dy-shown} {$do twig dy-shown}
@ -676,9 +677,11 @@
(dy-meal (slot 7 vax)) (dy-meal (slot 7 vax))
:: ::
$| $|
=+ hiz=;;(hiss +<.q.vax) => .(vax (slap vax !,(*twig ?>(?=($| -) .)))) :: XX working spec #72
=+ typ={$| (unit iden) hiss *}
=+ [~ usr hiz ~]=((dy-cast typ !>(*typ)) vax)
=. ..dy (he-diff %tan leaf+"< {(earn p.hiz)}" ~) =. ..dy (he-diff %tan leaf+"< {(earn p.hiz)}" ~)
(dy-eyre(pro `(slap (slot 7 vax) limb+%q)) /scar ~. hiz) (dy-eyre(pro `(slap (slot 15 vax) limb+%r)) /scar usr hiz)
== ==
:: ::
++ dy-sigh-scar :: scraper result ++ dy-sigh-scar :: scraper result

View File

@ -8,66 +8,69 @@
:: ::
|% |%
++ twit-path :: valid peer path ++ twit-path :: valid peer path
$% :: [%home ~] :: home timeline $% {$home p/@t $~} :: home timeline
[%user p=@t ~] :: user's tweets {$user p/@t $~} :: user's tweets
[%post p=span:,@uv ~] :: status of status {$post p/@taxuv $~} :: status of status
== ==
:: ::
++ axle :: app state ++ axle :: app state
$: %0 $: $0
kes=(map span keys:twittter) :: auth out/(map @uvI (each {knot cord} stat)) :: sent tweets
out=(map ,@uvI (each ,[span cord] stat)) :: sent tweets ran/(map path {p/@ud q/@da}) :: polls active
ran=(map path ,[p=@ud q=@da]) :: polls active fed/(jar path stat) :: feed cache
fed=(jar path stat) :: feed cache
== ==
:: ::
++ gift :: subscription action ++ gift :: subscription action
$% [%quit ~] :: terminate $% {$quit $~} :: terminate
[%diff gilt] :: send data {$diff gilt} :: send data
== ==
++ gilt ++ gilt
$% [%twit-feed p=(list stat)] :: posts in feed $% {$twit-feed p/(list stat)} :: posts in feed
[%twit-stat p=stat] :: tweet accepted {$twit-post p/stat} :: tweet accepted
[%ares term (list tank)] {$ares term (list tank)}
== ==
:: ::
++ move ,[bone card] ++ move {bone card}
++ card :: arvo request ++ card :: arvo request
$? gift $? gift
$% [%them path ~ u=hiss] :: HTTP request $% {$hiss wire (unit iden) api-call} :: api request
[%poke wire dock %talk-command command:talk] :: {$poke wire dock $talk-command command:talk} ::
[%wait path p=@da] :: timeout {$wait wire p/@da} :: timeout
== == == ==
:: ::
++ api-call {response-mark $twit-req {endpoint quay}} :: full hiss payload
++ response-mark ?($twit-post $twit-feed) :: sigh options
++ sign :: arvo response ++ sign :: arvo response
$% [%e %thou p=httr] :: HTTP result $% {$e $thou p/httr} :: HTTP result
[%t %wake ~] :: timeout ping {$t $wake $~} :: timeout ping
== ==
:: ::
++ stat stat:twitter :: recieved tweet :: XX =*
++ twit main:twitter :: api interface ++ stat post:twitter :: recieved tweet
++ twir parse:twitter :: reparsers ++ command command:twitter :: incoming command
++ twip render:twitter :: printers ++ endpoint endpoint:reqs:twitter :: outgoing target
++ param param:reqs:twitter :: twit-req paramters
++ print print:twitter :: their serialization
++ parse parse:twitter :: and deserialization
::
:: ++ twit args:reqs:twitter :: arugment types
:: ++ twir parse:twitter :: reparsers
:: ++ twip print:twitter :: printers
-- --
!: !:
:::: ::::
:: ::
|_ [bowl axle] |_ {bowl axle}
++ any-auth ?~(kes (auth) (auth p.n.kes)) :: use any keys
++ auth :: build API door
|= a=span
~| [%no-auth a]
~(. twit (~(got by kes) a) now `@`eny)
:: ::
++ cull :: remove seen tweets ++ cull :: remove seen tweets
|= [pax=path rep=(list stat)] ^+ rep |= {pax/path rep/(list stat)} ^+ rep
=+ pev=(sa (turn (~(get ja fed) pax) |=(stat id))) =+ pev=(silt (turn (~(get ja fed) pax) |=(stat id)))
(skip rep |=(stat (~(has in pev) id))) (skip rep |=(stat (~(has in pev) id)))
:: ::
++ done [*(list move) .] ++ done [*(list move) .]
++ dely :: next polling timeout ++ dely :: next polling timeout
|= pax=path |= pax/path
^- [(unit time) _ran] ^- {(unit time) _ran}
=+ cur=(~(get by ran) pax) =+ cur=(~(get by ran) pax)
=+ tym=(add now (mul ~s8 (bex ?~(cur 0 p.u.cur)))) =+ tym=(add now (mul ~s8 (bex ?~(cur 0 p.u.cur))))
:: ~& dely/`@dr`(sub tym now) :: ~& dely/`@dr`(sub tym now)
@ -75,8 +78,12 @@
[~ ran] [~ ran]
[`tym (~(put by ran) pax ?~(cur 0 (min 5 +(p.u.cur))) tym)] [`tym (~(put by ran) pax ?~(cur 0 (min 5 +(p.u.cur))) tym)]
:: ::
++ wait-new :: poll with min delay
|= {pax/path mof/(list move)}
(wait(ran (~(del by ran) pax)) pax mof)
::
++ wait :: ensure poll by path ++ wait :: ensure poll by path
|= [pax=path mof=(list move)] |= {pax/path mof/(list move)} ^+ done
=^ tym ran (dely pax) =^ tym ran (dely pax)
:_ +>.$ :_ +>.$
?~ tym ?~ tym
@ -87,117 +94,175 @@
mof mof
:: ::
++ poke-twit-do :: recieve request ++ poke-twit-do :: recieve request
|= [usr=span act=command:twitter] |= {usr/iden act/command} ^+ done
^+ [*(list move) +>]
?- -.act ?- -.act
%auth $post
:- [(print "authed @{(trip usr)}")]~ =. out (~(put by out) p.act %& usr q.act)
+>.$(kes (~(put by kes) usr p.act)) :: XX verify key %+ wait-new /peer/home/[usr]
%post =+ req=[%twit-req `endpoint`update+[%status q.act]~ ~]
=: out (~(put by out) p.act %& usr q.act) [ost %hiss post+(dray ~[%uv] p.act) `usr %twit-post req]~
ran (~(del by ran) /peer/home)
==
%+ wait /peer/home
=+ mez=(stat-upda:(auth usr) [%status q.act]~ ~)
[ost %them /post/(scot %uv p.act) ~ mez]~
== ==
:: ::
++ wake-peer ++ wake-peer
|= [pax=path ~] ^+ done |= {pax/path $~} ^+ done
~& twit-wake/peer/pax ~& twit-wake+peer+pax
:_ +>.$ :_ +>.$
?. (~(has by ran) peer/pax) :: ignore if retracted ?. (~(has by ran) peer+pax) :: ignore if retracted
~ ~
=+ => |=([a=bone @ b=path] [b a]) =+ => |=({a/bone @ b/path} [b a])
pus=(~(gas ju *(jug path bone)) (turn (~(tap by sup)) .)) pus=(~(gas ju *(jug path bone)) (turn (~(tap by sup)) .))
?~ (~(get ju pus) pax) ?~ (~(get ju pus) pax)
~ ~
~& peer-again/[pax ran] ~& peer-again+[pax ran]
(pear | our pax) (pear | `~. pax) ::(user-from-path pax))
:: ::
++ thou ++ sigh-recoverable-error :: Rate-limit
|= [pax=path hit=httr] ^+ done |= {pax/path $429 $rate-limit lim/(unit @da)}
?+ p.hit ~|([%unknown-code p.hit] !!) =. ran (~(put by ran) pax 6 now)
429 :: Rate-limit =+ tym=?~(lim (add ~m7.s30 now) (add ~1970.1.1 (mul ~s1 u.lim)))
=. ran (~(put by ran) pax 6 now) ~& retrying-in+`@dr`(sub tym now)
=+ lim=%.(%x-rate-limit-reset ;~(biff ~(get by (mo q.hit)) poja ni:jo)) :_(+>.$ [ost %wait pax tym]~)
=+ tym=?~(lim (add ~m7.s30 now) (add ~1970.1.1 (mul ~s1 u.lim))) ::
~& retrying-in/`@dr`(sub tym now) ++ sigh-twit-post-post :: status acknowledged
:_(+>.$ [ost %wait pax tym]~) |= {wir/wire rep/stat} ^+ done
:: =+ (raid wir mez=%uv ~)
200 :: OK =. out (~(put by out) mez %| rep)
=+ jon=(need (poja q:(need r.hit))) :_ +>.$
:: ~& twit-resp/%.(jon ?+(-.jon !! %o stat:twir, %a (ar:jo stat:twir))) =+ pax=/[who.rep]/status/(rsh 3 2 (scot %ui id.rep))
?+ pax ~|([%http-missed pax] !!) :- (show-url [& ~ &+/com/twitter] `pax ~)
[%post @ ~] :: post acknowledged =+ mof=~[[%diff %twit-post rep] [%quit ~]]
=+ ^= rep (weld (spam post+wir mof) (spam scry+x+post+wir mof))
~| [%bad-post jon] ::
(need %.(jon stat:twir)) ++ sigh-twit-feed :: feed data
=. out (~(put by out) (slav %uv i.t.pax) %| rep) |= {wir/wire rep/(list stat)} ^+ done
:_ +>.$ ?> ?=({?($peer $scry) *} wir)
=+ pax=/[who.rep]/status/(rsh 3 2 (scot %ui id.rep)) =* pax t.wir
:- (print (earn [& ~ `/com/twitter] `pax ~)) :: ~& got-feed+[(scag 5 (turn rep |=(stat id))) fed]
(spam pax (tweet-good rep)) =+ ren=(cull pax rep) :: new messages
[%peer *] :: feed data =. rep (weld ren (~(get ja fed) pax))
=+ ^= rep =. fed (~(put by fed) pax rep) :: save full list
~| [%bad-feed jon] ?: ?=($scry -.wir)
(need %.(jon (ar:jo stat:twir))) [(spam scry+x+pax [%diff twit-feed+(flop rep)] [%quit ~] ~) +>.$]
:: ~& got-feed/[(scag 5 (turn rep |=(stat id))) fed] ?~ ren
=+ ren=(cull t.pax rep) :: new messages (wait wir ~) :: pump polling
?~ ren :: ~& spam-feed+ren
(wait pax ~) :: pump polling (wait-new wir (spam pax [%diff twit-feed+(flop ren)] ~))
:: ~& spam-feed/ren ::
=: ran (~(del by ran) pax) :: clear poll delay ++ sigh-tang :: Err
fed (~(put by fed) t.pax rep) :: saw last message |= {pax/path tan/tang} ^+ done
== ~& sigh-tang+pax
(wait pax (spam t.pax [%diff twit-feed/(flop ren)] ~)) %- (slog (flop tan))
== =+ ^- git/gift
:: =+ err='' ::%.(q:(need r.hit) ;~(biff poja mean:twir)) :: XX parse?
?(400 401 403 404) :: Err :^ %diff %ares %bad-http
=+ ^- git=gift tan
=+ err=%.(q:(need r.hit) ;~(biff poja mean:twir)) :: [leaf/"HTTP Code {<p.hit>}" (turn (need err) mean:render:twit)]
:^ %diff %ares %bad-http ?+ pax [[ost git]~ +>.$]
[leaf/"HTTP Code {<p.hit>}" (turn (need err) mean:twip)] {$post @ $~}
?+ pax [[ost git]~ +>.$] [(spam pax git ~) +>.$]
[%post @ ~]
[(spam pax git ~) +>.$]
==
== ==
++ tweet-good |=(rep=stat `(list gift)`~[[%diff %twit-stat rep] [%quit ~]]) ::
++ peer |=(pax=path :_(+> (pear & src pax))) :: accept subscription :: ++ user-to-path |=(a/(unit iden) ?~(a '~' (scot %ta u.a)))
:: ++ user-from-path
:: |= pax/path ^- {(unit iden) path}
:: ~| %bad-user
:: ?~ pax ~|(%empty-path !!)
:: ~| i.pax
:: ?: =('~' i.pax) [~ t.pax]
:: [`(slav %ta i.pax) t.pax]
::
::
++ compat |=({usr/(unit iden) req/(unit iden)} ?~(req & =(usr req)))
::
:: .^(twit-feed %gx /=twit=/~/home/urbit_test)
:: .^(twit-stat %gx /=twit=/~./post/0vv0old.0post.hash0.0000)
++ peek
|= {ren/care pax/path} ^- (unit (unit gilt))
?> ?=($x ren) :: others unsupported
=+ usr=`~. :: =^ usr pax (user-from-path pax)
?. ?=(twit-path pax)
~|([%missed-path pax] !!)
=+ gil=(pear-scry pax)
?- -.gil
$none ~
$part ~ :: stale data
$full ``p.gil
==
::
++ peer-scry-x
|= pax/path ^+ done
:_ +>
=+ pek=(peek %x pax)
?^ pek
?~ u.pek ~|(bad-scry+x+pax !!)
~[[ost %diff u.u.pek] [ost %quit ~]]
=+ usr=`~. :: =^ usr pax (user-from-path pax)
?. ?=(twit-path pax)
~|([%missed-path pax] !!)
=+ hiz=(pear-hiss pax)
?~ hiz ~ :: already in flight
::?> (compat usr -.u.hiz) :: XX better auth
[ost %hiss scry+pax usr +.u.hiz]~
::
++ peer |=(pax/path :_(+> (pear & `~. pax))) :: accept subscription
++ pear :: poll, possibly returning current data ++ pear :: poll, possibly returning current data
|= [ver=? @ pax=path] |= {ver/? usr/(unit iden) pax/path}
^- (list move) ^- (list move)
?. ?=(twit-path pax) ?. ?=(twit-path pax)
~|([%missed-path pax] !!) ~|([%missed-path pax] !!)
=> .(pax `twit-path`pax) =+ gil=(pear-scry pax)
?: ?=(%post -.pax) %+ welp
?. ver ~ ^- (list move)
=+ sta=(~(get by out) (slav %uv p.pax)) ?: ?=($full -.gil) ~ :: permanent result
?. ?=([~ %| ^] sta) :: post not received =+ hiz=(pear-hiss pax)
~ ?~ hiz ~
~[[ost %diff %twit-stat p.u.sta] [ost %quit ~]] ::?> (compat usr -.u.hiz) :: XX better auth
=+ ole=(~(get ja fed) pax) [ost %hiss peer+pax usr +.u.hiz]~
:_ ^- (list move) ^- (list move)
?. ver ~ ?. ver ~
?~ ole ~ ?- -.gil
[ost %diff %twit-feed (flop ole)]~ $none ~
=- `move`[ost %them peer/pax ~ `hiss`-] $part [ost %diff p.gil]~
=+ opt=?~(ole ~ ['since_id' (lutt:twit id.i.ole)]~) $full ~[[ost %diff p.gil] [ost %quit ~]]
=+ aut=any-auth ==
::
++ pear-scry
|= pax/twit-path ^- $%({$none $~} {$part p/gilt} {$full p/gilt})
?- -.pax ?- -.pax
%user (stat-user:aut [(to-sd p.pax)]~ opt) $post
:: %home (stat-home:auth ~ opt) =+ (raid +.pax mez=%uv ~)
=+ sta=(~(get by out) mez)
?. ?=({$~ $| *} sta)
[%none ~]
[%full twit-post+p.u.sta]
::
?($user $home)
[%part twit-feed+(flop (~(get ja fed) pax))]
==
::
++ pear-hiss
|= pax/twit-path ^- (unit {(unit iden) api-call})
?- -.pax
$post ~ :: future/unacked
$user
=+ ole=(~(get ja fed) pax)
=+ opt=?~(ole ~ ['since_id' (tid:print id.i.ole)]~)
`[`~. [%twit-feed twit-req+[posts-by+[(to-sd p.pax)]~ opt]]]
::
$home
=+ ole=(~(get ja fed) pax)
=+ opt=?~(ole ~ ['since_id' (tid:print id.i.ole)]~)
`[`p.pax [%twit-feed twit-req+[timeline+~ opt]]]
== ==
:: ::
++ to-sd :: parse user name/numb ++ to-sd :: parse user name/numb
|= a=span ^- sd:twit |= a/knot ^- sd:param
~| [%not-user a] ~| [%not-user a]
%+ rash a %+ rash a
;~(pose (stag %user-id dem) (stag %screen-name user:twir)) ;~(pose (stag %user-id dem) (stag %screen-name user:parse))
:: ::
:: ++ pull :: release subscription :: ++ pull :: release subscription
:: |= ost=bone :: |= ost/bone
:: ?. (~(has by sup) ost) `+>.$ :: XX should not occur :: ?. (~(has by sup) ost) `+>.$ :: XX should not occur
:: =+ [his pax]=(~(got by sup) ost) :: =+ [his pax]=(~(got by sup) ost)
:: ?: (lth 1 ~(wyt in (~(get ju pus) pax))) :: ?: (lth 1 ~(wyt in (~(get ju pus) pax)))
@ -208,13 +273,12 @@
:: `+>.$ :: `+>.$
:: ::
++ spam :: send by path ++ spam :: send by path
|= [a=path b=(list gift)] ^- (list move) |= {a/path b/(list gift)} ^- (list move)
%- zing ^- (list (list move)) %- zing ^- (list (list move))
%+ turn (~(tap by sup)) %+ turn (~(tap by sup))
|= [ost=bone @ pax=path] |= {ost/bone @ pax/path}
?. =(pax a) ~ ?. =(pax a) ~
(turn b |=(c=gift [ost c])) (turn b |=(c/gift [ost c]))
:: ::
++ print ++ show-url ~(said-url talk `bowl`+<-)
|=(mes=tape [ost %poke / [our %talk] (said our %twit now eny leaf/mes ~)])
-- --

View File

@ -849,9 +849,8 @@
=+ url=((hard quri) q.q.cay) =+ url=((hard quri) q.q.cay)
(give-thou 307 [location+(crip (apex:earn url))]~ ~) (give-thou 307 [location+(crip (apex:earn url))]~ ~)
?. ?=($mime p.cay) ?. ?=($mime p.cay)
=+ bek=-:(need (tome p.tee)) =+ bek=(norm-beak -:(need (tome p.tee)))
=+ bik=?+(r.bek bek {$ud $0} bek(r da+now)) (exec-live tee bek [%flag [p.sih `~] %cast %mime [%$ p.q.sih]])
(exec-live tee bik [%flag [p.sih `~] %cast %mime [%$ p.q.sih]])
~| q.q.cay ~| q.q.cay
=+ ((hard {mit/mite rez/octs}) q.q.cay) =+ ((hard {mit/mite rez/octs}) q.q.cay)
=+ dep=(crip "W/{(pojo %s (scot %uv p.sih))}") =+ dep=(crip "W/{(pojo %s (scot %uv p.sih))}")
@ -859,6 +858,7 @@
== ==
== ==
:: ::
++ norm-beak |=(bek/beak ?+(r.bek bek {$ud $0} bek(r da+now)))
++ emule ++ emule
|= a/_|?(..emule) ^+ ..emule |= a/_|?(..emule) ^+ ..emule
=+ mul=(mule a) =+ mul=(mule a)
@ -891,13 +891,13 @@
:: ::
++ back :: %ford bounce ++ back :: %ford bounce
|= {tea/whir mar/mark cay/cage} |= {tea/whir mar/mark cay/cage}
=+ bek=?+(r.top -.top {$ud $0} -.top(r da+now)) (execute tea (norm-beak -.top) [%cast mar $+cay])
(execute tea bek [%cast mar $+cay])
:: ::
++ cast-thou ++ cast-thou
|= {mar/mark cay/cage} |= {mar/mark cay/cage}
?: ?=($httr mar) (give-sigh %& cay) ?: ?=($httr mar) (give-sigh %& cay)
(back si+~ mar cay) %^ execute si+~ (norm-beak -.top)
[%alts [%cast mar $+cay] [%cast %recoverable-error $+cay] ~]
:: ::
++ del-deps ++ del-deps
|= {a/@uvH b/(each duct ixor)} ^+ +>.$ |= {a/@uvH b/(each duct ixor)} ^+ +>.$
@ -1750,7 +1750,8 @@
:: XX formal dill-blit %url via hood :: XX formal dill-blit %url via hood
++ auth-print |=({$show a/purl} (slog auth-tank leaf+(earn a) ~)) ++ auth-print |=({$show a/purl} (slog auth-tank leaf+(earn a) ~))
++ auth-tank ++ auth-tank
=> rose+["." `~]^(turn (flop dom) |=(a/cord leaf+(trip a))) => =- ?~(usr - rose+["@" `~]^~[leaf+(trip usr) -])
rose+["." `~]^(turn (flop dom) |=(a/cord leaf+(trip a)))
rose+[" " `~]^~[leaf+"To authenticate" . leaf+"visit:"] rose+[" " `~]^~[leaf+"To authenticate" . leaf+"visit:"]
:: ::
++ do-give (with !>(|=({$give a/httr} a)) fin-httr) ++ do-give (with !>(|=({$give a/httr} a)) fin-httr)

View File

@ -78,7 +78,7 @@
$: nah/duct :: cause $: nah/duct :: cause
{bek/beak kas/silk} :: problem {bek/beak kas/silk} :: problem
keg/(map (pair term beam) cage) :: block results keg/(map (pair term beam) cage) :: block results
kig/{p/@ud q/(map @ud {van/vane ren/care bem/beam})} :: blocks kig/(set (trel vane care beam)) :: blocks
== :: == ::
++ gagl (list (pair gage gage)) :: ++ gagl (list (pair gage gage)) ::
++ vane ?($a $b $c $d $e $f $g) :: ++ vane ?($a $b $c $d $e $f $g) ::
@ -192,26 +192,22 @@
=: p.tad.bay +(p.tad.bay) =: p.tad.bay +(p.tad.bay)
dym.bay (~(put by dym.bay) hen num) dym.bay (~(put by dym.bay) hen num)
== ==
~(exec zo [num `task`[hen kub ~ 0 ~]]) ~(exec zo [num `task`[hen kub ~ ~]])
:: ::
++ axon :: take ++ axon :: take
|= {num/@ud tik/@ud sih/sign} |= {num/@ud {van/vane ren/care bem/beam} sih/sign}
^+ +> ^+ +>
?: ?=({$unto $quit *} +.sih)
+>.$
=+ tus=(~(get by q.tad.bay) num)
?~ tus
~& [%ford-lost van num]
+>.$
?- -.+.sih ?- -.+.sih
$writ $writ (~(resp zo [num u.tus]) [van ren bem] p.+.sih)
=+ tus=(~(get by q.tad.bay) num)
?~ tus
~& [%ford-lost num]
+>.$
(~(resp zo [num u.tus]) tik p.+.sih)
::
$unto $unto
=+ tus=(~(get by q.tad.bay) num) ?+ -.p.+.sih ~|(ford-strange-unto+-.p.+.sih !!)
?~ tus $diff (~(resd zo [num u.tus]) [van ren bem] p.p.+.sih)
~& [%ford-lost num]
+>.$
?+ -.p.+.sih ~|(%ford-strange-unto !!)
$diff (~(resd zo [num u.tus]) tik p.p.+.sih)
$reap ?~ p.p.+.sih +>.$ $reap ?~ p.p.+.sih +>.$
((slog leaf+"ford-reap-fail" u.p.p.+.sih) +>.$) ((slog leaf+"ford-reap-fail" u.p.p.+.sih) +>.$)
== ==
@ -292,49 +288,40 @@
== ==
++ camo :: stop requests ++ camo :: stop requests
^+ . ^+ .
=+ kiz=(~(tap by q.kig) *(list {p/@ud q/{van/vane ren/care bem/beam}})) =+ kiz=(~(tap in kig))
|- ^+ +> |- ^+ +>
?~ kiz +> ?~ kiz +>
?. ?=($c van.q.i.kiz) +> $(kiz t.kiz, mow :_(mow [hen (cancel i.kiz)]))
%= $ ::
kiz t.kiz ++ cancel :: stop a request
mow |= {van/vane ren/care bem/beam} ^- (wind note gift)
:_ mow ?+ van ~|(stub-cancel+van !!)
:- hen $c [%pass (camp-wire +<) van [%warp [our p.bem] q.bem ~]]
:^ %pass $g [%pass (camp-wire +<) van [%deal [our p.bem] q.bem [%pull ~]]]
[(scot %p our) (scot %ud num) (scot %ud p.i.kiz) ~]
%c
[%warp [our p.bem.q.i.kiz] q.bem.q.i.kiz ~]
== ==
++ camp-wire :: encode block
|= {van/vane ren/care bem/beam} ^- wire
[(scot %p our) (scot %ud num) van ren (tope bem)]
:: ::
++ camp :: request a file ++ camp :: request a file
|= {van/vane ren/care bem/beam} |= {van/vane ren/care bem/beam}
^+ +> ^+ +>
?: ?=($g van) ~& >> [%camping van ren bem]
%= +>.$ %_ +>.$
kig [+(p.kig) (~(put by q.kig) p.kig [%g ren bem])] kig (~(put in kig) +<)
mow mow
:_ mow :_ mow
:- hen :- hen
:^ %pass ?+ van ~&(%camp-stub !!)
[(scot %p our) (scot %ud num) (scot %ud p.kig) ~] $g
%g :+ %pass (camp-wire +<)
~& >> [%camping van ren bem] [%g [%deal [our p.bem] q.bem [%peer %scry ren (flop s.bem)]]]
[%deal [our p.bem] q.bem [%peer %scry ren (flop s.bem)]] ::
$c
:+ %pass (camp-wire +<)
[%c [%warp [our p.bem] q.bem [~ %sing ren r.bem (flop s.bem)]]]
== ==
?: ?=($c van) ==
%= +>.$
kig [+(p.kig) (~(put by q.kig) p.kig [%c ren bem])]
mow
:_ mow
:- hen
:^ %pass
[(scot %p our) (scot %ud num) (scot %ud p.kig) ~]
%c
~& >> [%camping van ren bem]
[%warp [our p.bem] q.bem [~ %sing ren r.bem (flop s.bem)]]
==
+>.$
:: ::
++ clad :: hash dependencies ++ clad :: hash dependencies
|* hoc/(bolt) ^+ [*@uvH hoc] |* hoc/(bolt) ^+ [*@uvH hoc]
@ -580,7 +567,7 @@
:: ::
++ exec :: execute app ++ exec :: execute app
^+ ..zo ^+ ..zo
?: !=(~ q.kig) ..zo ?: !=(~ kig) ..zo
=+ bot=(make-norm-bek [~ jav.bay deh.bay] kas) =+ bot=(make-norm-bek [~ jav.bay deh.bay] kas)
=^ dep bot (clad bot) =^ dep bot (clad bot)
=. ..exec (dash p.bot) =. ..exec (dash p.bot)
@ -1762,23 +1749,24 @@
== ==
:: ::
++ resp ++ resp
|= {tik/@ud rot/riot} |= {{van/vane ren/care bem/beam} rot/riot}
^+ ..zo ^+ ..zo
?> (~(has by q.kig) tik) ?> ?=($c van)
=+ `{van/vane ren/care bem/beam}`(~(got by q.kig) tik) =. kig (~(del in kig) +<-.$)
?~ rot ?~ rot
=^ dep deh.bay (daze ~ deh.bay) :: dependencies? =^ dep deh.bay (daze ~ deh.bay) :: dependencies?
amok:(expo [%made dep %| (smyt ren (tope bem)) ~]) amok:(expo [%made dep %| (smyt ren (tope bem)) ~])
=+ (cat 3 'c' ren) =+ (cat 3 van ren)
exec(q.kig (~(del by q.kig) tik), keg (~(put by keg) [- bem] r.u.rot)) exec(keg (~(put by keg) [- bem] r.u.rot))
:: ::
++ resd ++ resd
|= {tik/@ud cag/cage} |= {{van/vane ren/care bem/beam} cag/cage}
^+ ..zo ^+ ..zo
?> (~(has by q.kig) tik) ?> ?=($g van)
=+ `{van/vane ren/care bem/beam}`(~(got by q.kig) tik) =. kig (~(del in kig) +<-.$)
=+ (cat 3 'g' ren) =. mow :_(mow [hen (cancel van ren bem)])
exec(q.kig (~(del by q.kig) tik), keg (~(put by keg) [- bem] cag)) =+ (cat 3 van ren)
exec(keg (~(put by keg) [- bem] cag))
:: ::
++ syve ++ syve
^- sley ^- sley
@ -1789,6 +1777,9 @@
%+ biff +< %+ biff +<
|= cay/cage ^- (unit cage) |= cay/cage ^- (unit cage)
?. -:(nets:wa +.ref `span`p.q.cay) :: error if bad type ?. -:(nets:wa +.ref `span`p.q.cay) :: error if bad type
~& :^ %ford-syve-lost `path`[tem (tope bem)]
want=;;(span +.ref)
have=p.q.cay
~ ~
`cay `cay
^- (unit (unit cage)) ^- (unit (unit cage))
@ -1897,10 +1888,12 @@
?^ dep ?^ dep
=+ bem=(need (tome t.t.tea)) =+ bem=(need (tome t.t.tea))
abet:(~(axun za [our hen [now eny ski] ~] bay) tea u.dep bem q.hin) abet:(~(axun za [our hen [now eny ski] ~] bay) tea u.dep bem q.hin)
?> ?=({@ $~} t.t.tea) ?> ?=({@ @ ^} t.t.tea)
=+ :* num=(slav %ud i.t.tea) =+ :* num=(slav %ud i.t.tea)
tik=(slav %ud i.t.t.tea) van=((hard vane) i.t.t.tea)
ren=((hard care) i.t.t.t.tea)
bem=(need (tome t.t.t.t.tea))
== ==
abet:(~(axon za [our hen [now eny ski] ~] bay) num tik q.hin) abet:(~(axon za [our hen [now eny ski] ~] bay) num [van ren bem] q.hin)
[mos ..^$(pol (~(put by pol) our bay))] [mos ..^$(pol (~(put by pol) our bay))]
-- --

View File

@ -647,7 +647,11 @@
?+ q.p.zem ((slog leaf+"peek bad result" ~) [~ ~]) ?+ q.p.zem ((slog leaf+"peek bad result" ~) [~ ~])
$~ ~ $~ ~
{$~ $~} [~ ~] {$~ $~} [~ ~]
{$~ $~ term *} ``[+14.q.p.zem (slot 15 p.zem)] {$~ $~ ^}
=+ caz=(spec (slot 7 p.zem))
?. &(?=({p/@ *} q.caz) ((sane %tas) p.q.caz))
((slog leaf+"scry: malformed cage" ~) [~ ~])
``[p.q.caz (slot 3 caz)]
== ==
:: ::
++ ap-club :: apply effect ++ ap-club :: apply effect

View File

@ -1194,6 +1194,8 @@
(cold 63 (just '/')) (cold 63 (just '/'))
== ==
:: ::
:: .= ~[p=~.ack q=~.~sarnel r=~..y]
:: (dray ~[p=%tas q=%p r=%f] %ack ~sarnel &)
++ dray :: load tuple into path ++ dray :: load tuple into path
=- |* {a/{@tas (pole @tas)} b/*} ^- (paf a) =- |* {a/{@tas (pole @tas)} b/*} ^- (paf a)
=> .(b `(tup -.a +.a)`b) => .(b `(tup -.a +.a)`b)
@ -1211,7 +1213,7 @@
^= odo ^= odo
|* a/@tas |* a/@tas
|= b/* |= b/*
=< a(. (. b)) :: preserve face =< a(, (. b)) :: preserve face
?+ a @ ?+ a @
$c @c $da @da $dr @dr $f @f $if @if $is @is $p @p $c @c $da @da $dr @dr $f @f $if @if $is @is $p @p
$u @u $uc @uc $ub @ub $ui @ui $ux @ux $uv @uv $uw @uw $u @u $uc @uc $ub @ub $ui @ui $ux @ux $uv @uv $uw @uw

View File

@ -4,11 +4,11 @@
/? 310 /? 310
/- sole /- sole
[sole] [sole]
:- %get |= {^ {a/hiss $~} $~} :- %get |= {^ {a/hiss $~} usr/iden}
^- (sole-request (cask httr)) ^- (sole-request (cask httr))
?. ?=($get p.q.a) ?. ?=($get p.q.a)
~| %only-get-requests-supported-in-generators :: XX enforced? ~| %only-get-requests-supported-in-generators :: XX enforced?
!! !!
:- *tang :- *tang
:+ %| `hiss`a :^ %| `usr `hiss`a
|=(hit/httr (sole-so %httr hit)) |=(hit/httr (sole-so %httr hit))

View File

@ -5,6 +5,7 @@
/- sole /- sole
[sole] [sole]
:- %get |= {^ {a/tape $~} $~} :- %get |= {^ {a/tape $~} $~}
^- (sole-request (cask httr))
%+ sole-at (scan a auri:epur) %+ sole-at (scan a auri:epur)
|= hit/httr |= hit/httr
(sole-so %httr hit) (sole-so %httr hit)

View File

@ -4,7 +4,7 @@
:: ::
[twitter .] [twitter .]
:- %say :- %say
|= $: [now=@da eny=@uvI bec=beak] |= $: {now/@da eny/@uvI bec/beak}
[[who=span msg=cord ~] ~] {{who/knot msg/cord $~} $~}
== ==
[%twit-do [who %post eny msg]] [%twit-do [who %post eny msg]]

View File

@ -1,23 +0,0 @@
:: Input twitter keys
/- sole, twitter
!:
[sole twitter .]
|%
++ baz64 (cook crip (star alp))
--
!:
:- %ask
|= $: [now=@da eny=@uvI bec=beak]
[~ ~]
==
^- (sole-result (cask twit-do))
%+ sole-lo [%& %$ "User: "] %+ sole-go urs:ab |= acc=span
%+ sole-lo [%& %$ "App token: "] %+ sole-go baz64 |= ctok=cord
%+ sole-lo [%& %$ "App secret: "] %+ sole-go baz64 |= csec=cord
%+ sole-lo [%& %$ "User token: "] %+ sole-go baz64 |= atok=cord
%+ sole-lo [%& %$ "User secret: "] %+ sole-go baz64 |= asec=cord
(sole-so %twit-do [acc %auth [ctok csec] atok asec])

View File

@ -1,5 +0,0 @@
hoontap
AP3G1t8ki6rPzeeAqdWCTw03F
VV784LPwZSaAxtF16RWWTnST4F85BHN8VqQKNyv7MprCkA0xZD
2821727326-BAABHUpwCuoeVjINTHTVvfPlJlGHmigqKywlLcE
o6TCNfQhhUkzx6fKIC3CGi2cWn3YbEoQVCVgg210YYTtV

17
gen/twit/feed.hoon Normal file
View File

@ -0,0 +1,17 @@
:: Display twitter feed
::
:::: /hoon/feed/twit/gen
::
/- twitter
!:
:::: ~fyr
::
:- %say
|= $: {now/@da eny/@uvI bek/beak}
{{who/iden $~} typ/?($home $user)}
==
=+ pax=/(scot %p p.bek)/twit/(scot %da now)/[typ]/[who]
:- %tang
%+ turn (flop .^((list post:twitter) %gx pax))
|= post:twitter ^- tank
rose+[": " `~]^~[leaf+"{<now>} @{(trip who)}" leaf+(trip txt)]

View File

@ -1,13 +0,0 @@
/+ sh-utils
!:
|_ [hide ~]
++ peer ,_`.
++ poke--args
%+ add-subs [[our /twit] our /post/(scot %uv eny)]
%^ gate-mess .
|=([a=span b=cord ~] [/twit %twit-do !>([a %post eny b])])
,_`.
++ posh-twit-stat
(args-into-gate . |=([@ @ a=@da @] tang/~[leaf/"Tweet recieved {<a>}"]))
++ pour |*([ost=@ * sih=[@ ^]] :_(+>.$ [ost %give +.sih]~))
--

View File

@ -1,23 +0,0 @@
:: Display twitter feed
::
:::: /hook/core/twitter-feed/app
::
/+ sh-utils
!:
::
:::: ~fyr
::
|_ [hide ~]
++ stat ,[id=@u who=@ta now=@da txt=@t]
++ rens
:- %say
|=(stat rose/[": " `~]^~[leaf/"{<now>} @{(trip who)}" leaf/(trip txt)])
++ peer ,_`.
++ poke--args
|= [ost=bone his=ship who=span ~]
%.(+< (add-subs [[our /twit] our /user/[who]] ,_`+>.$))
::
++ posh-twit-feed
(args-into-gate . |=(a=(list stat) tang/(turn a rens)))
:: ++ pour |*([ost=@ * sih=[@ ^]] :_(+>.$ [ost %give +.sih]~))
--

View File

@ -150,6 +150,10 @@
:: ::
++ token-exchange (post-quay exchange-url ~) ++ token-exchange (post-quay exchange-url ~)
++ token-request (post-quay token-reqs-url oauth-callback+oauth-callback ~) ++ token-request (post-quay token-reqs-url oauth-callback+oauth-callback ~)
++ identity
%+ weld
?~(usr "default identity for " "{(trip usr)}@")
(trip (join '.' (flop dom)))
:: ::
:: use token to sign authorization header. requires: :: use token to sign authorization header. requires:
:: ++ res (res-handle-reqt handle-token) :: take request token :: ++ res (res-handle-reqt handle-token) :: take request token
@ -169,7 +173,10 @@
?. ?=({{$'oauth_token' oauth-token/@t} {$'oauth_verifier' @t} $~} a) ?. ?=({{$'oauth_token' oauth-token/@t} {$'oauth_verifier' @t} $~} a)
~|(no-token+a !!) ~|(no-token+a !!)
?~ tok ?~ tok
~|(%no-secret-for-token !!) %+ mean-wall %no-secret-for-token
"""
Attempting to authorize {identity}
"""
?. =(oauth-token.tok oauth-token.q.i.a) ?. =(oauth-token.tok oauth-token.q.i.a)
~| wrong-token+[id=usr q.i.a] ~| wrong-token+[id=usr q.i.a]
~|(%multiple-tokens-unsupported !!) ~|(%multiple-tokens-unsupported !!)
@ -178,8 +185,12 @@
++ token-response ['oauth_token' 'oauth_token_secret'] ++ token-response ['oauth_token' 'oauth_token_secret']
+- bak-save-access +- bak-save-access
|= handle/$-(token _done) |= handle/$-(token _done)
%- (res-parse token-response) %- (res-parse token-response 'screen_name')
|= access-token/{tok/@t sec/@t} ^- core-move |= {access-token/{tok/@t sec/@t} nam/knot} ^- core-move
?. ?~(usr & =(usr nam))
%- %- %*(. slog pri 1)
(flop p:(mule |.(~|(wrong-user+[req=usr got=nam] !!))))
[[%redo ~] (handle `token`~)]
[[%redo ~] (handle `token`[%access-token access-token])] [[%redo ~] (handle `token`[%access-token access-token])]
:: ::
+- res-parse +- res-parse

View File

@ -9,7 +9,7 @@
:::: ::::
:: ::
[. ^talk] [. ^talk]
|% |_ bol/bowl
++ main :: main story ++ main :: main story
|= our/ship ^- cord |= our/ship ^- cord
=+ can=(clan our) =+ can=(clan our)
@ -18,6 +18,18 @@
$king %floor $king %floor
== ==
:: ::
++ said-url :: app url
|= url/purl
:^ ost.bol %poke /said-url
:+ [our.bol %talk] %talk-command
^- command
:- %publish
:_ ~
^- thought
:+ (shaf %thot eny.bol)
[[[%& our.bol (main our.bol)] [*envelope %pending]] ~ ~]
[now.bol *bouquet [%app dap.bol (crip (earn url))]] :: XX
::
++ said :: app message ++ said :: app message
|= {our/@p dap/term now/@da eny/@uvI mes/(list tank)} |= {our/@p dap/term now/@da eny/@uvI mes/(list tank)}
:- %talk-command :- %talk-command

View File

@ -58,7 +58,7 @@
$get [url med *math ~] $get [url med *math ~]
$post $post
=+ hed=(my content-type+['application/x-www-form-urlencoded']~ ~) =+ hed=(my content-type+['application/x-www-form-urlencoded']~ ~)
[url(r ~) med hed (some (tact +:(tail:earn r.url)))] [url(r ~) med hed ?~(r.url ~ (some (tact +:(tail:earn r.url))))]
== ==
:: ::
++ find-req ++ find-req
@ -85,14 +85,14 @@
++ fasp |*(a/{@tas *} [(gsub '-' '_' -.a) +.a]) :: XX usable electroplating ++ fasp |*(a/{@tas *} [(gsub '-' '_' -.a) +.a]) :: XX usable electroplating
++ user (cook crip (plus ;~(pose aln cab))) ++ user (cook crip (plus ;~(pose aln cab)))
++ mean (ot errors+(ar (ot message+so code+ni ~)) ~):jo ++ mean (ot errors+(ar (ot message+so code+ni ~)) ~):jo
++ stat ++ post
=+ jo =+ jo
%+ ce stat:sur-twit %+ ce post:sur-twit
%- ot %- ot
:~ id+ni :~ id+ni
user+(ot (fasp screen-name+(su user)) ~) user+(ot (fasp screen-name+(su user)) ~)
(fasp created-at+da) (fasp created-at+da)
text+so text+(cu crip (su (star escp:poxa))) :: parse html escapes
== ==
++ usel ++ usel
=+ jo =+ jo
@ -109,10 +109,6 @@
|= a/$@(^scr ^lsc) ^- @t |= a/$@(^scr ^lsc) ^- @t
?@(a `@t`a (join ',' a)) ?@(a `@t`a (join ',' a))
:: ::
++ lst
|= a/$@(@t ^lst) ^- @t
?@(a `@t`a (join ',' a))
::
++ lid ++ lid
|= a/$@(^tid (list ^tid)) ^- @t |= a/$@(^tid (list ^tid)) ^- @t
?~ a ~|(%nil-id !!) ?~ a ~|(%nil-id !!)
@ -123,7 +119,7 @@
=+ args:reqs =+ args:reqs
|% |%
++ apex ++ apex
|= {a/endpoint b/quay} |= {a/endpoint b/quay} ^- hiss
=+ [med pax]=(find-req -.a) =+ [med pax]=(find-req -.a)
(valve med (cowl pax +.a b)) (valve med (cowl pax +.a b))
:: ::
@ -157,8 +153,7 @@
:- (gsub '-' '_' -.p) :- (gsub '-' '_' -.p)
?+ -.p p.p :: usually plain text ?+ -.p p.p :: usually plain text
?($source-id $target-id) (tid:print p.p) ?($source-id $target-id) (tid:print p.p)
?($follow $id $name $user-id) (lid:print p.p) ?($id $name $user-id) (lid:print p.p)
$track (lst:print p.p)
$screen-name (lsc:print p.p) $screen-name (lsc:print p.p)
== ==
-- --

View File

@ -0,0 +1,22 @@
:: Possibly non-fatal http error
::
:::: /hoon/recoverable-error/mar
::
/- recoverable-error
!:
:::: ~fyr
::
|_ recoverable-error
++ grab
|%
++ noun recoverable-error
++ httr
|= a/^httr ^- recoverable-error
~! a
?+ p.a ~|(non-recoverable+p.a !!)
$429 :+ p.a %rate-limit
%.(%x-rate-limit-reset ;~(biff ~(get by (malt q.a)) poja ni:jo))
==
--
++ grow |% ++ tank >[+<]< --
--

View File

@ -3,11 +3,11 @@
:::: /hoon/feed/twit/mar :::: /hoon/feed/twit/mar
:: ::
/+ twitter, httr-to-json /+ twitter, httr-to-json
|_ (list stat:twitter) |_ (list post:twitter)
++ grab ++ grab
|% |%
++ noun (list stat:twitter) ++ noun (list post:twitter)
++ json (corl need (ar:jo stat:parse:twitter)) ++ json (corl need (ar:jo post:parse:twitter))
++ httr (cork httr-to-json json) :: XX mark translation ++ httr (cork httr-to-json json) :: XX mark translation
-- --
++ grow ++ grow

View File

@ -1,13 +1,13 @@
:: Twitter status :: Twitter status
:: ::
:::: /hoon/stat/twit/mar :::: /hoon/post/twit/mar
:: ::
/+ twitter, httr-to-json /+ twitter, httr-to-json
|_ stat:twitter |_ post:twitter
++ grab ++ grab
|% |%
++ noun stat:twitter ++ noun post:twitter
++ json (corl need stat:parse:twitter) ++ json (corl need post:parse:twitter)
++ httr (cork httr-to-json json) :: XX mark translation ++ httr (cork httr-to-json json) :: XX mark translation
-- --
++ grow ++ grow

View File

@ -0,0 +1,8 @@
:: Possibly non-fatal http error
::
:::: /hoon/recoverable-error/sur
::
!:
$% :: more later, {@u (cask)}
{$429 p/{$rate-limit p/(unit @da)}}
==

View File

@ -73,7 +73,7 @@
|* out/$-(* *) :: output structure |* out/$-(* *) :: output structure
%+ pair (list tank) :: %+ pair (list tank) ::
%+ each (unit out) :: ~ is abort %+ each (unit out) :: ~ is abort
(pair hiss $-(httr (sole-request out))) :: fetch and continue (trel (unit iden) hiss $-(httr (sole-request out))) :: fetch and continue
:: :: :: ::
++ sole-gen :: XX virtual type ++ sole-gen :: XX virtual type
$% {$say $-((sole-args) (cask))} :: direct noun $% {$say $-((sole-args) (cask))} :: direct noun
@ -99,8 +99,10 @@
[p=*(list tank) q=[%| p=pom q=mor]] :: [p=*(list tank) q=[%| p=pom q=mor]] ::
:: :: :: ::
++ sole-at :: fetch url ++ sole-at :: fetch url
|* {pul/_purl fun/$-(httr *)} :: =| usr/iden ::
[p=*(list tank) q=[%| p=[pul %get ~ ~] q=fun]] :: |* {pul/_purl fun/$-(httr *)} ::
:- p=*(list tank) ::
q=[%| p=`usr q=[pul %get ~ ~] r=fun] ::
:: :: :: ::
++ sole-no :: empty result ++ sole-no :: empty result
[p=*(list tank) q=[%& ~]] :: [p=*(list tank) q=[%& ~]] ::

View File

@ -1,16 +1,15 @@
|% |%
++ stat {id/@u who/@ta now/@da txt/@t} :: recieved tweet ++ post {id/@u who/@ta now/@da txt/@t} :: recieved tweet
++ keys :: twitter-key type ++ keys :: twitter-key type
$: con/{tok/@t sec/@t} :: user key pair $: con/{tok/@t sec/@t} :: user key pair
acc/{tok/@t sec/@t} :: app key pair acc/{tok/@t sec/@t} :: app key pair
== ==
:: ::
++ command :: poke action ++ command :: poke action
$% {$auth p/keys} :: set API keys $% {$post p/@uvI q/cord} :: post a tweet
{$post p/@uvI q/cord} :: post a tweet
== ==
++ sur-twit . :: XX ++ sur-twit . :: XX
:: ::
++ reqs ++ reqs
|% |%
++ args ++ args
@ -21,7 +20,6 @@
++ lid (list tid) :: screen names ++ lid (list tid) :: screen names
++ lon @t :: longitude ++ lon @t :: longitude
++ lsc (list scr) :: ++ lsc (list scr) ::
++ lst (list @t)
++ nam @t :: location name ++ nam @t :: location name
++ pla @t :: place-id ++ pla @t :: place-id
++ scr @t :: screen name ++ scr @t :: screen name
@ -32,12 +30,11 @@
-- --
++ param ++ param
=> args => args
=< $? de fo gr id is la lo na os pl qq sc =< $? de gr id is la lo na os pl qq sc
sd ss sl si st te ti ts tr ur ui us sd ss sl si st te ti ts ur ui us
== ==
|% |%
++ de {$device p/dev} ++ de {$device p/dev}
++ fo {$follow p/lid}
++ gr {$grant-type p/gat} ++ gr {$grant-type p/gat}
++ id {$id p/tid} ++ id {$id p/tid}
++ is {$id p/lid} ++ is {$id p/lid}
@ -56,7 +53,6 @@
++ te {$text p/@t} ++ te {$text p/@t}
++ ti {$target-id p/tid} ++ ti {$target-id p/tid}
++ ts {$target-screen-name p/scr} ++ ts {$target-screen-name p/scr}
++ tr {$track p/lst}
++ ur {$url p/url} ++ ur {$url p/url}
++ ui {$user-id p/tid} ++ ui {$user-id p/tid}
++ us {$user-id p/lid} ++ us {$user-id p/lid}
@ -85,112 +81,115 @@
:: ^- (pole {_{term _(pole *param)} ?($get $post) path}) :: ^- (pole {_{term _(pole *param)} ?($get $post) path})
=> param => param
:~ :~
[ {$stat-ment $~} %get /statuses/mentions-timeline ] [ {$mentions $~} %get /statuses/mentions-timeline ]
[ {$stat-user sd $~} %get /statuses/user-timeline ] [ {$posts-by sd $~} %get /statuses/user-timeline ]
[ {$stat-home $~} %get /statuses/home-timeline ] [ {$timeline $~} %get /statuses/home-timeline ]
[ {$stat-retw $~} %get /statuses/retweets-of-me ] [ {$retweets-mine $~} %get /statuses/retweets-of-me ]
[ {$stat-rets-iddd id $~} %get /statuses/retweets/':id' ] [ {$retweets-of id $~} %get /statuses/retweets/':id' ]
[ {$stat-show id $~} %get /statuses/show ] [ {$show-status id $~} %get /statuses/show ]
[ {$stat-dest-iddd id $~} %post /statuses/destroy/':id' ] [ {$del-status id $~} %post /statuses/destroy/':id' ]
[ {$stat-upda st $~} %post /statuses/update ] [ {$full-status id $~} %post /statuses/looup ]
[ {$stat-retw-iddd id $~} %post /statuses/retweet/':id' ] [ {$update st $~} %post /statuses/update ]
[ {$stat-oemb-iddd id $~} %get /statuses/oembed ] [ {$retweet id $~} %post /statuses/retweet/':id' ]
[ {$stat-oemb-urll ur $~} %get /statuses/oembed ] [ {$unretweet id $~} %post /statuses/unretweet/':id' ]
[ {$stat-retw-idss id $~} %get /statuses/retweeters/ids ]
[ {$sear-twee qq $~} %get /search/tweets ]
:- {$stat-filt-foll ?(fo tr) $~}
[%post /statuses/filter]
:: ::
[ {$stat-samp $~} %get /statuses/sample ] [ {$oembed-from-id id $~} %get /statuses/oembed ]
[ {$stat-fire $~} %get /statuses/firehose ] [ {$oembed-from-url ur $~} %get /statuses/oembed ]
[ {$dire $~} %get /direct-messages ] [ {$retweeters id $~} %get /statuses/retweeters/ids ]
[ {$dire-sent $~} %get /direct-messages/sent ] [ {$search qq $~} %get /search/tweets ]
[ {$dire-show id $~} %get /direct-messages/show ] [ {$all-dms $~} %get /direct-messages ]
[ {$dire-dest id $~} %post /direct-messages/destroy ] [ {$all-dms-sent $~} %get /direct-messages/sent ]
[ {$dire-neww sd te $~} %post /direct-messages/new ] [ {$show-dm id $~} %get /direct-messages/show ]
[ {$frie-nore-idss $~} %get /friendships/no-retweets/ids ] [ {$del-dm id $~} %post /direct-messages/destroy ]
[ {$frie-idss sd $~} %get /friends/ids ] [ {$dm sd te $~} %post /direct-messages/new ]
[ {$foll-idss sd $~} %get /followers/ids ] ::
[ {$frie-inco $~} %get /friendships/incoming ] [ {$blocked-retweeters $~} %get /friendships/no-retweets/ids ]
[ {$frie-outg $~} %get /friendships/outgoing ] [ {$followers sd $~} %get /followers/list ]
[ {$frie-crea sd $~} %post /friendships/create ] [ {$follower-ids sd $~} %get /followers/ids ]
[ {$frie-dest sd $~} %post /friendships/destroy ] [ {$friends sd $~} %get /friends/list ]
[ {$frie-upda sd $~} %post /friendships/update ] [ {$friend-ids sd $~} %get /friends/ids ]
:- {$frie-show ?(si os) ?(ti ts) $~} [ {$friend-requests $~} %get /friendships/incoming ]
[ {$friend-requesting $~} %get /friendships/outgoing ]
[ {$follow sd $~} %post /friendships/create ]
[ {$unfollow sd $~} %post /friendships/destroy ]
[ {$set-friendship sd $~} %post /friendships/update ]
[ {$relationships ?(us ss) $~} %get /friendships/lookup ]
:- {$relationship ?(si os) ?(ti ts) $~}
[%get /friendships/show] [%get /friendships/show]
:: ::
[ {$frie-list sd $~} %get /friends/list ] [ {$show-settings $~} %get /account/settings ]
[ {$foll-list sd $~} %get /followers/list ] [ {$test-login $~} %get /account/verify-credentials ]
[ {$frie-look ?(us ss) $~} %get /friendships/lookup ] [ {$set-settings $~} %post /account/settings ]
[ {$acco-sett-gett $~} %get /account/settings ] [ {$set-sms-target de $~} %post /account/update-delivery-device ]
[ {$acco-veri $~} %get /account/verify-credentials ] [ {$set-profile $~} %post /account/update-profile ]
[ {$acco-sett-post $~} %post /account/settings ] [ {$set-colors $~} %post /account/update-profile-colors ]
[ {$acco-upda-deli de $~} %post /account/update-delivery-device ] [ {$del-background $~} %post /account/remove-profile-banner ]
[ {$acco-upda-prof $~} %post /account/update-profile ] :- {$set-background $~}
:- {$acco-upda-prof-back $~}
[%post /account/update-profile-background-image] [%post /account/update-profile-background-image]
:: ::
[ {$acco-upda-prof-colo $~} %post /account/update-profile-colors ] [ {$blocks $~} %get /blocks/list ]
[ {$bloc-list $~} %get /blocks/list ] [ {$blocks-ids $~} %get /blocks/ids ]
[ {$bloc-idss $~} %get /blocks/ids ] [ {$block sd $~} %post /blocks/create ]
[ {$bloc-crea sd $~} %post /blocks/create ] [ {$unblock sd $~} %post /blocks/destroy ]
[ {$bloc-dest sd $~} %post /blocks/destroy ]
[ {$user-look ?(us ss) $~} %get /users/lookup ]
[ {$user-show sd $~} %get /users/show ]
[ {$user-sear qq $~} %get /users/search ]
[ {$user-cont-tees sd $~} %get /users/contributees ]
[ {$user-cont-tors sd $~} %get /users/contributors ]
[ {$acco-remo $~} %post /account/remove-profile-banner ]
[ {$user-prof sd $~} %get /users/profile-banner ]
[ {$mute-user-crea sd $~} %post /mutes/users/create ]
[ {$mute-user-dest sd $~} %post /mutes/users/destroy ]
[ {$mute-user-idss $~} %get /mutes/users/ids ]
[ {$mute-user-list $~} %get /mutes/users/list ]
[ {$user-sugg-slug sl $~} %get /users/suggestions ]
[ {$user-sugg $~} %get /users/suggestions ]
[ {$favo-list $~} %get /favorites/list ]
[ {$favo-dest id $~} %post /favorites/destroy ]
[ {$favo-crea id $~} %post /favorites/create ]
[ {$list-list $~} %get /lists/list ]
[ {$list-stat $~} %get /lists/statuses ]
[ {$list-memb-dest $~} %post /lists/members/destroy ]
[ {$list-memb-hips sd $~} %get /lists/memberships ]
[ {$list-subs-bers $~} %get /lists/subscribers ]
[ {$list-subs-crea $~} %post /lists/subscribers/create ]
[ {$list-subs-show sd $~} %get /lists/subscribers/show ]
[ {$list-subs-dest $~} %post /lists/subscribers/destroy ]
:- {$list-memb-crea-alll ?(us ss) $~}
[%post /lists/members/create-all]
:: ::
[ {$list-memb-show sd $~} %get /lists/members/show ] [ {$full-users ?(us ss) $~} %get /users/lookup ]
[ {$list-memb-bers $~} %get /lists/members ] [ {$user sd $~} %get /users/show ]
[ {$list-memb-crea sd $~} %post /lists/members/create ] [ {$search-users qq $~} %get /users/search ]
[ {$list-dest $~} %post /lists/destroy ] [ {$user-contributees sd $~} %get /users/contributees ] :: undoc'd
[ {$list-upda $~} %post /lists/update ] [ {$user-contributors sd $~} %get /users/contributors ] :: undoc'd
[ {$list-crea na $~} %post /lists/create ] [ {$user-prof sd $~} %get /users/profile-banner ]
[ {$list-show $~} %get /lists/show ]
[ {$list-subs-ions sd $~} %get /lists/subscriptions ]
:- {$list-memb-dest-alll ?(us ss) $~}
[%post /lists/members/destroy-all]
:: ::
[ {$list-owne sd $~} %get /lists/ownerships ] [ {$mute-user sd $~} %post /mutes/users/create ]
[ {$save-list $~} %get /saved-searches/list ] [ {$unmute-user sd $~} %post /mutes/users/destroy ]
[ {$save-show-iddd id $~} %get /saved-searches/show/':id' ] [ {$muted $~} %get /mutes/users/list ]
[ {$save-crea qq $~} %post /saved-searches/create ] [ {$muted-ids $~} %get /mutes/users/ids ]
[ {$save-dest-iddd id $~} %post /saved-searches/destroy/':id' ] ::
[ {$geoo-iddd-plac id $~} %get /geo/id/':id' ] [ {$suggested $~} %get /users/suggestions ]
[ {$geoo-reve la lo $~} %get /geo/reverse-geocode ] [ {$suggestion sl $~} %get /users/suggestions/':slug' ]
[ {$geoo-sear $~} %get /geo/search ] :- {$suggestion-posts sl $~}
[ {$geoo-simi la lo na $~} %get /geo/similar-places ] [%get /users/suggestions/':slug'/members]
[ {$tren-plac id $~} %get /trends/place ] ::
[ {$tren-avai $~} %get /trends/available ] [ {$favorites $~} %get /favorites/list ]
[ {$tren-clos la lo $~} %get /trends/closest ] [ {$del-favorite id $~} %post /favorites/destroy ]
[ {$user-repo sd $~} %post /users/report-spam ] [ {$favorite id $~} %post /favorites/create ]
[ {$help-conf $~} %get /help/configuration ] ::
[ {$help-lang $~} %get /help/languages ] [ {$lists $~} %get /lists/list ]
[ {$help-priv $~} %get /help/privacy ] [ {$lists-of sd $~} %get /lists/memberships ]
[ {$help-toss $~} %get /help/tos ] [ {$lists-by sd $~} %get /lists/ownerships ]
[ {$appl-rate $~} %get /application/rate-limit-status ] [ {$lists-subscribed sd $~} %get /lists/subscriptions ]
[ {$list $~} %get /lists/show ]
[ {$list-posts $~} %get /lists/statuses ]
[ {$list-remove ?(us ss) $~} %post /lists/members/destroy-all ]
[ {$list-subscribers $~} %get /lists/subscribers ]
[ {$list-subscribe $~} %post /lists/subscribers/create ]
[ {$list-unsubscribe $~} %post /lists/subscribers/destroy ]
[ {$list-is-subscribed sd $~} %get /lists/subscribers/show ]
[ {$list-add ?(us ss) $~} %post /lists/members/create-all ]
[ {$list-is-in sd $~} %get /lists/members/show ]
[ {$list-members $~} %get /lists/members ]
[ {$del-list $~} %post /lists/destroy ]
[ {$config-list $~} %post /lists/update ]
[ {$new-list na $~} %post /lists/create ]
::
[ {$saved-searches $~} %get /saved-searches/list ]
[ {$full-saved-search id $~} %get /saved-searches/show/':id' ]
[ {$save-search qq $~} %post /saved-searches/create ]
[ {$del-saved-search id $~} %post /saved-searches/destroy/':id' ]
::
[ {$full-geo id $~} %get /geo/id/':id' ]
[ {$geo-reverse la lo $~} %get /geo/reverse-geocode ]
[ {$search-geo $~} %get /geo/search ]
[ {$geo-similar la lo na $~} %get /geo/similar-places ]
[ {$trend-locations $~} %get /trends/available ]
[ {$trends-at id $~} %get /trends/place ]
[ {$trends-near la lo $~} %get /trends/closest ]
::
[ {$user-report sd $~} %post /users/report-spam ]
[ {$help-config $~} %get /help/configuration ]
[ {$help-langs $~} %get /help/languages ]
[ {$help-privacy $~} %get /help/privacy ]
[ {$help-tos $~} %get /help/tos ]
[ {$rate-limit-info $~} %get /application/rate-limit-status ]
== ==
-- --
-- --