|
10 | 10 |
|
11 | 11 | ∇ r←Version |
12 | 12 | :Access Public Shared |
13 | | - r←'GitHubAPIv3' '1.2.0' '2024-03-19' |
| 13 | + r←'GitHubAPIv3' '1.2.0' '2024-04-28' |
14 | 14 | ∇ |
15 | 15 |
|
16 | 16 | ∇ History |
17 | 17 | :Access Public Shared |
18 | 18 | ⍝ * 1.2.0 |
19 | | - ⍝ * Dependencies updated |
| 19 | + ⍝ * Instances of GitHubAPIv3 now have a useful display format: for a user "foo" it shows GitHubAPIv3[foo] |
| 20 | + ⍝ * The name of the function `GetPrinciple` was changed to `GetPrincipal` |
| 21 | + ⍝ * When Assert signals an error not only the message but also the HTTP code is returned as in "Not found (404)" |
| 22 | + ⍝ * Package dependencies updated |
| 23 | + ⍝ * Bug fixes |
| 24 | + ⍝ * The DF of an issue was wrong ("Issues" rather than "Issue"). While on it the issue number was added. |
20 | 25 | ⍝ * 1.1.0 |
21 | 26 | ⍝ Dependencies updated: HttpCommand and APLTreeUtil2 |
22 | 27 | ⍝ * 1.0.1 |
|
52 | 57 | _regEx←'setup_<repoName>_<version>[.\]*.[0-9]{0,6}\.exe' ⍝ After version there _might_ be a built number |
53 | 58 | A←(⊃⊃⎕CLASS ⎕THIS).##.APLTreeUtils2 |
54 | 59 | H←(⊃⊃⎕CLASS ⎕THIS).##.HttpCommand |
| 60 | + ⎕DF'GitHubAPIv3[',owner,']' |
55 | 61 | ∇ |
56 | 62 |
|
57 | 63 | ∇ ns←GetLatestReleaseInfo repoName;gitPath |
|
131 | 137 | :Access Public Instance |
132 | 138 | ⍝ Returns all issues for a given repository but no pull requests by default.\\ |
133 | 139 | ⍝ In GitHub, every pull request is an issue, but not all issues are pull requests. |
134 | | - ⍝ You can enforce Pull Requests by passing a 1 as left argument. |
| 140 | + ⍝ You can enforce the addition of Pull Requests by passing a 1 as left argument. |
135 | 141 | addPullRequests←{0<⎕NC ⍵:⍎⍵ ⋄ 0}'addPullRequests' |
136 | 142 | gitPath←'https://api.github.com/repos/',(_owner),'/',repoName,'/issues' |
137 | 143 | ns←GetJson gitPath |
138 | 144 | :If ~addPullRequests |
139 | 145 | ns←(0=⊃¨ns.⎕NC⊂'pull_request')/ns |
140 | 146 | :EndIf |
141 | | - ns.{⎕DF'[Issues of repo ',⍵,']'}⊂repoName |
| 147 | + ns.⎕DF(repoName,' issue ')∘,¨(⍕¨ns.number) |
142 | 148 | ns.⎕FX⊂⎕CR'∆List' |
143 | | - ns.⎕FX⊂'r←∆Details instance' 'r←∆List' ' :If 0<≢instance' 'r(instance.GetPrinciple)←''assignees'' ''login''' 'r(instance.GetPrinciple)←''labels'' ''name''' ':EndIf' |
| 149 | + ns.⎕FX⊂'r←∆Details instance' 'r←∆List' ' :If 0<≢instance' 'r(instance.GetPrincipal)←''assignees'' ''login''' 'r(instance.GetPrincipal)←''labels'' ''name''' ':EndIf' |
144 | 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];]' |
145 | 151 | ∇ |
146 | 152 |
|
|
155 | 161 | ns←GetJson gitPath |
156 | 162 | ns.{⎕DF ⍵}'[Issue ',(⍕number),' of repo ',repoName,']' |
157 | 163 | ns.⎕FX ⎕CR'∆List' |
158 | | - ns.⎕FX'r←∆Details instance' 'r←∆List' 'r(instance.GetPrinciple)←''assignees'' ''login''' 'r(instance.GetPrinciple)←''labels'' ''name''' |
| 164 | + ns.⎕FX'r←∆Details instance' 'r←∆List' 'r(instance.GetPrincipal)←''assignees'' ''login''' 'r(instance.GetPrincipal)←''labels'' ''name''' |
159 | 165 | 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];]' |
160 | 166 | ∇ |
161 | 167 |
|
|
312 | 318 | :EndIf |
313 | 319 | h.URL←EncodeBlank gitURL |
314 | 320 | r←h.Run |
315 | | - r.HttpMessage Assert r.HttpStatus=200 |
| 321 | + (r.HttpMessage,' (',(⍕r.HttpStatus),')')Assert r.HttpStatus=200 |
316 | 322 | data←⎕JSON r.Data |
317 | 323 | noOfPages←GetNoOfPages r.Headers |
318 | 324 | :If 0<noOfPages |
|
321 | 327 | link←2⊃r.Headers[ind;] |
322 | 328 | h.URL←{¯1↓1↓⍵↑⍨¯1+⍵⍳';'}link |
323 | 329 | r2←h.Run |
324 | | - r.HttpMessage Assert r.HttpStatus≠200 Assert 200=r.HttpStatus |
| 330 | + (r.HttpMessage,' (',(⍕r.HttpStatus),')')Assert r.HttpStatus=200 |
325 | 331 | data,←⎕JSON r2.Data |
326 | 332 | :If 2<noOfPages |
327 | 333 | ⍝ Fetch all remaining pages |
328 | 334 | links←({¯2↓1↓⍵↑⍨¯1+⍵⍳';'}link)∘{⍺,⍕⍵}¨2↓⍳noOfPages |
329 | 335 | :For link :In links |
330 | 336 | h.URL←link |
331 | 337 | r2←h.Run |
332 | | - r.HttpMessage Assert r.HttpStatus=200 |
| 338 | + (r.HttpMessage,' (',(⍕r.HttpStatus),')')Assert r.HttpStatus=200 |
333 | 339 | data,←⎕JSON r2.Data |
334 | 340 | :EndFor |
335 | 341 | :EndIf |
336 | 342 | :EndIf |
337 | 343 | ∇ |
338 | 344 |
|
339 | | - ∇ data←data GetPrinciple(propName principleName);row;jsonObj;buff |
340 | | - ⍝ * `propName` is the name of a variable in a data space that is one or more JSON object(s) |
341 | | - ⍝ * `principleName` is the principle name of all the properties of that JSON object\\ |
| 345 | + ∇ data←data GetPrincipal(propName principalName);row;jsonObj;buff |
| 346 | + ⍝ * `propName` is the name of a variable in `data` holding one or more JSON object(s).\\ |
| 347 | + ⍝ * `principalName` is the principal name of that JSON object or JSON objects.\\ |
342 | 348 | ⍝ Typical examples are "label" or "name"\\ |
343 | | - ⍝ The generic names are then replaced but the "real" ones. |
344 | | - ⍝ Is concatenated with a comma and a blank, so ('bug' 'question') become: |
345 | | - ⍝ 'bug, question' |
| 349 | + ⍝ The generic names are then replaced but the real data. |
346 | 350 | :Access Public instance |
347 | 351 | row←data[;1]⍳⊂propName |
348 | 352 | :If 0≠≢jsonObj←2⊃data[row;] |
349 | | - buff←jsonObj⍎¨⊂principleName |
| 353 | + buff←jsonObj⍎¨⊂principalName |
350 | 354 | data[row;2]←{⍺,', ',⍵}/buff |
351 | 355 | :EndIf |
352 | 356 | ∇ |
|
0 commit comments