-
Notifications
You must be signed in to change notification settings - Fork 74
/
Copy pathgh-users.el
80 lines (65 loc) · 2.45 KB
/
gh-users.el
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
;;; gh-users.el --- users module for gh.el -*- lexical-binding: t; -*-
;; Copyright (C) 2013 Yann Hodique
;; Author: Yann Hodique <[email protected]>
;; Keywords:
;; This file is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation; either version 2, or (at your option)
;; any later version.
;; This file is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs; see the file COPYING. If not, write to
;; the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
;; Boston, MA 02111-1307, USA.
;;; Commentary:
;;
;;; Code:
(require 'eieio)
(require 'gh-api)
(require 'gh-auth)
(require 'gh-common)
(defclass gh-users-api (gh-api-v3)
((users-cls :allocation :class :initform gh-users-user))
"Users API")
(gh-defclass gh-users-user (gh-user)
((gravatar-id :initarg :gravatar-id)
(html-url :initarg :html-url)
(followers-url :initarg :followers-url)
(following-url :initarg :following-url)
(gists-url :initarg :gists-url)
(starred-url :initarg :starred-url)
(subscriptions-url :initarg :subscriptions-url)
(organizations-url :initarg :organizations-url)
(repos-url :initarg :repos-url)
(events-url :initarg :events-url)
(received-events-url :initarg :received-events-url)
(type :initarg :type)
(site-admin :initarg :site-admin)
(name :initarg :name)
(company :initarg :company)
(blog :initarg :blog)
(location :initarg :location)
(email :initarg :email)
(hireable :initarg :hireable)
(bio :initarg :bio)
(public-repos :initarg :public-repos)
(public-gists :initarg :public-gists)
(followers :initarg :followers)
(following :initarg :following)
(created-at :initarg :created-at)
(update-at :initarg :update-at)))
(cl-defmethod gh-users-get ((api gh-users-api) &optional username)
(gh-api-authenticated-request
api (gh-object-reader (oref api users-cls)) "GET"
(if username
(format "/users/%s" username)
"/user")))
(cl-defmethod gh-users-list ((api gh-users-api))
(gh-api-authenticated-request
api (gh-object-list-reader (oref api users-cls)) "GET"
"/users"))
(provide 'gh-users)
;;; gh-users.el ends here