Skip to content

Commit b02e57c

Browse files
author
Matt Revelle
committed
Fixed some require expressions and added type hints.
1 parent 035b412 commit b02e57c

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

src/twitter.clj

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
(ns twitter
22
(:use [clojure.contrib.json :only [read-json]]
3-
[clojure.contrib.str-utils :only [re-gsub]]
3+
[clojure.string :only [replace]]
44
[clojure.contrib.java-utils :only [as-str]])
55
(:require [clojure.set :as set]
66
[com.twinql.clojure.http :as http]
77
[twitter.query :as query]
8-
[oauth.client :as oauth])
8+
[oauth.client :as oauth]
9+
[oauth.signature])
910
(:import (java.io File)
1011
(org.apache.http.entity.mime.content FileBody)
1112
(org.apache.http.entity.mime MultipartEntity)))
@@ -50,7 +51,7 @@ take any required and optional arguments and call the associated Twitter method.
5051
rest-map# (apply hash-map rest#)
5152
provided-optional-params# (set/intersection (set ~optional-params)
5253
(set (keys rest-map#)))
53-
query-param-names# (sort (map (fn [x#] (keyword (re-gsub #"-" "_" (name x#))))
54+
query-param-names# (sort (map (fn [x#] (keyword (replace #"-" "_" (name x#))))
5455
(concat ~required-params provided-optional-params#)))
5556
query-params# (apply hash-map (interleave query-param-names#
5657
(vec (concat ~required-fn-params
@@ -63,8 +64,8 @@ take any required and optional arguments and call the associated Twitter method.
6364
*oauth-access-token-secret*
6465
~req-method
6566
req-uri#
66-
(into {} (map (fn [[k# v#]] [k# (oauth/url-encode v#)]) query-params#))))]
67-
; (into {} (map (fn [k# v#] [k# (oauth/url-encode v#)]) query-params#))
67+
(into {} (map (fn [[k# v#]] [k# (oauth.signature/url-encode v#)]) query-params#))))]
68+
; (into {} (map (fn [k# v#] [k# (oauth.signature/url-encode v#)]) query-params#))
6869
(~handler (~(symbol "http" (name req-method))
6970
req-uri#
7071
:query (merge query-params#
@@ -340,7 +341,7 @@ take any required and optional arguments and call the associated Twitter method.
340341
[]
341342
(comp #(:content %) status-handler)))
342343

343-
(defn update-profile-image [image]
344+
(defn update-profile-image [^String image]
344345
(let [req-uri__9408__auto__ "http://api.twitter.com/1/account/update_profile_image.json"
345346

346347
oauth-creds__9414__auto__ (when
@@ -371,7 +372,7 @@ take any required and optional arguments and call the associated Twitter method.
371372
[:title]
372373
(comp #(:content %) status-handler)))
373374

374-
(defn update-profile-background-image [image & rest__2570__auto__]
375+
(defn update-profile-background-image [^String image & rest__2570__auto__]
375376
(let [req-uri__2571__auto__ "http://api.twitter.com/1/account/update_profile_background_image.json"
376377
rest-map__2572__auto__ (apply hash-map rest__2570__auto__)
377378
provided-optional-params__2573__auto__ (set/intersection
@@ -384,7 +385,7 @@ take any required and optional arguments and call the associated Twitter method.
384385
(fn
385386
[x__2575__auto__]
386387
(keyword
387-
(re-gsub
388+
(replace
388389
#"-"
389390
"_"
390391
(name
@@ -609,7 +610,7 @@ the Twitter API."
609610
(request [] (body "request"))
610611
(remaining-requests [] (headers "X-RateLimit-Remaining"))
611612
(rate-limit-reset [] (java.util.Date.
612-
(headers "X-RateLimit-Reset"))))))))
613+
(long (headers "X-RateLimit-Reset")))))))))
613614

614615
(defn make-rate-limit-handler
615616
"Creates a handler that will only be called if the API rate limit has been exceeded."

0 commit comments

Comments
 (0)