Skip to content

Commit 4d5d7b9

Browse files
committed
GetPrinciple renamed to GetPrincipal * ⎕DFs added/improved
1 parent b476099 commit 4d5d7b9

File tree

5 files changed

+22
-18
lines changed

5 files changed

+22
-18
lines changed

APLSource/GitHubAPIv3.aplc

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,18 @@
1010

1111
∇ r←Version
1212
:Access Public Shared
13-
r←'GitHubAPIv3' '1.2.0' '2024-03-19'
13+
r←'GitHubAPIv3' '1.2.0' '2024-04-28'
1414
1515

1616
∇ History
1717
:Access Public Shared
1818
⍝ * 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.
2025
⍝ * 1.1.0
2126
⍝ Dependencies updated: HttpCommand and APLTreeUtil2
2227
⍝ * 1.0.1
@@ -52,6 +57,7 @@
5257
_regEx←'setup_<repoName>_<version>[.\]*.[0-9]{0,6}\.exe' ⍝ After version there _might_ be a built number
5358
A←(⊃⊃⎕CLASS ⎕THIS).##.APLTreeUtils2
5459
H←(⊃⊃⎕CLASS ⎕THIS).##.HttpCommand
60+
⎕DF'GitHubAPIv3[',owner,']'
5561
5662

5763
∇ ns←GetLatestReleaseInfo repoName;gitPath
@@ -131,16 +137,16 @@
131137
:Access Public Instance
132138
⍝ Returns all issues for a given repository but no pull requests by default.\\
133139
⍝ 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.
135141
addPullRequests←{0<⎕NC ⍵:⍎⍵ ⋄ 0}'addPullRequests'
136142
gitPath←'https://api.github.com/repos/',(_owner),'/',repoName,'/issues'
137143
ns←GetJson gitPath
138144
:If ~addPullRequests
139145
ns←(0=⊃¨ns.⎕NC⊂'pull_request')/ns
140146
:EndIf
141-
ns.{⎕DF'[Issues of repo ',⍵,']'}⊂repoName
147+
ns.⎕DF(repoName,' issue ')∘,¨(⍕¨ns.number)
142148
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'
144150
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];]'
145151
146152

@@ -155,7 +161,7 @@
155161
ns←GetJson gitPath
156162
ns.{⎕DF ⍵}'[Issue ',(⍕number),' of repo ',repoName,']'
157163
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'''
159165
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];]'
160166
161167

@@ -312,7 +318,7 @@
312318
:EndIf
313319
h.URL←EncodeBlank gitURL
314320
r←h.Run
315-
r.HttpMessage Assert r.HttpStatus=200
321+
(r.HttpMessage,' (',(⍕r.HttpStatus),')')Assert r.HttpStatus=200
316322
data←⎕JSON r.Data
317323
noOfPages←GetNoOfPages r.Headers
318324
:If 0<noOfPages
@@ -321,32 +327,30 @@
321327
link←2⊃r.Headers[ind;]
322328
h.URL←{¯1↓1↓⍵↑⍨¯1+⍵⍳';'}link
323329
r2←h.Run
324-
r.HttpMessage Assert r.HttpStatus≠200 Assert 200=r.HttpStatus
330+
(r.HttpMessage,' (',(⍕r.HttpStatus),')')Assert r.HttpStatus=200
325331
data,←⎕JSON r2.Data
326332
:If 2<noOfPages
327333
⍝ Fetch all remaining pages
328334
links←({¯2↓1↓⍵↑⍨¯1+⍵⍳';'}link)∘{⍺,⍕⍵}¨2↓⍳noOfPages
329335
:For link :In links
330336
h.URL←link
331337
r2←h.Run
332-
r.HttpMessage Assert r.HttpStatus=200
338+
(r.HttpMessage,' (',(⍕r.HttpStatus),')')Assert r.HttpStatus=200
333339
data,←⎕JSON r2.Data
334340
:EndFor
335341
:EndIf
336342
:EndIf
337343
338344

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.\\
342348
⍝ 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.
346350
:Access Public instance
347351
row←data[;1]⍳⊂propName
348352
:If 0≠≢jsonObj←2⊃data[row;]
349-
buff←jsonObj⍎¨⊂principleName
353+
buff←jsonObj⍎¨⊂principalName
350354
data[row;2]←{⍺,', ',⍵}/buff
351355
:EndIf
352356

APLSource/TestCases/Test_GetRelease_008.aplf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
→T.FailsIf 1
99
:Else
1010
dmx←⎕DMX
11-
→T.PassesIf'Not Found'≡dmx.EM
11+
→T.PassesIf'Not Found (404)'≡dmx.EM
1212
:EndTrap
1313

1414
R←T._OK

TestResults/CodeCoverage.cr

-1.79 KB
Binary file not shown.

TestResults/CodeCoverage.profile

8 Bytes
Binary file not shown.

apl-package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,5 @@
1919
source: "APLSource/GitHubAPIv3.aplc",
2020
tags: "github-utilities",
2121
userCommandScript: "",
22-
version: "1.1.0+35",
22+
version: "1.2.0+37",
2323
}

0 commit comments

Comments
 (0)