MCPcopy Create free account
hub / github.com/cli/cli / generatePullRequestNodeID

Function generatePullRequestNodeID

pkg/cmd/agent-task/capi/sessions.go:551–565  ·  view source on GitHub ↗

generatePullRequestNodeID converts an int64 databaseID and repoID to a GraphQL Node ID format with the "PR_" prefix for pull requests

(repoID, pullRequestID int64)

Source from the content-addressed store, hash-verified

549// generatePullRequestNodeID converts an int64 databaseID and repoID to a GraphQL Node ID format
550// with the "PR_" prefix for pull requests
551func generatePullRequestNodeID(repoID, pullRequestID int64) string {
552 buf := bytes.Buffer{}
553 parts := []int64{0, repoID, pullRequestID}
554
555 encoder := msgpack.NewEncoder(&buf)
556 encoder.UseCompactInts(true)
557
558 if err := encoder.Encode(parts); err != nil {
559 panic(err)
560 }
561
562 encoded := base64.RawURLEncoding.EncodeToString(buf.Bytes())
563
564 return "PR_" + encoded
565}
566
567func generateUserNodeID(userID int64) string {
568 buf := bytes.Buffer{}

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected