Skip to content

Commit f30e6f7

Browse files
committed
Draft and prerelease options were added to CreateRelease, added UpdateRelease
1 parent 56a41d3 commit f30e6f7

File tree

2 files changed

+30
-5
lines changed

2 files changed

+30
-5
lines changed

module.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<Document name="github-api.ZPM">
44
<Module>
55
<Name>github-api</Name>
6-
<Version>1.0.1</Version>
6+
<Version>1.0.2</Version>
77
<Packaging>module</Packaging>
88
<Resource Name="src.cls.GitHub.PKG"/>
99
</Module>

src/cls/GitHub/API.cls

Lines changed: 29 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -396,10 +396,12 @@ Method CreateRelease(Owner As %String, Repo As %String, Input As %DynamicObject,
396396
"tag_name": (Input."tag_name"),
397397
"target_commitish": (Input."target_commitish"),
398398
"name": (Input.name),
399-
"body": (Input.body),
400-
"draft": false,
401-
"prerelease": false
402-
}.%ToJSON()
399+
"body": (Input.body)
400+
}
401+
do json.%Set("draft", Input.%Get("draft", 0), "boolean")
402+
do json.%Set("prerelease", Input.%Get("prerelease", 0), "boolean")
403+
404+
set json = json.%ToJSON()
403405

404406
do ..Request.EntityBody.Write(json)
405407

@@ -413,6 +415,29 @@ Method CreateRelease(Owner As %String, Repo As %String, Input As %DynamicObject,
413415
Return st
414416
}
415417

418+
Method UpdateRelease(Owner As %String, Repo As %String, Input As %DynamicObject, ReleaseID As %Integer) As %Status
419+
{
420+
421+
Set ..Request.Location = "/repos/"_Owner_"/"_Repo_"/releases/"_ReleaseID
422+
423+
set json = {
424+
"tag_name": (Input."tag_name"),
425+
"target_commitish": (Input."target_commitish"),
426+
"name": (Input.name),
427+
"body": (Input.body)
428+
}
429+
do json.%Set("draft", Input.%Get("draft", 0), "boolean")
430+
do json.%Set("prerelease", Input.%Get("prerelease", 0), "boolean")
431+
432+
set json = json.%ToJSON()
433+
434+
do ..Request.EntityBody.Write(json)
435+
436+
Set st = ..Request.Patch()
437+
438+
Return st
439+
}
440+
416441
Method DeleteRelease(Owner As %String, Repo As %String, ReleaseID) As %Status
417442
{
418443
Set ..Request.Location = "/repos/"_Owner_"/"_Repo_"/releases/"_ReleaseID

0 commit comments

Comments
 (0)