MCPcopy Index your code
hub / github.com/google/go-github / createWebSubRequest

Method createWebSubRequest

github/repos_hooks.go:257–279  ·  view source on GitHub ↗

createWebSubRequest returns a subscribe/unsubscribe request that implements the WebSub (formerly PubSubHubbub) protocol. See: https://www.w3.org/TR/websub/#subscriber-sends-subscription-request

(ctx context.Context, hubMode, owner, repo, event, callback string, secret []byte)

Source from the content-addressed store, hash-verified

255//
256// See: https://www.w3.org/TR/websub/#subscriber-sends-subscription-request
257func (s *RepositoriesService) createWebSubRequest(ctx context.Context, hubMode, owner, repo, event, callback string, secret []byte) (*http.Request, error) {
258 topic := fmt.Sprintf(
259 "https://github.com/%v/%v/events/%v",
260 owner,
261 repo,
262 event,
263 )
264 form := url.Values{}
265 form.Add("hub.mode", hubMode)
266 form.Add("hub.topic", topic)
267 form.Add("hub.callback", callback)
268 if secret != nil {
269 form.Add("hub.secret", string(secret))
270 }
271 body := strings.NewReader(form.Encode())
272
273 req, err := s.client.NewFormRequest(ctx, "hub", body)
274 if err != nil {
275 return nil, err
276 }
277
278 return req, nil
279}

Callers 2

SubscribeMethod · 0.95
UnsubscribeMethod · 0.95

Calls 2

AddMethod · 0.80
NewFormRequestMethod · 0.80

Tested by

no test coverage detected