// Code generated by seatgen from the seat definitions; DO NOT EDIT. // Package git is the contract of the seat "git", defined whole (seats/git/seat.json): The forge: every read and act a delivery part makes of the mesh's git repositories, and what the forge says happened (design 47 *The seat git*, ADR 0596 §1, §2). A failed read answers an error, never an empty answer. package git import ( "encoding/json" "strings" "time" ) // Seat is the seat's name. const Seat = "git" // Form is the form of the seat's values, events and answers this contract was generated at (design 47 H2 §780): // a reader of a value of another form says "form N, this reader knows M". const Form = 3 // The forms and the digest of the fields this contract was generated from: the generator's compare fails a definition // whose fields changed while its forms did not (design 47 H2 §780). const ( generatedForms = "3" generatedFieldsDigest = "BranchAnswer=1cc6612a710e BranchMovedEvent=baaa6fdf37f2 Call=ebef3639e061 CallMember=f88f5a6a6d6d CallsByCallCallValue=05142ac90d52 Change=5a13d1572e59 CommentAnswer=74ec3ece9f05 ContainsAnswer=071d0e9742bd ErrorKind=3d26b2c1442a FailedStep=d68341819717 FailedStepsByModuleFingerprintStepValue=0fce6f5d3273 FileAnswer=8fcc52522004 ForgeDeleteEvent=35a0828a1238 ForgePullEvent=303345c390d7 ForgeStatusEvent=689488c43094 MemberOutcome=72dd97b3477b MergeCalled=cb5a36d22c92 MergeCalledEvent=8597a63a790c MergeCalledMembersItem=211bdc9bab48 MergeCalledRefusedItem=bbf9ce4382c8 MergePullAnswer=4ada4a7040bb Merging=482fbecedd58 NoteAnswer=74ec3ece9f05 OpenPull=56217c4c348a OpenPullsAnswer=a15ee399a171 Pull=6e3fdd146b1c PullAnswer=a8def6c28bf9 PullClosedEvent=c2b7ac1de473 PullMergedEvent=619d9c863307 PullUpdatedEvent=f86ee614998e RepoWritableEvent=1a8c6e6344ba Status=b2980533a044 StatusAnswer=74ec3ece9f05 StatusesAnswer=1c524343c18d Tag=b419017f7885 TagAnswer=8c1fa0ac9f1b TagsAnswer=77e4374f7d62 TreesAnswer=bc1ffccd2716 ViewAnswer=74ec3ece9f05" ) const ( VerbPull = "pull" VerbBranch = "branch" VerbOpenPulls = "open-pulls" VerbTags = "tags" VerbTrees = "trees" VerbFile = "file" VerbContains = "contains" VerbStatuses = "statuses" VerbStatus = "status" VerbComment = "comment" VerbView = "view" VerbNote = "note" VerbMergePull = "merge-pull" VerbTag = "tag" ) const ( EventPullUpdated = "pull-updated" EventPullMerged = "pull-merged" EventPullClosed = "pull-closed" EventForgePull = "forge-pull" EventForgeStatus = "forge-status" EventForgeDelete = "forge-delete" EventRepoWritable = "repo-writable" EventBranchMoved = "branch-moved" EventMergeCalled = "merge-called" ) // Verbs is every verb the seat serves, in its definition's order: a new copy each call. func Verbs() []string { return []string{VerbPull, VerbBranch, VerbOpenPulls, VerbTags, VerbTrees, VerbFile, VerbContains, VerbStatuses, VerbStatus, VerbComment, VerbView, VerbNote, VerbMergePull, VerbTag} } // VerbDescription is a verb's description as the seat's definition says it, "" for a verb the seat does not serve or // does not describe (design 47 H2 H-A-449). func VerbDescription(verb string) string { switch verb { case VerbPull: return "One pull request, by its repository and number or by its merge commit: its number, base, head branch, head, merge commit, author and state; for an open one, also what the forge would merge now (merging). A pull request the forge does not hold answers an error naming it." case VerbBranch: return "A branch's head (design 47 *The seat git*, *Watched branches and the catalog graph per branch*). A branch the forge does not hold answers the error kind not-found." case VerbOpenPulls: return "Every open pull request of every repository, its head and base, the statuses its base's protection requires and those its head has." case VerbTags: return "A repository's tags, a page at a time, newest first; the page's bound is said, and more when another page exists." case VerbTrees: return "The trees of one commit: the root tree and the tree of every directory that holds a module.json, by their git hashes; with files, every blob under each named directory; with paths, the object of each named path. A listing the forge cut is refused, never answered in part. A directory named in files or paths that the commit does not hold answers the error kind not-found (design 47 H2 §796)." case VerbFile: return "One file at one commit, branch or tag, decoded; a file over 512 KiB is refused. An absent file is answered absent only when the forge said so." case VerbContains: return "Whether one commit contains another: an ancestor of it, or the same." case VerbStatuses: return "The statuses a commit carries, the newest of each context." case VerbStatus: return "Set a commit status. An act: its id is the caller's, and the same id said again sets it again to the same." case VerbComment: return "Add a comment to a pull request. The comment carries the act's id, and an id the pull request already holds is skipped (held)." case VerbView: return "Keep the delivery's one view comment on a pull request: made the first time, edited in place after; it carries the act's id, and an id already held is skipped (held)." case VerbNote: return "Append one line to a commit's note under refs/notes/mesh-plan. The line carries the act's id, and an id the note already holds is skipped (held)." case VerbMergePull: return "Merge one or more pull requests with the forge tools' account, each at the head the caller names: one merge call, a delivery's start and, with two or more members, its group (design 47 H §734, §735, §766; ADR 0682 §1, §2). Every member is judged before any is merged: still the pull request's head, its base a watched branch, no run at the head's build-input fingerprint failed a required step (judged from its own state failed-steps), registrations heard; no branch protection is read. A member whose repository has no watched branch is judged against nothing of the module graph and merged plainly in the order named, starting no delivery: its outcome says merged with the note no delivery (H-A-471). When one member is refused, none is merged. Then it merges them in the order named, writing the call in its state calls before the first merge, and says merge-called once. It answers once, at the call's end, naming the call and each member's outcome; a member already merged is refused already-merged, naming its commit." case VerbTag: return "Write the git tag of a released version, /vMAJOR.MINOR.PATCH for a Go package (design 47 H2 §796), at the commit its build was made from; the builder writes it only on the catalog's version-released (design 47 G section 370). A tag already at that commit is answered performed. An error answer carries error and error-kind." } return "" } // Events is every event published on the seat's subject: a new copy each call. func Events() []string { return []string{EventPullUpdated, EventPullMerged, EventPullClosed, EventForgePull, EventForgeStatus, EventForgeDelete, EventRepoWritable, EventBranchMoved, EventMergeCalled} } // Family is where the seat's events are kept: the shared events stream, filtered to the seat's subjects. const ( Family = "git.events" FamilyMaxAgeDays = 7 ) // SubjectPullUpdated is where pull-updated is published. const SubjectPullUpdated = "mesh.seat.git.event.pull-updated" // SubjectPullMerged is where pull-merged is published. const SubjectPullMerged = "mesh.seat.git.event.pull-merged" // SubjectPullClosed is where pull-closed is published. const SubjectPullClosed = "mesh.seat.git.event.pull-closed" // SubjectForgePull is where forge-pull is published. const SubjectForgePull = "mesh.seat.git.event.forge-pull" // SubjectForgeStatus is where forge-status is published. const SubjectForgeStatus = "mesh.seat.git.event.forge-status" // SubjectForgeDelete is where forge-delete is published. const SubjectForgeDelete = "mesh.seat.git.event.forge-delete" // SubjectRepoWritable is where repo-writable is published. const SubjectRepoWritable = "mesh.seat.git.event.repo-writable" // StreamBranchMoved is the stream branch-moved is kept in. const StreamBranchMoved = "SEAT_git_branch-moved" // SubjectBranchMoved is where branch-moved is published. const SubjectBranchMoved = "mesh.seat.git.event.branch-moved" // StreamMergeCalled is the stream merge-called is kept in. const StreamMergeCalled = "SEAT_git_merge-called" // SubjectMergeCalled is where merge-called is published, on mesh.seat.git.event.merge-called.. func SubjectMergeCalled(call string) string { return "mesh.seat.git.event.merge-called." + call } // SubjectMergeCalledAll hears every merge-called. const SubjectMergeCalledAll = "mesh.seat.git.event.merge-called.*" const ( StateFailedSteps = "failed-steps" StateCalls = "calls" ) // FailedStepsByModuleFingerprintStepKey is the key of one value of the state failed-steps under the form "..". func FailedStepsByModuleFingerprintStepKey(module, fingerprint, step string) string { return module + "." + fingerprint + "." + step } // ParseFailedStepsByModuleFingerprintStepKey reads the parts of a key of the form "..", in the order of the form; the last result is false for a key of another form. func ParseFailedStepsByModuleFingerprintStepKey(key string) (string, string, string, bool) { rest := key v0, after0, found0 := strings.Cut(rest, ".") if !found0 || v0 == "" { return "", "", "", false } rest = after0 v2, after2, found2 := strings.Cut(rest, ".") if !found2 || v2 == "" { return "", "", "", false } rest = after2 if rest == "" { return "", "", "", false } v4 := rest rest = "" if rest != "" { return "", "", "", false } return v0, v2, v4, true } // DecodeFailedStepsByModuleFingerprintStepValue reads one value of the state failed-steps under the form ".." as another part wrote it: a field FailedStepsByModuleFingerprintStepValue does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780). func DecodeFailedStepsByModuleFingerprintStepValue(raw []byte) (FailedStepsByModuleFingerprintStepValue, int, error) { var v FailedStepsByModuleFingerprintStepValue if err := json.Unmarshal(raw, &v); err != nil { return v, 0, err } return v, formRead(raw), nil } // CallsByCallCallKey is the key of one value of the state calls under the form "call.". func CallsByCallCallKey(call string) string { return "call." + call } // ParseCallsByCallCallKey reads the parts of a key of the form "call.", in the order of the form; the last result is false for a key of another form. func ParseCallsByCallCallKey(key string) (string, bool) { rest := key if !strings.HasPrefix(rest, "call.") { return "", false } rest = rest[5:] if rest == "" { return "", false } v1 := rest rest = "" if rest != "" { return "", false } return v1, true } // DecodeCallsByCallCallValue reads one value of the state calls under the form "call." as another part wrote it: a field CallsByCallCallValue does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780). func DecodeCallsByCallCallValue(raw []byte) (CallsByCallCallValue, int, error) { var v CallsByCallCallValue if err := json.Unmarshal(raw, &v); err != nil { return v, 0, err } return v, formRead(raw), nil } // Call is one merge call, written before its first merge and updated as each member merges (design 47 H §766). type Call struct { // the bus account the tool runner proved for the call Account string `json:"account"` At time.Time `json:"at"` // the caller as who@node By string `json:"by"` // is the form of what this value carries, left out while it is 1 (design 47 H2 §780). Form int64 `json:"form,omitempty"` Members []CallMember `json:"members"` // merge-called was said for it Said bool `json:"said"` } // CallMember is one member of a kept call. type CallMember struct { // the pull request's base, read at judging: a watched branch, but for a member noted as of a repository with no watched branch Branch string `json:"branch"` // for merged, the merge commit Commit string `json:"commit,omitempty"` Head string `json:"head"` // for a member merged plainly, its repository having no watched branch: "no delivery: the repository has no watched branch"; it starts no delivery and merge-called leaves it out (design 47 H2 H-A-471) Note string `json:"note,omitempty"` Number int64 `json:"number"` Repository string `json:"repository"` State string `json:"state"` // for refused, why Why string `json:"why,omitempty"` } // The values of CallMember's state. const ( CallMemberStateJudged = "judged" CallMemberStateMerged = "merged" CallMemberStateRefused = "refused" ) // Change is what a pull request changed. type Change struct { // the changed directories that hold a module at its head; absent when they could not be read ModuleDirs []string `json:"module-dirs,omitempty"` // the paths it changed Paths []string `json:"paths"` // the forge cut the list PathsTruncated bool `json:"paths-truncated,omitempty"` // which of them it deleted Removed []string `json:"removed,omitempty"` } // ErrorKind is which kind of error, set with error alone: refused, the forge or the holder refused and error says why in the forge's own words; not-found, the forge said that what was asked about (a repository, a commit, a pull request, a branch or a tag) does not exist, so a caller never reads it out of error's words; failed, the forge failed or could not be reached, so the act or read could not be performed; away, a part the holder depends on (the forge, its store) is away, with part naming what did not answer and words: a caller reads it as a transport fault and calls again (design 47 H2 §776). type ErrorKind = string // The values of ErrorKind. const ( ErrorKindRefused = "refused" ErrorKindNotFound = "not-found" ErrorKindFailed = "failed" ErrorKindAway = "away" ) // FailedStep is a failed required step at a build-input fingerprint, with the commits it was seen at and the run that failed it (design 47 *Judged from its own state, never by a call*); cleared by a later passing rerun of that step whose proved caller is the operator or a healer. type FailedStep struct { // the artifact reference, : Artifact string `json:"artifact,omitempty"` At *time.Time `json:"at,omitempty"` // every commit it was seen at Commits []string `json:"commits"` // the build-input fingerprint the step failed at Fingerprint string `json:"fingerprint"` // is the form of what this value carries, left out while it is 1 (design 47 H2 §780). Form int64 `json:"form,omitempty"` Module string `json:"module"` // the run that failed it: the runner's pipeline key Run string `json:"run"` // why it failed, as the runner's step-ended said Said string `json:"said,omitempty"` Step string `json:"step"` // the layout version V int64 `json:"v,omitempty"` } // MemberOutcome is one member of a merge call and where it stands (design 47 H §766, H-A-22). type MemberOutcome struct { // for merged, the merge commit; for a member refused already-merged, its commit Commit string `json:"commit,omitempty"` // for a member merged plainly, its repository having no watched branch: "no delivery: the repository has no watched branch"; it starts no delivery and merge-called leaves it out (design 47 H2 H-A-471) Note string `json:"note,omitempty"` Number int64 `json:"number"` Repository string `json:"repository"` // judged, judged and not merged; merged, with its commit; refused, with why State string `json:"state"` // for refused, why, naming the step for a failed required step Why string `json:"why,omitempty"` } // The values of MemberOutcome's state. const ( MemberOutcomeStateJudged = "judged" MemberOutcomeStateMerged = "merged" MemberOutcomeStateRefused = "refused" ) // Merging is what the forge would merge now, for an open pull request (issues 1275, 1945; ADR 0441 §1): answered whole or not at all, and a read the forge could not make answers the verb's error, never a guess; absent for a merged or closed one. type Merging struct { // the forge's own word on whether it merges into its base now: false while it is in conflict with its base, or while the forge works that out after the base moved Mergeable bool `json:"mergeable"` // whether a protection rule guards its base branch Protected bool `json:"protected"` // the status contexts the base branch's protection requires; none when it requires none Required []string `json:"required"` // whether the forge's merging account may write the repository: false, its statuses and its merge are refused Writes bool `json:"writes"` } // OpenPull is an open pull request, with the statuses its base requires and those its head has. type OpenPull struct { // the head's statuses by context, the newest of each Checks map[string]Status `json:"checks"` Pull Pull `json:"pull"` // the contexts the base branch's protection requires; none when it requires none Required []string `json:"required"` } // Pull is one pull request as the forge holds it; never its description (ADR 0659 §1). type Pull struct { // who opened it, the forge's login Author string `json:"author,omitempty"` // the branch it merges into Base string `json:"base"` // its head branch: what a delivery group is named by Branch string `json:"branch"` // a commit, its full 40-hex sha Head string `json:"head"` // the merge commit, once merged MergeCommit string `json:"merge-commit,omitempty"` // when it merged MergedAt *time.Time `json:"merged-at,omitempty"` // the pull request's number Number int64 `json:"number"` // the repository, / Repository string `json:"repository"` // open, merged or closed State string `json:"state"` // its title Title string `json:"title,omitempty"` // its page on the forge URL string `json:"url,omitempty"` } // The values of Pull's state. const ( PullStateOpen = "open" PullStateMerged = "merged" PullStateClosed = "closed" ) // Status is the newest status of one context on a commit. type Status struct { // when it was set At *time.Time `json:"at,omitempty"` // who set it By string `json:"by,omitempty"` // the status's context, such as mesh/check Context string `json:"context"` // what it says Description string `json:"description,omitempty"` // pending, success, failure, error or warning State string `json:"state"` // the page it links to Target string `json:"target,omitempty"` } // Tag is a tag and the commit it names (design 47 H2 §796). type Tag struct { // the commit it names, its full 40-hex sha Commit string `json:"commit"` Tag string `json:"tag"` } // MergeCalledMembersItem is a type of the contract. type MergeCalledMembersItem struct { // the pull request's base, a watched branch Branch string `json:"branch"` // the merge commit the forge records for the pull request Commit string `json:"commit"` Head string `json:"head"` Number int64 `json:"number"` Repository string `json:"repository"` } // MergeCalledRefusedItem is a type of the contract. type MergeCalledRefusedItem struct { Number int64 `json:"number"` Repository string `json:"repository"` Why string `json:"why"` } // MergeCalled is a merge call's members merged or refused, said once by the forge module (design 47 H §736, §767). type MergeCalled struct { // the bus account the tool runner proved Account string `json:"account"` // the time of the last merge At time.Time `json:"at"` // the caller as who@node By string `json:"by"` // the merge call, 16 lowercase hex characters made once per call Call string `json:"call"` // is the form of what this value carries, left out while it is 1 (design 47 H2 §780). Form int64 `json:"form,omitempty"` // one per landed member Members []MergeCalledMembersItem `json:"members"` // one per member not merged after every member was judged (design 47 H §767) Refused []MergeCalledRefusedItem `json:"refused,omitempty"` } // PullInput is what pull takes. type PullInput struct { // instead of the number: the merge commit it made MergeCommit string `json:"merge-commit,omitempty"` // its number Number int64 `json:"number,omitempty"` // the repository, / Repository string `json:"repository"` } // PullAnswer is what pull answers. type PullAnswer struct { // why the forge could not answer, or refused: set alone with error-kind, and a caller reads it as a failure, never as none Error string `json:"error,omitempty"` ErrorKind ErrorKind `json:"error-kind,omitempty"` // is the form of what this value carries, left out while it is 1 (design 47 H2 §780). Form int64 `json:"form,omitempty"` Merging *Merging `json:"merging,omitempty"` // with the error kind away, what did not answer (design 47 H2 §776) Part string `json:"part,omitempty"` Pull *Pull `json:"pull,omitempty"` // with the error kind away, the holder's words (design 47 H2 §776) Words string `json:"words,omitempty"` } // BranchInput is what branch takes. type BranchInput struct { Branch string `json:"branch"` // the repository, / Repository string `json:"repository"` } // BranchAnswer is what branch answers. type BranchAnswer struct { Branch string `json:"branch,omitempty"` // why the forge could not answer, or refused: set alone with error-kind, and a caller reads it as a failure, never as none Error string `json:"error,omitempty"` ErrorKind ErrorKind `json:"error-kind,omitempty"` // is the form of what this value carries, left out while it is 1 (design 47 H2 §780). Form int64 `json:"form,omitempty"` // a commit, its full 40-hex sha Head string `json:"head,omitempty"` // with the error kind away, what did not answer (design 47 H2 §776) Part string `json:"part,omitempty"` Repository string `json:"repository,omitempty"` // with the error kind away, the holder's words (design 47 H2 §776) Words string `json:"words,omitempty"` } // OpenPullsInput is what open-pulls takes. type OpenPullsInput struct { } // OpenPullsAnswer is what open-pulls answers. type OpenPullsAnswer struct { // why the forge could not answer, or refused: set alone with error-kind, and a caller reads it as a failure, never as none Error string `json:"error,omitempty"` ErrorKind ErrorKind `json:"error-kind,omitempty"` // is the form of what this value carries, left out while it is 1 (design 47 H2 §780). Form int64 `json:"form,omitempty"` // with the error kind away, what did not answer (design 47 H2 §776) Part string `json:"part,omitempty"` // every open pull request; said empty when none is open, so an answer that lacks it is never read as none Pulls []OpenPull `json:"pulls"` // with the error kind away, the holder's words (design 47 H2 §776) Words string `json:"words,omitempty"` } // TagsInput is what tags takes. type TagsInput struct { // the page, from 1 Page int64 `json:"page,omitempty"` // only tags starting with it Prefix string `json:"prefix,omitempty"` // the repository, / Repository string `json:"repository"` } // TagsAnswer is what tags answers. type TagsAnswer struct { // how many tags a page holds Bound int64 `json:"bound,omitempty"` // why the forge could not answer, or refused: set alone with error-kind, and a caller reads it as a failure, never as none Error string `json:"error,omitempty"` ErrorKind ErrorKind `json:"error-kind,omitempty"` // is the form of what this value carries, left out while it is 1 (design 47 H2 §780). Form int64 `json:"form,omitempty"` // another page exists More bool `json:"more,omitempty"` // the page Page int64 `json:"page,omitempty"` // with the error kind away, what did not answer (design 47 H2 §776) Part string `json:"part,omitempty"` // the repository, / Repository string `json:"repository,omitempty"` // the tags of this page, each with the commit it names (design 47 H2 §796) Tags []Tag `json:"tags,omitempty"` // with the error kind away, the holder's words (design 47 H2 §776) Words string `json:"words,omitempty"` } // TreesInput is what trees takes. type TreesInput struct { // a commit, its full 40-hex sha Commit string `json:"commit"` // directories whose every blob is answered; the root is the empty name Files []string `json:"files,omitempty"` // {directory: [path relative to it]}; the root is the empty name Paths map[string][]string `json:"paths,omitempty"` // the repository, / Repository string `json:"repository"` } // TreesAnswer is what trees answers. type TreesAnswer struct { // a commit, its full 40-hex sha Commit string `json:"commit,omitempty"` // why the forge could not answer, or refused: set alone with error-kind, and a caller reads it as a failure, never as none Error string `json:"error,omitempty"` ErrorKind ErrorKind `json:"error-kind,omitempty"` // directory to {path: blob id} Files map[string]map[string]string `json:"files,omitempty"` // is the form of what this value carries, left out while it is 1 (design 47 H2 §780). Form int64 `json:"form,omitempty"` // with the error kind away, what did not answer (design 47 H2 §776) Part string `json:"part,omitempty"` // directory to {path: object id} Paths map[string]map[string]string `json:"paths,omitempty"` // the root tree's hash Root string `json:"root,omitempty"` // directory to its tree's hash, the root as the empty name Trees map[string]string `json:"trees,omitempty"` // with the error kind away, the holder's words (design 47 H2 §776) Words string `json:"words,omitempty"` } // FileInput is what file takes. type FileInput struct { // the file's path from the repository's root Path string `json:"path"` // a commit, branch or tag; the default branch when absent Ref string `json:"ref,omitempty"` // the repository, / Repository string `json:"repository"` } // FileAnswer is what file answers. type FileAnswer struct { // the forge holds no such file there Absent bool `json:"absent,omitempty"` // the file's git blob id Blob string `json:"blob,omitempty"` // its content Content string `json:"content,omitempty"` // why the forge could not answer, or refused: set alone with error-kind, and a caller reads it as a failure, never as none Error string `json:"error,omitempty"` ErrorKind ErrorKind `json:"error-kind,omitempty"` // is the form of what this value carries, left out while it is 1 (design 47 H2 §780). Form int64 `json:"form,omitempty"` // with the error kind away, what did not answer (design 47 H2 §776) Part string `json:"part,omitempty"` // the path Path string `json:"path,omitempty"` // what was read Ref string `json:"ref,omitempty"` // its size in bytes Size int64 `json:"size,omitempty"` // with the error kind away, the holder's words (design 47 H2 §776) Words string `json:"words,omitempty"` } // ContainsInput is what contains takes. type ContainsInput struct { // the commit asked about Commit string `json:"commit"` // the commit it may be contained in In string `json:"in"` // the repository, / Repository string `json:"repository"` } // ContainsAnswer is what contains answers. type ContainsAnswer struct { // how many commits commit is ahead of in Ahead int64 `json:"ahead,omitempty"` // the commit Commit string `json:"commit,omitempty"` // in contains commit Contains bool `json:"contains,omitempty"` // why the forge could not answer, or refused: set alone with error-kind, and a caller reads it as a failure, never as none Error string `json:"error,omitempty"` ErrorKind ErrorKind `json:"error-kind,omitempty"` // is the form of what this value carries, left out while it is 1 (design 47 H2 §780). Form int64 `json:"form,omitempty"` // the other In string `json:"in,omitempty"` // with the error kind away, what did not answer (design 47 H2 §776) Part string `json:"part,omitempty"` // with the error kind away, the holder's words (design 47 H2 §776) Words string `json:"words,omitempty"` } // StatusesInput is what statuses takes. type StatusesInput struct { // a commit, its full 40-hex sha Commit string `json:"commit"` // the repository, / Repository string `json:"repository"` } // StatusesAnswer is what statuses answers. type StatusesAnswer struct { // the forge's combined state Combined string `json:"combined,omitempty"` // a commit, its full 40-hex sha Commit string `json:"commit,omitempty"` // why the forge could not answer, or refused: set alone with error-kind, and a caller reads it as a failure, never as none Error string `json:"error,omitempty"` ErrorKind ErrorKind `json:"error-kind,omitempty"` // is the form of what this value carries, left out while it is 1 (design 47 H2 §780). Form int64 `json:"form,omitempty"` // with the error kind away, what did not answer (design 47 H2 §776) Part string `json:"part,omitempty"` // the newest of each context Statuses []Status `json:"statuses,omitempty"` // with the error kind away, the holder's words (design 47 H2 §776) Words string `json:"words,omitempty"` } // StatusInput is what status takes. type StatusInput struct { // a commit, its full 40-hex sha Commit string `json:"commit"` // the context, such as mesh/check Context string `json:"context"` // what it says Description string `json:"description,omitempty"` // the act's id ID string `json:"id"` // the repository, / Repository string `json:"repository"` // the state State string `json:"state"` // the page it links to Target string `json:"target,omitempty"` } // The values of StatusInput's state. const ( StatusInputStatePending = "pending" StatusInputStateSuccess = "success" StatusInputStateFailure = "failure" StatusInputStateError = "error" StatusInputStateWarning = "warning" ) // StatusAnswer is what status answers. type StatusAnswer struct { // why the forge could not answer, or refused: set alone with error-kind, and a caller reads it as a failure, never as none Error string `json:"error,omitempty"` ErrorKind ErrorKind `json:"error-kind,omitempty"` // is the form of what this value carries, left out while it is 1 (design 47 H2 §780). Form int64 `json:"form,omitempty"` // the id was already held on the pull request or the note, so nothing was done again Held bool `json:"held,omitempty"` // the act's id, as the caller gave it ID string `json:"id,omitempty"` // with the error kind away, what did not answer (design 47 H2 §776) Part string `json:"part,omitempty"` // the forge holds the act now Performed bool `json:"performed,omitempty"` // with the error kind away, the holder's words (design 47 H2 §776) Words string `json:"words,omitempty"` } // CommentInput is what comment takes. type CommentInput struct { // the act's id ID string `json:"id"` // the pull request's number Number int64 `json:"number"` // the repository, / Repository string `json:"repository"` // the comment, markdown Text string `json:"text"` } // CommentAnswer is what comment answers. type CommentAnswer struct { // why the forge could not answer, or refused: set alone with error-kind, and a caller reads it as a failure, never as none Error string `json:"error,omitempty"` ErrorKind ErrorKind `json:"error-kind,omitempty"` // is the form of what this value carries, left out while it is 1 (design 47 H2 §780). Form int64 `json:"form,omitempty"` // the id was already held on the pull request or the note, so nothing was done again Held bool `json:"held,omitempty"` // the act's id, as the caller gave it ID string `json:"id,omitempty"` // with the error kind away, what did not answer (design 47 H2 §776) Part string `json:"part,omitempty"` // the forge holds the act now Performed bool `json:"performed,omitempty"` // with the error kind away, the holder's words (design 47 H2 §776) Words string `json:"words,omitempty"` } // ViewInput is what view takes. type ViewInput struct { // the act's id ID string `json:"id"` // the pull request's number Number int64 `json:"number"` // the repository, / Repository string `json:"repository"` // the view, markdown Text string `json:"text"` } // ViewAnswer is what view answers. type ViewAnswer struct { // why the forge could not answer, or refused: set alone with error-kind, and a caller reads it as a failure, never as none Error string `json:"error,omitempty"` ErrorKind ErrorKind `json:"error-kind,omitempty"` // is the form of what this value carries, left out while it is 1 (design 47 H2 §780). Form int64 `json:"form,omitempty"` // the id was already held on the pull request or the note, so nothing was done again Held bool `json:"held,omitempty"` // the act's id, as the caller gave it ID string `json:"id,omitempty"` // with the error kind away, what did not answer (design 47 H2 §776) Part string `json:"part,omitempty"` // the forge holds the act now Performed bool `json:"performed,omitempty"` // with the error kind away, the holder's words (design 47 H2 §776) Words string `json:"words,omitempty"` } // NoteInput is what note takes. type NoteInput struct { // a commit, its full 40-hex sha Commit string `json:"commit"` // the act's id ID string `json:"id"` // the line, one line Line string `json:"line"` // the repository, / Repository string `json:"repository"` } // NoteAnswer is what note answers. type NoteAnswer struct { // why the forge could not answer, or refused: set alone with error-kind, and a caller reads it as a failure, never as none Error string `json:"error,omitempty"` ErrorKind ErrorKind `json:"error-kind,omitempty"` // is the form of what this value carries, left out while it is 1 (design 47 H2 §780). Form int64 `json:"form,omitempty"` // the id was already held on the pull request or the note, so nothing was done again Held bool `json:"held,omitempty"` // the act's id, as the caller gave it ID string `json:"id,omitempty"` // with the error kind away, what did not answer (design 47 H2 §776) Part string `json:"part,omitempty"` // the forge holds the act now Performed bool `json:"performed,omitempty"` // with the error kind away, the holder's words (design 47 H2 §776) Words string `json:"words,omitempty"` } // MergePullInputPullsItem is a type of the contract. type MergePullInputPullsItem struct { // the head the caller names Head string `json:"head"` // the pull request's number Number int64 `json:"number"` // the repository, / Repository string `json:"repository"` } // MergePullInput is what merge-pull takes. type MergePullInput struct { // the caller as who@node, recorded beside the bus account the tool runner proves By string `json:"by"` // the members, in the order they are merged Pulls []MergePullInputPullsItem `json:"pulls"` } // MergePullAnswer is what merge-pull answers. type MergePullAnswer struct { // the merge call, 16 lowercase hex characters made once per call Call string `json:"call,omitempty"` // why the forge could not answer, or refused: set alone with error-kind, and a caller reads it as a failure, never as none Error string `json:"error,omitempty"` ErrorKind ErrorKind `json:"error-kind,omitempty"` // is the form of what this value carries, left out while it is 1 (design 47 H2 §780). Form int64 `json:"form,omitempty"` // each member's outcome, in the order named Members []MemberOutcome `json:"members,omitempty"` // with the error kind away, what did not answer (design 47 H2 §776) Part string `json:"part,omitempty"` // with the error kind away, the holder's words (design 47 H2 §776) Words string `json:"words,omitempty"` } // TagInput is what tag takes. type TagInput struct { // the commit it is written at Commit string `json:"commit"` // the repository, / Repository string `json:"repository"` // the tag Tag string `json:"tag"` } // TagAnswer is what tag answers. type TagAnswer struct { // why the forge could not write it: set alone with error-kind Error string `json:"error,omitempty"` ErrorKind ErrorKind `json:"error-kind,omitempty"` // is the form of what this value carries, left out while it is 1 (design 47 H2 §780). Form int64 `json:"form,omitempty"` // with the error kind away, what did not answer (design 47 H2 §776) Part string `json:"part,omitempty"` // the forge holds the tag at that commit now Performed bool `json:"performed,omitempty"` // the tag, as asked Tag string `json:"tag,omitempty"` // with the error kind away, the holder's words (design 47 H2 §776) Words string `json:"words,omitempty"` } // PullUpdatedEvent is the body of the event pull-updated. type PullUpdatedEvent struct { // who opened it Author string `json:"author,omitempty"` // the branch it merges into Base string `json:"base"` // the base branch's head as the head was announced; absent when it could not be read BaseHead string `json:"base-head,omitempty"` // its head branch Branch string `json:"branch"` Change *Change `json:"change,omitempty"` // is the form of what this value carries, left out while it is 1 (design 47 H2 §780). Form int64 `json:"form,omitempty"` // a commit, its full 40-hex sha Head string `json:"head"` // the pull request's number Number int64 `json:"number"` // the repository, / Repository string `json:"repository"` // its title Title string `json:"title,omitempty"` // its page URL string `json:"url,omitempty"` } // PullMergedEvent is the body of the event pull-merged. type PullMergedEvent struct { // who opened it Author string `json:"author,omitempty"` // the branch it merges into Base string `json:"base"` // its head branch Branch string `json:"branch"` Change *Change `json:"change,omitempty"` // is the form of what this value carries, left out while it is 1 (design 47 H2 §780). Form int64 `json:"form,omitempty"` // a commit, its full 40-hex sha Head string `json:"head"` // the head's statuses by context, their states; absent when they could not be read HeadChecks map[string]string `json:"head-checks,omitempty"` // a commit, its full 40-hex sha MergeCommit string `json:"merge-commit"` // when MergedAt *time.Time `json:"merged-at,omitempty"` // the pull request's number Number int64 `json:"number"` // the repository, / Repository string `json:"repository"` // its title Title string `json:"title,omitempty"` // its page URL string `json:"url,omitempty"` } // PullClosedEvent is the body of the event pull-closed. type PullClosedEvent struct { // who opened it Author string `json:"author,omitempty"` // the branch it merges into Base string `json:"base"` // its head branch Branch string `json:"branch"` // is the form of what this value carries, left out while it is 1 (design 47 H2 §780). Form int64 `json:"form,omitempty"` // a commit, its full 40-hex sha Head string `json:"head"` // the pull request's number Number int64 `json:"number"` // the repository, / Repository string `json:"repository"` // its title Title string `json:"title,omitempty"` // its page URL string `json:"url,omitempty"` } // ForgePullEvent is the body of the event forge-pull. type ForgePullEvent struct { // what the forge said: opened, reopened, synchronized, edited, closed, merged Action string `json:"action"` // who opened it Author string `json:"author,omitempty"` // its base branch Base string `json:"base,omitempty"` // its head branch Branch string `json:"branch,omitempty"` // is the form of what this value carries, left out while it is 1 (design 47 H2 §780). Form int64 `json:"form,omitempty"` // its head commit Head string `json:"head,omitempty"` // the merge commit MergeCommit string `json:"merge-commit,omitempty"` // merged Merged bool `json:"merged,omitempty"` // its number Number int64 `json:"number"` // the repository, / Repository string `json:"repository"` // who acted Sender string `json:"sender,omitempty"` } // ForgeStatusEvent is the body of the event forge-status. type ForgeStatusEvent struct { // the commit Commit string `json:"commit"` // the context Context string `json:"context"` // what it says Description string `json:"description,omitempty"` // is the form of what this value carries, left out while it is 1 (design 47 H2 §780). Form int64 `json:"form,omitempty"` // the repository, / Repository string `json:"repository"` // who set it Sender string `json:"sender,omitempty"` // the state State string `json:"state"` } // ForgeDeleteEvent is the body of the event forge-delete. type ForgeDeleteEvent struct { // is the form of what this value carries, left out while it is 1 (design 47 H2 §780). Form int64 `json:"form,omitempty"` // the deleted branch or tag Ref string `json:"ref"` // branch or tag RefType string `json:"ref-type,omitempty"` // the repository, / Repository string `json:"repository"` // who deleted it Sender string `json:"sender,omitempty"` } // RepoWritableEvent is the body of the event repo-writable. type RepoWritableEvent struct { // the account that writes it now Account string `json:"account"` // is the form of what this value carries, left out while it is 1 (design 47 H2 §780). Form int64 `json:"form,omitempty"` // the repository, / Repository string `json:"repository"` } // BranchMovedEvent is the body of the event branch-moved. type BranchMovedEvent struct { At *time.Time `json:"at,omitempty"` Branch string `json:"branch"` // is the form of what this value carries, left out while it is 1 (design 47 H2 §780). Form int64 `json:"form,omitempty"` // the head the webhook said, a commit's full 40-hex sha; read again by branch Head string `json:"head,omitempty"` // the repository, / Repository string `json:"repository"` } // MergeCalledEvent is the body of the event merge-called. type MergeCalledEvent = MergeCalled // FailedStepsByModuleFingerprintStepValue is one value of the state failed-steps under the key ... type FailedStepsByModuleFingerprintStepValue = FailedStep // CallsByCallCallValue is one value of the state calls under the key call.. type CallsByCallCallValue = Call // DecodePullAnswer reads a PullAnswer as another part wrote it: a field this reader does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780). func DecodePullAnswer(raw []byte) (PullAnswer, int, error) { var v PullAnswer if err := json.Unmarshal(raw, &v); err != nil { return v, 0, err } return v, formRead(raw), nil } // DecodeBranchAnswer reads a BranchAnswer as another part wrote it: a field this reader does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780). func DecodeBranchAnswer(raw []byte) (BranchAnswer, int, error) { var v BranchAnswer if err := json.Unmarshal(raw, &v); err != nil { return v, 0, err } return v, formRead(raw), nil } // DecodeOpenPullsAnswer reads a OpenPullsAnswer as another part wrote it: a field this reader does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780). func DecodeOpenPullsAnswer(raw []byte) (OpenPullsAnswer, int, error) { var v OpenPullsAnswer if err := json.Unmarshal(raw, &v); err != nil { return v, 0, err } return v, formRead(raw), nil } // DecodeTagsAnswer reads a TagsAnswer as another part wrote it: a field this reader does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780). func DecodeTagsAnswer(raw []byte) (TagsAnswer, int, error) { var v TagsAnswer if err := json.Unmarshal(raw, &v); err != nil { return v, 0, err } return v, formRead(raw), nil } // DecodeTreesAnswer reads a TreesAnswer as another part wrote it: a field this reader does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780). func DecodeTreesAnswer(raw []byte) (TreesAnswer, int, error) { var v TreesAnswer if err := json.Unmarshal(raw, &v); err != nil { return v, 0, err } return v, formRead(raw), nil } // DecodeFileAnswer reads a FileAnswer as another part wrote it: a field this reader does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780). func DecodeFileAnswer(raw []byte) (FileAnswer, int, error) { var v FileAnswer if err := json.Unmarshal(raw, &v); err != nil { return v, 0, err } return v, formRead(raw), nil } // DecodeContainsAnswer reads a ContainsAnswer as another part wrote it: a field this reader does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780). func DecodeContainsAnswer(raw []byte) (ContainsAnswer, int, error) { var v ContainsAnswer if err := json.Unmarshal(raw, &v); err != nil { return v, 0, err } return v, formRead(raw), nil } // DecodeStatusesAnswer reads a StatusesAnswer as another part wrote it: a field this reader does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780). func DecodeStatusesAnswer(raw []byte) (StatusesAnswer, int, error) { var v StatusesAnswer if err := json.Unmarshal(raw, &v); err != nil { return v, 0, err } return v, formRead(raw), nil } // DecodeStatusAnswer reads a StatusAnswer as another part wrote it: a field this reader does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780). func DecodeStatusAnswer(raw []byte) (StatusAnswer, int, error) { var v StatusAnswer if err := json.Unmarshal(raw, &v); err != nil { return v, 0, err } return v, formRead(raw), nil } // DecodeCommentAnswer reads a CommentAnswer as another part wrote it: a field this reader does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780). func DecodeCommentAnswer(raw []byte) (CommentAnswer, int, error) { var v CommentAnswer if err := json.Unmarshal(raw, &v); err != nil { return v, 0, err } return v, formRead(raw), nil } // DecodeViewAnswer reads a ViewAnswer as another part wrote it: a field this reader does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780). func DecodeViewAnswer(raw []byte) (ViewAnswer, int, error) { var v ViewAnswer if err := json.Unmarshal(raw, &v); err != nil { return v, 0, err } return v, formRead(raw), nil } // DecodeNoteAnswer reads a NoteAnswer as another part wrote it: a field this reader does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780). func DecodeNoteAnswer(raw []byte) (NoteAnswer, int, error) { var v NoteAnswer if err := json.Unmarshal(raw, &v); err != nil { return v, 0, err } return v, formRead(raw), nil } // DecodeMergePullAnswer reads a MergePullAnswer as another part wrote it: a field this reader does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780). func DecodeMergePullAnswer(raw []byte) (MergePullAnswer, int, error) { var v MergePullAnswer if err := json.Unmarshal(raw, &v); err != nil { return v, 0, err } return v, formRead(raw), nil } // DecodeTagAnswer reads a TagAnswer as another part wrote it: a field this reader does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780). func DecodeTagAnswer(raw []byte) (TagAnswer, int, error) { var v TagAnswer if err := json.Unmarshal(raw, &v); err != nil { return v, 0, err } return v, formRead(raw), nil } // DecodePullUpdatedEvent reads a PullUpdatedEvent as another part wrote it: a field this reader does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780). func DecodePullUpdatedEvent(raw []byte) (PullUpdatedEvent, int, error) { var v PullUpdatedEvent if err := json.Unmarshal(raw, &v); err != nil { return v, 0, err } return v, formRead(raw), nil } // DecodePullMergedEvent reads a PullMergedEvent as another part wrote it: a field this reader does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780). func DecodePullMergedEvent(raw []byte) (PullMergedEvent, int, error) { var v PullMergedEvent if err := json.Unmarshal(raw, &v); err != nil { return v, 0, err } return v, formRead(raw), nil } // DecodePullClosedEvent reads a PullClosedEvent as another part wrote it: a field this reader does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780). func DecodePullClosedEvent(raw []byte) (PullClosedEvent, int, error) { var v PullClosedEvent if err := json.Unmarshal(raw, &v); err != nil { return v, 0, err } return v, formRead(raw), nil } // DecodeForgePullEvent reads a ForgePullEvent as another part wrote it: a field this reader does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780). func DecodeForgePullEvent(raw []byte) (ForgePullEvent, int, error) { var v ForgePullEvent if err := json.Unmarshal(raw, &v); err != nil { return v, 0, err } return v, formRead(raw), nil } // DecodeForgeStatusEvent reads a ForgeStatusEvent as another part wrote it: a field this reader does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780). func DecodeForgeStatusEvent(raw []byte) (ForgeStatusEvent, int, error) { var v ForgeStatusEvent if err := json.Unmarshal(raw, &v); err != nil { return v, 0, err } return v, formRead(raw), nil } // DecodeForgeDeleteEvent reads a ForgeDeleteEvent as another part wrote it: a field this reader does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780). func DecodeForgeDeleteEvent(raw []byte) (ForgeDeleteEvent, int, error) { var v ForgeDeleteEvent if err := json.Unmarshal(raw, &v); err != nil { return v, 0, err } return v, formRead(raw), nil } // DecodeRepoWritableEvent reads a RepoWritableEvent as another part wrote it: a field this reader does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780). func DecodeRepoWritableEvent(raw []byte) (RepoWritableEvent, int, error) { var v RepoWritableEvent if err := json.Unmarshal(raw, &v); err != nil { return v, 0, err } return v, formRead(raw), nil } // DecodeBranchMovedEvent reads a BranchMovedEvent as another part wrote it: a field this reader does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780). func DecodeBranchMovedEvent(raw []byte) (BranchMovedEvent, int, error) { var v BranchMovedEvent if err := json.Unmarshal(raw, &v); err != nil { return v, 0, err } return v, formRead(raw), nil } // DecodeMergeCalledEvent reads a MergeCalledEvent as another part wrote it: a field this reader does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780). func DecodeMergeCalledEvent(raw []byte) (MergeCalledEvent, int, error) { var v MergeCalledEvent if err := json.Unmarshal(raw, &v); err != nil { return v, 0, err } return v, formRead(raw), nil } // formRead is the form a value says on the wire: 1 when it says none, or is no object. func formRead(raw []byte) int { var f struct { Form int `json:"form"` } if json.Unmarshal(raw, &f) != nil || f.Form < 1 { return 1 } return f.Form }