diff --git a/extra/bit/ly/authors.txt b/extra/bit/ly/authors.txt new file mode 100644 index 0000000000..1901f27a24 --- /dev/null +++ b/extra/bit/ly/authors.txt @@ -0,0 +1 @@ +Slava Pestov diff --git a/extra/bit/ly/ly.factor b/extra/bit/ly/ly.factor new file mode 100644 index 0000000000..32d40786f7 --- /dev/null +++ b/extra/bit/ly/ly.factor @@ -0,0 +1,23 @@ +! Copyright (C) 2010 Slava Pestov. +! See http://factorcode.org/license.txt for BSD license. +USING: assocs http.client json.reader kernel namespaces urls ; +IN: bit.ly + +SYMBOLS: login api-key ; + +url + login get "login" set-query-param + api-key get "apiKey" set-query-param + "json" "format" set-query-param + swap "longUrl" set-query-param ; + +: parse-response ( response data -- short-url ) + nip json> "data" swap at "url" swap at ; + +PRIVATE> + +: shorten-url ( long-url -- short-url ) + make-request http-get parse-response ; diff --git a/extra/bit/ly/summary.txt b/extra/bit/ly/summary.txt new file mode 100644 index 0000000000..29020a649b --- /dev/null +++ b/extra/bit/ly/summary.txt @@ -0,0 +1 @@ +Wrapper for bit.ly URL shortening web service diff --git a/extra/bit/ly/tags.txt b/extra/bit/ly/tags.txt new file mode 100644 index 0000000000..0a8d552b33 --- /dev/null +++ b/extra/bit/ly/tags.txt @@ -0,0 +1 @@ +web services