Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

complete repos-repo api #6

Merged
merged 2 commits into from

2 participants

@tarsius

gh-repos-read now returns eieio-unbound if data is nil. Without this gh-repos-read would have to be wrapped again and again in code that first checks whether the data is nil before calling it. Examples of this are the fields parent, source and organisation of the repos-repo api.

@sigma sigma merged commit 275bd60 into sigma:master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
Showing with 26 additions and 8 deletions.
  1. +6 −4 gh-common.el
  2. +20 −4 gh-repos.el
View
10 gh-common.el
@@ -36,10 +36,12 @@
())
(defmethod gh-object-read :static ((obj gh-object) data)
- (let ((target (if (object-p obj) obj
- (make-instance obj))))
- (gh-object-read-into target data)
- target))
+ (if data
+ (let ((target (if (object-p obj) obj
+ (make-instance obj))))
+ (gh-object-read-into target data)
+ target)
+ eieio-unbound))
(defmethod gh-object-reader :static ((obj gh-object))
(apply-partially 'gh-object-read obj))
View
24 gh-repos.el
@@ -66,24 +66,33 @@
(git-url :initarg :git-url)
(ssh-url :initarg :ssh-url)
(svn-url :initarg :svn-url)
+ (mirror-url :initarg :mirror-url)
(owner :initarg :owner :initform nil)
(language :initarg :language)
(fork :initarg :fork)
(forks :initarg :forks)
(watchers :initarg :watchers)
(size :initarg :size)
+ (master-branch :initarg :master-branch)
(open-issues :initarg :open-issues)
(pushed-at :initarg :pushed-at)
(created-at :initarg :created-at)
-
- (owner-cls :allocation :class :initform gh-user))
+ (updated-at :initarg :updated-at)
+ (organisation :initarg :organisation :initform nil)
+ (parent :initarg :parent)
+ (source :initarg :source)
+
+ (owner-cls :allocation :class :initform gh-user)
+ (organisation-cls :allocation :class :initform gh-user)
+ (parent-cls :allocation :class :initform gh-repos-repo)
+ (source-cls :allocation :class :initform gh-repos-repo))
"Class for GitHub repositories")
(defmethod gh-object-read-into ((repo gh-repos-repo) data)
(call-next-method)
(with-slots (url html-url clone-url git-url ssh-url svn-url
owner language fork forks watchers size open-issues
- pushed-at created-at)
+ pushed-at created-at organisation parent source)
repo
(setq url (gh-read data 'url)
html-url (gh-read data 'html_url)
@@ -101,7 +110,14 @@
size (gh-read data 'size)
open-issues (gh-read data 'open_issues)
pushed-at (gh-read data 'pushed_at)
- created-at (gh-read data 'created_at))))
+ created-at (gh-read data 'created_at)
+ organisation (gh-object-read (or (oref repo :organisation)
+ (oref repo organisation-cls))
+ (gh-read data 'organisation))
+ parent (gh-object-read (oref repo parent-cls)
+ (gh-read data 'parent))
+ source (gh-object-read (oref repo source-cls)
+ (gh-read data 'source)))))
(defclass gh-repos-ref (gh-object)
((label :initarg :label)
Something went wrong with that request. Please try again.