diff options
author | Sean Allred <code@seanallred.com> | 2014-12-03 17:59:02 -0500 |
---|---|---|
committer | Sean Allred <code@seanallred.com> | 2014-12-03 17:59:02 -0500 |
commit | 6b2ecadd89e31feb994883987c38f6988a140b8c (patch) | |
tree | c77890b4800813287f5d2fdf38effd389c219164 /sx-request.el | |
parent | 114ca09da984738df2510bc72753a3443d16857c (diff) | |
parent | 67b60ea558f0386a1ea3dadcf3a9c4d22d398620 (diff) |
Merge branch 'master' into issue-130
Conflicts:
sx-request.el
Conflict was trivial.
Diffstat (limited to 'sx-request.el')
-rw-r--r-- | sx-request.el | 16 |
1 files changed, 5 insertions, 11 deletions
diff --git a/sx-request.el b/sx-request.el index c8c6eb6..0994fbd 100644 --- a/sx-request.el +++ b/sx-request.el @@ -91,9 +91,8 @@ number of requests left every time it finishes a call." ;;; Making Requests -(defun sx-request-make - (method &optional args request-method) - "Make a request to the API, executing METHOD with ARGS. +(defun sx-request-make (method &optional args request-method) + "Make a request to the API, executing METHOD with ARGS. You should almost certainly be using `sx-method-call' instead of this function. REQUEST-METHOD is one of `GET' (default) or `POST'. @@ -116,8 +115,7 @@ then read with `json-read-from-string'. the main content of the response is returned." (let* ((url-automatic-caching t) (url-inhibit-uncompression t) - (url-request-data (sx-request--build-keyword-arguments args - nil)) + (url-request-data (sx-request--build-keyword-arguments args nil)) (request-url (concat sx-request-api-root method)) (url-request-method request-method) (url-request-extra-headers @@ -168,15 +166,11 @@ Currently returns nil." ;;; Support Functions - -(defun sx-request--build-keyword-arguments (alist &optional - kv-sep) +(defun sx-request--build-keyword-arguments (alist &optional kv-sep) "Format ALIST as a key-value list joined with KV-SEP. If authentication is needed, include it also or error if it is not available. -If NEED-AUTH is non-nil, authentication is required. - Build a \"key=value&key=value&...\"-style string with the elements of ALIST. If any value in the alist is nil, that pair will not be included in the return. If you wish to pass a notion of @@ -185,7 +179,7 @@ false, use the symbol `false'. Each element is processed with ;; Add API key to list of arguments, this allows for increased quota ;; automatically. (let ((api-key (cons "key" sx-request-api-key)) - (auth (car (sx-cache-get 'auth)))) + (auth (car (sx-cache-get 'auth)))) (push api-key alist) (when auth (push auth alist)) |