Skip to content

Commit 7ec4fd4

Browse files
m-pavelunknwon
authored andcommitted
repo: EditUncyclo implementation (#113)
* EditUncyclo implementation * Change method to PATCH since it working now to align existing API
1 parent 4c3c189 commit 7ec4fd4

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

repo.go

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,23 @@ func (c *Client) EditIssueTracker(owner, repo string, opt EditIssueTrackerOption
146146
return err
147147
}
148148

149+
type EditUncycloOption struct {
150+
EnableUncyclo *bool `json:"enable_wiki"`
151+
AllowPublicUncyclo *bool `json:"allow_public_wiki"`
152+
EnableExternalUncyclo *bool `json:"enable_external_wiki"`
153+
ExternalUncycloURL *string `json:"external_wiki_url"`
154+
}
155+
156+
// EditUncyclo updates wiki options of the repository.
157+
func (c *Client) EditUncyclo(owner, repo string, opt EditUncycloOption) error {
158+
body, err := json.Marshal(&opt)
159+
if err != nil {
160+
return err
161+
}
162+
_, err = c.getResponse("PATCH", fmt.Sprintf("/repos/%s/%s/wiki", owner, repo), jsonHeader, bytes.NewReader(body))
163+
return err
164+
}
165+
149166
func (c *Client) MirrorSync(owner, repo string) error {
150167
_, err := c.getResponse("POST", fmt.Sprintf("/repos/%s/%s/mirror-sync", owner, repo), jsonHeader, nil)
151168
return err

0 commit comments

Comments
 (0)