mirror of
https://github.com/ilyakooo0/urbit.git
synced 2024-11-28 19:55:53 +03:00
partial(twitter) revert of bfd52f9e
'sweeping'
This commit is contained in:
parent
f51226fd6e
commit
5f44ec53b3
219
ape/twit.hoon
Normal file
219
ape/twit.hoon
Normal file
@ -0,0 +1,219 @@
|
||||
:: Twitter daemon
|
||||
::
|
||||
:::: /hook/core/twit/app
|
||||
::
|
||||
/- twitter
|
||||
/+ twitter, talk
|
||||
::
|
||||
:::: ~fyr
|
||||
::
|
||||
[twitter .]
|
||||
|%
|
||||
++ twit-path :: valid peer path
|
||||
$% :: [%home ~] :: home timeline
|
||||
[%user p=@t ~] :: user's tweets
|
||||
[%post p=span:,@uv ~] :: status of status
|
||||
==
|
||||
::
|
||||
++ axle :: app state
|
||||
$: %0
|
||||
kes=(map span keys:twit-do) :: auth
|
||||
out=(map ,@uvI (each ,[span cord] stat)) :: sent tweets
|
||||
ran=(map path ,[p=@ud q=@da]) :: polls active
|
||||
fed=(jar path stat) :: feed cache
|
||||
==
|
||||
::
|
||||
++ gift :: subscription action
|
||||
$% [%quit ~] :: terminate
|
||||
[%diff gilt] :: send data
|
||||
==
|
||||
++ gilt
|
||||
$% [%twit-feed p=(list stat)] :: posts in feed
|
||||
[%twit-stat p=stat] :: tweet accepted
|
||||
[%ares term (list tank)]
|
||||
==
|
||||
::
|
||||
++ move ,[bone card]
|
||||
++ card :: arvo request
|
||||
$? gift
|
||||
$% [%them path ~ u=hiss] :: HTTP request
|
||||
[%poke wire dock %talk-command command:talk] ::
|
||||
[%wait path p=@da] :: timeout
|
||||
== ==
|
||||
::
|
||||
++ sign :: arvo response
|
||||
$% [%e %thou p=httr] :: HTTP result
|
||||
[%t %wake ~] :: timeout ping
|
||||
==
|
||||
::
|
||||
++ stat twit-stat :: recieved tweet
|
||||
--
|
||||
!:
|
||||
::::
|
||||
::
|
||||
|_ [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
|
||||
|= [pax=path rep=(list stat)] ^+ rep
|
||||
=+ pev=(sa (turn (~(get ja fed) pax) |=(stat id)))
|
||||
(skip rep |=(stat (~(has in pev) id)))
|
||||
::
|
||||
++ done [*(list move) .]
|
||||
++ dely :: next polling timeout
|
||||
|= pax=path
|
||||
^- [(unit time) _ran]
|
||||
=+ cur=(~(get by ran) pax)
|
||||
=+ tym=(add now (mul ~s8 (bex ?~(cur 0 p.u.cur))))
|
||||
:: ~& dely/`@dr`(sub tym now)
|
||||
?: &(?=(^ cur) (gte tym q.u.cur) (gth q.u.cur now))
|
||||
[~ ran]
|
||||
[`tym (~(put by ran) pax ?~(cur 0 (min 5 +(p.u.cur))) tym)]
|
||||
::
|
||||
++ wait :: ensure poll by path
|
||||
|= [pax=path mof=(list move)]
|
||||
=^ tym ran (dely pax)
|
||||
:_ +>.$
|
||||
?~ tym
|
||||
:: ~& no-wait/ran
|
||||
mof
|
||||
:: ~& will-wait/u.tym
|
||||
:- [ost %wait pax u.tym]
|
||||
mof
|
||||
::
|
||||
++ poke-twit-do :: recieve request
|
||||
|= act=twit-do
|
||||
^+ [*(list move) +>]
|
||||
?- -.q.act
|
||||
%auth
|
||||
:- [(print "authed @{(trip p.act)}")]~
|
||||
+>.$(kes (~(put by kes) p.act p.q.act)) :: XX verify key
|
||||
%post
|
||||
=: out (~(put by out) p.q.act %& p.act q.q.act)
|
||||
ran (~(del by ran) /peer/home)
|
||||
==
|
||||
%+ wait /peer/home
|
||||
=+ mez=(stat-upda:(auth p.act) [%status q.q.act]~ ~)
|
||||
[ost %them /post/(scot %uv p.q.act) ~ mez]~
|
||||
==
|
||||
::
|
||||
++ wake-peer
|
||||
|= [pax=path ~] ^+ done
|
||||
~& twit-wake/peer/pax
|
||||
:_ +>.$
|
||||
?. (~(has by ran) peer/pax) :: ignore if retracted
|
||||
~
|
||||
=+ => |=([a=bone @ b=path] [b a])
|
||||
pus=(~(gas ju *(jug path bone)) (turn (~(tap by sup)) .))
|
||||
?~ (~(get ju pus) pax)
|
||||
~
|
||||
~& peer-again/[pax ran]
|
||||
(pear | our pax)
|
||||
::
|
||||
++ thou
|
||||
|= [pax=path hit=httr] ^+ done
|
||||
?+ p.hit ~|([%unknown-code p.hit] !!)
|
||||
429 :: Rate-limit
|
||||
=. ran (~(put by ran) pax 6 now)
|
||||
=+ lim=%.(%x-rate-limit-reset ;~(biff ~(get by (mo q.hit)) poja ni:jo))
|
||||
=+ tym=?~(lim (add ~m7.s30 now) (add ~1970.1.1 (mul ~s1 u.lim)))
|
||||
~& retrying-in/`@dr`(sub tym now)
|
||||
:_(+>.$ [ost %wait pax tym]~)
|
||||
::
|
||||
200 :: OK
|
||||
=+ jon=(need (poja q:(need r.hit)))
|
||||
:: ~& twit-resp/%.(jon ?+(-.jon !! %o stat:twir, %a (ar:jo stat:twir)))
|
||||
?+ pax ~|([%http-missed pax] !!)
|
||||
[%post @ ~] :: post acknowledged
|
||||
=+ ^= rep
|
||||
~| [%bad-post jon]
|
||||
(need %.(jon stat:twir))
|
||||
=. out (~(put by out) (slav %uv i.t.pax) %| rep)
|
||||
:_ +>.$
|
||||
=+ pax=/[who.rep]/status/(rsh 3 2 (scot %ui id.rep))
|
||||
:- (print (earn [& ~ `/com/twitter] `pax ~))
|
||||
(spam pax (tweet-good rep))
|
||||
[%peer *] :: feed data
|
||||
=+ ^= rep
|
||||
~| [%bad-feed jon]
|
||||
(need %.(jon (ar:jo stat:twir)))
|
||||
:: ~& got-feed/[(scag 5 (turn rep |=(stat id))) fed]
|
||||
=+ ren=(cull t.pax rep) :: new messages
|
||||
?~ ren
|
||||
(wait pax ~) :: pump polling
|
||||
:: ~& spam-feed/ren
|
||||
=: ran (~(del by ran) pax) :: clear poll delay
|
||||
fed (~(put by fed) t.pax rep) :: saw last message
|
||||
==
|
||||
(wait pax (spam t.pax [%diff twit-feed/(flop ren)] ~))
|
||||
==
|
||||
::
|
||||
?(400 401 403 404) :: Err
|
||||
=+ ^- git=gift
|
||||
=+ err=%.(q:(need r.hit) ;~(biff poja mean:twir))
|
||||
:^ %diff %ares %bad-http
|
||||
[leaf/"HTTP Code {<p.hit>}" (turn (need err) mean:twip)]
|
||||
?+ pax [[ost git]~ +>.$]
|
||||
[%post @ ~]
|
||||
[(spam pax git ~) +>.$]
|
||||
==
|
||||
==
|
||||
++ tweet-good |=(rep=stat `(list gift)`~[[%diff %twit-stat rep] [%quit ~]])
|
||||
++ peer |=(pax=path :_(+> (pear & src pax))) :: accept subscription
|
||||
++ pear :: poll, possibly returning current data
|
||||
|= [ver=? @ pax=path]
|
||||
^- (list move)
|
||||
?. ?=(twit-path pax)
|
||||
~|([%missed-path pax] !!)
|
||||
=> .(pax `twit-path`pax)
|
||||
?: ?=(%post -.pax)
|
||||
?. ver ~
|
||||
=+ sta=(~(get by out) (slav %uv p.pax))
|
||||
?. ?=([~ %| ^] sta) :: post not received
|
||||
~
|
||||
~[[ost %diff %twit-stat p.u.sta] [ost %quit ~]]
|
||||
=+ ole=(~(get ja fed) pax)
|
||||
:_ ^- (list move)
|
||||
?. ver ~
|
||||
?~ ole ~
|
||||
[ost %diff %twit-feed (flop ole)]~
|
||||
=- `move`[ost %them peer/pax ~ `hiss`-]
|
||||
=+ opt=?~(ole ~ ['since_id' (lutt:twit id.i.ole)]~)
|
||||
=+ aut=any-auth
|
||||
?- -.pax
|
||||
%user (stat-user:aut [(to-sd p.pax)]~ opt)
|
||||
:: %home (stat-home:auth ~ opt)
|
||||
==
|
||||
::
|
||||
++ to-sd :: parse user name/numb
|
||||
|= a=span ^- sd:twit
|
||||
~| [%not-user a]
|
||||
%+ rash a
|
||||
;~(pose (stag %user-id dem) (stag %screen-name user:twir))
|
||||
::
|
||||
:: ++ pull :: release subscription
|
||||
:: |= ost=bone
|
||||
:: ?. (~(has by sup) ost) `+>.$ :: XX should not occur
|
||||
:: =+ [his pax]=(~(got by sup) ost)
|
||||
:: ?: (lth 1 ~(wyt in (~(get ju pus) pax)))
|
||||
:: `+>.$
|
||||
:: =: ran (~(del by ran) [%peer pax])
|
||||
:: fed (~(del by fed) pax)
|
||||
:: ==
|
||||
:: `+>.$
|
||||
::
|
||||
++ spam :: send by path
|
||||
|= [a=path b=(list gift)] ^- (list move)
|
||||
%- zing ^- (list (list move))
|
||||
%+ turn (~(tap by sup))
|
||||
|= [ost=bone @ pax=path]
|
||||
?. =(pax a) ~
|
||||
(turn b |=(c=gift [ost c]))
|
||||
::
|
||||
++ print
|
||||
|=(mes=tape [ost %poke / [our %talk] (said our %twit now eny leaf/mes ~)])
|
||||
--
|
10
gen/twit/as.hoon
Normal file
10
gen/twit/as.hoon
Normal file
@ -0,0 +1,10 @@
|
||||
/- twitter
|
||||
::
|
||||
::::
|
||||
::
|
||||
[twitter .]
|
||||
:- %say
|
||||
|= $: [now=@da eny=@uvI bec=beak]
|
||||
[[who=span msg=cord ~] ~]
|
||||
==
|
||||
[%twit-do [who %post eny msg]]
|
23
gen/twit/auth.hoon
Normal file
23
gen/twit/auth.hoon
Normal file
@ -0,0 +1,23 @@
|
||||
:: 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])
|
||||
|
||||
|
||||
|
||||
|
5
gen/twit/auth/hoontap-keys.txt
Normal file
5
gen/twit/auth/hoontap-keys.txt
Normal file
@ -0,0 +1,5 @@
|
||||
hoontap
|
||||
AP3G1t8ki6rPzeeAqdWCTw03F
|
||||
VV784LPwZSaAxtF16RWWTnST4F85BHN8VqQKNyv7MprCkA0xZD
|
||||
2821727326-RZGXSeTn7hCFQfJqR0ViivM3YYpu2O1M71gelBl
|
||||
jW9VygFPOTsEK0WmrJDHYSoEnofOPdCE1oQRzueemVTl8
|
13
gen/twit/tweet.hoon
Normal file
13
gen/twit/tweet.hoon
Normal file
@ -0,0 +1,13 @@
|
||||
/+ 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]~))
|
||||
--
|
23
gen/twit/twitter-feed.hoon
Normal file
23
gen/twit/twitter-feed.hoon
Normal file
@ -0,0 +1,23 @@
|
||||
:: 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]~))
|
||||
--
|
544
lib/twitter.hoon
Normal file
544
lib/twitter.hoon
Normal file
@ -0,0 +1,544 @@
|
||||
:: A Twitter API library.
|
||||
::
|
||||
:::: /hoon/twitter/lib
|
||||
::
|
||||
/? 314
|
||||
/- twitter
|
||||
=+ twit:twitter
|
||||
!:
|
||||
:::: functions
|
||||
::
|
||||
|%
|
||||
++ fass :: rewrite path
|
||||
|= a=path
|
||||
%- trip
|
||||
%^ gsub '-' '_'
|
||||
%+ reel a
|
||||
|= [p=@t q=@t]
|
||||
(cat 3 '/' (cat 3 p q))
|
||||
::
|
||||
++ gsub :: replace chars
|
||||
|= [a=@t b=@t t=@t]
|
||||
^- @t
|
||||
?~ t t
|
||||
%+ add (lsh 3 1 $(t (rsh 3 1 t)))
|
||||
=+ c=(mod t (bex 8))
|
||||
?:(=(a c) b c)
|
||||
::
|
||||
++ oauth :: OAuth 1.0 header
|
||||
|= $: med=meth
|
||||
url=tape
|
||||
pas=(list tape)
|
||||
key=keys
|
||||
zet=@
|
||||
ken=@
|
||||
==
|
||||
^- @t
|
||||
=+ non=(turn (rip 2 (shaw zet 128 ken)) |=(a=@ ~(x ne a)))
|
||||
=+ tim=(slag 2 (scow %ui (unt zet)))
|
||||
=+ sky=(crip :(weld (urle (trip sec.con.key)) "&" (urle (trip sec.acc.key))))
|
||||
=+ ^= bas
|
||||
^- tape
|
||||
=+ ^= hds
|
||||
%- reel :_ |=([p=tape q=tape] :(weld p "&" q))
|
||||
%- sort :_ aor
|
||||
%- weld :- pas
|
||||
^- (list tape)
|
||||
:~ :(weld "oauth_consumer_key=" (trip tok.con.key))
|
||||
:(weld "oauth_nonce=" non)
|
||||
:(weld "oauth_signature_method=HMAC-SHA1")
|
||||
:(weld "oauth_timestamp=" tim)
|
||||
:(weld "oauth_token=" (trip tok.acc.key))
|
||||
:(weld "oauth_version=1.0")
|
||||
==
|
||||
;: weld
|
||||
(trip (cuss (trip `@t`med))) "&"
|
||||
(urle url) "&"
|
||||
(urle (scag (dec (lent hds)) `tape`hds))
|
||||
==
|
||||
=+ sig=`tape`(sifo (swap 3 (hmac (swap 3 sky) (crip bas))))
|
||||
%- crip
|
||||
;: weld "OAuth "
|
||||
"oauth_consumer_key=" "\"" (trip tok.con.key) "\", "
|
||||
"oauth_nonce=" "\"" non "\", "
|
||||
"oauth_signature=" "\"" (urle sig) "\", "
|
||||
"oauth_signature_method=\"HMAC-SHA1\", "
|
||||
"oauth_timestamp=" "\"" tim "\", "
|
||||
"oauth_token=" "\"" (trip tok.acc.key) "\", "
|
||||
"oauth_version=1.0"
|
||||
==
|
||||
::
|
||||
++ valve :: produce request
|
||||
|= $: med=meth
|
||||
[rus=tape quy=quay]
|
||||
key=keys
|
||||
est=time
|
||||
eny=@
|
||||
==
|
||||
^- hiss
|
||||
=+ url="https://api.twitter.com/1.1{rus}.json"
|
||||
=+ req=|=(a=tape (scan a auri:epur))
|
||||
=+ ^= help
|
||||
|= quy=(list ,[tape tape])
|
||||
^- (list tape)
|
||||
%+ turn quy
|
||||
|= a=[p=tape q=tape]
|
||||
:(weld (urle p.a) "=" (urle q.a))
|
||||
=+ tan=(turn quy |=([p=@t q=@t] [(trip p) (trip q)]))
|
||||
=+ har=(help (turn tan |=(p=[p=tape q=tape] [p.p (urle q.p)])))
|
||||
=+ hab=(help tan)
|
||||
=+ lav=(reel har |=([p=tape q=tape] :(weld p "&" q)))
|
||||
=+ voy=?:(=(0 (lent lav)) ~ (scag (dec (lent lav)) `tape`lav))
|
||||
=+ vab=(reel hab |=([p=tape q=tape] :(weld p "&" q)))
|
||||
=+ vur=(crip ?:(=(0 (lent vab)) ~ (scag (dec (lent vab)) `tape`vab)))
|
||||
=+ ^= head
|
||||
%- ~(gas by *math)
|
||||
:~ ['authorization' [(oauth med url hab key est eny) ~]]
|
||||
['content-type' ['application/x-www-form-urlencoded' ~]]
|
||||
==
|
||||
?: =(%get med)
|
||||
?~ voy
|
||||
[(req url) med head ~]
|
||||
[(req :(weld url "?" voy)) med head ~]
|
||||
[(req url) med head (some [(met 3 vur) vur])]
|
||||
--
|
||||
!:
|
||||
:::: library
|
||||
::
|
||||
|%
|
||||
++ twip :: response printers
|
||||
|%
|
||||
++ mean
|
||||
|= [msg=@t num=@ud] ^- tank
|
||||
rose/[": " `~]^~[leaf/"Error {<num>}" leaf/(trip msg)]
|
||||
--
|
||||
++ twir :: response parsers
|
||||
|%
|
||||
++ fasp |*([a=@tas b=*] [(gsub '-' '_' a) b])
|
||||
++ user (cook crip (plus ;~(pose aln cab)))
|
||||
++ mean (ot errors/(ar (ot message/so code/ni ~)) ~):jo
|
||||
++ stat
|
||||
=+ jo
|
||||
^- $+(json (unit ,[id=@u who=@ta now=@da txt=@t]))
|
||||
%- ot
|
||||
:~ id/ni
|
||||
user/(ot (fasp screen-name/(su user)) ~)
|
||||
(fasp created-at/da)
|
||||
text/so
|
||||
==
|
||||
++ usel
|
||||
=+ jo
|
||||
^- $+(json (unit (list ,who=@ta)))
|
||||
=- (ot users/(ar -) ~)
|
||||
(ot (fasp screen-name/(su user)) ~)
|
||||
--
|
||||
++ twit
|
||||
=> |% :: request structures
|
||||
++ dev ,@t :: device name
|
||||
++ gat ,@t :: grant type
|
||||
++ lat ,@t :: latitude
|
||||
++ lid (list tid)
|
||||
++ lon ,@t :: longitude
|
||||
++ lsc (list scr)
|
||||
++ lst (list ,@t)
|
||||
++ nam ,@t :: location name
|
||||
++ pla ,@t :: place-id
|
||||
++ scr ,@t :: screen name
|
||||
++ slu ,@t :: category name
|
||||
++ tid ,@u
|
||||
++ tok ,@t :: oauth token
|
||||
++ url ,@t :: callback url
|
||||
::
|
||||
++ at ,[%access-token p=tok]
|
||||
++ de ,[%device p=dev]
|
||||
++ fo ,[%follow p=lid]
|
||||
++ gr ,[%grant-type p=gat]
|
||||
++ id ,[%id p=tid]
|
||||
++ ii ,[%'!inline' p=@t]
|
||||
++ is ,[%id p=lid]
|
||||
++ la ,[%lat p=lat]
|
||||
++ lo ,[%long p=lon]
|
||||
++ na ,[%name p=lid]
|
||||
++ oa ,[%oauth-callback p=url]
|
||||
++ os ,[%source-screen-name p=scr]
|
||||
++ pl ,[%place-id p=pla]
|
||||
++ qq ,[%q p=@t]
|
||||
++ sc ,[%screen-name p=scr]
|
||||
++ sd ?(ui sc)
|
||||
++ ss ,[%screen-name p=lsc]
|
||||
++ sl ,[%slug p=slu]
|
||||
++ si ,[%source-id p=tid]
|
||||
++ st ,[%status p=@t]
|
||||
++ te ,[%text p=@t]
|
||||
++ ti ,[%target-id p=tid]
|
||||
++ ts ,[%target-screen-name p=scr]
|
||||
++ tr ,[%track p=lst]
|
||||
++ ur ,[%url p=url]
|
||||
++ ui ,[%user-id p=tid]
|
||||
++ us ,[%user-id p=lid]
|
||||
--
|
||||
|_ [key=keys est=time eny=@uw]
|
||||
++ lutt |=(@ `@t`(rsh 3 2 (scot %ui +<)))
|
||||
++ llsc
|
||||
|= (list scr)
|
||||
(roll +< |=([p=scr q=@t] (cat 3 (cat 3 q ',') p)))
|
||||
::
|
||||
++ llst
|
||||
|= (list ,@t)
|
||||
(roll +< |=([p=@t q=@t] (cat 3 (cat 3 q ',') p)))
|
||||
::
|
||||
++ llid
|
||||
|= (list tid)
|
||||
(roll +< |=([p=tid q=@t] (cat 3 (cat 3 q ',') (lutt p))))
|
||||
::
|
||||
++ mold :: construct request
|
||||
|* [med=meth pax=path a=$+(* *)]
|
||||
|= [args=a quy=quay]
|
||||
(valve med (cowl pax args quy) key est eny)
|
||||
::
|
||||
++ cowl :: handle parameters
|
||||
|= $: pax=path
|
||||
ban=(list ,[p=@t q=?(@ (list ,@))])
|
||||
quy=quay
|
||||
==
|
||||
^- [path quay]
|
||||
?~ ban
|
||||
[(fass pax) quy]
|
||||
?: =('!inline' p.i.ban)
|
||||
?@ q.i.ban
|
||||
[(fass (welp pax /[`@t`q.i.ban])) quy]
|
||||
!!
|
||||
:- (fass pax)
|
||||
%+ welp quy
|
||||
%+ turn `(list ,[p=@t q=?(@ (list ,@))])`ban
|
||||
|= [p=@t q=?(@ (list ,@))]
|
||||
^- [@t @t]
|
||||
:- (gsub '-' '_' p)
|
||||
?@ q
|
||||
?- p
|
||||
?(%id %source-id %target-id %user-id) (lutt q)
|
||||
@ `@t`q
|
||||
==
|
||||
?- p
|
||||
?(%follow %id %name %user-id) (llid q)
|
||||
%track (llst q)
|
||||
%screen-name (llsc q)
|
||||
* !!
|
||||
==
|
||||
::
|
||||
++ stat-ment
|
||||
(mold %get /statuses/mentions-timeline ,~)
|
||||
::
|
||||
++ stat-user
|
||||
(mold %get /statuses/user-timeline ,[sd ~])
|
||||
::
|
||||
++ stat-home
|
||||
(mold %get /statuses/home-timeline ,~)
|
||||
::
|
||||
++ stat-retw
|
||||
(mold %get /statuses/retweets-of-me ,~)
|
||||
::
|
||||
++ stat-rets-iddd
|
||||
(mold %get /statuses/retweets ,[ii ~])
|
||||
::
|
||||
++ stat-show
|
||||
(mold %get /statuses/show ,[id ~])
|
||||
::
|
||||
++ stat-dest-iddd
|
||||
(mold %post /statuses/destroy ,[ii ~])
|
||||
::
|
||||
++ stat-upda
|
||||
(mold %post /statuses/update ,[st ~])
|
||||
::
|
||||
++ stat-retw-iddd
|
||||
(mold %post /statuses/retweet ,[ii ~])
|
||||
::
|
||||
++ stat-oemb-iddd
|
||||
(mold %get /statuses/oembed ,[id ~])
|
||||
::
|
||||
++ stat-oemb-urll
|
||||
(mold %get /statuses/oembed ,[ur ~])
|
||||
::
|
||||
++ stat-retw-idss
|
||||
(mold %get /statuses/retweeters/ids ,[id ~])
|
||||
::
|
||||
++ sear-twee
|
||||
(mold %get /search/tweets ,[qq ~])
|
||||
::
|
||||
++ stat-filt-foll
|
||||
(mold %post /statuses/filter ,[?(fo tr) ~])
|
||||
::
|
||||
++ stat-samp
|
||||
(mold %get /statuses/sample ,~)
|
||||
::
|
||||
++ stat-fire
|
||||
(mold %get /statuses/firehose ,~)
|
||||
::
|
||||
++ user
|
||||
(mold %get /user ,~)
|
||||
::
|
||||
++ site
|
||||
(mold %get /site ,[fo ~])
|
||||
::
|
||||
++ dire
|
||||
(mold %get /direct-messages ,~)
|
||||
::
|
||||
++ dire-sent
|
||||
(mold %get /direct-messages/sent ,~)
|
||||
::
|
||||
++ dire-show
|
||||
(mold %get /direct-messages/show ,[id ~])
|
||||
::
|
||||
++ dire-dest
|
||||
(mold %post /direct-messages/destroy ,[id ~])
|
||||
::
|
||||
++ dire-neww
|
||||
(mold %post /direct-messages/new ,[sd te ~])
|
||||
::
|
||||
++ frie-nore-idss
|
||||
(mold %get /friendships/no-retweets/ids ,~)
|
||||
::
|
||||
++ frie-idss
|
||||
(mold %get /friends/ids ,[sd ~])
|
||||
::
|
||||
++ foll-idss
|
||||
(mold %get /followers/ids ,[sd ~])
|
||||
::
|
||||
++ frie-inco
|
||||
(mold %get /friendships/incoming ,~)
|
||||
::
|
||||
++ frie-outg
|
||||
(mold %get /friendships/outgoing ,~)
|
||||
::
|
||||
++ frie-crea
|
||||
(mold %post /friendships/create ,[sd ~])
|
||||
::
|
||||
++ frie-dest
|
||||
(mold %post /friendships/destroy ,[sd ~])
|
||||
::
|
||||
++ frie-upda
|
||||
(mold %post /friendships/update ,[sd ~])
|
||||
::
|
||||
++ frie-show
|
||||
(mold %get /friendships/show ,[?(si os) ?(ti ts) ~])
|
||||
::
|
||||
++ frie-list
|
||||
(mold %get /friends/list ,[sd ~])
|
||||
::
|
||||
++ foll-list
|
||||
(mold %get /followers/list ,[sd ~])
|
||||
::
|
||||
++ frie-look
|
||||
(mold %get /friendships/lookup ,[?(us ss) ~])
|
||||
::
|
||||
++ acco-sett-gett
|
||||
(mold %get /account/settings ,~)
|
||||
::
|
||||
++ acco-veri
|
||||
(mold %get /account/verify-credentials ,~)
|
||||
::
|
||||
++ acco-sett-post
|
||||
(mold %post /account/settings ,~)
|
||||
::
|
||||
++ acco-upda-deli
|
||||
(mold %post /account/update-delivery-device ,[de ~])
|
||||
::
|
||||
++ acco-upda-prof
|
||||
(mold %post /account/update-profile ,~)
|
||||
::
|
||||
++ acco-upda-prof-back
|
||||
(mold %post /account/update-profile-background-image ,~)
|
||||
::
|
||||
++ acco-upda-prof-colo
|
||||
(mold %post /account/update-profile-colors ,~)
|
||||
::
|
||||
++ bloc-list
|
||||
(mold %get /blocks/list ,~)
|
||||
::
|
||||
++ bloc-idss
|
||||
(mold %get /blocks/ids ,~)
|
||||
::
|
||||
++ bloc-crea
|
||||
(mold %post /blocks/create ,[sd ~])
|
||||
::
|
||||
++ bloc-dest
|
||||
(mold %post /blocks/destroy ,[sd ~])
|
||||
::
|
||||
++ user-look
|
||||
(mold %get /users/lookup ,[?(us ss) ~])
|
||||
::
|
||||
++ user-show
|
||||
(mold %get /users/show ,[sd ~])
|
||||
::
|
||||
++ user-sear
|
||||
(mold %get /users/search ,[qq ~])
|
||||
::
|
||||
++ user-cont-tees
|
||||
(mold %get /users/contributees ,[sd ~])
|
||||
::
|
||||
++ user-cont-tors
|
||||
(mold %get /users/contributors ,[sd ~])
|
||||
::
|
||||
++ acco-remo
|
||||
(mold %post /account/remove-profile-banner ,~)
|
||||
::
|
||||
++ user-prof
|
||||
(mold %get /users/profile-banner ,[sd ~])
|
||||
::
|
||||
++ mute-user-crea
|
||||
(mold %post /mutes/users/create ,[sd ~])
|
||||
::
|
||||
++ mute-user-dest
|
||||
(mold %post /mutes/users/destroy ,[sd ~])
|
||||
::
|
||||
++ mute-user-idss
|
||||
(mold %get /mutes/users/ids ,~)
|
||||
::
|
||||
++ mute-user-list
|
||||
(mold %get /mutes/users/list ,~)
|
||||
::
|
||||
++ user-sugg-slug
|
||||
(mold %get /users/suggestions ,[sl ~])
|
||||
::
|
||||
++ user-sugg
|
||||
(mold %get /users/suggestions ,~)
|
||||
::
|
||||
++ favo-list
|
||||
(mold %get /favorites/list ,~)
|
||||
::
|
||||
++ favo-dest
|
||||
(mold %post /favorites/destroy ,[id ~])
|
||||
::
|
||||
++ favo-crea
|
||||
(mold %post /favorites/create ,[id ~])
|
||||
::
|
||||
++ list-list
|
||||
(mold %get /lists/list ,~)
|
||||
::
|
||||
++ list-stat
|
||||
(mold %get /lists/statuses ,~)
|
||||
::
|
||||
++ list-memb-dest
|
||||
(mold %post /lists/members/destroy ,~)
|
||||
::
|
||||
++ list-memb-hips
|
||||
(mold %get /lists/memberships ,[sd ~])
|
||||
::
|
||||
++ list-subs-bers
|
||||
(mold %get /lists/subscribers ,~)
|
||||
::
|
||||
++ list-subs-crea
|
||||
(mold %post /lists/subscribers/create ,~)
|
||||
::
|
||||
++ list-subs-show
|
||||
(mold %get /lists/subscribers/show ,[sd ~])
|
||||
::
|
||||
++ list-subs-dest
|
||||
(mold %post /lists/subscribers/destroy ,~)
|
||||
::
|
||||
++ list-memb-crea-alll
|
||||
(mold %post /lists/members/create-all ,[?(us ss) ~])
|
||||
::
|
||||
++ list-memb-show
|
||||
(mold %get /lists/members/show ,[sd ~])
|
||||
::
|
||||
++ list-memb-bers
|
||||
(mold %get /lists/members ,~)
|
||||
::
|
||||
++ list-memb-crea
|
||||
(mold %post /lists/members/create ,[sd ~])
|
||||
::
|
||||
++ list-dest
|
||||
(mold %post /lists/destroy ,~)
|
||||
::
|
||||
++ list-upda
|
||||
(mold %post /lists/update ,~)
|
||||
::
|
||||
++ list-crea
|
||||
(mold %post /lists/create ,[na ~])
|
||||
::
|
||||
++ list-show
|
||||
(mold %get /lists/show ,~)
|
||||
::
|
||||
++ list-subs-ions
|
||||
(mold %get /lists/subscriptions ,[sd ~])
|
||||
::
|
||||
++ list-memb-dest-alll
|
||||
(mold %post /lists/members/destroy-all ,[?(us ss) ~])
|
||||
::
|
||||
++ list-owne
|
||||
(mold %get /lists/ownerships ,[sd ~])
|
||||
::
|
||||
++ save-list
|
||||
(mold %get /saved-searches/list ,~)
|
||||
::
|
||||
++ save-show-iddd
|
||||
(mold %get /saved-searches/show ,[ii ~])
|
||||
::
|
||||
++ save-crea
|
||||
(mold %post /saved-searches/create ,[qq ~])
|
||||
::
|
||||
++ save-dest-iddd
|
||||
(mold %post /saved-searches/destroy ,[ii ~])
|
||||
::
|
||||
++ geoo-iddd-plac
|
||||
(mold %get /geo/id ,[ii ~])
|
||||
::
|
||||
++ geoo-reve
|
||||
(mold %get /geo/reverse-geocode ,[la lo ~])
|
||||
::
|
||||
++ geoo-sear
|
||||
(mold %get /geo/search ,~)
|
||||
::
|
||||
++ geoo-simi
|
||||
(mold %get /geo/similar-places ,[la lo na ~])
|
||||
::
|
||||
++ tren-plac
|
||||
(mold %get /trends/place ,[id ~])
|
||||
::
|
||||
++ tren-avai
|
||||
(mold %get /trends/available ,~)
|
||||
::
|
||||
++ tren-clos
|
||||
(mold %get /trends/closest ,[la lo ~])
|
||||
::
|
||||
++ user-repo
|
||||
(mold %post /users/report-spam ,[sd ~])
|
||||
::
|
||||
++ oaut-auth-cate
|
||||
(mold %get /oauth/authenticate ,~)
|
||||
::
|
||||
++ oaut-auth-rize
|
||||
(mold %get /oauth/authorize ,~)
|
||||
::
|
||||
++ oaut-acce
|
||||
(mold %post /oauth/access-token ,~)
|
||||
::
|
||||
++ oaut-requ
|
||||
(mold %post /oauth/request-token ,[oa ~])
|
||||
::
|
||||
++ oaut-toke
|
||||
(mold %post /oauth2/token ,[gr ~])
|
||||
::
|
||||
++ oaut-inva
|
||||
(mold %post /oauth2/invalidate-token ,[at ~])
|
||||
::
|
||||
++ help-conf
|
||||
(mold %get /help/configuration ,~)
|
||||
::
|
||||
++ help-lang
|
||||
(mold %get /help/languages ,~)
|
||||
::
|
||||
++ help-priv
|
||||
(mold %get /help/privacy ,~)
|
||||
::
|
||||
++ help-toss
|
||||
(mold %get /help/tos ,~)
|
||||
::
|
||||
++ appl-rate
|
||||
(mold %get /application/rate-limit-status ,~)
|
||||
::
|
||||
++ stat-look
|
||||
(mold %get /statuses/lookup ,[us ~])
|
||||
--
|
||||
--
|
16
sur/twitter.hoon
Normal file
16
sur/twitter.hoon
Normal file
@ -0,0 +1,16 @@
|
||||
|%
|
||||
++ twit-do => twit ,[p=span q=command] :: user and action
|
||||
++ twit-stat ,[id=@u who=@ta now=@da txt=@t] :: recieved tweet
|
||||
++ twit
|
||||
|%
|
||||
++ keys :: twitter-key type
|
||||
$: con=[tok=@t sec=@t] :: user key pair
|
||||
acc=[tok=@t sec=@t] :: app key pair
|
||||
==
|
||||
::
|
||||
++ command :: poke action
|
||||
$% [%auth p=keys] :: set API keys
|
||||
[%post p=@uvI q=cord] :: post a tweet
|
||||
==
|
||||
--
|
||||
--
|
Loading…
Reference in New Issue
Block a user