MCPcopy
hub / github.com/PyGithub/PyGithub / edit

Method edit

github/Hook.py:156–187  ·  view source on GitHub ↗

:calls: `PATCH /repos/{owner}/{repo}/hooks/{hook_id} `_

(
        self,
        name: str,
        config: dict,
        events: Opt[list[str]] = NotSet,
        add_events: Opt[list[str]] = NotSet,
        remove_events: Opt[list[str]] = NotSet,
        active: Opt[bool] = NotSet,
    )

Source from the content-addressed store, hash-verified

154 headers, data = self._requester.requestJsonAndCheck("DELETE", self.url)
155
156 def edit(
157 self,
158 name: str,
159 config: dict,
160 events: Opt[list[str]] = NotSet,
161 add_events: Opt[list[str]] = NotSet,
162 remove_events: Opt[list[str]] = NotSet,
163 active: Opt[bool] = NotSet,
164 ) -> None:
165 """
166 :calls: `PATCH /repos/{owner}/{repo}/hooks/{hook_id} <https://docs.github.com/en/rest/reference/repos#webhooks>`_
167 """
168 assert isinstance(name, str), name
169 assert isinstance(config, dict), config
170 assert is_optional_list(events, str), events
171 assert is_optional_list(add_events, str), add_events
172 assert is_optional_list(remove_events, str), remove_events
173 assert is_optional(active, bool), active
174 post_parameters = NotSet.remove_unset_items(
175 {
176 "name": name,
177 "config": config,
178 "events": events,
179 "add_events": add_events,
180 "remove_events": remove_events,
181 "active": active,
182 }
183 )
184
185 headers, data = self._requester.requestJsonAndCheck("PATCH", self.url, input=post_parameters)
186 self._useAttributes(data)
187 self._set_complete()
188
189 def test(self) -> None:
190 """

Callers

nothing calls this directly

Calls 6

_useAttributesMethod · 0.95
is_optional_listFunction · 0.90
is_optionalFunction · 0.90
remove_unset_itemsMethod · 0.80
requestJsonAndCheckMethod · 0.80
_set_completeMethod · 0.80

Tested by

no test coverage detected