|
1 | 1 | :Class GitHubAPIv3 |
2 | | -⍝ This class offers methods that allows one to communicate with GitHub by using GitHub's REST API from Dyalog APL. |
| 2 | +⍝ This class offers methods that allow one to communicate with GitHub by using the GitHub REST API from Dyalog APL. |
3 | 3 | ⍝ Note that this is version 3 of the GitHub API; Later versions do **not** use REST.\\ |
4 | 4 | ⍝ Most methods of this class become available only by instantiating the class. `⎕NEW` requires an owner as argument.\\ |
5 | 5 | ⍝ However, there are also a few shared methods beyond `Version` and `History` available.\\ |
|
10 | 10 |
|
11 | 11 | ∇ r←Version |
12 | 12 | :Access Public Shared |
13 | | - r←'GitHubAPIv3' '1.2.0' '2024-04-28' |
| 13 | + r←'GitHubAPIv3' '1.2.1' '2024-07-25' |
14 | 14 | ∇ |
15 | 15 |
|
16 | 16 | ∇ History |
17 | 17 | :Access Public Shared |
| 18 | + ⍝ * 1.2.1 |
| 19 | + ⍝ * Bug fixed |
| 20 | + ⍝ `GetAllIssues` crashed when there were no issues to report |
18 | 21 | ⍝ * 1.2.0 |
19 | 22 | ⍝ * Instances of GitHubAPIv3 now have a useful display format: for a user "foo" it shows GitHubAPIv3[foo] |
20 | 23 | ⍝ * The name of the function `GetPrinciple` was changed to `GetPrincipal` |
|
137 | 140 | :Access Public Instance |
138 | 141 | ⍝ Returns all issues for a given repository but no pull requests by default.\\ |
139 | 142 | ⍝ In GitHub, every pull request is an issue, but not all issues are pull requests. |
140 | | - ⍝ You can enforce the addition of Pull Requests by passing a 1 as left argument. |
| 143 | + ⍝ You can enforce the addition of Pull Requests by passing a 1 as left argument.\\ |
| 144 | + ⍝ In case there are no issues an empty vector is returned. |
141 | 145 | addPullRequests←{0<⎕NC ⍵:⍎⍵ ⋄ 0}'addPullRequests' |
142 | 146 | gitPath←'https://api.github.com/repos/',(_owner),'/',repoName,'/issues' |
143 | 147 | ns←GetJson gitPath |
144 | | - :If ~addPullRequests |
145 | | - ns←(0=⊃¨ns.⎕NC⊂'pull_request')/ns |
| 148 | + :If 0<≢ns |
| 149 | + :If ~addPullRequests |
| 150 | + ns←(0=⊃¨ns.⎕NC⊂'pull_request')/ns |
| 151 | + :EndIf |
| 152 | + ns.⎕DF(repoName,' issue ')∘,¨(⍕¨ns.number) |
| 153 | + ns.⎕FX⊂⎕CR'∆List' |
| 154 | + ns.⎕FX⊂'r←∆Details instance' 'r←∆List' ' :If 0<≢instance' 'r(instance.GetPrincipal)←''assignees'' ''login''' 'r(instance.GetPrincipal)←''labels'' ''name''' ':EndIf' |
| 155 | + ns.⎕FX⊂'r←∆QuickView instance;keyWords' 'r←∆Details instance' 'keyWords←''title'' ''number'' ''state'' ''updated_at'' ''labels'' ''assignees''' 'r←(r[;1]∊keyWords)⌿r' 'r←r[⍋keyWords⍳r[;1];]' |
146 | 156 | :EndIf |
147 | | - ns.⎕DF(repoName,' issue ')∘,¨(⍕¨ns.number) |
148 | | - ns.⎕FX⊂⎕CR'∆List' |
149 | | - ns.⎕FX⊂'r←∆Details instance' 'r←∆List' ' :If 0<≢instance' 'r(instance.GetPrincipal)←''assignees'' ''login''' 'r(instance.GetPrincipal)←''labels'' ''name''' ':EndIf' |
150 | | - ns.⎕FX⊂'r←∆QuickView instance;keyWords' 'r←∆Details instance' 'keyWords←''title'' ''number'' ''state'' ''updated_at'' ''labels'' ''assignees''' 'r←(r[;1]∊keyWords)⌿r' 'r←r[⍋keyWords⍳r[;1];]' |
151 | 157 | ∇ |
152 | 158 |
|
153 | 159 | ∇ ns←GetIssue(repoName number);gitPath |
|
0 commit comments