Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 7ec4fd4

Browse files
m-pavelunknwon
authored andcommitted
repo: EditWiki implementation (#113)
* EditWiki 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 EditWikiOption struct {
150+
EnableWiki *bool `json:"enable_wiki"`
151+
AllowPublicWiki *bool `json:"allow_public_wiki"`
152+
EnableExternalWiki *bool `json:"enable_external_wiki"`
153+
ExternalWikiURL *string `json:"external_wiki_url"`
154+
}
155+
156+
// EditWiki updates wiki options of the repository.
157+
func (c *Client) EditWiki(owner, repo string, opt EditWikiOption) 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)

AltStyle によって変換されたページ (->オリジナル) /