Compare commits
	
		
			1 Commits
		
	
	
		
			warn-key-r
			...
			gerrit-pac
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 
						 | 
					9d100afe03 | 
							
								
								
									
										30
									
								
								gerrit/gerrit.el
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										30
									
								
								gerrit/gerrit.el
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,30 @@
 | 
			
		||||
(eval-when-compile (require 'cl))
 | 
			
		||||
 | 
			
		||||
(require 'request)
 | 
			
		||||
 | 
			
		||||
(defun gerrit-json-read ()
 | 
			
		||||
  "Gerrit puts five extra chars (\")]}'\n\")at the beginning of
 | 
			
		||||
  each JSON response for security reasons. All this function does
 | 
			
		||||
  is it strips those chars before calling `json-read'"
 | 
			
		||||
 | 
			
		||||
  (goto-line 2)
 | 
			
		||||
  (beginning-of-line)
 | 
			
		||||
  (json-read))
 | 
			
		||||
 | 
			
		||||
(let ((username "epolger")
 | 
			
		||||
      (password "EsthaiTh6Fu"))
 | 
			
		||||
  (request
 | 
			
		||||
   "https://gerrit.ericsson.se/a/changes/?q=status:open+owner:self"
 | 
			
		||||
   :parser 'gerrit-json-read
 | 
			
		||||
   :headers '(("Authorization"
 | 
			
		||||
               (concat ("Basic "
 | 
			
		||||
                        (base64-encode-string (concat username
 | 
			
		||||
                                                      ":"
 | 
			
		||||
                                                      password))))))
 | 
			
		||||
   :success (function* (lambda (&key data &allow-other-keys)
 | 
			
		||||
                         (message "Success!")
 | 
			
		||||
                         (message "%s" data)))
 | 
			
		||||
   :error (function* (lambda (&key error-thrown &allow-other-keys&rest _)
 | 
			
		||||
                       (message "Got error: %s" error-thrown)))
 | 
			
		||||
   :complete (lambda (&rest _) (message "Finished!"))
 | 
			
		||||
   :status-code '((401 . (lambda (&rest _) (message "Got 401"))))))
 | 
			
		||||
		Reference in New Issue
	
	Block a user