@noldova/git.hosting.protocol 0.0.5 → 0.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +4 -4
- package/src/api/index.d.ts +3697 -122
- package/src/api/index.js +42 -0
- package/src/enums/file-change-kind.js +13 -0
- package/src/enums/host-capability.js +23 -0
- package/src/enums/policy-state.js +14 -0
- package/src/enums/pull-request-status.js +13 -0
- package/src/enums/thread-status.js +16 -0
- package/src/enums/work-item-category.js +14 -0
- package/src/enums/work-item-scope.js +11 -0
- package/src/models/author-query.js +40 -0
- package/src/models/branch-pull-request.js +11 -4
- package/src/models/commit-query.js +32 -0
- package/src/models/field-check.js +6 -0
- package/src/models/host-avatar.js +27 -0
- package/src/models/host-build.js +60 -0
- package/src/models/host-capabilities.js +33 -0
- package/src/models/host-changes.js +12 -4
- package/src/models/host-comment.js +50 -0
- package/src/models/host-commit-comments.js +42 -0
- package/src/models/host-person.js +9 -4
- package/src/models/host-policy.js +43 -0
- package/src/models/host-pull-request-commit.js +34 -0
- package/src/models/host-pull-request-commits.js +33 -0
- package/src/models/host-pull-request-conflicts.js +34 -0
- package/src/models/host-pull-request-file.js +36 -0
- package/src/models/host-pull-request-files.js +46 -0
- package/src/models/host-pull-request-head.js +47 -0
- package/src/models/host-pull-request-heads.js +42 -0
- package/src/models/host-pull-request-list.js +42 -0
- package/src/models/host-pull-request-row.js +79 -0
- package/src/models/host-pull-request-threads.js +28 -0
- package/src/models/host-pull-request-update.js +46 -0
- package/src/models/host-pull-request-updates.js +33 -0
- package/src/models/host-pull-request.js +69 -0
- package/src/models/host-review-request-list.js +42 -0
- package/src/models/host-review-request.js +45 -0
- package/src/models/host-reviewer.js +41 -0
- package/src/models/host-sign-in.js +17 -6
- package/src/models/host-thread.js +53 -0
- package/src/models/host-work-item-detail.js +83 -0
- package/src/models/host-work-item-link.js +51 -0
- package/src/models/host-work-item-list.js +31 -0
- package/src/models/host-work-item-type.js +37 -0
- package/src/models/host-work-item.js +91 -0
- package/src/models/hosting-names.js +12 -0
- package/src/models/person-query.js +36 -0
- package/src/models/repository-query.js +29 -0
- package/src/models/work-item-query.js +32 -0
- package/src/models/work-item-update.js +47 -0
- package/src/models/work-items-query.js +49 -0
- package/src/resources.js +122 -3
package/src/api/index.d.ts
CHANGED
|
@@ -28,7 +28,7 @@ export declare const SignInState: {
|
|
|
28
28
|
readonly SignedOut: "SignedOut";
|
|
29
29
|
|
|
30
30
|
/**
|
|
31
|
-
* The
|
|
31
|
+
* The sign-in waits for the person: to enter the code the host showed on the host's page, or to finish signing in in the browser.
|
|
32
32
|
*/
|
|
33
33
|
readonly Waiting: "Waiting";
|
|
34
34
|
|
|
@@ -170,6 +170,43 @@ export declare const ReferenceState: {
|
|
|
170
170
|
*/
|
|
171
171
|
export type ReferenceState = (typeof ReferenceState)[keyof typeof ReferenceState];
|
|
172
172
|
|
|
173
|
+
/**
|
|
174
|
+
* What a pull request did to a file.
|
|
175
|
+
*
|
|
176
|
+
* @example
|
|
177
|
+
* ```ts
|
|
178
|
+
* import { FileChangeKind } from "@noldova/git.hosting.protocol";
|
|
179
|
+
*
|
|
180
|
+
* console.log(FileChangeKind.Renamed);
|
|
181
|
+
* ```
|
|
182
|
+
*/
|
|
183
|
+
export declare const FileChangeKind: {
|
|
184
|
+
/**
|
|
185
|
+
* The pull request adds the file.
|
|
186
|
+
*/
|
|
187
|
+
readonly Added: "Added";
|
|
188
|
+
|
|
189
|
+
/**
|
|
190
|
+
* The pull request changes the file in place.
|
|
191
|
+
*/
|
|
192
|
+
readonly Modified: "Modified";
|
|
193
|
+
|
|
194
|
+
/**
|
|
195
|
+
* The pull request deletes the file.
|
|
196
|
+
*/
|
|
197
|
+
readonly Deleted: "Deleted";
|
|
198
|
+
|
|
199
|
+
/**
|
|
200
|
+
* The pull request moves the file, with or without changes.
|
|
201
|
+
*/
|
|
202
|
+
readonly Renamed: "Renamed";
|
|
203
|
+
};
|
|
204
|
+
|
|
205
|
+
/**
|
|
206
|
+
* What a pull request did to a file.
|
|
207
|
+
*/
|
|
208
|
+
export type FileChangeKind = (typeof FileChangeKind)[keyof typeof FileChangeKind];
|
|
209
|
+
|
|
173
210
|
/**
|
|
174
211
|
* Where a check on a commit stands, such as a CI job.
|
|
175
212
|
*
|
|
@@ -553,10 +590,15 @@ export declare class HostSignIn {
|
|
|
553
590
|
public readonly state: SignInState;
|
|
554
591
|
|
|
555
592
|
/**
|
|
556
|
-
* The code,
|
|
593
|
+
* The code, while the sign-in waits for the person to enter it, or null.
|
|
557
594
|
*/
|
|
558
595
|
public readonly deviceCode: DeviceCode | null;
|
|
559
596
|
|
|
597
|
+
/**
|
|
598
|
+
* The https address, while the sign-in waits for the person to finish it in the browser, or null.
|
|
599
|
+
*/
|
|
600
|
+
public readonly address: string | null;
|
|
601
|
+
|
|
560
602
|
/**
|
|
561
603
|
* The account, exactly while signed in.
|
|
562
604
|
*/
|
|
@@ -571,10 +613,11 @@ export declare class HostSignIn {
|
|
|
571
613
|
* Makes a sign-in from its parts.
|
|
572
614
|
*
|
|
573
615
|
* @param state Where it stands.
|
|
574
|
-
* @param deviceCode The code,
|
|
616
|
+
* @param deviceCode The code, while it waits for the person to enter it; while it waits, exactly one of `deviceCode` and `address`.
|
|
575
617
|
* @param account The account, exactly while signed in.
|
|
576
618
|
* @param failure The failure, only while signed out.
|
|
577
619
|
* @param reader The reader the values came from, so an error names the field by its path; omitted for values that didn't come from JSON.
|
|
620
|
+
* @param address The https address, while it waits for the person in the browser; null by default, as for a sign-in made before 0.0.7, which had none.
|
|
578
621
|
* @throws {HostingArgumentException} Without a reader, when the parts don't fit the state, naming the field as the parameter, such as `account`.
|
|
579
622
|
* @throws {HostingFieldException} With a reader, when the parts don't fit the state, naming the field by its path, such as `$.account`.
|
|
580
623
|
* @example
|
|
@@ -585,7 +628,8 @@ export declare class HostSignIn {
|
|
|
585
628
|
* console.log(signIn.failure);
|
|
586
629
|
* ```
|
|
587
630
|
*/
|
|
588
|
-
public constructor(state: SignInState, deviceCode: DeviceCode | null, account: HostAccount | null, failure: SignInFailure | null, reader?: JsonReader
|
|
631
|
+
public constructor(state: SignInState, deviceCode: DeviceCode | null, account: HostAccount | null, failure: SignInFailure | null, reader?: JsonReader,
|
|
632
|
+
address?: string | null);
|
|
589
633
|
|
|
590
634
|
/**
|
|
591
635
|
* A sign-out, with why the last sign-in ended or null.
|
|
@@ -616,6 +660,22 @@ export declare class HostSignIn {
|
|
|
616
660
|
*/
|
|
617
661
|
public static waiting(deviceCode: DeviceCode): HostSignIn;
|
|
618
662
|
|
|
663
|
+
/**
|
|
664
|
+
* A sign-in that waits for the person to finish it in the browser.
|
|
665
|
+
*
|
|
666
|
+
* @param address The https address the browser opens.
|
|
667
|
+
* @returns The sign-in.
|
|
668
|
+
* @throws {HostingArgumentException} When the address isn't https.
|
|
669
|
+
* @example
|
|
670
|
+
* ```ts
|
|
671
|
+
* import { HostSignIn } from "@noldova/git.hosting.protocol";
|
|
672
|
+
*
|
|
673
|
+
* const signIn = HostSignIn.waitingInBrowser("https://login.microsoftonline.com/organizations/oauth2/v2.0/authorize?client_id=contoso");
|
|
674
|
+
* console.log(signIn.address);
|
|
675
|
+
* ```
|
|
676
|
+
*/
|
|
677
|
+
public static waitingInBrowser(address: string): HostSignIn;
|
|
678
|
+
|
|
619
679
|
/**
|
|
620
680
|
* A signed-in account.
|
|
621
681
|
*
|
|
@@ -643,14 +703,14 @@ export declare class HostSignIn {
|
|
|
643
703
|
* ```ts
|
|
644
704
|
* import { HostSignIn } from "@noldova/git.hosting.protocol";
|
|
645
705
|
*
|
|
646
|
-
* const signIn = HostSignIn.fromJson({ state: "SignedOut", deviceCode: null, account: null, failure: "Expired" });
|
|
706
|
+
* const signIn = HostSignIn.fromJson({ state: "SignedOut", deviceCode: null, address: null, account: null, failure: "Expired" });
|
|
647
707
|
* console.log(signIn.state);
|
|
648
708
|
* ```
|
|
649
709
|
*/
|
|
650
710
|
public static fromJson(value: unknown, path?: string): HostSignIn;
|
|
651
711
|
|
|
652
712
|
/**
|
|
653
|
-
* Writes the sign-in as JSON: `state`, `deviceCode`, `account` and `failure`, each null when it has none.
|
|
713
|
+
* Writes the sign-in as JSON: `state`, `deviceCode`, `account` and `failure`, each null when it has none, and `address` only while it waits in the browser.
|
|
654
714
|
*
|
|
655
715
|
* @returns The JSON.
|
|
656
716
|
* @example
|
|
@@ -689,6 +749,12 @@ export declare class HostingNames {
|
|
|
689
749
|
*/
|
|
690
750
|
public static readonly cancelSignInMethod: string;
|
|
691
751
|
|
|
752
|
+
/**
|
|
753
|
+
* The method that takes `{ "token": string }`, a personal access token the person pasted, checks it with the host, keeps it on this computer and
|
|
754
|
+
* answers the sign-in; for hosts whose sign-in is a token rather than a device code.
|
|
755
|
+
*/
|
|
756
|
+
public static readonly signInWithTokenMethod: string;
|
|
757
|
+
|
|
692
758
|
/**
|
|
693
759
|
* The method that forgets the kept token on this computer, and answers the sign-in.
|
|
694
760
|
*/
|
|
@@ -710,11 +776,77 @@ export declare class HostingNames {
|
|
|
710
776
|
*/
|
|
711
777
|
public static readonly readBranchPullRequestMethod: string;
|
|
712
778
|
|
|
779
|
+
/**
|
|
780
|
+
* The method that takes a `CommitQuery` as JSON and answers the pull request that brought the commit in, with its checks, as
|
|
781
|
+
* `BranchPullRequest` JSON, or no pull request when none did or the module can't show it.
|
|
782
|
+
*/
|
|
783
|
+
public static readonly readCommitPullRequestMethod: string;
|
|
784
|
+
|
|
785
|
+
/**
|
|
786
|
+
* The method that takes a `HostReference` to a pull request as JSON and answers it with its reviewers, policies and builds as `HostPullRequest`
|
|
787
|
+
* JSON, or null when the host can't show it.
|
|
788
|
+
*/
|
|
789
|
+
public static readonly readPullRequestMethod: string;
|
|
790
|
+
|
|
713
791
|
/**
|
|
714
792
|
* The method that takes a `PullRequestDraft` as JSON, opens the pull request on the host and answers it as `HostItem` JSON.
|
|
715
793
|
*/
|
|
716
794
|
public static readonly createPullRequestMethod: string;
|
|
717
795
|
|
|
796
|
+
/**
|
|
797
|
+
* The method that takes an `AuthorQuery` as JSON and answers the author's picture on the host as `HostAvatar` JSON.
|
|
798
|
+
*/
|
|
799
|
+
public static readonly readAuthorAvatarMethod: string;
|
|
800
|
+
|
|
801
|
+
/**
|
|
802
|
+
* The method that takes a `PersonQuery` as JSON and answers the person's picture on the host as `HostAvatar` JSON.
|
|
803
|
+
*/
|
|
804
|
+
public static readonly readPersonAvatarMethod: string;
|
|
805
|
+
|
|
806
|
+
/**
|
|
807
|
+
* The method that takes a `WorkItemQuery` as JSON and answers the work item with its type, state, assignee, iteration, area and parent as
|
|
808
|
+
* `HostWorkItem` JSON, or null when the host can't show it.
|
|
809
|
+
*/
|
|
810
|
+
public static readonly readWorkItemMethod: string;
|
|
811
|
+
|
|
812
|
+
/**
|
|
813
|
+
* The method that takes a `WorkItemsQuery` as JSON and answers its work items as a `HostWorkItemList`, each parent before its children, with
|
|
814
|
+
* whether the query's search stopped at its limit; no items when signed out or when the query is another host's.
|
|
815
|
+
*/
|
|
816
|
+
public static readonly readWorkItemsMethod: string;
|
|
817
|
+
|
|
818
|
+
/**
|
|
819
|
+
* The method that takes a `WorkItemUpdate` as JSON, changes the work item on the host for the signed-in person, and answers the changed work
|
|
820
|
+
* item as `HostWorkItem` JSON; null when signed out or when the update is another host's.
|
|
821
|
+
*/
|
|
822
|
+
public static readonly updateWorkItemMethod: string;
|
|
823
|
+
|
|
824
|
+
/**
|
|
825
|
+
* The method that takes a `RepositoryQuery` as JSON and answers the repository's open pull requests as `HostPullRequestList` JSON, the most
|
|
826
|
+
* recently updated first; signed out, `HostPullRequestList.signedOut()`, having asked the host nothing.
|
|
827
|
+
*/
|
|
828
|
+
public static readonly readPullRequestsMethod: string;
|
|
829
|
+
|
|
830
|
+
/**
|
|
831
|
+
* The method that takes a `RepositoryQuery` as JSON and answers the open pull requests on that repository that ask the signed-in person for a
|
|
832
|
+
* review as `HostReviewRequestList` JSON, the newest first; signed out, `HostReviewRequestList.signedOut()`, having asked the host nothing.
|
|
833
|
+
*/
|
|
834
|
+
public static readonly readReviewRequestsMethod: string;
|
|
835
|
+
|
|
836
|
+
/**
|
|
837
|
+
* The method that takes a `CommitQuery` as JSON and answers the review comments on that commit as `HostCommitComments` JSON: their count, whether
|
|
838
|
+
* a page of the host's answer was full, and the page that shows them; `HostCommitComments.none()` when signed out, for another host, or when the host
|
|
839
|
+
* has nothing that counts them.
|
|
840
|
+
*/
|
|
841
|
+
public static readonly readCommitCommentsMethod: string;
|
|
842
|
+
|
|
843
|
+
/**
|
|
844
|
+
* The method that takes a pull request's `HostReference` as JSON and answers its comment threads as `HostPullRequestThreads` JSON, oldest first,
|
|
845
|
+
* leaving out the threads the host writes for itself, with `hasMore` when the host keeps older comments than it answers; no threads when the host
|
|
846
|
+
* can't show them.
|
|
847
|
+
*/
|
|
848
|
+
public static readonly readPullRequestThreadsMethod: string;
|
|
849
|
+
|
|
718
850
|
/**
|
|
719
851
|
* A member's full name in a module.
|
|
720
852
|
*
|
|
@@ -768,7 +900,7 @@ export declare class HostReference {
|
|
|
768
900
|
* Makes a reference from its parts.
|
|
769
901
|
*
|
|
770
902
|
* @param host The id of the host module that reads the reference, which isn't blank.
|
|
771
|
-
* @param owner The owner of the repository on the host: names of letters, digits, `.`, `_
|
|
903
|
+
* @param owner The owner of the repository on the host: names of letters, digits, `.`, `_`, `-` and percent escapes such as `%20` but not of `/` or `\` joined by `/` for nested groups, none of them `.` or `..`, `%2e` counting as a dot.
|
|
772
904
|
* @param repository The repository's name on the host: letters, digits, `.`, `_` and `-`, other than `.` and `..`.
|
|
773
905
|
* @param number The issue's or pull request's number in its repository, a whole number above zero.
|
|
774
906
|
* @param reader The reader the values came from, so an error names the field by its path; omitted for values that didn't come from JSON.
|
|
@@ -827,7 +959,7 @@ export declare class HostReference {
|
|
|
827
959
|
}
|
|
828
960
|
|
|
829
961
|
/**
|
|
830
|
-
* A person on a host, such as the author of a pull request or an issue: their login and
|
|
962
|
+
* A person on a host, such as the author of a pull request or an issue: their login, their avatar and the name they show.
|
|
831
963
|
*
|
|
832
964
|
* @example
|
|
833
965
|
* ```ts
|
|
@@ -854,6 +986,11 @@ export declare class HostPerson {
|
|
|
854
986
|
*/
|
|
855
987
|
public readonly url: string | null;
|
|
856
988
|
|
|
989
|
+
/**
|
|
990
|
+
* The name the person shows on the host, such as "Mona Lisa" for a login that is an email address; null when the host gives none, so a window shows the login.
|
|
991
|
+
*/
|
|
992
|
+
public readonly name: string | null;
|
|
993
|
+
|
|
857
994
|
/**
|
|
858
995
|
* Makes a person from their parts.
|
|
859
996
|
*
|
|
@@ -861,6 +998,7 @@ export declare class HostPerson {
|
|
|
861
998
|
* @param avatar The avatar as a base64 data address of a PNG, JPEG, GIF or WebP image of at most 64 KiB, or null.
|
|
862
999
|
* @param url The profile page as an https address, or null.
|
|
863
1000
|
* @param reader The reader the values came from, so an error names the field by its path; omitted for values that didn't come from JSON.
|
|
1001
|
+
* @param name The name the person shows, which isn't blank, or null, the default.
|
|
864
1002
|
* @throws {HostingArgumentException} Without a reader, when a part is out of its range, naming the field as the parameter, such as `login`.
|
|
865
1003
|
* @throws {HostingFieldException} With a reader, when a part is out of its range, naming the field by its path, such as `$.login`.
|
|
866
1004
|
* @example
|
|
@@ -868,9 +1006,10 @@ export declare class HostPerson {
|
|
|
868
1006
|
* import { HostPerson } from "@noldova/git.hosting.protocol";
|
|
869
1007
|
*
|
|
870
1008
|
* const person = new HostPerson("monalisa", null, null);
|
|
1009
|
+
* const named = new HostPerson("monalisa@fabrikam.test", null, null, undefined, "Mona Lisa");
|
|
871
1010
|
* ```
|
|
872
1011
|
*/
|
|
873
|
-
public constructor(login: string, avatar: string | null, url: string | null, reader?: JsonReader);
|
|
1012
|
+
public constructor(login: string, avatar: string | null, url: string | null, reader?: JsonReader, name?: string | null);
|
|
874
1013
|
|
|
875
1014
|
/**
|
|
876
1015
|
* Reads a person from their JSON.
|
|
@@ -890,7 +1029,7 @@ export declare class HostPerson {
|
|
|
890
1029
|
public static fromJson(value: unknown, path?: string): HostPerson;
|
|
891
1030
|
|
|
892
1031
|
/**
|
|
893
|
-
* Writes the person as JSON: `login`, `avatar` and `url`, each of the last two null when there is none.
|
|
1032
|
+
* Writes the person as JSON: `login`, `avatar` and `url`, each of the last two null when there is none, and `name` only when there is one.
|
|
894
1033
|
*
|
|
895
1034
|
* @returns The JSON.
|
|
896
1035
|
* @example
|
|
@@ -916,17 +1055,17 @@ export declare class HostPerson {
|
|
|
916
1055
|
*/
|
|
917
1056
|
export declare class HostChanges {
|
|
918
1057
|
/**
|
|
919
|
-
* The lines the pull request adds.
|
|
1058
|
+
* The lines the pull request adds; zero when the host doesn't count them.
|
|
920
1059
|
*/
|
|
921
1060
|
public readonly additions: number;
|
|
922
1061
|
|
|
923
1062
|
/**
|
|
924
|
-
* The lines the pull request deletes.
|
|
1063
|
+
* The lines the pull request deletes; zero when the host doesn't count them.
|
|
925
1064
|
*/
|
|
926
1065
|
public readonly deletions: number;
|
|
927
1066
|
|
|
928
1067
|
/**
|
|
929
|
-
* The files the pull request changes.
|
|
1068
|
+
* The files the pull request changes; zero when the host doesn't count them.
|
|
930
1069
|
*/
|
|
931
1070
|
public readonly changedFiles: number;
|
|
932
1071
|
|
|
@@ -945,6 +1084,11 @@ export declare class HostChanges {
|
|
|
945
1084
|
*/
|
|
946
1085
|
public readonly headCommit: string;
|
|
947
1086
|
|
|
1087
|
+
/**
|
|
1088
|
+
* Whether the host counts the lines and files; when it doesn't, the three counts are zero and show nothing.
|
|
1089
|
+
*/
|
|
1090
|
+
public readonly isCounted: boolean;
|
|
1091
|
+
|
|
948
1092
|
/**
|
|
949
1093
|
* Makes changes from their parts.
|
|
950
1094
|
*
|
|
@@ -955,6 +1099,7 @@ export declare class HostChanges {
|
|
|
955
1099
|
* @param baseBranch The base branch, which isn't blank.
|
|
956
1100
|
* @param headCommit The head commit, a full hash of 40 or 64 lowercase hexadecimal digits.
|
|
957
1101
|
* @param reader The reader the values came from, so an error names the field by its path; omitted for values that didn't come from JSON.
|
|
1102
|
+
* @param isCounted Whether the host counts the lines and files, true by default; false needs the three counts at zero.
|
|
958
1103
|
* @throws {HostingArgumentException} Without a reader, when a part is out of its range, naming the field as the parameter, such as `headCommit`.
|
|
959
1104
|
* @throws {HostingFieldException} With a reader, when a part is out of its range, naming the field by its path, such as `$.headCommit`.
|
|
960
1105
|
* @example
|
|
@@ -965,7 +1110,25 @@ export declare class HostChanges {
|
|
|
965
1110
|
* ```
|
|
966
1111
|
*/
|
|
967
1112
|
public constructor(additions: number, deletions: number, changedFiles: number, headBranch: string, baseBranch: string, headCommit: string,
|
|
968
|
-
reader?: JsonReader);
|
|
1113
|
+
reader?: JsonReader, isCounted?: boolean);
|
|
1114
|
+
|
|
1115
|
+
/**
|
|
1116
|
+
* Makes changes whose host doesn't count the lines and files: their counts are zero, and `isCounted` is false.
|
|
1117
|
+
*
|
|
1118
|
+
* @param headBranch The head branch, which isn't blank.
|
|
1119
|
+
* @param baseBranch The base branch, which isn't blank.
|
|
1120
|
+
* @param headCommit The head commit, a full hash of 40 or 64 lowercase hexadecimal digits.
|
|
1121
|
+
* @returns The changes.
|
|
1122
|
+
* @throws {HostingArgumentException} When a part is out of its range, naming the parameter.
|
|
1123
|
+
* @example
|
|
1124
|
+
* ```ts
|
|
1125
|
+
* import { HostChanges } from "@noldova/git.hosting.protocol";
|
|
1126
|
+
*
|
|
1127
|
+
* const changes = HostChanges.uncounted("monalisa/fix", "main", "6dcb09b5b57875f334f61aebed695e2e4193db5e");
|
|
1128
|
+
* console.log(changes.isCounted);
|
|
1129
|
+
* ```
|
|
1130
|
+
*/
|
|
1131
|
+
public static uncounted(headBranch: string, baseBranch: string, headCommit: string): HostChanges;
|
|
969
1132
|
|
|
970
1133
|
/**
|
|
971
1134
|
* Reads changes from their JSON.
|
|
@@ -992,7 +1155,8 @@ export declare class HostChanges {
|
|
|
992
1155
|
public static fromJson(value: unknown, path?: string): HostChanges;
|
|
993
1156
|
|
|
994
1157
|
/**
|
|
995
|
-
* Writes the changes as JSON: `additions`, `deletions`, `changedFiles`, `headBranch`, `baseBranch` and `headCommit
|
|
1158
|
+
* Writes the changes as JSON: `additions`, `deletions`, `changedFiles`, `headBranch`, `baseBranch` and `headCommit`, and `isCounted`, false, only for
|
|
1159
|
+
* changes the host doesn't count.
|
|
996
1160
|
*
|
|
997
1161
|
* @returns The JSON.
|
|
998
1162
|
* @example
|
|
@@ -1224,17 +1388,17 @@ export declare class HostCheck {
|
|
|
1224
1388
|
}
|
|
1225
1389
|
|
|
1226
1390
|
/**
|
|
1227
|
-
* A question for a
|
|
1391
|
+
* A question for a commit author's picture on a host: the host, the repository's path, the author's email and a commit of theirs.
|
|
1228
1392
|
*
|
|
1229
1393
|
* @example
|
|
1230
1394
|
* ```ts
|
|
1231
|
-
* import {
|
|
1395
|
+
* import { AuthorQuery } from "@noldova/git.hosting.protocol";
|
|
1232
1396
|
*
|
|
1233
|
-
* const query = new
|
|
1397
|
+
* const query = new AuthorQuery("github.com", "octocat/hello-world", "octocat@github.com", "7fd1a60b01f91b314f59955a4e4d4e80d8edf11d");
|
|
1234
1398
|
* console.log(query.toJson());
|
|
1235
1399
|
* ```
|
|
1236
1400
|
*/
|
|
1237
|
-
export declare class
|
|
1401
|
+
export declare class AuthorQuery {
|
|
1238
1402
|
/**
|
|
1239
1403
|
* The host the repository is on, such as `github.com`.
|
|
1240
1404
|
*/
|
|
@@ -1246,33 +1410,33 @@ export declare class BranchQuery {
|
|
|
1246
1410
|
public readonly path: string;
|
|
1247
1411
|
|
|
1248
1412
|
/**
|
|
1249
|
-
* The
|
|
1413
|
+
* The author's email as the commit names it.
|
|
1250
1414
|
*/
|
|
1251
|
-
public readonly
|
|
1415
|
+
public readonly email: string;
|
|
1252
1416
|
|
|
1253
1417
|
/**
|
|
1254
|
-
*
|
|
1418
|
+
* A commit of the author's in the repository, as a full hash, for a host that finds people by commit.
|
|
1255
1419
|
*/
|
|
1256
|
-
public readonly
|
|
1420
|
+
public readonly commit: string;
|
|
1257
1421
|
|
|
1258
1422
|
/**
|
|
1259
1423
|
* Makes a query from its parts.
|
|
1260
1424
|
*
|
|
1261
1425
|
* @param host The host, which isn't blank.
|
|
1262
|
-
* @param path The repository's path: names of letters, digits, `.`, `_
|
|
1263
|
-
* @param
|
|
1264
|
-
* @param
|
|
1426
|
+
* @param path The repository's path: names of letters, digits, `.`, `_`, `-` and percent escapes such as `%20` but not of `/` or `\` joined by `/`, none of them `.` or `..`, `%2e` counting as a dot.
|
|
1427
|
+
* @param email The email, which isn't blank.
|
|
1428
|
+
* @param commit The commit, a full hash of 40 or 64 lowercase hexadecimal digits.
|
|
1265
1429
|
* @param reader The reader the values came from, so an error names the field by its path; omitted for values that didn't come from JSON.
|
|
1266
|
-
* @throws {HostingArgumentException} Without a reader, when a part is out of its range, naming the field as the parameter, such as `
|
|
1267
|
-
* @throws {HostingFieldException} With a reader, when a part is out of its range, naming the field by its path, such as `$.
|
|
1430
|
+
* @throws {HostingArgumentException} Without a reader, when a part is out of its range, naming the field as the parameter, such as `commit`.
|
|
1431
|
+
* @throws {HostingFieldException} With a reader, when a part is out of its range, naming the field by its path, such as `$.commit`.
|
|
1268
1432
|
* @example
|
|
1269
1433
|
* ```ts
|
|
1270
|
-
* import {
|
|
1434
|
+
* import { AuthorQuery } from "@noldova/git.hosting.protocol";
|
|
1271
1435
|
*
|
|
1272
|
-
* const query = new
|
|
1436
|
+
* const query = new AuthorQuery("github.com", "octocat/hello-world", "octocat@github.com", "7fd1a60b01f91b314f59955a4e4d4e80d8edf11d");
|
|
1273
1437
|
* ```
|
|
1274
1438
|
*/
|
|
1275
|
-
public constructor(host: string, path: string,
|
|
1439
|
+
public constructor(host: string, path: string, email: string, commit: string, reader?: JsonReader);
|
|
1276
1440
|
|
|
1277
1441
|
/**
|
|
1278
1442
|
* Reads a query from its JSON.
|
|
@@ -1284,136 +1448,178 @@ export declare class BranchQuery {
|
|
|
1284
1448
|
* @throws {HostingFieldException} When the value holds an unknown field, or a field is out of its range.
|
|
1285
1449
|
* @example
|
|
1286
1450
|
* ```ts
|
|
1287
|
-
* import {
|
|
1451
|
+
* import { AuthorQuery } from "@noldova/git.hosting.protocol";
|
|
1288
1452
|
*
|
|
1289
|
-
* const query =
|
|
1453
|
+
* const query = AuthorQuery.fromJson({ host: "github.com", path: "octocat/hello-world", email: "octocat@github.com", commit: "7fd1a60b01f91b314f59955a4e4d4e80d8edf11d" });
|
|
1290
1454
|
* ```
|
|
1291
1455
|
*/
|
|
1292
|
-
public static fromJson(value: unknown, path?: string):
|
|
1456
|
+
public static fromJson(value: unknown, path?: string): AuthorQuery;
|
|
1293
1457
|
|
|
1294
1458
|
/**
|
|
1295
|
-
* Writes the query as JSON: `host`, `path`, `
|
|
1459
|
+
* Writes the query as JSON: `host`, `path`, `email` and `commit`.
|
|
1296
1460
|
*
|
|
1297
1461
|
* @returns The JSON.
|
|
1298
1462
|
* @example
|
|
1299
1463
|
* ```ts
|
|
1300
|
-
* import {
|
|
1464
|
+
* import { AuthorQuery } from "@noldova/git.hosting.protocol";
|
|
1301
1465
|
*
|
|
1302
|
-
* console.log(new
|
|
1466
|
+
* console.log(new AuthorQuery("github.com", "octocat/hello-world", "octocat@github.com", "7fd1a60b01f91b314f59955a4e4d4e80d8edf11d").toJson());
|
|
1303
1467
|
* ```
|
|
1304
1468
|
*/
|
|
1305
1469
|
public toJson(): JsonObject;
|
|
1306
1470
|
}
|
|
1307
1471
|
|
|
1308
1472
|
/**
|
|
1309
|
-
* A
|
|
1473
|
+
* A question for a person's picture on a host: the host, the organization's path and the person's sign-in name, such as their email.
|
|
1310
1474
|
*
|
|
1311
1475
|
* @example
|
|
1312
1476
|
* ```ts
|
|
1313
|
-
* import
|
|
1477
|
+
* import { PersonQuery } from "@noldova/git.hosting.protocol";
|
|
1314
1478
|
*
|
|
1315
|
-
*
|
|
1316
|
-
*
|
|
1317
|
-
* }
|
|
1479
|
+
* const query = new PersonQuery("dev.azure.com", "fabrikam", "monalisa@fabrikam.test");
|
|
1480
|
+
* console.log(query.toJson());
|
|
1318
1481
|
* ```
|
|
1319
1482
|
*/
|
|
1320
|
-
export declare class
|
|
1483
|
+
export declare class PersonQuery {
|
|
1321
1484
|
/**
|
|
1322
|
-
* The
|
|
1485
|
+
* The host the person is on, such as `dev.azure.com`.
|
|
1323
1486
|
*/
|
|
1324
|
-
public readonly
|
|
1487
|
+
public readonly host: string;
|
|
1325
1488
|
|
|
1326
1489
|
/**
|
|
1327
|
-
* The
|
|
1490
|
+
* The organization's path on the host, such as `fabrikam`.
|
|
1328
1491
|
*/
|
|
1329
|
-
public readonly
|
|
1492
|
+
public readonly path: string;
|
|
1330
1493
|
|
|
1331
1494
|
/**
|
|
1332
|
-
*
|
|
1495
|
+
* The person's sign-in name on the host, as its work items and pull requests name them, such as their email.
|
|
1333
1496
|
*/
|
|
1334
|
-
public readonly
|
|
1497
|
+
public readonly login: string;
|
|
1335
1498
|
|
|
1336
1499
|
/**
|
|
1337
|
-
* Makes
|
|
1500
|
+
* Makes a query from its parts.
|
|
1338
1501
|
*
|
|
1339
|
-
* @param
|
|
1340
|
-
* @param
|
|
1341
|
-
* @param
|
|
1502
|
+
* @param host The host, which isn't blank.
|
|
1503
|
+
* @param path The organization's path: names of letters, digits, `.`, `_`, `-` and percent escapes such as `%20` but not of `/` or `\` joined by `/`, none of them `.` or `..`, `%2e` counting as a dot.
|
|
1504
|
+
* @param login The person's sign-in name, which isn't blank.
|
|
1342
1505
|
* @param reader The reader the values came from, so an error names the field by its path; omitted for values that didn't come from JSON.
|
|
1343
|
-
* @throws {HostingArgumentException} Without a reader, when
|
|
1344
|
-
*
|
|
1345
|
-
* @throws {HostingFieldException} With a reader, when the item isn't a pull request, there are checks with no pull request, or the review
|
|
1346
|
-
* decision is null for a pull request or set without one, naming the field by its path, such as `$.checks`.
|
|
1506
|
+
* @throws {HostingArgumentException} Without a reader, when a part is out of its range, naming the field as the parameter, such as `login`.
|
|
1507
|
+
* @throws {HostingFieldException} With a reader, when a part is out of its range, naming the field by its path, such as `$.login`.
|
|
1347
1508
|
* @example
|
|
1348
1509
|
* ```ts
|
|
1349
|
-
* import {
|
|
1510
|
+
* import { PersonQuery } from "@noldova/git.hosting.protocol";
|
|
1350
1511
|
*
|
|
1351
|
-
* const
|
|
1512
|
+
* const query = new PersonQuery("dev.azure.com", "fabrikam", "monalisa@fabrikam.test");
|
|
1352
1513
|
* ```
|
|
1353
1514
|
*/
|
|
1354
|
-
public constructor(
|
|
1515
|
+
public constructor(host: string, path: string, login: string, reader?: JsonReader);
|
|
1355
1516
|
|
|
1356
1517
|
/**
|
|
1357
|
-
*
|
|
1518
|
+
* Reads a query from its JSON.
|
|
1358
1519
|
*
|
|
1520
|
+
* @param value The JSON, with exactly the fields `toJson` writes.
|
|
1521
|
+
* @param path The JSON's path, `$` by default.
|
|
1522
|
+
* @returns The query.
|
|
1523
|
+
* @throws {JsonException} When the value isn't an object, or a field is missing or of the wrong type; it comes from `@noldova/context.json`.
|
|
1524
|
+
* @throws {HostingFieldException} When the value holds an unknown field, or a field is out of its range.
|
|
1359
1525
|
* @example
|
|
1360
1526
|
* ```ts
|
|
1361
|
-
* import {
|
|
1527
|
+
* import { PersonQuery } from "@noldova/git.hosting.protocol";
|
|
1362
1528
|
*
|
|
1363
|
-
*
|
|
1364
|
-
* return answer.checksState === CheckState.Failed;
|
|
1365
|
-
* }
|
|
1529
|
+
* const query = PersonQuery.fromJson({ host: "dev.azure.com", path: "fabrikam", login: "monalisa@fabrikam.test" });
|
|
1366
1530
|
* ```
|
|
1367
1531
|
*/
|
|
1368
|
-
public
|
|
1532
|
+
public static fromJson(value: unknown, path?: string): PersonQuery;
|
|
1533
|
+
|
|
1534
|
+
/**
|
|
1535
|
+
* Writes the query as JSON: `host`, `path` and `login`.
|
|
1536
|
+
*
|
|
1537
|
+
* @returns The JSON.
|
|
1538
|
+
* @example
|
|
1539
|
+
* ```ts
|
|
1540
|
+
* import { PersonQuery } from "@noldova/git.hosting.protocol";
|
|
1541
|
+
*
|
|
1542
|
+
* console.log(new PersonQuery("dev.azure.com", "fabrikam", "monalisa@fabrikam.test").toJson());
|
|
1543
|
+
* ```
|
|
1544
|
+
*/
|
|
1545
|
+
public toJson(): JsonObject;
|
|
1546
|
+
}
|
|
1547
|
+
|
|
1548
|
+
/**
|
|
1549
|
+
* A commit author's picture on a host, or none.
|
|
1550
|
+
*
|
|
1551
|
+
* @example
|
|
1552
|
+
* ```ts
|
|
1553
|
+
* import { HostAvatar } from "@noldova/git.hosting.protocol";
|
|
1554
|
+
*
|
|
1555
|
+
* console.log(new HostAvatar(null).toJson());
|
|
1556
|
+
* ```
|
|
1557
|
+
*/
|
|
1558
|
+
export declare class HostAvatar {
|
|
1559
|
+
/**
|
|
1560
|
+
* The picture as a base64 data address of a PNG, JPEG, GIF or WebP image of at most 64 KiB, or null when the host has none.
|
|
1561
|
+
*/
|
|
1562
|
+
public readonly avatar: string | null;
|
|
1563
|
+
|
|
1564
|
+
/**
|
|
1565
|
+
* Makes an answer.
|
|
1566
|
+
*
|
|
1567
|
+
* @param avatar The picture as a base64 data address, or null.
|
|
1568
|
+
* @param reader The reader the values came from, so an error names the field by its path; omitted for values that didn't come from JSON.
|
|
1569
|
+
* @throws {HostingArgumentException} Without a reader, when the picture isn't such an image's data address.
|
|
1570
|
+
* @throws {HostingFieldException} With a reader, when the picture isn't such an image's data address, naming `$.avatar`.
|
|
1571
|
+
* @example
|
|
1572
|
+
* ```ts
|
|
1573
|
+
* import { HostAvatar } from "@noldova/git.hosting.protocol";
|
|
1574
|
+
*
|
|
1575
|
+
* const answer = new HostAvatar("data:image/png;base64,iVBORw0KGgo=");
|
|
1576
|
+
* ```
|
|
1577
|
+
*/
|
|
1578
|
+
public constructor(avatar: string | null, reader?: JsonReader);
|
|
1369
1579
|
|
|
1370
1580
|
/**
|
|
1371
1581
|
* Reads an answer from its JSON.
|
|
1372
1582
|
*
|
|
1373
|
-
* @param value The JSON, with the
|
|
1374
|
-
* `Waiting`.
|
|
1583
|
+
* @param value The JSON, with exactly the field `toJson` writes.
|
|
1375
1584
|
* @param path The JSON's path, `$` by default.
|
|
1376
1585
|
* @returns The answer.
|
|
1377
|
-
* @throws {JsonException} When the value isn't an object,
|
|
1378
|
-
*
|
|
1379
|
-
* @throws {HostingFieldException} When the value holds an unknown field, a field is out of its range, the item isn't a pull request,
|
|
1380
|
-
* there are checks with no pull request, or the review decision is null for a pull request or set without one.
|
|
1586
|
+
* @throws {JsonException} When the value isn't an object, or the picture is missing or neither a text nor null; it comes from `@noldova/context.json`.
|
|
1587
|
+
* @throws {HostingFieldException} When the value holds an unknown field, or the picture is out of its range.
|
|
1381
1588
|
* @example
|
|
1382
1589
|
* ```ts
|
|
1383
|
-
* import {
|
|
1590
|
+
* import { HostAvatar } from "@noldova/git.hosting.protocol";
|
|
1384
1591
|
*
|
|
1385
|
-
* const
|
|
1592
|
+
* const answer = HostAvatar.fromJson({ avatar: null });
|
|
1386
1593
|
* ```
|
|
1387
1594
|
*/
|
|
1388
|
-
public static fromJson(value: unknown, path?: string):
|
|
1595
|
+
public static fromJson(value: unknown, path?: string): HostAvatar;
|
|
1389
1596
|
|
|
1390
1597
|
/**
|
|
1391
|
-
* Writes the answer as JSON: `
|
|
1598
|
+
* Writes the answer as JSON: `avatar`, null when there is none.
|
|
1392
1599
|
*
|
|
1393
1600
|
* @returns The JSON.
|
|
1394
1601
|
* @example
|
|
1395
1602
|
* ```ts
|
|
1396
|
-
* import {
|
|
1603
|
+
* import { HostAvatar } from "@noldova/git.hosting.protocol";
|
|
1397
1604
|
*
|
|
1398
|
-
* console.log(new
|
|
1605
|
+
* console.log(new HostAvatar(null).toJson());
|
|
1399
1606
|
* ```
|
|
1400
1607
|
*/
|
|
1401
1608
|
public toJson(): JsonObject;
|
|
1402
1609
|
}
|
|
1403
1610
|
|
|
1404
1611
|
/**
|
|
1405
|
-
* A pull request
|
|
1406
|
-
* opens as a draft.
|
|
1612
|
+
* A question for a branch's pull request on a host: the host, the repository's path, the branch and the commit whose checks to read.
|
|
1407
1613
|
*
|
|
1408
1614
|
* @example
|
|
1409
1615
|
* ```ts
|
|
1410
|
-
* import {
|
|
1616
|
+
* import { BranchQuery } from "@noldova/git.hosting.protocol";
|
|
1411
1617
|
*
|
|
1412
|
-
* const
|
|
1413
|
-
* console.log(
|
|
1618
|
+
* const query = new BranchQuery("github.com", "octocat/hello-world", "octocat/patch-1", "7fd1a60b01f91b314f59955a4e4d4e80d8edf11d");
|
|
1619
|
+
* console.log(query.toJson());
|
|
1414
1620
|
* ```
|
|
1415
1621
|
*/
|
|
1416
|
-
export declare class
|
|
1622
|
+
export declare class BranchQuery {
|
|
1417
1623
|
/**
|
|
1418
1624
|
* The host the repository is on, such as `github.com`.
|
|
1419
1625
|
*/
|
|
@@ -1425,66 +1631,331 @@ export declare class PullRequestDraft {
|
|
|
1425
1631
|
public readonly path: string;
|
|
1426
1632
|
|
|
1427
1633
|
/**
|
|
1428
|
-
* The branch whose
|
|
1429
|
-
*/
|
|
1430
|
-
public readonly headBranch: string;
|
|
1431
|
-
|
|
1432
|
-
/**
|
|
1433
|
-
* The branch the pull request merges into.
|
|
1434
|
-
*/
|
|
1435
|
-
public readonly baseBranch: string;
|
|
1436
|
-
|
|
1437
|
-
/**
|
|
1438
|
-
* The pull request's title.
|
|
1439
|
-
*/
|
|
1440
|
-
public readonly title: string;
|
|
1441
|
-
|
|
1442
|
-
/**
|
|
1443
|
-
* The pull request's description, which may be empty.
|
|
1634
|
+
* The branch whose pull request to read.
|
|
1444
1635
|
*/
|
|
1445
|
-
public readonly
|
|
1636
|
+
public readonly branch: string;
|
|
1446
1637
|
|
|
1447
1638
|
/**
|
|
1448
|
-
*
|
|
1639
|
+
* The commit whose checks to read, as a full hash, or null for the pull request's own head.
|
|
1449
1640
|
*/
|
|
1450
|
-
public readonly
|
|
1641
|
+
public readonly headCommit: string | null;
|
|
1451
1642
|
|
|
1452
1643
|
/**
|
|
1453
|
-
* Makes a
|
|
1644
|
+
* Makes a query from its parts.
|
|
1454
1645
|
*
|
|
1455
1646
|
* @param host The host, which isn't blank.
|
|
1456
|
-
* @param path The repository's path: names of letters, digits, `.`, `_
|
|
1457
|
-
* @param
|
|
1458
|
-
* @param
|
|
1459
|
-
* @param title The title, which isn't blank.
|
|
1460
|
-
* @param body The description, any text.
|
|
1461
|
-
* @param isDraft Whether it opens as a draft.
|
|
1647
|
+
* @param path The repository's path: names of letters, digits, `.`, `_`, `-` and percent escapes such as `%20` but not of `/` or `\` joined by `/`, none of them `.` or `..`, `%2e` counting as a dot.
|
|
1648
|
+
* @param branch The branch, which isn't blank.
|
|
1649
|
+
* @param headCommit The commit, a full hash of 40 or 64 lowercase hexadecimal digits, or null.
|
|
1462
1650
|
* @param reader The reader the values came from, so an error names the field by its path; omitted for values that didn't come from JSON.
|
|
1463
|
-
* @throws {HostingArgumentException} Without a reader, when a part is out of its range
|
|
1464
|
-
*
|
|
1465
|
-
* @throws {HostingFieldException} With a reader, when a part is out of its range or the base branch is the head branch, naming the field by
|
|
1466
|
-
* its path, such as `$.baseBranch`.
|
|
1651
|
+
* @throws {HostingArgumentException} Without a reader, when a part is out of its range, naming the field as the parameter, such as `headCommit`.
|
|
1652
|
+
* @throws {HostingFieldException} With a reader, when a part is out of its range, naming the field by its path, such as `$.headCommit`.
|
|
1467
1653
|
* @example
|
|
1468
1654
|
* ```ts
|
|
1469
|
-
* import {
|
|
1655
|
+
* import { BranchQuery } from "@noldova/git.hosting.protocol";
|
|
1470
1656
|
*
|
|
1471
|
-
* const
|
|
1657
|
+
* const query = new BranchQuery("github.com", "octocat/hello-world", "monalisa/fix", null);
|
|
1472
1658
|
* ```
|
|
1473
1659
|
*/
|
|
1474
|
-
public constructor(host: string, path: string,
|
|
1475
|
-
reader?: JsonReader);
|
|
1660
|
+
public constructor(host: string, path: string, branch: string, headCommit: string | null, reader?: JsonReader);
|
|
1476
1661
|
|
|
1477
1662
|
/**
|
|
1478
|
-
* Reads a
|
|
1663
|
+
* Reads a query from its JSON.
|
|
1479
1664
|
*
|
|
1480
1665
|
* @param value The JSON, with exactly the fields `toJson` writes.
|
|
1481
1666
|
* @param path The JSON's path, `$` by default.
|
|
1482
|
-
* @returns The
|
|
1667
|
+
* @returns The query.
|
|
1483
1668
|
* @throws {JsonException} When the value isn't an object, or a field is missing or of the wrong type; it comes from `@noldova/context.json`.
|
|
1484
|
-
* @throws {HostingFieldException} When the value holds an unknown field, a field is out of its range
|
|
1669
|
+
* @throws {HostingFieldException} When the value holds an unknown field, or a field is out of its range.
|
|
1485
1670
|
* @example
|
|
1486
1671
|
* ```ts
|
|
1487
|
-
* import {
|
|
1672
|
+
* import { BranchQuery } from "@noldova/git.hosting.protocol";
|
|
1673
|
+
*
|
|
1674
|
+
* const query = BranchQuery.fromJson({ host: "github.com", path: "octocat/hello-world", branch: "octocat/patch-1", headCommit: null });
|
|
1675
|
+
* ```
|
|
1676
|
+
*/
|
|
1677
|
+
public static fromJson(value: unknown, path?: string): BranchQuery;
|
|
1678
|
+
|
|
1679
|
+
/**
|
|
1680
|
+
* Writes the query as JSON: `host`, `path`, `branch` and `headCommit`, null when there is none.
|
|
1681
|
+
*
|
|
1682
|
+
* @returns The JSON.
|
|
1683
|
+
* @example
|
|
1684
|
+
* ```ts
|
|
1685
|
+
* import { BranchQuery } from "@noldova/git.hosting.protocol";
|
|
1686
|
+
*
|
|
1687
|
+
* console.log(new BranchQuery("github.com", "octocat/hello-world", "octocat/patch-1", null).toJson());
|
|
1688
|
+
* ```
|
|
1689
|
+
*/
|
|
1690
|
+
public toJson(): JsonObject;
|
|
1691
|
+
}
|
|
1692
|
+
|
|
1693
|
+
/**
|
|
1694
|
+
* Which commit's pull request to read: the host, the repository's path on it and the commit.
|
|
1695
|
+
*
|
|
1696
|
+
* @example
|
|
1697
|
+
* ```ts
|
|
1698
|
+
* import { CommitQuery } from "@noldova/git.hosting.protocol";
|
|
1699
|
+
*
|
|
1700
|
+
* const query = new CommitQuery("dev.azure.com", "fabrikam/Web/_git/web", "6dcb09b5b57875f334f61aebed695e2e4193db5e");
|
|
1701
|
+
* console.log(query.toJson());
|
|
1702
|
+
* ```
|
|
1703
|
+
*/
|
|
1704
|
+
export declare class CommitQuery {
|
|
1705
|
+
/**
|
|
1706
|
+
* The host the repository is on, such as `dev.azure.com`.
|
|
1707
|
+
*/
|
|
1708
|
+
public readonly host: string;
|
|
1709
|
+
|
|
1710
|
+
/**
|
|
1711
|
+
* The repository's path on the host, such as `fabrikam/Web/_git/web`.
|
|
1712
|
+
*/
|
|
1713
|
+
public readonly path: string;
|
|
1714
|
+
|
|
1715
|
+
/**
|
|
1716
|
+
* The commit whose pull request to read, as a full hash.
|
|
1717
|
+
*/
|
|
1718
|
+
public readonly commit: string;
|
|
1719
|
+
|
|
1720
|
+
/**
|
|
1721
|
+
* Makes a query from its parts.
|
|
1722
|
+
*
|
|
1723
|
+
* @param host The host, which isn't blank.
|
|
1724
|
+
* @param path The repository's path: names of letters, digits, `.`, `_`, `-` and percent escapes such as `%20` but not of `/` or `\` joined by `/`, none of them `.` or `..`, `%2e` counting as a dot.
|
|
1725
|
+
* @param commit The commit, a full hash of 40 or 64 lowercase hexadecimal digits.
|
|
1726
|
+
* @param reader The reader the values came from, so an error names the field by its path; omitted for values that didn't come from JSON.
|
|
1727
|
+
* @throws {HostingArgumentException} Without a reader, when a part is out of its range, naming the field as the parameter, such as `commit`.
|
|
1728
|
+
* @throws {HostingFieldException} With a reader, when a part is out of its range, naming the field by its path, such as `$.commit`.
|
|
1729
|
+
* @example
|
|
1730
|
+
* ```ts
|
|
1731
|
+
* import { CommitQuery } from "@noldova/git.hosting.protocol";
|
|
1732
|
+
*
|
|
1733
|
+
* const query = new CommitQuery("github.com", "octocat/hello-world", "6dcb09b5b57875f334f61aebed695e2e4193db5e");
|
|
1734
|
+
* ```
|
|
1735
|
+
*/
|
|
1736
|
+
public constructor(host: string, path: string, commit: string, reader?: JsonReader);
|
|
1737
|
+
|
|
1738
|
+
/**
|
|
1739
|
+
* Reads a query from its JSON.
|
|
1740
|
+
*
|
|
1741
|
+
* @param value The JSON, with exactly the fields `toJson` writes.
|
|
1742
|
+
* @param path The JSON's path, `$` by default.
|
|
1743
|
+
* @returns The query.
|
|
1744
|
+
* @throws {JsonException} When the value isn't an object, or a field is missing or of the wrong type; it comes from `@noldova/context.json`.
|
|
1745
|
+
* @throws {HostingFieldException} When the value holds an unknown field, or a field is out of its range.
|
|
1746
|
+
* @example
|
|
1747
|
+
* ```ts
|
|
1748
|
+
* import { CommitQuery } from "@noldova/git.hosting.protocol";
|
|
1749
|
+
*
|
|
1750
|
+
* const query = CommitQuery.fromJson({ host: "github.com", path: "octocat/hello-world", commit: "6dcb09b5b57875f334f61aebed695e2e4193db5e" });
|
|
1751
|
+
* ```
|
|
1752
|
+
*/
|
|
1753
|
+
public static fromJson(value: unknown, path?: string): CommitQuery;
|
|
1754
|
+
|
|
1755
|
+
/**
|
|
1756
|
+
* Writes the query as JSON: `host`, `path` and `commit`.
|
|
1757
|
+
*
|
|
1758
|
+
* @returns The JSON.
|
|
1759
|
+
* @example
|
|
1760
|
+
* ```ts
|
|
1761
|
+
* import { CommitQuery } from "@noldova/git.hosting.protocol";
|
|
1762
|
+
*
|
|
1763
|
+
* console.log(new CommitQuery("github.com", "octocat/hello-world", "6dcb09b5b57875f334f61aebed695e2e4193db5e").toJson());
|
|
1764
|
+
* ```
|
|
1765
|
+
*/
|
|
1766
|
+
public toJson(): JsonObject;
|
|
1767
|
+
}
|
|
1768
|
+
|
|
1769
|
+
/**
|
|
1770
|
+
* A branch's pull request on a host, or none, the checks on its commit and where its review stands.
|
|
1771
|
+
*
|
|
1772
|
+
* @example
|
|
1773
|
+
* ```ts
|
|
1774
|
+
* import type { BranchPullRequest } from "@noldova/git.hosting.protocol";
|
|
1775
|
+
*
|
|
1776
|
+
* function describe(answer: BranchPullRequest): string {
|
|
1777
|
+
* return answer.pullRequest === null ? "no pull request" : `${answer.pullRequest.reference.text}: ${answer.checksState ?? "no checks"}`;
|
|
1778
|
+
* }
|
|
1779
|
+
* ```
|
|
1780
|
+
*/
|
|
1781
|
+
export declare class BranchPullRequest {
|
|
1782
|
+
/**
|
|
1783
|
+
* The branch's pull request, or null when it has none.
|
|
1784
|
+
*/
|
|
1785
|
+
public readonly pullRequest: HostItem | null;
|
|
1786
|
+
|
|
1787
|
+
/**
|
|
1788
|
+
* The checks on the commit, none when there is no pull request.
|
|
1789
|
+
*/
|
|
1790
|
+
public readonly checks: readonly HostCheck[];
|
|
1791
|
+
|
|
1792
|
+
/**
|
|
1793
|
+
* Where the pull request's review stands, or null when there is no pull request.
|
|
1794
|
+
*/
|
|
1795
|
+
public readonly reviewDecision: ReviewDecision | null;
|
|
1796
|
+
|
|
1797
|
+
/**
|
|
1798
|
+
* How many reviewers approve the pull request, or null when there is no pull request or the host doesn't count them.
|
|
1799
|
+
*/
|
|
1800
|
+
public readonly approvals: number | null;
|
|
1801
|
+
|
|
1802
|
+
/**
|
|
1803
|
+
* Makes an answer from its parts.
|
|
1804
|
+
*
|
|
1805
|
+
* @param pullRequest The pull request, an item of the kind `PullRequest`, or null.
|
|
1806
|
+
* @param checks The checks, none when the pull request is null.
|
|
1807
|
+
* @param reviewDecision Where the review stands, null exactly when the pull request is; `Waiting` for a pull request, and null without one, by default.
|
|
1808
|
+
* @param approvals How many reviewers approve, a whole number, zero or more, only with a pull request; null, by default, when the host doesn't count them.
|
|
1809
|
+
* @param reader The reader the values came from, so an error names the field by its path; omitted for values that didn't come from JSON.
|
|
1810
|
+
* @throws {HostingArgumentException} Without a reader, when the item isn't a pull request, there are checks or approvals with no pull request,
|
|
1811
|
+
* the approvals are below zero, or the review decision is null for a pull request or set without one, naming the field as the parameter,
|
|
1812
|
+
* `pullRequest`, `checks`, `approvals` or `reviewDecision`.
|
|
1813
|
+
* @throws {HostingFieldException} With a reader, when the item isn't a pull request, there are checks or approvals with no pull request, the
|
|
1814
|
+
* approvals are below zero, or the review decision is null for a pull request or set without one, naming the field by its path, such as `$.checks`.
|
|
1815
|
+
* @example
|
|
1816
|
+
* ```ts
|
|
1817
|
+
* import { BranchPullRequest } from "@noldova/git.hosting.protocol";
|
|
1818
|
+
*
|
|
1819
|
+
* const none = new BranchPullRequest(null, []);
|
|
1820
|
+
* ```
|
|
1821
|
+
*/
|
|
1822
|
+
public constructor(pullRequest: HostItem | null, checks: readonly HostCheck[], reviewDecision?: ReviewDecision | null, approvals?: number | null,
|
|
1823
|
+
reader?: JsonReader);
|
|
1824
|
+
|
|
1825
|
+
/**
|
|
1826
|
+
* The worst state among the checks, in the order `Failed`, `Running`, `Queued`, `Succeeded` and `Neutral`, or null when there are no checks.
|
|
1827
|
+
*
|
|
1828
|
+
* @example
|
|
1829
|
+
* ```ts
|
|
1830
|
+
* import { type BranchPullRequest, CheckState } from "@noldova/git.hosting.protocol";
|
|
1831
|
+
*
|
|
1832
|
+
* function isFailing(answer: BranchPullRequest): boolean {
|
|
1833
|
+
* return answer.checksState === CheckState.Failed;
|
|
1834
|
+
* }
|
|
1835
|
+
* ```
|
|
1836
|
+
*/
|
|
1837
|
+
public get checksState(): CheckState | null;
|
|
1838
|
+
|
|
1839
|
+
/**
|
|
1840
|
+
* Reads an answer from its JSON.
|
|
1841
|
+
*
|
|
1842
|
+
* @param value The JSON, with the fields `toJson` writes; without `reviewDecision`, as an older module answers, a pull request's review reads as
|
|
1843
|
+
* `Waiting`, and without `approvals` they read as null.
|
|
1844
|
+
* @param path The JSON's path, `$` by default.
|
|
1845
|
+
* @returns The answer.
|
|
1846
|
+
* @throws {JsonException} When the value isn't an object, a field is missing or of the wrong type, or the review decision isn't one of
|
|
1847
|
+
* `ReviewDecision`'s; it comes from `@noldova/context.json`.
|
|
1848
|
+
* @throws {HostingFieldException} When the value holds an unknown field, a field is out of its range, the item isn't a pull request,
|
|
1849
|
+
* there are checks or approvals with no pull request, the approvals are below zero, or the review decision is null for a pull request or set
|
|
1850
|
+
* without one.
|
|
1851
|
+
* @example
|
|
1852
|
+
* ```ts
|
|
1853
|
+
* import { BranchPullRequest } from "@noldova/git.hosting.protocol";
|
|
1854
|
+
*
|
|
1855
|
+
* const none = BranchPullRequest.fromJson({ pullRequest: null, checks: [] });
|
|
1856
|
+
* ```
|
|
1857
|
+
*/
|
|
1858
|
+
public static fromJson(value: unknown, path?: string): BranchPullRequest;
|
|
1859
|
+
|
|
1860
|
+
/**
|
|
1861
|
+
* Writes the answer as JSON: `pullRequest`, null when there is none, `checks`, `reviewDecision`, null without a pull request, and `approvals`,
|
|
1862
|
+
* null when not counted.
|
|
1863
|
+
*
|
|
1864
|
+
* @returns The JSON.
|
|
1865
|
+
* @example
|
|
1866
|
+
* ```ts
|
|
1867
|
+
* import { BranchPullRequest } from "@noldova/git.hosting.protocol";
|
|
1868
|
+
*
|
|
1869
|
+
* console.log(new BranchPullRequest(null, []).toJson());
|
|
1870
|
+
* ```
|
|
1871
|
+
*/
|
|
1872
|
+
public toJson(): JsonObject;
|
|
1873
|
+
}
|
|
1874
|
+
|
|
1875
|
+
/**
|
|
1876
|
+
* A pull request to open on a host: the host, the repository's path, the head and base branches, the title, the body and whether it
|
|
1877
|
+
* opens as a draft.
|
|
1878
|
+
*
|
|
1879
|
+
* @example
|
|
1880
|
+
* ```ts
|
|
1881
|
+
* import { PullRequestDraft } from "@noldova/git.hosting.protocol";
|
|
1882
|
+
*
|
|
1883
|
+
* const draft = new PullRequestDraft("github.com", "octocat/hello-world", "octocat/patch-1", "main", "Fix the greeting", "", true);
|
|
1884
|
+
* console.log(draft.toJson());
|
|
1885
|
+
* ```
|
|
1886
|
+
*/
|
|
1887
|
+
export declare class PullRequestDraft {
|
|
1888
|
+
/**
|
|
1889
|
+
* The host the repository is on, such as `github.com`.
|
|
1890
|
+
*/
|
|
1891
|
+
public readonly host: string;
|
|
1892
|
+
|
|
1893
|
+
/**
|
|
1894
|
+
* The repository's path on the host, such as `octocat/hello-world`.
|
|
1895
|
+
*/
|
|
1896
|
+
public readonly path: string;
|
|
1897
|
+
|
|
1898
|
+
/**
|
|
1899
|
+
* The branch whose changes the pull request brings.
|
|
1900
|
+
*/
|
|
1901
|
+
public readonly headBranch: string;
|
|
1902
|
+
|
|
1903
|
+
/**
|
|
1904
|
+
* The branch the pull request merges into.
|
|
1905
|
+
*/
|
|
1906
|
+
public readonly baseBranch: string;
|
|
1907
|
+
|
|
1908
|
+
/**
|
|
1909
|
+
* The pull request's title.
|
|
1910
|
+
*/
|
|
1911
|
+
public readonly title: string;
|
|
1912
|
+
|
|
1913
|
+
/**
|
|
1914
|
+
* The pull request's description, which may be empty.
|
|
1915
|
+
*/
|
|
1916
|
+
public readonly body: string;
|
|
1917
|
+
|
|
1918
|
+
/**
|
|
1919
|
+
* Whether the pull request opens as a draft.
|
|
1920
|
+
*/
|
|
1921
|
+
public readonly isDraft: boolean;
|
|
1922
|
+
|
|
1923
|
+
/**
|
|
1924
|
+
* Makes a draft from its parts.
|
|
1925
|
+
*
|
|
1926
|
+
* @param host The host, which isn't blank.
|
|
1927
|
+
* @param path The repository's path: names of letters, digits, `.`, `_`, `-` and percent escapes such as `%20` but not of `/` or `\` joined by `/`, none of them `.` or `..`, `%2e` counting as a dot.
|
|
1928
|
+
* @param headBranch The head branch, which isn't blank.
|
|
1929
|
+
* @param baseBranch The base branch, which isn't blank and isn't the head branch.
|
|
1930
|
+
* @param title The title, which isn't blank.
|
|
1931
|
+
* @param body The description, any text.
|
|
1932
|
+
* @param isDraft Whether it opens as a draft.
|
|
1933
|
+
* @param reader The reader the values came from, so an error names the field by its path; omitted for values that didn't come from JSON.
|
|
1934
|
+
* @throws {HostingArgumentException} Without a reader, when a part is out of its range or the base branch is the head branch, naming the field as the
|
|
1935
|
+
* parameter, such as `baseBranch`.
|
|
1936
|
+
* @throws {HostingFieldException} With a reader, when a part is out of its range or the base branch is the head branch, naming the field by
|
|
1937
|
+
* its path, such as `$.baseBranch`.
|
|
1938
|
+
* @example
|
|
1939
|
+
* ```ts
|
|
1940
|
+
* import { PullRequestDraft } from "@noldova/git.hosting.protocol";
|
|
1941
|
+
*
|
|
1942
|
+
* const draft = new PullRequestDraft("github.com", "octocat/hello-world", "monalisa/fix", "main", "Fix the greeting", "Closes #2.", false);
|
|
1943
|
+
* ```
|
|
1944
|
+
*/
|
|
1945
|
+
public constructor(host: string, path: string, headBranch: string, baseBranch: string, title: string, body: string, isDraft: boolean,
|
|
1946
|
+
reader?: JsonReader);
|
|
1947
|
+
|
|
1948
|
+
/**
|
|
1949
|
+
* Reads a draft from its JSON.
|
|
1950
|
+
*
|
|
1951
|
+
* @param value The JSON, with exactly the fields `toJson` writes.
|
|
1952
|
+
* @param path The JSON's path, `$` by default.
|
|
1953
|
+
* @returns The draft.
|
|
1954
|
+
* @throws {JsonException} When the value isn't an object, or a field is missing or of the wrong type; it comes from `@noldova/context.json`.
|
|
1955
|
+
* @throws {HostingFieldException} When the value holds an unknown field, a field is out of its range, or the base branch is the head branch.
|
|
1956
|
+
* @example
|
|
1957
|
+
* ```ts
|
|
1958
|
+
* import { PullRequestDraft } from "@noldova/git.hosting.protocol";
|
|
1488
1959
|
*
|
|
1489
1960
|
* const draft = PullRequestDraft.fromJson({
|
|
1490
1961
|
* host: "github.com",
|
|
@@ -1512,3 +1983,3107 @@ export declare class PullRequestDraft {
|
|
|
1512
1983
|
*/
|
|
1513
1984
|
public toJson(): JsonObject;
|
|
1514
1985
|
}
|
|
1986
|
+
|
|
1987
|
+
/**
|
|
1988
|
+
* A work item to read from a host: the host module, the organization and the item's id, which is unique in the organization.
|
|
1989
|
+
*
|
|
1990
|
+
* @example
|
|
1991
|
+
* ```ts
|
|
1992
|
+
* import { WorkItemQuery } from "@noldova/git.hosting.protocol";
|
|
1993
|
+
*
|
|
1994
|
+
* const query = new WorkItemQuery("git-azure-devops", "fabrikam", 42);
|
|
1995
|
+
* console.log(query.toJson());
|
|
1996
|
+
* ```
|
|
1997
|
+
*/
|
|
1998
|
+
export declare class WorkItemQuery {
|
|
1999
|
+
/**
|
|
2000
|
+
* The host module's id, such as `git-azure-devops`.
|
|
2001
|
+
*/
|
|
2002
|
+
public readonly host: string;
|
|
2003
|
+
|
|
2004
|
+
/**
|
|
2005
|
+
* The organization the work item is in, such as `fabrikam`.
|
|
2006
|
+
*/
|
|
2007
|
+
public readonly organization: string;
|
|
2008
|
+
|
|
2009
|
+
/**
|
|
2010
|
+
* The work item's id.
|
|
2011
|
+
*/
|
|
2012
|
+
public readonly id: number;
|
|
2013
|
+
|
|
2014
|
+
/**
|
|
2015
|
+
* Makes a query from its parts.
|
|
2016
|
+
*
|
|
2017
|
+
* @param host The host module's id: letters, digits, `.`, `_` and `-`, other than `.` and `..`.
|
|
2018
|
+
* @param organization The organization: letters, digits, `.`, `_` and `-`, other than `.` and `..`.
|
|
2019
|
+
* @param id The work item's id, a whole number above zero.
|
|
2020
|
+
* @param reader The reader the values came from, so an error names the field by its path; omitted for values that didn't come from JSON.
|
|
2021
|
+
* @throws {HostingArgumentException} Without a reader, when a part is out of its range, naming the field as the parameter, such as `id`.
|
|
2022
|
+
* @throws {HostingFieldException} With a reader, when a part is out of its range, naming the field by its path, such as `$.id`.
|
|
2023
|
+
* @example
|
|
2024
|
+
* ```ts
|
|
2025
|
+
* import { WorkItemQuery } from "@noldova/git.hosting.protocol";
|
|
2026
|
+
*
|
|
2027
|
+
* const query = new WorkItemQuery("git-azure-devops", "fabrikam", 42);
|
|
2028
|
+
* ```
|
|
2029
|
+
*/
|
|
2030
|
+
public constructor(host: string, organization: string, id: number, reader?: JsonReader);
|
|
2031
|
+
|
|
2032
|
+
/**
|
|
2033
|
+
* Reads a query from its JSON.
|
|
2034
|
+
*
|
|
2035
|
+
* @param value The JSON, with exactly the fields `toJson` writes.
|
|
2036
|
+
* @param path The JSON's path, `$` by default.
|
|
2037
|
+
* @returns The query.
|
|
2038
|
+
* @throws {JsonException} When the value isn't an object, or a field is missing or of the wrong type; it comes from `@noldova/context.json`.
|
|
2039
|
+
* @throws {HostingFieldException} When the value holds an unknown field or a field is out of its range.
|
|
2040
|
+
* @example
|
|
2041
|
+
* ```ts
|
|
2042
|
+
* import { WorkItemQuery } from "@noldova/git.hosting.protocol";
|
|
2043
|
+
*
|
|
2044
|
+
* const query = WorkItemQuery.fromJson({ host: "git-azure-devops", organization: "fabrikam", id: 42 });
|
|
2045
|
+
* ```
|
|
2046
|
+
*/
|
|
2047
|
+
public static fromJson(value: unknown, path?: string): WorkItemQuery;
|
|
2048
|
+
|
|
2049
|
+
/**
|
|
2050
|
+
* Writes the query as JSON: `host`, `organization` and `id`.
|
|
2051
|
+
*
|
|
2052
|
+
* @returns The JSON.
|
|
2053
|
+
* @example
|
|
2054
|
+
* ```ts
|
|
2055
|
+
* import { WorkItemQuery } from "@noldova/git.hosting.protocol";
|
|
2056
|
+
*
|
|
2057
|
+
* console.log(new WorkItemQuery("git-azure-devops", "fabrikam", 42).toJson());
|
|
2058
|
+
* ```
|
|
2059
|
+
*/
|
|
2060
|
+
public toJson(): JsonObject;
|
|
2061
|
+
}
|
|
2062
|
+
|
|
2063
|
+
/**
|
|
2064
|
+
* Work items to read from a host: the host module, the organization, the project, which items, and for the `Ids` scope, their ids.
|
|
2065
|
+
*
|
|
2066
|
+
* @example
|
|
2067
|
+
* ```ts
|
|
2068
|
+
* import { WorkItemScope, WorkItemsQuery } from "@noldova/git.hosting.protocol";
|
|
2069
|
+
*
|
|
2070
|
+
* const query = new WorkItemsQuery("git-azure-devops", "fabrikam", "Web Site", WorkItemScope.Mine, []);
|
|
2071
|
+
* console.log(query.toJson());
|
|
2072
|
+
* ```
|
|
2073
|
+
*/
|
|
2074
|
+
export declare class WorkItemsQuery {
|
|
2075
|
+
/**
|
|
2076
|
+
* The host module's id, such as `git-azure-devops`.
|
|
2077
|
+
*/
|
|
2078
|
+
public readonly host: string;
|
|
2079
|
+
|
|
2080
|
+
/**
|
|
2081
|
+
* The organization the project is in, such as `fabrikam`.
|
|
2082
|
+
*/
|
|
2083
|
+
public readonly organization: string;
|
|
2084
|
+
|
|
2085
|
+
/**
|
|
2086
|
+
* The project's name, such as `Web Site`.
|
|
2087
|
+
*/
|
|
2088
|
+
public readonly project: string;
|
|
2089
|
+
|
|
2090
|
+
/**
|
|
2091
|
+
* Which work items to read.
|
|
2092
|
+
*/
|
|
2093
|
+
public readonly scope: WorkItemScope;
|
|
2094
|
+
|
|
2095
|
+
/**
|
|
2096
|
+
* The work items' ids, each once, exactly for the `Ids` scope; empty otherwise.
|
|
2097
|
+
*/
|
|
2098
|
+
public readonly ids: readonly number[];
|
|
2099
|
+
|
|
2100
|
+
/**
|
|
2101
|
+
* Makes a query from its parts.
|
|
2102
|
+
*
|
|
2103
|
+
* @param host The host module's id: letters, digits, `.`, `_` and `-`, other than `.` and `..`.
|
|
2104
|
+
* @param organization The organization: letters, digits, `.`, `_` and `-`, other than `.` and `..`.
|
|
2105
|
+
* @param project The project's name, a text that isn't blank.
|
|
2106
|
+
* @param scope Which work items to read.
|
|
2107
|
+
* @param ids The work items' ids, whole numbers above zero, each once, exactly for the `Ids` scope; empty otherwise.
|
|
2108
|
+
* @param reader The reader the values came from, so an error names the field by its path; omitted for values that didn't come from JSON.
|
|
2109
|
+
* @throws {HostingArgumentException} Without a reader, when a part is out of its range, naming the field as the parameter, such as `ids`.
|
|
2110
|
+
* @throws {HostingFieldException} With a reader, when a part is out of its range, naming the field by its path, such as `$.ids`.
|
|
2111
|
+
* @example
|
|
2112
|
+
* ```ts
|
|
2113
|
+
* import { WorkItemScope, WorkItemsQuery } from "@noldova/git.hosting.protocol";
|
|
2114
|
+
*
|
|
2115
|
+
* const query = new WorkItemsQuery("git-azure-devops", "fabrikam", "Web Site", WorkItemScope.Ids, [42, 43]);
|
|
2116
|
+
* ```
|
|
2117
|
+
*/
|
|
2118
|
+
public constructor(host: string, organization: string, project: string, scope: WorkItemScope, ids: readonly number[], reader?: JsonReader);
|
|
2119
|
+
|
|
2120
|
+
/**
|
|
2121
|
+
* Reads a query from its JSON.
|
|
2122
|
+
*
|
|
2123
|
+
* @param value The JSON, with exactly the fields `toJson` writes.
|
|
2124
|
+
* @param path The JSON's path, `$` by default.
|
|
2125
|
+
* @returns The query.
|
|
2126
|
+
* @throws {JsonException} When the value isn't an object, or a field is missing or of the wrong type; it comes from `@noldova/context.json`.
|
|
2127
|
+
* @throws {HostingFieldException} When the value holds an unknown field or a field is out of its range.
|
|
2128
|
+
* @example
|
|
2129
|
+
* ```ts
|
|
2130
|
+
* import { WorkItemsQuery } from "@noldova/git.hosting.protocol";
|
|
2131
|
+
*
|
|
2132
|
+
* const query = WorkItemsQuery.fromJson({ host: "git-azure-devops", organization: "fabrikam", project: "Web Site", scope: "Mine", ids: [] });
|
|
2133
|
+
* ```
|
|
2134
|
+
*/
|
|
2135
|
+
public static fromJson(value: unknown, path?: string): WorkItemsQuery;
|
|
2136
|
+
|
|
2137
|
+
/**
|
|
2138
|
+
* Writes the query as JSON: `host`, `organization`, `project`, `scope` and `ids`.
|
|
2139
|
+
*
|
|
2140
|
+
* @returns The JSON.
|
|
2141
|
+
* @example
|
|
2142
|
+
* ```ts
|
|
2143
|
+
* import { WorkItemScope, WorkItemsQuery } from "@noldova/git.hosting.protocol";
|
|
2144
|
+
*
|
|
2145
|
+
* console.log(new WorkItemsQuery("git-azure-devops", "fabrikam", "Web Site", WorkItemScope.Mine, []).toJson());
|
|
2146
|
+
* ```
|
|
2147
|
+
*/
|
|
2148
|
+
public toJson(): JsonObject;
|
|
2149
|
+
}
|
|
2150
|
+
|
|
2151
|
+
/**
|
|
2152
|
+
* A change to a work item on a host: a new state, an assignment to the signed-in person, or both.
|
|
2153
|
+
*
|
|
2154
|
+
* @example
|
|
2155
|
+
* ```ts
|
|
2156
|
+
* import { WorkItemUpdate } from "@noldova/git.hosting.protocol";
|
|
2157
|
+
*
|
|
2158
|
+
* const update = new WorkItemUpdate("git-azure-devops", "fabrikam", 42, "Active", true);
|
|
2159
|
+
* console.log(update.toJson());
|
|
2160
|
+
* ```
|
|
2161
|
+
*/
|
|
2162
|
+
export declare class WorkItemUpdate {
|
|
2163
|
+
/**
|
|
2164
|
+
* The host module's id, such as `git-azure-devops`.
|
|
2165
|
+
*/
|
|
2166
|
+
public readonly host: string;
|
|
2167
|
+
|
|
2168
|
+
/**
|
|
2169
|
+
* The organization the work item is in, such as `fabrikam`.
|
|
2170
|
+
*/
|
|
2171
|
+
public readonly organization: string;
|
|
2172
|
+
|
|
2173
|
+
/**
|
|
2174
|
+
* The work item's id, unique in the organization.
|
|
2175
|
+
*/
|
|
2176
|
+
public readonly id: number;
|
|
2177
|
+
|
|
2178
|
+
/**
|
|
2179
|
+
* The state to move the work item to, as its process names it, such as `Active`, or null to leave it.
|
|
2180
|
+
*/
|
|
2181
|
+
public readonly state: string | null;
|
|
2182
|
+
|
|
2183
|
+
/**
|
|
2184
|
+
* Whether to assign the work item to the signed-in person.
|
|
2185
|
+
*/
|
|
2186
|
+
public readonly assignToMe: boolean;
|
|
2187
|
+
|
|
2188
|
+
/**
|
|
2189
|
+
* Makes an update from its parts.
|
|
2190
|
+
*
|
|
2191
|
+
* @param host The host module's id: letters, digits, `.`, `_` and `-`, other than `.` and `..`.
|
|
2192
|
+
* @param organization The organization: letters, digits, `.`, `_` and `-`, other than `.` and `..`.
|
|
2193
|
+
* @param id The work item's id, a whole number above zero.
|
|
2194
|
+
* @param state The new state, a text that isn't blank, or null to leave it; null needs `assignToMe`.
|
|
2195
|
+
* @param assignToMe Whether to assign the work item to the signed-in person.
|
|
2196
|
+
* @param reader The reader the values came from, so an error names the field by its path; omitted for values that didn't come from JSON.
|
|
2197
|
+
* @throws {HostingArgumentException} Without a reader, when a part is out of its range or the update changes nothing, naming the field as the
|
|
2198
|
+
* parameter, such as `state`.
|
|
2199
|
+
* @throws {HostingFieldException} With a reader, when a part is out of its range or the update changes nothing, naming the field by its path,
|
|
2200
|
+
* such as `$.state`.
|
|
2201
|
+
* @example
|
|
2202
|
+
* ```ts
|
|
2203
|
+
* import { WorkItemUpdate } from "@noldova/git.hosting.protocol";
|
|
2204
|
+
*
|
|
2205
|
+
* const update = new WorkItemUpdate("git-azure-devops", "fabrikam", 42, null, true);
|
|
2206
|
+
* ```
|
|
2207
|
+
*/
|
|
2208
|
+
public constructor(host: string, organization: string, id: number, state: string | null, assignToMe: boolean, reader?: JsonReader);
|
|
2209
|
+
|
|
2210
|
+
/**
|
|
2211
|
+
* Reads an update from its JSON.
|
|
2212
|
+
*
|
|
2213
|
+
* @param value The JSON, with exactly the fields `toJson` writes.
|
|
2214
|
+
* @param path The JSON's path, `$` by default.
|
|
2215
|
+
* @returns The update.
|
|
2216
|
+
* @throws {JsonException} When the value isn't an object, or a field is missing or of the wrong type; it comes from `@noldova/context.json`.
|
|
2217
|
+
* @throws {HostingFieldException} When the value holds an unknown field, a field is out of its range or the update changes nothing.
|
|
2218
|
+
* @example
|
|
2219
|
+
* ```ts
|
|
2220
|
+
* import { WorkItemUpdate } from "@noldova/git.hosting.protocol";
|
|
2221
|
+
*
|
|
2222
|
+
* const update = WorkItemUpdate.fromJson({ host: "git-azure-devops", organization: "fabrikam", id: 42, state: "Active", assignToMe: false });
|
|
2223
|
+
* ```
|
|
2224
|
+
*/
|
|
2225
|
+
public static fromJson(value: unknown, path?: string): WorkItemUpdate;
|
|
2226
|
+
|
|
2227
|
+
/**
|
|
2228
|
+
* Writes the update as JSON: `host`, `organization`, `id`, `state` and `assignToMe`.
|
|
2229
|
+
*
|
|
2230
|
+
* @returns The JSON.
|
|
2231
|
+
* @example
|
|
2232
|
+
* ```ts
|
|
2233
|
+
* import { WorkItemUpdate } from "@noldova/git.hosting.protocol";
|
|
2234
|
+
*
|
|
2235
|
+
* console.log(new WorkItemUpdate("git-azure-devops", "fabrikam", 42, "Active", true).toJson());
|
|
2236
|
+
* ```
|
|
2237
|
+
*/
|
|
2238
|
+
public toJson(): JsonObject;
|
|
2239
|
+
}
|
|
2240
|
+
|
|
2241
|
+
/**
|
|
2242
|
+
* The work items a `WorkItemsQuery` answers, and whether its search stopped at the host's limit.
|
|
2243
|
+
*
|
|
2244
|
+
* @example
|
|
2245
|
+
* ```ts
|
|
2246
|
+
* import type { HostWorkItemList } from "@noldova/git.hosting.protocol";
|
|
2247
|
+
*
|
|
2248
|
+
* const countOf = (list: HostWorkItemList): string => `${list.items.length}${list.isTruncated ? "+" : ""}`;
|
|
2249
|
+
* ```
|
|
2250
|
+
*/
|
|
2251
|
+
export declare class HostWorkItemList {
|
|
2252
|
+
/**
|
|
2253
|
+
* The work items, each parent before its children, the ancestors the host adds to them included.
|
|
2254
|
+
*/
|
|
2255
|
+
public readonly items: readonly HostWorkItemDetail[];
|
|
2256
|
+
|
|
2257
|
+
/**
|
|
2258
|
+
* Whether the query's search found as many work items as the host reads at most, so there may be more; the ancestors added afterwards don't count.
|
|
2259
|
+
*/
|
|
2260
|
+
public readonly isTruncated: boolean;
|
|
2261
|
+
|
|
2262
|
+
/**
|
|
2263
|
+
* Makes a list from its parts.
|
|
2264
|
+
*
|
|
2265
|
+
* @param items The work items.
|
|
2266
|
+
* @param isTruncated Whether the search stopped at the host's limit.
|
|
2267
|
+
* @example
|
|
2268
|
+
* ```ts
|
|
2269
|
+
* import { HostWorkItemList } from "@noldova/git.hosting.protocol";
|
|
2270
|
+
*
|
|
2271
|
+
* const empty = new HostWorkItemList([], false);
|
|
2272
|
+
* ```
|
|
2273
|
+
*/
|
|
2274
|
+
public constructor(items: readonly HostWorkItemDetail[], isTruncated: boolean);
|
|
2275
|
+
|
|
2276
|
+
/**
|
|
2277
|
+
* Reads a list from its JSON.
|
|
2278
|
+
*
|
|
2279
|
+
* @param value The JSON, with exactly the fields `toJson` writes.
|
|
2280
|
+
* @param path The JSON's path, `$` by default.
|
|
2281
|
+
* @returns The list.
|
|
2282
|
+
* @throws {JsonException} When the value isn't an object, or a field is missing or of the wrong type; it comes from `@noldova/context.json`.
|
|
2283
|
+
* @throws {HostingFieldException} When the value holds an unknown field, or an item is out of its range.
|
|
2284
|
+
* @example
|
|
2285
|
+
* ```ts
|
|
2286
|
+
* import { HostWorkItemList } from "@noldova/git.hosting.protocol";
|
|
2287
|
+
*
|
|
2288
|
+
* const list = HostWorkItemList.fromJson({ items: [], isTruncated: false });
|
|
2289
|
+
* ```
|
|
2290
|
+
*/
|
|
2291
|
+
public static fromJson(value: unknown, path?: string): HostWorkItemList;
|
|
2292
|
+
|
|
2293
|
+
/**
|
|
2294
|
+
* Writes the list as JSON: `items` and `isTruncated`.
|
|
2295
|
+
*
|
|
2296
|
+
* @returns The JSON.
|
|
2297
|
+
* @example
|
|
2298
|
+
* ```ts
|
|
2299
|
+
* import { HostWorkItemList } from "@noldova/git.hosting.protocol";
|
|
2300
|
+
*
|
|
2301
|
+
* console.log(new HostWorkItemList([], true).toJson());
|
|
2302
|
+
* ```
|
|
2303
|
+
*/
|
|
2304
|
+
public toJson(): JsonObject;
|
|
2305
|
+
}
|
|
2306
|
+
|
|
2307
|
+
/**
|
|
2308
|
+
* A work item with what plans and tracks it: its points, its hours of work left and done, its order in the backlog, its acceptance criteria, its
|
|
2309
|
+
* children, the pull requests, commits and branches linked to it, and whether one of those pull requests waits on review.
|
|
2310
|
+
*
|
|
2311
|
+
* @example
|
|
2312
|
+
* ```ts
|
|
2313
|
+
* import { HostWorkItemDetail } from "@noldova/git.hosting.protocol";
|
|
2314
|
+
*
|
|
2315
|
+
* declare const item: import("@noldova/git.hosting.protocol").HostWorkItem;
|
|
2316
|
+
* const detail = new HostWorkItemDetail(item, 5, null, null, 1000, "Readers see a due date.", [7530, 7531], [], 5, ["users/kim/7521-export-notes"]);
|
|
2317
|
+
* console.log(detail.toJson());
|
|
2318
|
+
* ```
|
|
2319
|
+
*/
|
|
2320
|
+
export declare class HostWorkItemDetail {
|
|
2321
|
+
/**
|
|
2322
|
+
* The work item.
|
|
2323
|
+
*/
|
|
2324
|
+
public readonly item: HostWorkItem;
|
|
2325
|
+
|
|
2326
|
+
/**
|
|
2327
|
+
* The work item's story points or effort, or null when it has none.
|
|
2328
|
+
*/
|
|
2329
|
+
public readonly points: number | null;
|
|
2330
|
+
|
|
2331
|
+
/**
|
|
2332
|
+
* The hours of work left, or null when the host records none.
|
|
2333
|
+
*/
|
|
2334
|
+
public readonly remaining: number | null;
|
|
2335
|
+
|
|
2336
|
+
/**
|
|
2337
|
+
* The hours of work done, or null when the host records none.
|
|
2338
|
+
*/
|
|
2339
|
+
public readonly completed: number | null;
|
|
2340
|
+
|
|
2341
|
+
/**
|
|
2342
|
+
* The work item's place in its backlog, lower first, or null when it has none.
|
|
2343
|
+
*/
|
|
2344
|
+
public readonly order: number | null;
|
|
2345
|
+
|
|
2346
|
+
/**
|
|
2347
|
+
* The acceptance criteria as plain text, or null when it has none.
|
|
2348
|
+
*/
|
|
2349
|
+
public readonly acceptance: string | null;
|
|
2350
|
+
|
|
2351
|
+
/**
|
|
2352
|
+
* The ids of the work item's children, in the host's order.
|
|
2353
|
+
*/
|
|
2354
|
+
public readonly children: readonly number[];
|
|
2355
|
+
|
|
2356
|
+
/**
|
|
2357
|
+
* The pull requests linked to the work item.
|
|
2358
|
+
*/
|
|
2359
|
+
public readonly pullRequests: readonly HostReference[];
|
|
2360
|
+
|
|
2361
|
+
/**
|
|
2362
|
+
* How many commits are linked to the work item.
|
|
2363
|
+
*/
|
|
2364
|
+
public readonly commits: number;
|
|
2365
|
+
|
|
2366
|
+
/**
|
|
2367
|
+
* The names of the branches linked to the work item.
|
|
2368
|
+
*/
|
|
2369
|
+
public readonly branches: readonly string[];
|
|
2370
|
+
|
|
2371
|
+
/**
|
|
2372
|
+
* Whether one of the linked pull requests waits on review: it is active, and a reviewer voted to wait for its author or a required reviewer
|
|
2373
|
+
* hasn't approved it. False when none waits, a completed or abandoned pull request never waiting; null when that isn't known, such as when
|
|
2374
|
+
* the read didn't list the pull requests, or for a work item read alone. A host that knows it lists the waiting pull requests first.
|
|
2375
|
+
*/
|
|
2376
|
+
public readonly isWaiting: boolean | null;
|
|
2377
|
+
|
|
2378
|
+
/**
|
|
2379
|
+
* Makes a work item's detail from its parts.
|
|
2380
|
+
*
|
|
2381
|
+
* @param item The work item.
|
|
2382
|
+
* @param points The points, a number zero or more, or null.
|
|
2383
|
+
* @param remaining The hours left, a number zero or more, or null.
|
|
2384
|
+
* @param completed The hours done, a number zero or more, or null.
|
|
2385
|
+
* @param order The backlog order, a number, or null.
|
|
2386
|
+
* @param acceptance The acceptance criteria, a text that isn't blank, or null.
|
|
2387
|
+
* @param children The children's ids, whole numbers above zero, each once and none the work item itself.
|
|
2388
|
+
* @param pullRequests The linked pull requests.
|
|
2389
|
+
* @param commits How many commits are linked, a whole number, zero or more.
|
|
2390
|
+
* @param branches The linked branches' names, texts that aren't blank.
|
|
2391
|
+
* @param isWaiting Whether a linked pull request waits on review, or null, the default, when that isn't known.
|
|
2392
|
+
* @param reader The reader the values came from, so an error names the field by its path; omitted for values that didn't come from JSON.
|
|
2393
|
+
* @throws {HostingArgumentException} Without a reader, when a part is out of its range, naming the field as the parameter, such as `children`.
|
|
2394
|
+
* @throws {HostingFieldException} With a reader, when a part is out of its range, naming the field by its path, such as `$.children`.
|
|
2395
|
+
* @example
|
|
2396
|
+
* ```ts
|
|
2397
|
+
* import { HostWorkItemDetail } from "@noldova/git.hosting.protocol";
|
|
2398
|
+
*
|
|
2399
|
+
* declare const item: import("@noldova/git.hosting.protocol").HostWorkItem;
|
|
2400
|
+
* const detail = new HostWorkItemDetail(item, null, 4, 2, null, null, [], [], 0, []);
|
|
2401
|
+
* ```
|
|
2402
|
+
*/
|
|
2403
|
+
public constructor(item: HostWorkItem, points: number | null, remaining: number | null, completed: number | null, order: number | null,
|
|
2404
|
+
acceptance: string | null, children: readonly number[], pullRequests: readonly HostReference[], commits: number, branches: readonly string[],
|
|
2405
|
+
isWaiting?: boolean | null, reader?: JsonReader);
|
|
2406
|
+
|
|
2407
|
+
/**
|
|
2408
|
+
* Reads a work item's detail from its JSON.
|
|
2409
|
+
*
|
|
2410
|
+
* @param value The JSON, with exactly the fields `toJson` writes.
|
|
2411
|
+
* @param path The JSON's path, `$` by default.
|
|
2412
|
+
* @returns The detail.
|
|
2413
|
+
* @throws {JsonException} When the value isn't an object, or a field is missing or of the wrong type; it comes from `@noldova/context.json`.
|
|
2414
|
+
* @throws {HostingFieldException} When the value holds an unknown field or a field is out of its range.
|
|
2415
|
+
* @example
|
|
2416
|
+
* ```ts
|
|
2417
|
+
* import { HostWorkItemDetail } from "@noldova/git.hosting.protocol";
|
|
2418
|
+
*
|
|
2419
|
+
* declare const json: unknown;
|
|
2420
|
+
* const detail = HostWorkItemDetail.fromJson(json);
|
|
2421
|
+
* ```
|
|
2422
|
+
*/
|
|
2423
|
+
public static fromJson(value: unknown, path?: string): HostWorkItemDetail;
|
|
2424
|
+
|
|
2425
|
+
/**
|
|
2426
|
+
* Writes the detail as JSON: `item`, `points`, `remaining`, `completed`, `order`, `acceptance`, `children`, `pullRequests`, `commits`,
|
|
2427
|
+
* `branches` and `isWaiting`.
|
|
2428
|
+
*
|
|
2429
|
+
* @returns The JSON.
|
|
2430
|
+
* @example
|
|
2431
|
+
* ```ts
|
|
2432
|
+
* import { HostWorkItemDetail } from "@noldova/git.hosting.protocol";
|
|
2433
|
+
*
|
|
2434
|
+
* declare const detail: HostWorkItemDetail;
|
|
2435
|
+
* console.log(detail.toJson());
|
|
2436
|
+
* ```
|
|
2437
|
+
*/
|
|
2438
|
+
public toJson(): JsonObject;
|
|
2439
|
+
}
|
|
2440
|
+
|
|
2441
|
+
/**
|
|
2442
|
+
* What a host module can do, so a window shows only that.
|
|
2443
|
+
*
|
|
2444
|
+
* @example
|
|
2445
|
+
* ```ts
|
|
2446
|
+
* import { HostCapability } from "@noldova/git.hosting.protocol";
|
|
2447
|
+
*
|
|
2448
|
+
* console.log(HostCapability.Votes);
|
|
2449
|
+
* ```
|
|
2450
|
+
*/
|
|
2451
|
+
export declare const HostCapability: {
|
|
2452
|
+
/**
|
|
2453
|
+
* The person signs in to the host.
|
|
2454
|
+
*/
|
|
2455
|
+
readonly SignIn: "SignIn";
|
|
2456
|
+
|
|
2457
|
+
/**
|
|
2458
|
+
* The module reads an issue, a work item or a pull request by its reference.
|
|
2459
|
+
*/
|
|
2460
|
+
readonly ReadItem: "ReadItem";
|
|
2461
|
+
|
|
2462
|
+
/**
|
|
2463
|
+
* The module reads a branch's pull request.
|
|
2464
|
+
*/
|
|
2465
|
+
readonly BranchPullRequest: "BranchPullRequest";
|
|
2466
|
+
|
|
2467
|
+
/**
|
|
2468
|
+
* The person opens a pull request.
|
|
2469
|
+
*/
|
|
2470
|
+
readonly CreatePullRequest: "CreatePullRequest";
|
|
2471
|
+
|
|
2472
|
+
/**
|
|
2473
|
+
* A pull request shows the checks on its head commit.
|
|
2474
|
+
*/
|
|
2475
|
+
readonly Checks: "Checks";
|
|
2476
|
+
|
|
2477
|
+
/**
|
|
2478
|
+
* A pull request's reviewers vote.
|
|
2479
|
+
*/
|
|
2480
|
+
readonly Votes: "Votes";
|
|
2481
|
+
|
|
2482
|
+
/**
|
|
2483
|
+
* A pull request's branch policies hold it until they pass.
|
|
2484
|
+
*/
|
|
2485
|
+
readonly Policies: "Policies";
|
|
2486
|
+
|
|
2487
|
+
/**
|
|
2488
|
+
* A pull request shows the builds that ran for it.
|
|
2489
|
+
*/
|
|
2490
|
+
readonly Builds: "Builds";
|
|
2491
|
+
|
|
2492
|
+
/**
|
|
2493
|
+
* A pull request completes on its own once its policies pass.
|
|
2494
|
+
*/
|
|
2495
|
+
readonly AutoComplete: "AutoComplete";
|
|
2496
|
+
|
|
2497
|
+
/**
|
|
2498
|
+
* The host has work items with types, states, iterations and areas.
|
|
2499
|
+
*/
|
|
2500
|
+
readonly WorkItems: "WorkItems";
|
|
2501
|
+
|
|
2502
|
+
/**
|
|
2503
|
+
* The person makes a branch from a work item, linked to it.
|
|
2504
|
+
*/
|
|
2505
|
+
readonly BranchFromItem: "BranchFromItem";
|
|
2506
|
+
|
|
2507
|
+
/**
|
|
2508
|
+
* The host runs pipelines with stages and logs.
|
|
2509
|
+
*/
|
|
2510
|
+
readonly Pipelines: "Pipelines";
|
|
2511
|
+
|
|
2512
|
+
/**
|
|
2513
|
+
* The host shows commit authors' pictures.
|
|
2514
|
+
*/
|
|
2515
|
+
readonly AuthorAvatars: "AuthorAvatars";
|
|
2516
|
+
|
|
2517
|
+
/**
|
|
2518
|
+
* The host lists a repository's open pull requests.
|
|
2519
|
+
*/
|
|
2520
|
+
readonly PullRequests: "PullRequests";
|
|
2521
|
+
};
|
|
2522
|
+
|
|
2523
|
+
/**
|
|
2524
|
+
* The name of one of a host module's capabilities.
|
|
2525
|
+
*/
|
|
2526
|
+
export type HostCapability = (typeof HostCapability)[keyof typeof HostCapability];
|
|
2527
|
+
|
|
2528
|
+
/**
|
|
2529
|
+
* Where a pull request's branch policy stands.
|
|
2530
|
+
*
|
|
2531
|
+
* @example
|
|
2532
|
+
* ```ts
|
|
2533
|
+
* import { PolicyState } from "@noldova/git.hosting.protocol";
|
|
2534
|
+
*
|
|
2535
|
+
* console.log(PolicyState.Approved);
|
|
2536
|
+
* ```
|
|
2537
|
+
*/
|
|
2538
|
+
export declare const PolicyState: {
|
|
2539
|
+
/**
|
|
2540
|
+
* The policy waits to be checked.
|
|
2541
|
+
*/
|
|
2542
|
+
readonly Queued: "Queued";
|
|
2543
|
+
|
|
2544
|
+
/**
|
|
2545
|
+
* The policy is being checked, such as by a build.
|
|
2546
|
+
*/
|
|
2547
|
+
readonly Running: "Running";
|
|
2548
|
+
|
|
2549
|
+
/**
|
|
2550
|
+
* The policy passed.
|
|
2551
|
+
*/
|
|
2552
|
+
readonly Approved: "Approved";
|
|
2553
|
+
|
|
2554
|
+
/**
|
|
2555
|
+
* The policy failed.
|
|
2556
|
+
*/
|
|
2557
|
+
readonly Rejected: "Rejected";
|
|
2558
|
+
|
|
2559
|
+
/**
|
|
2560
|
+
* The policy doesn't apply to this pull request.
|
|
2561
|
+
*/
|
|
2562
|
+
readonly NotApplicable: "NotApplicable";
|
|
2563
|
+
};
|
|
2564
|
+
|
|
2565
|
+
/**
|
|
2566
|
+
* The name of a branch policy's state.
|
|
2567
|
+
*/
|
|
2568
|
+
export type PolicyState = (typeof PolicyState)[keyof typeof PolicyState];
|
|
2569
|
+
|
|
2570
|
+
/**
|
|
2571
|
+
* The category a work item's state belongs to, whatever the host's process names the state.
|
|
2572
|
+
*
|
|
2573
|
+
* @example
|
|
2574
|
+
* ```ts
|
|
2575
|
+
* import { WorkItemCategory } from "@noldova/git.hosting.protocol";
|
|
2576
|
+
*
|
|
2577
|
+
* console.log(WorkItemCategory.InProgress);
|
|
2578
|
+
* ```
|
|
2579
|
+
*/
|
|
2580
|
+
export declare const WorkItemCategory: {
|
|
2581
|
+
/**
|
|
2582
|
+
* The work is proposed and not started.
|
|
2583
|
+
*/
|
|
2584
|
+
readonly Proposed: "Proposed";
|
|
2585
|
+
|
|
2586
|
+
/**
|
|
2587
|
+
* The work is under way.
|
|
2588
|
+
*/
|
|
2589
|
+
readonly InProgress: "InProgress";
|
|
2590
|
+
|
|
2591
|
+
/**
|
|
2592
|
+
* The work is done and waits to be confirmed.
|
|
2593
|
+
*/
|
|
2594
|
+
readonly Resolved: "Resolved";
|
|
2595
|
+
|
|
2596
|
+
/**
|
|
2597
|
+
* The work is done.
|
|
2598
|
+
*/
|
|
2599
|
+
readonly Completed: "Completed";
|
|
2600
|
+
|
|
2601
|
+
/**
|
|
2602
|
+
* The work was dropped.
|
|
2603
|
+
*/
|
|
2604
|
+
readonly Removed: "Removed";
|
|
2605
|
+
};
|
|
2606
|
+
|
|
2607
|
+
/**
|
|
2608
|
+
* The name of a work item state's category.
|
|
2609
|
+
*/
|
|
2610
|
+
export type WorkItemCategory = (typeof WorkItemCategory)[keyof typeof WorkItemCategory];
|
|
2611
|
+
|
|
2612
|
+
/**
|
|
2613
|
+
* Which work items a `WorkItemsQuery` reads.
|
|
2614
|
+
*
|
|
2615
|
+
* @example
|
|
2616
|
+
* ```ts
|
|
2617
|
+
* import { WorkItemScope } from "@noldova/git.hosting.protocol";
|
|
2618
|
+
*
|
|
2619
|
+
* console.log(WorkItemScope.Mine);
|
|
2620
|
+
* ```
|
|
2621
|
+
*/
|
|
2622
|
+
export declare const WorkItemScope: {
|
|
2623
|
+
/**
|
|
2624
|
+
* The work items assigned to the signed-in person that aren't closed, with their ancestors, so the hierarchy reads.
|
|
2625
|
+
*/
|
|
2626
|
+
readonly Mine: "Mine";
|
|
2627
|
+
|
|
2628
|
+
/**
|
|
2629
|
+
* The work items with the query's ids.
|
|
2630
|
+
*/
|
|
2631
|
+
readonly Ids: "Ids";
|
|
2632
|
+
};
|
|
2633
|
+
|
|
2634
|
+
/**
|
|
2635
|
+
* The name of a work item scope.
|
|
2636
|
+
*/
|
|
2637
|
+
export type WorkItemScope = (typeof WorkItemScope)[keyof typeof WorkItemScope];
|
|
2638
|
+
|
|
2639
|
+
/**
|
|
2640
|
+
* Where a pull request's comment thread stands.
|
|
2641
|
+
*
|
|
2642
|
+
* @example
|
|
2643
|
+
* ```ts
|
|
2644
|
+
* import { ThreadStatus } from "@noldova/git.hosting.protocol";
|
|
2645
|
+
*
|
|
2646
|
+
* console.log(ThreadStatus.Resolved);
|
|
2647
|
+
* ```
|
|
2648
|
+
*/
|
|
2649
|
+
export declare const ThreadStatus: {
|
|
2650
|
+
/**
|
|
2651
|
+
* The thread waits for an answer or a change.
|
|
2652
|
+
*/
|
|
2653
|
+
readonly Active: "Active";
|
|
2654
|
+
|
|
2655
|
+
/**
|
|
2656
|
+
* The thread waits on something its author named.
|
|
2657
|
+
*/
|
|
2658
|
+
readonly Pending: "Pending";
|
|
2659
|
+
|
|
2660
|
+
/**
|
|
2661
|
+
* The thread's point was fixed.
|
|
2662
|
+
*/
|
|
2663
|
+
readonly Resolved: "Resolved";
|
|
2664
|
+
|
|
2665
|
+
/**
|
|
2666
|
+
* The thread's point won't be fixed.
|
|
2667
|
+
*/
|
|
2668
|
+
readonly WontFix: "WontFix";
|
|
2669
|
+
|
|
2670
|
+
/**
|
|
2671
|
+
* The thread's point is the intended behavior.
|
|
2672
|
+
*/
|
|
2673
|
+
readonly ByDesign: "ByDesign";
|
|
2674
|
+
|
|
2675
|
+
/**
|
|
2676
|
+
* The thread was closed with no outcome.
|
|
2677
|
+
*/
|
|
2678
|
+
readonly Closed: "Closed";
|
|
2679
|
+
|
|
2680
|
+
/**
|
|
2681
|
+
* The host keeps no state for the thread.
|
|
2682
|
+
*/
|
|
2683
|
+
readonly None: "None";
|
|
2684
|
+
};
|
|
2685
|
+
|
|
2686
|
+
/**
|
|
2687
|
+
* The name of a thread's state.
|
|
2688
|
+
*/
|
|
2689
|
+
export type ThreadStatus = (typeof ThreadStatus)[keyof typeof ThreadStatus];
|
|
2690
|
+
|
|
2691
|
+
/**
|
|
2692
|
+
* The capabilities a host module has, each at most once.
|
|
2693
|
+
*
|
|
2694
|
+
* @example
|
|
2695
|
+
* ```ts
|
|
2696
|
+
* import { HostCapabilities, HostCapability } from "@noldova/git.hosting.protocol";
|
|
2697
|
+
*
|
|
2698
|
+
* const capabilities = new HostCapabilities([HostCapability.SignIn, HostCapability.Votes]);
|
|
2699
|
+
* console.log(capabilities.has(HostCapability.Votes));
|
|
2700
|
+
* ```
|
|
2701
|
+
*/
|
|
2702
|
+
export declare class HostCapabilities {
|
|
2703
|
+
/**
|
|
2704
|
+
* The capabilities, in the order given.
|
|
2705
|
+
*/
|
|
2706
|
+
public readonly capabilities: readonly HostCapability[];
|
|
2707
|
+
|
|
2708
|
+
/**
|
|
2709
|
+
* Makes the capabilities from a list, which it copies.
|
|
2710
|
+
*
|
|
2711
|
+
* @param capabilities The capabilities, each at most once.
|
|
2712
|
+
* @param reader The reader the values came from, so an error names the field by its path; omitted for values that didn't come from JSON.
|
|
2713
|
+
* @throws {HostingArgumentException} Without a reader, when a capability is named twice, naming `capabilities`.
|
|
2714
|
+
* @throws {HostingFieldException} With a reader, when a capability is named twice, naming `$.capabilities`.
|
|
2715
|
+
* @example
|
|
2716
|
+
* ```ts
|
|
2717
|
+
* import { HostCapabilities, HostCapability } from "@noldova/git.hosting.protocol";
|
|
2718
|
+
*
|
|
2719
|
+
* const capabilities = new HostCapabilities([HostCapability.Builds]);
|
|
2720
|
+
* ```
|
|
2721
|
+
*/
|
|
2722
|
+
public constructor(capabilities: readonly HostCapability[], reader?: JsonReader);
|
|
2723
|
+
|
|
2724
|
+
/**
|
|
2725
|
+
* Tells whether the host has a capability.
|
|
2726
|
+
*
|
|
2727
|
+
* @param capability The capability.
|
|
2728
|
+
* @returns Whether the list holds it.
|
|
2729
|
+
* @example
|
|
2730
|
+
* ```ts
|
|
2731
|
+
* import { HostCapabilities, HostCapability } from "@noldova/git.hosting.protocol";
|
|
2732
|
+
*
|
|
2733
|
+
* console.log(new HostCapabilities([]).has(HostCapability.Pipelines));
|
|
2734
|
+
* ```
|
|
2735
|
+
*/
|
|
2736
|
+
public has(capability: HostCapability): boolean;
|
|
2737
|
+
|
|
2738
|
+
/**
|
|
2739
|
+
* Reads the capabilities from their JSON.
|
|
2740
|
+
*
|
|
2741
|
+
* @param value The JSON, with exactly the field `toJson` writes.
|
|
2742
|
+
* @param path The JSON's path, `$` by default.
|
|
2743
|
+
* @returns The capabilities.
|
|
2744
|
+
* @throws {JsonException} When the value isn't an object or `capabilities` isn't a list of texts; it comes from `@noldova/context.json`.
|
|
2745
|
+
* @throws {HostingFieldException} When the value holds an unknown field, or a capability is unknown or named twice.
|
|
2746
|
+
* @example
|
|
2747
|
+
* ```ts
|
|
2748
|
+
* import { HostCapabilities } from "@noldova/git.hosting.protocol";
|
|
2749
|
+
*
|
|
2750
|
+
* const capabilities = HostCapabilities.fromJson({ capabilities: ["SignIn"] });
|
|
2751
|
+
* ```
|
|
2752
|
+
*/
|
|
2753
|
+
public static fromJson(value: unknown, path?: string): HostCapabilities;
|
|
2754
|
+
|
|
2755
|
+
/**
|
|
2756
|
+
* Writes the capabilities as JSON: `capabilities`.
|
|
2757
|
+
*
|
|
2758
|
+
* @returns The JSON.
|
|
2759
|
+
* @example
|
|
2760
|
+
* ```ts
|
|
2761
|
+
* import { HostCapabilities, HostCapability } from "@noldova/git.hosting.protocol";
|
|
2762
|
+
*
|
|
2763
|
+
* console.log(new HostCapabilities([HostCapability.SignIn]).toJson());
|
|
2764
|
+
* ```
|
|
2765
|
+
*/
|
|
2766
|
+
public toJson(): JsonObject;
|
|
2767
|
+
}
|
|
2768
|
+
|
|
2769
|
+
/**
|
|
2770
|
+
* A pull request's reviewer and their vote.
|
|
2771
|
+
*
|
|
2772
|
+
* @example
|
|
2773
|
+
* ```ts
|
|
2774
|
+
* import { HostPerson, HostReviewer } from "@noldova/git.hosting.protocol";
|
|
2775
|
+
*
|
|
2776
|
+
* const reviewer = new HostReviewer(new HostPerson("monalisa", null, null), 1, "Approved", true);
|
|
2777
|
+
* console.log(reviewer.voteLabel);
|
|
2778
|
+
* ```
|
|
2779
|
+
*/
|
|
2780
|
+
export declare class HostReviewer {
|
|
2781
|
+
/**
|
|
2782
|
+
* The reviewer.
|
|
2783
|
+
*/
|
|
2784
|
+
public readonly person: HostPerson;
|
|
2785
|
+
|
|
2786
|
+
/**
|
|
2787
|
+
* The vote from -1, rejected, through 0, no vote, to 1, approved; a host with more steps places them between.
|
|
2788
|
+
*/
|
|
2789
|
+
public readonly vote: number;
|
|
2790
|
+
|
|
2791
|
+
/**
|
|
2792
|
+
* The vote in the host's own words.
|
|
2793
|
+
*/
|
|
2794
|
+
public readonly voteLabel: string;
|
|
2795
|
+
|
|
2796
|
+
/**
|
|
2797
|
+
* Whether the pull request needs this reviewer.
|
|
2798
|
+
*/
|
|
2799
|
+
public readonly isRequired: boolean;
|
|
2800
|
+
|
|
2801
|
+
/**
|
|
2802
|
+
* Makes a reviewer from its parts.
|
|
2803
|
+
*
|
|
2804
|
+
* @param person The reviewer.
|
|
2805
|
+
* @param vote The vote, from -1 to 1.
|
|
2806
|
+
* @param voteLabel The vote in the host's words, which isn't blank.
|
|
2807
|
+
* @param isRequired Whether the pull request needs the reviewer.
|
|
2808
|
+
* @param reader The reader the values came from, so an error names the field by its path; omitted for values that didn't come from JSON.
|
|
2809
|
+
* @throws {HostingArgumentException} Without a reader, when a part is out of its range, naming the field as the parameter, such as `vote`.
|
|
2810
|
+
* @throws {HostingFieldException} With a reader, when a part is out of its range, naming the field by its path, such as `$.vote`.
|
|
2811
|
+
* @example
|
|
2812
|
+
* ```ts
|
|
2813
|
+
* import { HostPerson, HostReviewer } from "@noldova/git.hosting.protocol";
|
|
2814
|
+
*
|
|
2815
|
+
* const reviewer = new HostReviewer(new HostPerson("octocat", null, null), 0.5, "Approved with suggestions", false);
|
|
2816
|
+
* ```
|
|
2817
|
+
*/
|
|
2818
|
+
public constructor(person: HostPerson, vote: number, voteLabel: string, isRequired: boolean, reader?: JsonReader);
|
|
2819
|
+
|
|
2820
|
+
/**
|
|
2821
|
+
* Reads a reviewer from its JSON.
|
|
2822
|
+
*
|
|
2823
|
+
* @param value The JSON, with exactly the fields `toJson` writes.
|
|
2824
|
+
* @param path The JSON's path, `$` by default.
|
|
2825
|
+
* @returns The reviewer.
|
|
2826
|
+
* @throws {JsonException} When the value isn't an object, or a field is missing or of the wrong type; it comes from `@noldova/context.json`.
|
|
2827
|
+
* @throws {HostingFieldException} When the value holds an unknown field, or a field is out of its range.
|
|
2828
|
+
* @example
|
|
2829
|
+
* ```ts
|
|
2830
|
+
* import { HostReviewer } from "@noldova/git.hosting.protocol";
|
|
2831
|
+
*
|
|
2832
|
+
* const reviewer = HostReviewer.fromJson({ person: { login: "monalisa", avatar: null, url: null }, vote: 0, voteLabel: "No vote", isRequired: false });
|
|
2833
|
+
* ```
|
|
2834
|
+
*/
|
|
2835
|
+
public static fromJson(value: unknown, path?: string): HostReviewer;
|
|
2836
|
+
|
|
2837
|
+
/**
|
|
2838
|
+
* Writes the reviewer as JSON: `person`, `vote`, `voteLabel` and `isRequired`.
|
|
2839
|
+
*
|
|
2840
|
+
* @returns The JSON.
|
|
2841
|
+
* @example
|
|
2842
|
+
* ```ts
|
|
2843
|
+
* import { HostPerson, HostReviewer } from "@noldova/git.hosting.protocol";
|
|
2844
|
+
*
|
|
2845
|
+
* console.log(new HostReviewer(new HostPerson("monalisa", null, null), -1, "Rejected", false).toJson());
|
|
2846
|
+
* ```
|
|
2847
|
+
*/
|
|
2848
|
+
public toJson(): JsonObject;
|
|
2849
|
+
}
|
|
2850
|
+
|
|
2851
|
+
/**
|
|
2852
|
+
* A branch policy on a pull request: its name, where it stands and whether it holds the pull request.
|
|
2853
|
+
*
|
|
2854
|
+
* @example
|
|
2855
|
+
* ```ts
|
|
2856
|
+
* import { HostPolicy, PolicyState } from "@noldova/git.hosting.protocol";
|
|
2857
|
+
*
|
|
2858
|
+
* const policy = new HostPolicy("Minimum number of reviewers", PolicyState.Approved, true, null);
|
|
2859
|
+
* console.log(policy.state);
|
|
2860
|
+
* ```
|
|
2861
|
+
*/
|
|
2862
|
+
export declare class HostPolicy {
|
|
2863
|
+
/**
|
|
2864
|
+
* The policy's name on the host.
|
|
2865
|
+
*/
|
|
2866
|
+
public readonly name: string;
|
|
2867
|
+
|
|
2868
|
+
/**
|
|
2869
|
+
* Where the policy stands.
|
|
2870
|
+
*/
|
|
2871
|
+
public readonly state: PolicyState;
|
|
2872
|
+
|
|
2873
|
+
/**
|
|
2874
|
+
* Whether the pull request can't complete until the policy passes.
|
|
2875
|
+
*/
|
|
2876
|
+
public readonly isBlocking: boolean;
|
|
2877
|
+
|
|
2878
|
+
/**
|
|
2879
|
+
* The https address of the policy's page on the host, or null when it has none.
|
|
2880
|
+
*/
|
|
2881
|
+
public readonly url: string | null;
|
|
2882
|
+
|
|
2883
|
+
/**
|
|
2884
|
+
* For a build policy, the number of the build it ran, such as "20261121.4"; null for another policy, or when the host doesn't give it.
|
|
2885
|
+
*/
|
|
2886
|
+
public readonly buildNumber: string | null;
|
|
2887
|
+
|
|
2888
|
+
/**
|
|
2889
|
+
* Makes a policy from its parts.
|
|
2890
|
+
*
|
|
2891
|
+
* @param name The name, which isn't blank.
|
|
2892
|
+
* @param state Where it stands.
|
|
2893
|
+
* @param isBlocking Whether it holds the pull request.
|
|
2894
|
+
* @param url The page's https address, with no user name or password, or null.
|
|
2895
|
+
* @param buildNumber The number of the build a build policy ran, which isn't blank; null, by default, for another policy or when the host doesn't give it.
|
|
2896
|
+
* @param reader The reader the values came from, so an error names the field by its path; omitted for values that didn't come from JSON.
|
|
2897
|
+
* @throws {HostingArgumentException} Without a reader, when a part is out of its range, naming the field as the parameter, such as `url`.
|
|
2898
|
+
* @throws {HostingFieldException} With a reader, when a part is out of its range, naming the field by its path, such as `$.url`.
|
|
2899
|
+
* @example
|
|
2900
|
+
* ```ts
|
|
2901
|
+
* import { HostPolicy, PolicyState } from "@noldova/git.hosting.protocol";
|
|
2902
|
+
*
|
|
2903
|
+
* const policy = new HostPolicy("Build", PolicyState.Running, true, null);
|
|
2904
|
+
* ```
|
|
2905
|
+
*/
|
|
2906
|
+
public constructor(name: string, state: PolicyState, isBlocking: boolean, url: string | null, buildNumber?: string | null, reader?: JsonReader);
|
|
2907
|
+
|
|
2908
|
+
/**
|
|
2909
|
+
* Reads a policy from its JSON.
|
|
2910
|
+
*
|
|
2911
|
+
* @param value The JSON, with exactly the fields `toJson` writes; without `buildNumber`, it reads as null.
|
|
2912
|
+
* @param path The JSON's path, `$` by default.
|
|
2913
|
+
* @returns The policy.
|
|
2914
|
+
* @throws {JsonException} When the value isn't an object, a field is missing or of the wrong type, or the state isn't one of its names; it
|
|
2915
|
+
* comes from `@noldova/context.json`.
|
|
2916
|
+
* @throws {HostingFieldException} When the value holds an unknown field, or a field is out of its range.
|
|
2917
|
+
* @example
|
|
2918
|
+
* ```ts
|
|
2919
|
+
* import { HostPolicy } from "@noldova/git.hosting.protocol";
|
|
2920
|
+
*
|
|
2921
|
+
* const policy = HostPolicy.fromJson({ name: "Build", state: "Queued", isBlocking: true, url: null });
|
|
2922
|
+
* ```
|
|
2923
|
+
*/
|
|
2924
|
+
public static fromJson(value: unknown, path?: string): HostPolicy;
|
|
2925
|
+
|
|
2926
|
+
/**
|
|
2927
|
+
* Writes the policy as JSON: `name`, `state`, `isBlocking`, `url` and `buildNumber`.
|
|
2928
|
+
*
|
|
2929
|
+
* @returns The JSON.
|
|
2930
|
+
* @example
|
|
2931
|
+
* ```ts
|
|
2932
|
+
* import { HostPolicy, PolicyState } from "@noldova/git.hosting.protocol";
|
|
2933
|
+
*
|
|
2934
|
+
* console.log(new HostPolicy("Build", PolicyState.Rejected, true, null).toJson());
|
|
2935
|
+
* ```
|
|
2936
|
+
*/
|
|
2937
|
+
public toJson(): JsonObject;
|
|
2938
|
+
}
|
|
2939
|
+
|
|
2940
|
+
/**
|
|
2941
|
+
* A build that ran for a pull request or a commit: its name, where it stands, its page and its times.
|
|
2942
|
+
*
|
|
2943
|
+
* @example
|
|
2944
|
+
* ```ts
|
|
2945
|
+
* import { CheckState, HostBuild } from "@noldova/git.hosting.protocol";
|
|
2946
|
+
*
|
|
2947
|
+
* const build = new HostBuild("web-ci", CheckState.Running, null, 1_800_000_000_000, null);
|
|
2948
|
+
* console.log(build.state);
|
|
2949
|
+
* ```
|
|
2950
|
+
*/
|
|
2951
|
+
export declare class HostBuild {
|
|
2952
|
+
/**
|
|
2953
|
+
* The build's name on the host, such as its pipeline's.
|
|
2954
|
+
*/
|
|
2955
|
+
public readonly name: string;
|
|
2956
|
+
|
|
2957
|
+
/**
|
|
2958
|
+
* Where the build stands.
|
|
2959
|
+
*/
|
|
2960
|
+
public readonly state: CheckState;
|
|
2961
|
+
|
|
2962
|
+
/**
|
|
2963
|
+
* The https address of the build's page on the host, or null when it has none.
|
|
2964
|
+
*/
|
|
2965
|
+
public readonly url: string | null;
|
|
2966
|
+
|
|
2967
|
+
/**
|
|
2968
|
+
* When the build started, in milliseconds since 1970 UTC, or null when it hasn't.
|
|
2969
|
+
*/
|
|
2970
|
+
public readonly startedAt: number | null;
|
|
2971
|
+
|
|
2972
|
+
/**
|
|
2973
|
+
* When the build finished, in milliseconds since 1970 UTC, exactly when it succeeded, failed or ended neutral.
|
|
2974
|
+
*/
|
|
2975
|
+
public readonly finishedAt: number | null;
|
|
2976
|
+
|
|
2977
|
+
/**
|
|
2978
|
+
* The build's number on the host, such as "20261121.4", or null when the host doesn't give one.
|
|
2979
|
+
*/
|
|
2980
|
+
public readonly number: string | null;
|
|
2981
|
+
|
|
2982
|
+
/**
|
|
2983
|
+
* Makes a build from its parts.
|
|
2984
|
+
*
|
|
2985
|
+
* @param name The name, which isn't blank.
|
|
2986
|
+
* @param state Where it stands.
|
|
2987
|
+
* @param url The page's https address, with no user name or password, or null.
|
|
2988
|
+
* @param startedAt When it started, above zero, or null.
|
|
2989
|
+
* @param finishedAt When it finished, above zero and no earlier than its start, exactly when the state is `Succeeded`, `Failed` or `Neutral`.
|
|
2990
|
+
* @param number The build's number, which isn't blank; null, by default, when the host doesn't give one.
|
|
2991
|
+
* @param reader The reader the values came from, so an error names the field by its path; omitted for values that didn't come from JSON.
|
|
2992
|
+
* @throws {HostingArgumentException} Without a reader, when a part is out of its range, naming the field as the parameter, such as `finishedAt`.
|
|
2993
|
+
* @throws {HostingFieldException} With a reader, when a part is out of its range, naming the field by its path, such as `$.finishedAt`.
|
|
2994
|
+
* @example
|
|
2995
|
+
* ```ts
|
|
2996
|
+
* import { CheckState, HostBuild } from "@noldova/git.hosting.protocol";
|
|
2997
|
+
*
|
|
2998
|
+
* const build = new HostBuild("web-ci", CheckState.Succeeded, null, 1_800_000_000_000, 1_800_000_060_000);
|
|
2999
|
+
* ```
|
|
3000
|
+
*/
|
|
3001
|
+
public constructor(name: string, state: CheckState, url: string | null, startedAt: number | null, finishedAt: number | null, number?: string | null,
|
|
3002
|
+
reader?: JsonReader);
|
|
3003
|
+
|
|
3004
|
+
/**
|
|
3005
|
+
* Reads a build from its JSON.
|
|
3006
|
+
*
|
|
3007
|
+
* @param value The JSON, with exactly the fields `toJson` writes; without `number`, it reads as null.
|
|
3008
|
+
* @param path The JSON's path, `$` by default.
|
|
3009
|
+
* @returns The build.
|
|
3010
|
+
* @throws {JsonException} When the value isn't an object, a field is missing or of the wrong type, or the state isn't one of its names; it
|
|
3011
|
+
* comes from `@noldova/context.json`.
|
|
3012
|
+
* @throws {HostingFieldException} When the value holds an unknown field, or a field is out of its range.
|
|
3013
|
+
* @example
|
|
3014
|
+
* ```ts
|
|
3015
|
+
* import { HostBuild } from "@noldova/git.hosting.protocol";
|
|
3016
|
+
*
|
|
3017
|
+
* const build = HostBuild.fromJson({ name: "web-ci", state: "Queued", url: null, startedAt: null, finishedAt: null });
|
|
3018
|
+
* ```
|
|
3019
|
+
*/
|
|
3020
|
+
public static fromJson(value: unknown, path?: string): HostBuild;
|
|
3021
|
+
|
|
3022
|
+
/**
|
|
3023
|
+
* Writes the build as JSON: `name`, `state`, `url`, `startedAt`, `finishedAt` and `number`.
|
|
3024
|
+
*
|
|
3025
|
+
* @returns The JSON.
|
|
3026
|
+
* @example
|
|
3027
|
+
* ```ts
|
|
3028
|
+
* import { CheckState, HostBuild } from "@noldova/git.hosting.protocol";
|
|
3029
|
+
*
|
|
3030
|
+
* console.log(new HostBuild("web-ci", CheckState.Queued, null, null, null).toJson());
|
|
3031
|
+
* ```
|
|
3032
|
+
*/
|
|
3033
|
+
public toJson(): JsonObject;
|
|
3034
|
+
}
|
|
3035
|
+
|
|
3036
|
+
/**
|
|
3037
|
+
* A pull request with its reviewers and their votes, its branch policies and its builds.
|
|
3038
|
+
*
|
|
3039
|
+
* @example
|
|
3040
|
+
* ```ts
|
|
3041
|
+
* import { HostPullRequest } from "@noldova/git.hosting.protocol";
|
|
3042
|
+
*
|
|
3043
|
+
* declare const pullRequest: HostPullRequest;
|
|
3044
|
+
* console.log(pullRequest.reviewers.length);
|
|
3045
|
+
* ```
|
|
3046
|
+
*/
|
|
3047
|
+
export declare class HostPullRequest {
|
|
3048
|
+
/**
|
|
3049
|
+
* The pull request itself.
|
|
3050
|
+
*/
|
|
3051
|
+
public readonly item: HostItem;
|
|
3052
|
+
|
|
3053
|
+
/**
|
|
3054
|
+
* Its reviewers, in the host's order.
|
|
3055
|
+
*/
|
|
3056
|
+
public readonly reviewers: readonly HostReviewer[];
|
|
3057
|
+
|
|
3058
|
+
/**
|
|
3059
|
+
* Its branch policies, in the host's order.
|
|
3060
|
+
*/
|
|
3061
|
+
public readonly policies: readonly HostPolicy[];
|
|
3062
|
+
|
|
3063
|
+
/**
|
|
3064
|
+
* The builds that ran for it, in the host's order.
|
|
3065
|
+
*/
|
|
3066
|
+
public readonly builds: readonly HostBuild[];
|
|
3067
|
+
|
|
3068
|
+
/**
|
|
3069
|
+
* Whether it completes on its own once its policies pass.
|
|
3070
|
+
*/
|
|
3071
|
+
public readonly isAutoComplete: boolean;
|
|
3072
|
+
|
|
3073
|
+
/**
|
|
3074
|
+
* Its description as the author wrote it, in Markdown; empty when it has none.
|
|
3075
|
+
*/
|
|
3076
|
+
public readonly description: string;
|
|
3077
|
+
|
|
3078
|
+
/**
|
|
3079
|
+
* How many commits it has, or null when the host can't say, such as for 100 or more.
|
|
3080
|
+
*/
|
|
3081
|
+
public readonly commitCount: number | null;
|
|
3082
|
+
|
|
3083
|
+
/**
|
|
3084
|
+
* The work items linked to it.
|
|
3085
|
+
*/
|
|
3086
|
+
public readonly workItems: readonly HostWorkItemLink[];
|
|
3087
|
+
|
|
3088
|
+
/**
|
|
3089
|
+
* The merge type auto-complete is set to complete it with, as the host names it, such as Azure DevOps' `squash`; null when auto-complete isn't set or
|
|
3090
|
+
* the host doesn't say.
|
|
3091
|
+
*/
|
|
3092
|
+
public readonly autoCompleteMergeType: string | null;
|
|
3093
|
+
|
|
3094
|
+
/**
|
|
3095
|
+
* Whether it conflicts with its target branch, so it can't merge until the conflicts are resolved; null when the host doesn't say.
|
|
3096
|
+
*/
|
|
3097
|
+
public readonly hasConflicts: boolean | null;
|
|
3098
|
+
|
|
3099
|
+
/**
|
|
3100
|
+
* Makes a pull request from its parts, copying the lists.
|
|
3101
|
+
*
|
|
3102
|
+
* @param item The pull request, of the kind `PullRequest`.
|
|
3103
|
+
* @param reviewers Its reviewers.
|
|
3104
|
+
* @param policies Its branch policies.
|
|
3105
|
+
* @param builds Its builds.
|
|
3106
|
+
* @param isAutoComplete Whether it completes on its own.
|
|
3107
|
+
* @param description Its description in Markdown, empty when it has none.
|
|
3108
|
+
* @param commitCount How many commits it has, zero or more, or null when the host can't say.
|
|
3109
|
+
* @param workItems The work items linked to it.
|
|
3110
|
+
* @param autoCompleteMergeType The merge type auto-complete is set to complete it with, not blank, or null, the default, when it isn't set or the host
|
|
3111
|
+
* doesn't say.
|
|
3112
|
+
* @param hasConflicts Whether it conflicts with its target branch, or null, the default, when the host doesn't say.
|
|
3113
|
+
* @param reader The reader the values came from, so an error names the field by its path; omitted for values that didn't come from JSON.
|
|
3114
|
+
* @throws {HostingArgumentException} Without a reader, when the item isn't a pull request, naming `item`, the commit count is out of its range,
|
|
3115
|
+
* naming `commitCount`, or the auto-complete merge type is blank, naming `autoCompleteMergeType`.
|
|
3116
|
+
* @throws {HostingFieldException} With a reader, when a part is out of its range, naming the field by its path, such as `$.item`.
|
|
3117
|
+
* @example
|
|
3118
|
+
* ```ts
|
|
3119
|
+
* import { HostItem, HostPullRequest } from "@noldova/git.hosting.protocol";
|
|
3120
|
+
*
|
|
3121
|
+
* declare const item: HostItem;
|
|
3122
|
+
* const pullRequest = new HostPullRequest(item, [], [], [], false, "", null, []);
|
|
3123
|
+
* ```
|
|
3124
|
+
*/
|
|
3125
|
+
public constructor(item: HostItem, reviewers: readonly HostReviewer[], policies: readonly HostPolicy[], builds: readonly HostBuild[],
|
|
3126
|
+
isAutoComplete: boolean, description: string, commitCount: number | null, workItems: readonly HostWorkItemLink[], autoCompleteMergeType?: string | null,
|
|
3127
|
+
hasConflicts?: boolean | null, reader?: JsonReader);
|
|
3128
|
+
|
|
3129
|
+
/**
|
|
3130
|
+
* Reads a pull request from its JSON.
|
|
3131
|
+
*
|
|
3132
|
+
* @param value The JSON, with exactly the fields `toJson` writes.
|
|
3133
|
+
* @param path The JSON's path, `$` by default.
|
|
3134
|
+
* @returns The pull request.
|
|
3135
|
+
* @throws {JsonException} When the value isn't an object, or a field is missing or of the wrong type; it comes from `@noldova/context.json`.
|
|
3136
|
+
* @throws {HostingFieldException} When the value holds an unknown field, a field is out of its range, or the item isn't a pull request.
|
|
3137
|
+
* @example
|
|
3138
|
+
* ```ts
|
|
3139
|
+
* import { HostPullRequest } from "@noldova/git.hosting.protocol";
|
|
3140
|
+
*
|
|
3141
|
+
* declare const json: unknown;
|
|
3142
|
+
* const pullRequest = HostPullRequest.fromJson(json);
|
|
3143
|
+
* ```
|
|
3144
|
+
*/
|
|
3145
|
+
public static fromJson(value: unknown, path?: string): HostPullRequest;
|
|
3146
|
+
|
|
3147
|
+
/**
|
|
3148
|
+
* Writes the pull request as JSON: `item`, `reviewers`, `policies`, `builds`, `isAutoComplete`, `description`, `commitCount` and `workItems`.
|
|
3149
|
+
*
|
|
3150
|
+
* @returns The JSON.
|
|
3151
|
+
* @example
|
|
3152
|
+
* ```ts
|
|
3153
|
+
* import { HostPullRequest } from "@noldova/git.hosting.protocol";
|
|
3154
|
+
*
|
|
3155
|
+
* declare const pullRequest: HostPullRequest;
|
|
3156
|
+
* console.log(pullRequest.toJson());
|
|
3157
|
+
* ```
|
|
3158
|
+
*/
|
|
3159
|
+
public toJson(): JsonObject;
|
|
3160
|
+
}
|
|
3161
|
+
|
|
3162
|
+
/**
|
|
3163
|
+
* A work item linked to a pull request: its id, title, type, state, the state's category and page.
|
|
3164
|
+
*
|
|
3165
|
+
* @example
|
|
3166
|
+
* ```ts
|
|
3167
|
+
* import { HostWorkItemLink, HostWorkItemType, WorkItemCategory } from "@noldova/git.hosting.protocol";
|
|
3168
|
+
*
|
|
3169
|
+
* const link = new HostWorkItemLink(7521, "Export notes as Markdown files", new HostWorkItemType("User Story", "009CCC", "icon_book"), "Active",
|
|
3170
|
+
* WorkItemCategory.InProgress, "https://dev.azure.com/fabrikam/_workitems/edit/7521");
|
|
3171
|
+
* ```
|
|
3172
|
+
*/
|
|
3173
|
+
export declare class HostWorkItemLink {
|
|
3174
|
+
/**
|
|
3175
|
+
* The work item's id.
|
|
3176
|
+
*/
|
|
3177
|
+
public readonly id: number;
|
|
3178
|
+
|
|
3179
|
+
/**
|
|
3180
|
+
* The work item's title.
|
|
3181
|
+
*/
|
|
3182
|
+
public readonly title: string;
|
|
3183
|
+
|
|
3184
|
+
/**
|
|
3185
|
+
* The work item's type as the host draws it.
|
|
3186
|
+
*/
|
|
3187
|
+
public readonly type: HostWorkItemType;
|
|
3188
|
+
|
|
3189
|
+
/**
|
|
3190
|
+
* The work item's state, as the host names it, such as `Active`.
|
|
3191
|
+
*/
|
|
3192
|
+
public readonly state: string;
|
|
3193
|
+
|
|
3194
|
+
/**
|
|
3195
|
+
* The category the state belongs to.
|
|
3196
|
+
*/
|
|
3197
|
+
public readonly category: WorkItemCategory;
|
|
3198
|
+
|
|
3199
|
+
/**
|
|
3200
|
+
* The work item's page, an https address.
|
|
3201
|
+
*/
|
|
3202
|
+
public readonly url: string;
|
|
3203
|
+
|
|
3204
|
+
/**
|
|
3205
|
+
* Makes a link from its parts.
|
|
3206
|
+
*
|
|
3207
|
+
* @param id The id, one or more.
|
|
3208
|
+
* @param title The title, which isn't blank.
|
|
3209
|
+
* @param type The type.
|
|
3210
|
+
* @param state The state, which isn't blank.
|
|
3211
|
+
* @param category The state's category.
|
|
3212
|
+
* @param url The page, an https address with no user name or password.
|
|
3213
|
+
* @param reader The reader the values came from, so an error names the field by its path; omitted for values that didn't come from JSON.
|
|
3214
|
+
* @throws {HostingArgumentException} Without a reader, when a part is out of its range, naming the field as the parameter, such as `id`.
|
|
3215
|
+
* @throws {HostingFieldException} With a reader, when a part is out of its range, naming the field by its path, such as `$.workItems.0.id`.
|
|
3216
|
+
* @example
|
|
3217
|
+
* ```ts
|
|
3218
|
+
* import { HostWorkItemLink, HostWorkItemType, WorkItemCategory } from "@noldova/git.hosting.protocol";
|
|
3219
|
+
*
|
|
3220
|
+
* const link = new HostWorkItemLink(7499, "Due dates ignore local times", new HostWorkItemType("Bug", "CC293D", "icon_insect"), "Active",
|
|
3221
|
+
* WorkItemCategory.InProgress, "https://dev.azure.com/fabrikam/_workitems/edit/7499");
|
|
3222
|
+
* ```
|
|
3223
|
+
*/
|
|
3224
|
+
public constructor(id: number, title: string, type: HostWorkItemType, state: string, category: WorkItemCategory, url: string, reader?: JsonReader);
|
|
3225
|
+
|
|
3226
|
+
/**
|
|
3227
|
+
* Reads a link from its JSON.
|
|
3228
|
+
*
|
|
3229
|
+
* @param value The JSON, with exactly the fields `toJson` writes.
|
|
3230
|
+
* @param path The JSON's path, `$` by default.
|
|
3231
|
+
* @returns The link.
|
|
3232
|
+
* @throws {JsonException} When the value isn't an object, or a field is missing or of the wrong type; it comes from `@noldova/context.json`.
|
|
3233
|
+
* @throws {HostingFieldException} When the value holds an unknown field, or a field is out of its range.
|
|
3234
|
+
* @example
|
|
3235
|
+
* ```ts
|
|
3236
|
+
* import { HostWorkItemLink } from "@noldova/git.hosting.protocol";
|
|
3237
|
+
*
|
|
3238
|
+
* const link = HostWorkItemLink.fromJson({ id: 7521, title: "Export notes as Markdown files",
|
|
3239
|
+
* type: { name: "User Story", color: "009CCC", icon: "icon_book" }, state: "Active", category: "InProgress",
|
|
3240
|
+
* url: "https://dev.azure.com/fabrikam/_workitems/edit/7521" });
|
|
3241
|
+
* ```
|
|
3242
|
+
*/
|
|
3243
|
+
public static fromJson(value: unknown, path?: string): HostWorkItemLink;
|
|
3244
|
+
|
|
3245
|
+
/**
|
|
3246
|
+
* Writes the link as JSON: `id`, `title`, `type`, `state`, `category` and `url`.
|
|
3247
|
+
*
|
|
3248
|
+
* @returns The JSON.
|
|
3249
|
+
* @example
|
|
3250
|
+
* ```ts
|
|
3251
|
+
* import type { HostWorkItemLink } from "@noldova/git.hosting.protocol";
|
|
3252
|
+
*
|
|
3253
|
+
* const send = (link: HostWorkItemLink): string => JSON.stringify(link.toJson());
|
|
3254
|
+
* ```
|
|
3255
|
+
*/
|
|
3256
|
+
public toJson(): JsonObject;
|
|
3257
|
+
}
|
|
3258
|
+
|
|
3259
|
+
/**
|
|
3260
|
+
* A comment in a pull request's thread: its id, the comment it answers, its author, when it was published and its Markdown text.
|
|
3261
|
+
*
|
|
3262
|
+
* @example
|
|
3263
|
+
* ```ts
|
|
3264
|
+
* import { HostComment, HostPerson } from "@noldova/git.hosting.protocol";
|
|
3265
|
+
*
|
|
3266
|
+
* const comment = new HostComment(1, null, new HostPerson("monalisa@fabrikam.test", null, null), 1_800_000_000_000, "Should this respect local times?");
|
|
3267
|
+
* ```
|
|
3268
|
+
*/
|
|
3269
|
+
export declare class HostComment {
|
|
3270
|
+
/**
|
|
3271
|
+
* The comment's id within its thread.
|
|
3272
|
+
*/
|
|
3273
|
+
public readonly id: number;
|
|
3274
|
+
|
|
3275
|
+
/**
|
|
3276
|
+
* The id of the comment this one answers, or null for a comment that starts the thread or answers none.
|
|
3277
|
+
*/
|
|
3278
|
+
public readonly parent: number | null;
|
|
3279
|
+
|
|
3280
|
+
/**
|
|
3281
|
+
* The comment's author.
|
|
3282
|
+
*/
|
|
3283
|
+
public readonly author: HostPerson;
|
|
3284
|
+
|
|
3285
|
+
/**
|
|
3286
|
+
* When the comment was published, in milliseconds since 1970 in UTC.
|
|
3287
|
+
*/
|
|
3288
|
+
public readonly publishedAt: number;
|
|
3289
|
+
|
|
3290
|
+
/**
|
|
3291
|
+
* The comment's text, in Markdown.
|
|
3292
|
+
*/
|
|
3293
|
+
public readonly body: string;
|
|
3294
|
+
|
|
3295
|
+
/**
|
|
3296
|
+
* Makes a comment from its parts.
|
|
3297
|
+
*
|
|
3298
|
+
* @param id The id, one or more.
|
|
3299
|
+
* @param parent The id of the comment it answers, one or more and not its own, or null.
|
|
3300
|
+
* @param author The author.
|
|
3301
|
+
* @param publishedAt When it was published, one or more.
|
|
3302
|
+
* @param body The Markdown text, which isn't blank.
|
|
3303
|
+
* @param reader The reader the values came from, so an error names the field by its path; omitted for values that didn't come from JSON.
|
|
3304
|
+
* @throws {HostingArgumentException} Without a reader, when a part is out of its range, naming the field as the parameter, such as `parent`.
|
|
3305
|
+
* @throws {HostingFieldException} With a reader, when a part is out of its range, naming the field by its path, such as `$.comments.1.parent`.
|
|
3306
|
+
* @example
|
|
3307
|
+
* ```ts
|
|
3308
|
+
* import { HostComment, HostPerson } from "@noldova/git.hosting.protocol";
|
|
3309
|
+
*
|
|
3310
|
+
* const reply = new HostComment(2, 1, new HostPerson("octocat@fabrikam.test", null, null), 1_800_000_060_000, "Yes, fixed.");
|
|
3311
|
+
* ```
|
|
3312
|
+
*/
|
|
3313
|
+
public constructor(id: number, parent: number | null, author: HostPerson, publishedAt: number, body: string, reader?: JsonReader);
|
|
3314
|
+
|
|
3315
|
+
/**
|
|
3316
|
+
* Reads a comment from its JSON.
|
|
3317
|
+
*
|
|
3318
|
+
* @param value The JSON, with exactly the fields `toJson` writes.
|
|
3319
|
+
* @param path The JSON's path, `$` by default.
|
|
3320
|
+
* @returns The comment.
|
|
3321
|
+
* @throws {JsonException} When the value isn't an object, or a field is missing or of the wrong type; it comes from `@noldova/context.json`.
|
|
3322
|
+
* @throws {HostingFieldException} When the value holds an unknown field, or a field is out of its range.
|
|
3323
|
+
* @example
|
|
3324
|
+
* ```ts
|
|
3325
|
+
* import { HostComment } from "@noldova/git.hosting.protocol";
|
|
3326
|
+
*
|
|
3327
|
+
* const comment = HostComment.fromJson({ id: 1, parent: null, author: { login: "monalisa@fabrikam.test", avatar: null, url: null },
|
|
3328
|
+
* publishedAt: 1_800_000_000_000, body: "Should this respect local times?" });
|
|
3329
|
+
* ```
|
|
3330
|
+
*/
|
|
3331
|
+
public static fromJson(value: unknown, path?: string): HostComment;
|
|
3332
|
+
|
|
3333
|
+
/**
|
|
3334
|
+
* Writes the comment as JSON: `id`, `parent`, `author`, `publishedAt` and `body`.
|
|
3335
|
+
*
|
|
3336
|
+
* @returns The JSON.
|
|
3337
|
+
* @example
|
|
3338
|
+
* ```ts
|
|
3339
|
+
* import type { HostComment } from "@noldova/git.hosting.protocol";
|
|
3340
|
+
*
|
|
3341
|
+
* const send = (comment: HostComment): string => JSON.stringify(comment.toJson());
|
|
3342
|
+
* ```
|
|
3343
|
+
*/
|
|
3344
|
+
public toJson(): JsonObject;
|
|
3345
|
+
}
|
|
3346
|
+
|
|
3347
|
+
/**
|
|
3348
|
+
* A pull request's comment thread: its id, its state, the file and line it is on, and its comments, oldest first.
|
|
3349
|
+
*
|
|
3350
|
+
* @example
|
|
3351
|
+
* ```ts
|
|
3352
|
+
* import { HostComment, HostPerson, HostThread, ThreadStatus } from "@noldova/git.hosting.protocol";
|
|
3353
|
+
*
|
|
3354
|
+
* const thread = new HostThread(7, ThreadStatus.Active, "/src/notes-export.ts", 42,
|
|
3355
|
+
* [new HostComment(1, null, new HostPerson("monalisa@fabrikam.test", null, null), 1_800_000_000_000, "Should this respect local times?")]);
|
|
3356
|
+
* ```
|
|
3357
|
+
*/
|
|
3358
|
+
export declare class HostThread {
|
|
3359
|
+
/**
|
|
3360
|
+
* The thread's id, unique within its pull request. A host that numbers its kinds of comments apart, such as GitHub's conversation and review comments,
|
|
3361
|
+
* makes it from the kind and the first comment's id, so it may differ from every comment's own id.
|
|
3362
|
+
*/
|
|
3363
|
+
public readonly id: number;
|
|
3364
|
+
|
|
3365
|
+
/**
|
|
3366
|
+
* The thread's state.
|
|
3367
|
+
*/
|
|
3368
|
+
public readonly state: ThreadStatus;
|
|
3369
|
+
|
|
3370
|
+
/**
|
|
3371
|
+
* The file the thread is on, as the host writes its path, or null for a thread on the whole pull request.
|
|
3372
|
+
*/
|
|
3373
|
+
public readonly path: string | null;
|
|
3374
|
+
|
|
3375
|
+
/**
|
|
3376
|
+
* The line the thread is on, counted from one, or null for a thread on the whole file or the whole pull request.
|
|
3377
|
+
*/
|
|
3378
|
+
public readonly line: number | null;
|
|
3379
|
+
|
|
3380
|
+
/**
|
|
3381
|
+
* The thread's comments, oldest first, at least one.
|
|
3382
|
+
*/
|
|
3383
|
+
public readonly comments: readonly HostComment[];
|
|
3384
|
+
|
|
3385
|
+
/**
|
|
3386
|
+
* Makes a thread from its parts, keeping its own copy of the comments.
|
|
3387
|
+
*
|
|
3388
|
+
* @param id The id, one or more.
|
|
3389
|
+
* @param state The state.
|
|
3390
|
+
* @param path The file, which isn't blank, or null.
|
|
3391
|
+
* @param line The line, one or more and only with a file, or null.
|
|
3392
|
+
* @param comments The comments, at least one.
|
|
3393
|
+
* @param reader The reader the values came from, so an error names the field by its path; omitted for values that didn't come from JSON.
|
|
3394
|
+
* @throws {HostingArgumentException} Without a reader, when a part is out of its range, naming the field as the parameter, such as `line`.
|
|
3395
|
+
* @throws {HostingFieldException} With a reader, when a part is out of its range, naming the field by its path, such as `$.0.line`.
|
|
3396
|
+
* @example
|
|
3397
|
+
* ```ts
|
|
3398
|
+
* import { HostComment, HostPerson, HostThread, ThreadStatus } from "@noldova/git.hosting.protocol";
|
|
3399
|
+
*
|
|
3400
|
+
* const thread = new HostThread(8, ThreadStatus.Resolved, null, null,
|
|
3401
|
+
* [new HostComment(1, null, new HostPerson("octocat@fabrikam.test", null, null), 1_800_000_000_000, "Ready once CI passes.")]);
|
|
3402
|
+
* ```
|
|
3403
|
+
*/
|
|
3404
|
+
public constructor(id: number, state: ThreadStatus, path: string | null, line: number | null, comments: readonly HostComment[], reader?: JsonReader);
|
|
3405
|
+
|
|
3406
|
+
/**
|
|
3407
|
+
* Reads a thread from its JSON.
|
|
3408
|
+
*
|
|
3409
|
+
* @param value The JSON, with exactly the fields `toJson` writes.
|
|
3410
|
+
* @param path The JSON's path, `$` by default.
|
|
3411
|
+
* @returns The thread.
|
|
3412
|
+
* @throws {JsonException} When the value isn't an object, a field is missing or of the wrong type, or the state is unknown; it comes from
|
|
3413
|
+
* `@noldova/context.json`.
|
|
3414
|
+
* @throws {HostingFieldException} When the value holds an unknown field, or a field is out of its range.
|
|
3415
|
+
* @example
|
|
3416
|
+
* ```ts
|
|
3417
|
+
* import { HostThread } from "@noldova/git.hosting.protocol";
|
|
3418
|
+
*
|
|
3419
|
+
* const thread = HostThread.fromJson({ id: 8, state: "Active", path: null, line: null, comments: [{ id: 1, parent: null,
|
|
3420
|
+
* author: { login: "octocat@fabrikam.test", avatar: null, url: null }, publishedAt: 1_800_000_000_000, body: "Ready once CI passes." }] });
|
|
3421
|
+
* ```
|
|
3422
|
+
*/
|
|
3423
|
+
public static fromJson(value: unknown, path?: string): HostThread;
|
|
3424
|
+
|
|
3425
|
+
/**
|
|
3426
|
+
* Writes the thread as JSON: `id`, `state`, `path`, `line` and `comments`.
|
|
3427
|
+
*
|
|
3428
|
+
* @returns The JSON.
|
|
3429
|
+
* @example
|
|
3430
|
+
* ```ts
|
|
3431
|
+
* import type { HostThread } from "@noldova/git.hosting.protocol";
|
|
3432
|
+
*
|
|
3433
|
+
* const send = (threads: readonly HostThread[]): string => JSON.stringify(threads.map(t => t.toJson()));
|
|
3434
|
+
* ```
|
|
3435
|
+
*/
|
|
3436
|
+
public toJson(): JsonObject;
|
|
3437
|
+
}
|
|
3438
|
+
|
|
3439
|
+
/**
|
|
3440
|
+
* A work item type as the host draws it: its name, color and icon.
|
|
3441
|
+
*
|
|
3442
|
+
* @example
|
|
3443
|
+
* ```ts
|
|
3444
|
+
* import { HostWorkItemType } from "@noldova/git.hosting.protocol";
|
|
3445
|
+
*
|
|
3446
|
+
* const type = new HostWorkItemType("User Story", "009CCC", "icon_book");
|
|
3447
|
+
* console.log(type.color);
|
|
3448
|
+
* ```
|
|
3449
|
+
*/
|
|
3450
|
+
export declare class HostWorkItemType {
|
|
3451
|
+
/**
|
|
3452
|
+
* The type's name in the host's process, such as `User Story`.
|
|
3453
|
+
*/
|
|
3454
|
+
public readonly name: string;
|
|
3455
|
+
|
|
3456
|
+
/**
|
|
3457
|
+
* The type's color, six hexadecimal digits without `#`.
|
|
3458
|
+
*/
|
|
3459
|
+
public readonly color: string;
|
|
3460
|
+
|
|
3461
|
+
/**
|
|
3462
|
+
* The name of the type's icon on the host, which a host module's window maps to its own icon when the type has no image.
|
|
3463
|
+
*/
|
|
3464
|
+
public readonly icon: string;
|
|
3465
|
+
|
|
3466
|
+
/**
|
|
3467
|
+
* The icon as the host draws it, SVG markup in the type's color, or null when the host gave none; a window shows it only as an image, where it runs no
|
|
3468
|
+
* script and loads nothing. JSON without the field reads as null.
|
|
3469
|
+
*/
|
|
3470
|
+
public readonly image: string | null;
|
|
3471
|
+
|
|
3472
|
+
/**
|
|
3473
|
+
* Makes a work item type from its parts.
|
|
3474
|
+
*
|
|
3475
|
+
* @param name The name, which isn't blank.
|
|
3476
|
+
* @param color Six hexadecimal digits.
|
|
3477
|
+
* @param icon A name of letters, digits, `.`, `_` and `-`.
|
|
3478
|
+
* @param image SVG markup of at most 65536 characters, which may start with an XML declaration, or null, the default.
|
|
3479
|
+
* @param reader The reader the values came from, so an error names the field by its path; omitted for values that didn't come from JSON.
|
|
3480
|
+
* @throws {HostingArgumentException} Without a reader, when a part is out of its range, naming the field as the parameter, such as `color`.
|
|
3481
|
+
* @throws {HostingFieldException} With a reader, when a part is out of its range, naming the field by its path, such as `$.color`.
|
|
3482
|
+
* @example
|
|
3483
|
+
* ```ts
|
|
3484
|
+
* import { HostWorkItemType } from "@noldova/git.hosting.protocol";
|
|
3485
|
+
*
|
|
3486
|
+
* const type = new HostWorkItemType("Bug", "CC293D", "icon_insect");
|
|
3487
|
+
* ```
|
|
3488
|
+
*/
|
|
3489
|
+
public constructor(name: string, color: string, icon: string, image?: string | null, reader?: JsonReader);
|
|
3490
|
+
|
|
3491
|
+
/**
|
|
3492
|
+
* Reads a work item type from its JSON.
|
|
3493
|
+
*
|
|
3494
|
+
* @param value The JSON, with exactly the fields `toJson` writes.
|
|
3495
|
+
* @param path The JSON's path, `$` by default.
|
|
3496
|
+
* @returns The type.
|
|
3497
|
+
* @throws {JsonException} When the value isn't an object, or a field is missing or of the wrong type; it comes from `@noldova/context.json`.
|
|
3498
|
+
* @throws {HostingFieldException} When the value holds an unknown field, or a field is out of its range.
|
|
3499
|
+
* @example
|
|
3500
|
+
* ```ts
|
|
3501
|
+
* import { HostWorkItemType } from "@noldova/git.hosting.protocol";
|
|
3502
|
+
*
|
|
3503
|
+
* const type = HostWorkItemType.fromJson({ name: "Task", color: "F2CB1D", icon: "icon_clipboard" });
|
|
3504
|
+
* ```
|
|
3505
|
+
*/
|
|
3506
|
+
public static fromJson(value: unknown, path?: string): HostWorkItemType;
|
|
3507
|
+
|
|
3508
|
+
/**
|
|
3509
|
+
* Writes the type as JSON: `name`, `color` and `icon`.
|
|
3510
|
+
*
|
|
3511
|
+
* @returns The JSON.
|
|
3512
|
+
* @example
|
|
3513
|
+
* ```ts
|
|
3514
|
+
* import { HostWorkItemType } from "@noldova/git.hosting.protocol";
|
|
3515
|
+
*
|
|
3516
|
+
* console.log(new HostWorkItemType("Task", "F2CB1D", "icon_clipboard").toJson());
|
|
3517
|
+
* ```
|
|
3518
|
+
*/
|
|
3519
|
+
public toJson(): JsonObject;
|
|
3520
|
+
}
|
|
3521
|
+
|
|
3522
|
+
/**
|
|
3523
|
+
* A work item on a host: where it lives, its type, title, state and category, who has it, and where it sits in the plan.
|
|
3524
|
+
*
|
|
3525
|
+
* @example
|
|
3526
|
+
* ```ts
|
|
3527
|
+
* import { HostWorkItem } from "@noldova/git.hosting.protocol";
|
|
3528
|
+
*
|
|
3529
|
+
* declare const item: HostWorkItem;
|
|
3530
|
+
* console.log(`${item.type.name} ${item.id}: ${item.title}`);
|
|
3531
|
+
* ```
|
|
3532
|
+
*/
|
|
3533
|
+
export declare class HostWorkItem {
|
|
3534
|
+
/**
|
|
3535
|
+
* The host module's id, such as `git-azure-devops`.
|
|
3536
|
+
*/
|
|
3537
|
+
public readonly host: string;
|
|
3538
|
+
|
|
3539
|
+
/**
|
|
3540
|
+
* The organization that holds the item.
|
|
3541
|
+
*/
|
|
3542
|
+
public readonly organization: string;
|
|
3543
|
+
|
|
3544
|
+
/**
|
|
3545
|
+
* The project that holds the item, as the host names it.
|
|
3546
|
+
*/
|
|
3547
|
+
public readonly project: string;
|
|
3548
|
+
|
|
3549
|
+
/**
|
|
3550
|
+
* The item's number, unique in the organization.
|
|
3551
|
+
*/
|
|
3552
|
+
public readonly id: number;
|
|
3553
|
+
|
|
3554
|
+
/**
|
|
3555
|
+
* The item's type.
|
|
3556
|
+
*/
|
|
3557
|
+
public readonly type: HostWorkItemType;
|
|
3558
|
+
|
|
3559
|
+
/**
|
|
3560
|
+
* The item's title.
|
|
3561
|
+
*/
|
|
3562
|
+
public readonly title: string;
|
|
3563
|
+
|
|
3564
|
+
/**
|
|
3565
|
+
* The item's state in the host's process, such as `Active`.
|
|
3566
|
+
*/
|
|
3567
|
+
public readonly state: string;
|
|
3568
|
+
|
|
3569
|
+
/**
|
|
3570
|
+
* The category the state belongs to.
|
|
3571
|
+
*/
|
|
3572
|
+
public readonly category: WorkItemCategory;
|
|
3573
|
+
|
|
3574
|
+
/**
|
|
3575
|
+
* The https address of the item's page.
|
|
3576
|
+
*/
|
|
3577
|
+
public readonly url: string;
|
|
3578
|
+
|
|
3579
|
+
/**
|
|
3580
|
+
* Who the item is assigned to, or null.
|
|
3581
|
+
*/
|
|
3582
|
+
public readonly assignee: HostPerson | null;
|
|
3583
|
+
|
|
3584
|
+
/**
|
|
3585
|
+
* The item's iteration path, or null.
|
|
3586
|
+
*/
|
|
3587
|
+
public readonly iteration: string | null;
|
|
3588
|
+
|
|
3589
|
+
/**
|
|
3590
|
+
* The item's area path, or null.
|
|
3591
|
+
*/
|
|
3592
|
+
public readonly area: string | null;
|
|
3593
|
+
|
|
3594
|
+
/**
|
|
3595
|
+
* The parent item's number, or null.
|
|
3596
|
+
*/
|
|
3597
|
+
public readonly parent: number | null;
|
|
3598
|
+
|
|
3599
|
+
/**
|
|
3600
|
+
* When the item last changed, in milliseconds since 1970 UTC, or null when the host didn't say; JSON without the field reads as null.
|
|
3601
|
+
*/
|
|
3602
|
+
public readonly changedAt: number | null;
|
|
3603
|
+
|
|
3604
|
+
/**
|
|
3605
|
+
* Makes a work item from its parts.
|
|
3606
|
+
*
|
|
3607
|
+
* @param host The host module's id, a name of letters, digits, `.`, `_` and `-`.
|
|
3608
|
+
* @param organization The organization, a name of the same characters.
|
|
3609
|
+
* @param project The project, which isn't blank.
|
|
3610
|
+
* @param id The number, above zero.
|
|
3611
|
+
* @param type The type.
|
|
3612
|
+
* @param title The title, which isn't blank.
|
|
3613
|
+
* @param state The state, which isn't blank.
|
|
3614
|
+
* @param category The state's category.
|
|
3615
|
+
* @param url The page's https address, with no user name or password.
|
|
3616
|
+
* @param assignee The assignee, or null.
|
|
3617
|
+
* @param iteration The iteration path, which isn't blank, or null.
|
|
3618
|
+
* @param area The area path, which isn't blank, or null.
|
|
3619
|
+
* @param parent The parent's number, above zero and not the item's own, or null.
|
|
3620
|
+
* @param changedAt When it last changed, in milliseconds since 1970 UTC and above zero, or null, the default.
|
|
3621
|
+
* @param reader The reader the values came from, so an error names the field by its path; omitted for values that didn't come from JSON.
|
|
3622
|
+
* @throws {HostingArgumentException} Without a reader, when a part is out of its range, naming the field as the parameter, such as `parent`.
|
|
3623
|
+
* @throws {HostingFieldException} With a reader, when a part is out of its range, naming the field by its path, such as `$.parent`.
|
|
3624
|
+
* @example
|
|
3625
|
+
* ```ts
|
|
3626
|
+
* import { HostWorkItem, HostWorkItemType, WorkItemCategory } from "@noldova/git.hosting.protocol";
|
|
3627
|
+
*
|
|
3628
|
+
* const item = new HostWorkItem("git-azure-devops", "fabrikam", "Web Site", 42, new HostWorkItemType("Bug", "CC293D", "icon_insect"),
|
|
3629
|
+
* "The sign-in page loops", "New", WorkItemCategory.Proposed, "https://dev.azure.com/fabrikam/Web%20Site/_workitems/edit/42", null, null, null, null);
|
|
3630
|
+
* ```
|
|
3631
|
+
*/
|
|
3632
|
+
public constructor(host: string, organization: string, project: string, id: number, type: HostWorkItemType, title: string, state: string,
|
|
3633
|
+
category: WorkItemCategory, url: string, assignee: HostPerson | null, iteration: string | null, area: string | null, parent: number | null,
|
|
3634
|
+
changedAt?: number | null, reader?: JsonReader);
|
|
3635
|
+
|
|
3636
|
+
/**
|
|
3637
|
+
* Reads a work item from its JSON.
|
|
3638
|
+
*
|
|
3639
|
+
* @param value The JSON, with exactly the fields `toJson` writes.
|
|
3640
|
+
* @param path The JSON's path, `$` by default.
|
|
3641
|
+
* @returns The work item.
|
|
3642
|
+
* @throws {JsonException} When the value isn't an object, a field is missing or of the wrong type, or the category isn't one of its names; it
|
|
3643
|
+
* comes from `@noldova/context.json`.
|
|
3644
|
+
* @throws {HostingFieldException} When the value holds an unknown field, or a field is out of its range.
|
|
3645
|
+
* @example
|
|
3646
|
+
* ```ts
|
|
3647
|
+
* import { HostWorkItem } from "@noldova/git.hosting.protocol";
|
|
3648
|
+
*
|
|
3649
|
+
* declare const json: unknown;
|
|
3650
|
+
* const item = HostWorkItem.fromJson(json);
|
|
3651
|
+
* ```
|
|
3652
|
+
*/
|
|
3653
|
+
public static fromJson(value: unknown, path?: string): HostWorkItem;
|
|
3654
|
+
|
|
3655
|
+
/**
|
|
3656
|
+
* Writes the work item as JSON: `host`, `organization`, `project`, `id`, `type`, `title`, `state`, `category`, `url`, `assignee`, `iteration`,
|
|
3657
|
+
* `area` and `parent`.
|
|
3658
|
+
*
|
|
3659
|
+
* @returns The JSON.
|
|
3660
|
+
* @example
|
|
3661
|
+
* ```ts
|
|
3662
|
+
* import { HostWorkItem } from "@noldova/git.hosting.protocol";
|
|
3663
|
+
*
|
|
3664
|
+
* declare const item: HostWorkItem;
|
|
3665
|
+
* console.log(item.toJson());
|
|
3666
|
+
* ```
|
|
3667
|
+
*/
|
|
3668
|
+
public toJson(): JsonObject;
|
|
3669
|
+
}
|
|
3670
|
+
|
|
3671
|
+
/**
|
|
3672
|
+
* Where a pull request's checks stand, the worst of them first.
|
|
3673
|
+
*
|
|
3674
|
+
* @example
|
|
3675
|
+
* ```ts
|
|
3676
|
+
* import { PullRequestStatus } from "@noldova/git.hosting.protocol";
|
|
3677
|
+
*
|
|
3678
|
+
* const isRed = (status: PullRequestStatus): boolean => status === PullRequestStatus.Failed;
|
|
3679
|
+
* ```
|
|
3680
|
+
*/
|
|
3681
|
+
export declare const PullRequestStatus: {
|
|
3682
|
+
/**
|
|
3683
|
+
* A check failed.
|
|
3684
|
+
*/
|
|
3685
|
+
readonly Failed: "Failed";
|
|
3686
|
+
|
|
3687
|
+
/**
|
|
3688
|
+
* None failed, and a check runs or waits.
|
|
3689
|
+
*/
|
|
3690
|
+
readonly Pending: "Pending";
|
|
3691
|
+
|
|
3692
|
+
/**
|
|
3693
|
+
* Every check passed.
|
|
3694
|
+
*/
|
|
3695
|
+
readonly Succeeded: "Succeeded";
|
|
3696
|
+
|
|
3697
|
+
/**
|
|
3698
|
+
* The pull request has no checks.
|
|
3699
|
+
*/
|
|
3700
|
+
readonly None: "None";
|
|
3701
|
+
};
|
|
3702
|
+
|
|
3703
|
+
/**
|
|
3704
|
+
* Where a pull request's checks stand.
|
|
3705
|
+
*/
|
|
3706
|
+
export type PullRequestStatus = (typeof PullRequestStatus)[keyof typeof PullRequestStatus];
|
|
3707
|
+
|
|
3708
|
+
/**
|
|
3709
|
+
* A repository on a host, as a read of its pull requests names it.
|
|
3710
|
+
*
|
|
3711
|
+
* @example
|
|
3712
|
+
* ```ts
|
|
3713
|
+
* import { RepositoryQuery } from "@noldova/git.hosting.protocol";
|
|
3714
|
+
*
|
|
3715
|
+
* const query = new RepositoryQuery("github.com", "octocat/hello-world");
|
|
3716
|
+
* ```
|
|
3717
|
+
*/
|
|
3718
|
+
export declare class RepositoryQuery {
|
|
3719
|
+
/**
|
|
3720
|
+
* The host the repository is on, such as `github.com` or `dev.azure.com`.
|
|
3721
|
+
*/
|
|
3722
|
+
public readonly host: string;
|
|
3723
|
+
|
|
3724
|
+
/**
|
|
3725
|
+
* The repository's path on the host, such as `octocat/hello-world` or `fabrikam/web/_git/site`.
|
|
3726
|
+
*/
|
|
3727
|
+
public readonly path: string;
|
|
3728
|
+
|
|
3729
|
+
/**
|
|
3730
|
+
* Makes a query from its parts.
|
|
3731
|
+
*
|
|
3732
|
+
* @param host The host, which isn't blank.
|
|
3733
|
+
* @param path The repository's path: names of letters, digits, `.`, `_`, `-` and percent escapes such as `%20` but not of `/` or `\` joined by `/`, none of them `.` or `..`, `%2e` counting as a dot.
|
|
3734
|
+
* @param reader The reader the values came from, so an error names the field by its path; omitted for values that didn't come from JSON.
|
|
3735
|
+
* @throws {HostingArgumentException} Without a reader, when a part is out of its range, naming the field as the parameter, such as `path`.
|
|
3736
|
+
* @throws {HostingFieldException} With a reader, when a part is out of its range, naming the field by its path, such as `$.path`.
|
|
3737
|
+
* @example
|
|
3738
|
+
* ```ts
|
|
3739
|
+
* import { RepositoryQuery } from "@noldova/git.hosting.protocol";
|
|
3740
|
+
*
|
|
3741
|
+
* const query = new RepositoryQuery("dev.azure.com", "fabrikam/web/_git/site");
|
|
3742
|
+
* ```
|
|
3743
|
+
*/
|
|
3744
|
+
public constructor(host: string, path: string, reader?: JsonReader);
|
|
3745
|
+
|
|
3746
|
+
/**
|
|
3747
|
+
* Reads a query from its JSON.
|
|
3748
|
+
*
|
|
3749
|
+
* @param value The JSON, with exactly the fields `toJson` writes.
|
|
3750
|
+
* @param path The JSON's path, `$` by default.
|
|
3751
|
+
* @returns The query.
|
|
3752
|
+
* @throws {JsonException} When the value isn't an object, or a field is missing or of the wrong type; it comes from `@noldova/context.json`.
|
|
3753
|
+
* @throws {HostingFieldException} When the value holds an unknown field, or a field is out of its range.
|
|
3754
|
+
* @example
|
|
3755
|
+
* ```ts
|
|
3756
|
+
* import { RepositoryQuery } from "@noldova/git.hosting.protocol";
|
|
3757
|
+
*
|
|
3758
|
+
* const query = RepositoryQuery.fromJson({ host: "github.com", path: "octocat/hello-world" });
|
|
3759
|
+
* ```
|
|
3760
|
+
*/
|
|
3761
|
+
public static fromJson(value: unknown, path?: string): RepositoryQuery;
|
|
3762
|
+
|
|
3763
|
+
/**
|
|
3764
|
+
* Writes the query as JSON: `host` and `path`.
|
|
3765
|
+
*
|
|
3766
|
+
* @returns The JSON.
|
|
3767
|
+
* @example
|
|
3768
|
+
* ```ts
|
|
3769
|
+
* import { RepositoryQuery } from "@noldova/git.hosting.protocol";
|
|
3770
|
+
*
|
|
3771
|
+
* console.log(new RepositoryQuery("github.com", "octocat/hello-world").toJson());
|
|
3772
|
+
* ```
|
|
3773
|
+
*/
|
|
3774
|
+
public toJson(): JsonObject;
|
|
3775
|
+
}
|
|
3776
|
+
|
|
3777
|
+
/**
|
|
3778
|
+
* An open pull request as a row of the repository's list: its reference, title and page, whether it is a draft, how many reviewers approve it,
|
|
3779
|
+
* and how many of its checks passed, failed or still run.
|
|
3780
|
+
*
|
|
3781
|
+
* @example
|
|
3782
|
+
* ```ts
|
|
3783
|
+
* import type { HostPullRequestRow } from "@noldova/git.hosting.protocol";
|
|
3784
|
+
*
|
|
3785
|
+
* const describe = (row: HostPullRequestRow): string => `#${row.reference.number} ${row.title}: ${row.status}`;
|
|
3786
|
+
* ```
|
|
3787
|
+
*/
|
|
3788
|
+
export declare class HostPullRequestRow {
|
|
3789
|
+
/**
|
|
3790
|
+
* The pull request's reference on its host.
|
|
3791
|
+
*/
|
|
3792
|
+
public readonly reference: HostReference;
|
|
3793
|
+
|
|
3794
|
+
/**
|
|
3795
|
+
* The pull request's title.
|
|
3796
|
+
*/
|
|
3797
|
+
public readonly title: string;
|
|
3798
|
+
|
|
3799
|
+
/**
|
|
3800
|
+
* The pull request's page, an https address.
|
|
3801
|
+
*/
|
|
3802
|
+
public readonly url: string;
|
|
3803
|
+
|
|
3804
|
+
/**
|
|
3805
|
+
* Whether the pull request is a draft.
|
|
3806
|
+
*/
|
|
3807
|
+
public readonly isDraft: boolean;
|
|
3808
|
+
|
|
3809
|
+
/**
|
|
3810
|
+
* How many reviewers approve it as their latest review or vote.
|
|
3811
|
+
*/
|
|
3812
|
+
public readonly approvals: number;
|
|
3813
|
+
|
|
3814
|
+
/**
|
|
3815
|
+
* How many of its checks, builds and blocking policies passed.
|
|
3816
|
+
*/
|
|
3817
|
+
public readonly passed: number;
|
|
3818
|
+
|
|
3819
|
+
/**
|
|
3820
|
+
* How many of them failed or were rejected.
|
|
3821
|
+
*/
|
|
3822
|
+
public readonly failing: number;
|
|
3823
|
+
|
|
3824
|
+
/**
|
|
3825
|
+
* How many of them run or wait.
|
|
3826
|
+
*/
|
|
3827
|
+
public readonly pending: number;
|
|
3828
|
+
|
|
3829
|
+
/**
|
|
3830
|
+
* The branch it merges from, without `refs/heads/`, such as `feature/sign-in`.
|
|
3831
|
+
*/
|
|
3832
|
+
public readonly headBranch: string;
|
|
3833
|
+
|
|
3834
|
+
/**
|
|
3835
|
+
* The branch it merges into, without `refs/heads/`, such as `main`, or `null` when the host didn't say.
|
|
3836
|
+
*/
|
|
3837
|
+
public readonly baseBranch: string | null;
|
|
3838
|
+
|
|
3839
|
+
/**
|
|
3840
|
+
* Makes a row from its parts.
|
|
3841
|
+
*
|
|
3842
|
+
* @param reference The pull request's reference.
|
|
3843
|
+
* @param title The title, which isn't blank.
|
|
3844
|
+
* @param url The page, an https address with no user name or password.
|
|
3845
|
+
* @param isDraft Whether it is a draft.
|
|
3846
|
+
* @param approvals The approvals, zero or more.
|
|
3847
|
+
* @param passed The checks that passed, zero or more.
|
|
3848
|
+
* @param failing The checks that failed, zero or more.
|
|
3849
|
+
* @param pending The checks that run or wait, zero or more.
|
|
3850
|
+
* @param headBranch The branch it merges from, without `refs/heads/`, which isn't blank.
|
|
3851
|
+
* @param baseBranch The branch it merges into, without `refs/heads/`, which isn't blank; `null`, the default, when the host didn't say.
|
|
3852
|
+
* @param reader The reader the values came from, so an error names the field by its path; omitted for values that didn't come from JSON.
|
|
3853
|
+
* @throws {HostingArgumentException} Without a reader, when a part is out of its range, naming the field as the parameter, such as `failing`.
|
|
3854
|
+
* @throws {HostingFieldException} With a reader, when a part is out of its range, naming the field by its path, such as `$.rows.0.failing`.
|
|
3855
|
+
* @example
|
|
3856
|
+
* ```ts
|
|
3857
|
+
* import { HostPullRequestRow, HostReference } from "@noldova/git.hosting.protocol";
|
|
3858
|
+
*
|
|
3859
|
+
* const row = new HostPullRequestRow(new HostReference("git-github", "octocat", "hello-world", 214), "Add the sign-in page",
|
|
3860
|
+
* "https://github.com/octocat/hello-world/pull/214", false, 2, 3, 0, 0, "feature/sign-in");
|
|
3861
|
+
* ```
|
|
3862
|
+
*/
|
|
3863
|
+
public constructor(reference: HostReference, title: string, url: string, isDraft: boolean, approvals: number, passed: number, failing: number,
|
|
3864
|
+
pending: number, headBranch: string, baseBranch?: string | null, reader?: JsonReader);
|
|
3865
|
+
|
|
3866
|
+
/**
|
|
3867
|
+
* The worst of its checks: `Failed` when any failed, else `Pending` when any runs or waits, else `Succeeded` when any passed, else `None`.
|
|
3868
|
+
*/
|
|
3869
|
+
public get status(): PullRequestStatus;
|
|
3870
|
+
|
|
3871
|
+
/**
|
|
3872
|
+
* Makes a row from a pull request's parts and its checks: a passed check counts as passed, a failed one as failing, a queued or running one as
|
|
3873
|
+
* pending, and a neutral one not at all, so every host counts alike.
|
|
3874
|
+
*
|
|
3875
|
+
* @param reference The pull request's reference.
|
|
3876
|
+
* @param title The title, which isn't blank.
|
|
3877
|
+
* @param url The page, an https address with no user name or password.
|
|
3878
|
+
* @param isDraft Whether it is a draft.
|
|
3879
|
+
* @param approvals The approvals, zero or more.
|
|
3880
|
+
* @param checks Its checks, builds and blocking policies as checks.
|
|
3881
|
+
* @param headBranch The branch it merges from, without `refs/heads/`, which isn't blank.
|
|
3882
|
+
* @param baseBranch The branch it merges into, without `refs/heads/`, which isn't blank; `null`, the default, when the host didn't say.
|
|
3883
|
+
* @returns The row.
|
|
3884
|
+
* @throws {HostingArgumentException} When a part is out of its range, naming the field as the parameter.
|
|
3885
|
+
* @example
|
|
3886
|
+
* ```ts
|
|
3887
|
+
* import { type HostCheck, HostPullRequestRow, HostReference } from "@noldova/git.hosting.protocol";
|
|
3888
|
+
*
|
|
3889
|
+
* const rowOf = (checks: readonly HostCheck[]): HostPullRequestRow => HostPullRequestRow.of(new HostReference("git-github", "octocat",
|
|
3890
|
+
* "hello-world", 214), "Add the sign-in page", "https://github.com/octocat/hello-world/pull/214", false, 0, checks, "feature/sign-in");
|
|
3891
|
+
* ```
|
|
3892
|
+
*/
|
|
3893
|
+
public static of(reference: HostReference, title: string, url: string, isDraft: boolean, approvals: number,
|
|
3894
|
+
checks: readonly HostCheck[], headBranch: string, baseBranch?: string | null): HostPullRequestRow;
|
|
3895
|
+
|
|
3896
|
+
/**
|
|
3897
|
+
* Reads a row from its JSON.
|
|
3898
|
+
*
|
|
3899
|
+
* @param value The JSON, with exactly the fields `toJson` writes.
|
|
3900
|
+
* @param path The JSON's path, `$` by default.
|
|
3901
|
+
* @returns The row.
|
|
3902
|
+
* @throws {JsonException} When the value isn't an object, or a field is missing or of the wrong type; it comes from `@noldova/context.json`.
|
|
3903
|
+
* @throws {HostingFieldException} When the value holds an unknown field, or a field is out of its range.
|
|
3904
|
+
* @example
|
|
3905
|
+
* ```ts
|
|
3906
|
+
* import { HostPullRequestRow } from "@noldova/git.hosting.protocol";
|
|
3907
|
+
*
|
|
3908
|
+
* const row = HostPullRequestRow.fromJson({ reference: { host: "git-github", owner: "octocat", repository: "hello-world", number: 214 },
|
|
3909
|
+
* title: "Add the sign-in page", url: "https://github.com/octocat/hello-world/pull/214", isDraft: false, approvals: 2, passed: 3, failing: 0,
|
|
3910
|
+
* pending: 0, headBranch: "feature/sign-in", baseBranch: "main" });
|
|
3911
|
+
* ```
|
|
3912
|
+
*/
|
|
3913
|
+
public static fromJson(value: unknown, path?: string): HostPullRequestRow;
|
|
3914
|
+
|
|
3915
|
+
/**
|
|
3916
|
+
* Writes the row as JSON: `reference`, `title`, `url`, `isDraft`, `approvals`, `passed`, `failing`, `pending`, `headBranch` and `baseBranch`.
|
|
3917
|
+
*
|
|
3918
|
+
* @returns The JSON.
|
|
3919
|
+
* @example
|
|
3920
|
+
* ```ts
|
|
3921
|
+
* import type { HostPullRequestRow } from "@noldova/git.hosting.protocol";
|
|
3922
|
+
*
|
|
3923
|
+
* const send = (row: HostPullRequestRow): string => JSON.stringify(row.toJson());
|
|
3924
|
+
* ```
|
|
3925
|
+
*/
|
|
3926
|
+
public toJson(): JsonObject;
|
|
3927
|
+
}
|
|
3928
|
+
|
|
3929
|
+
/**
|
|
3930
|
+
* A repository's open pull requests, at most 20 with the most recently updated first, whether it has more, and whether the host was signed in to
|
|
3931
|
+
* read them.
|
|
3932
|
+
*
|
|
3933
|
+
* @example
|
|
3934
|
+
* ```ts
|
|
3935
|
+
* import type { HostPullRequestList } from "@noldova/git.hosting.protocol";
|
|
3936
|
+
*
|
|
3937
|
+
* const countOf = (list: HostPullRequestList): string => `${list.rows.length}${list.hasMore ? "+" : ""}`;
|
|
3938
|
+
* ```
|
|
3939
|
+
*/
|
|
3940
|
+
export declare class HostPullRequestList {
|
|
3941
|
+
/**
|
|
3942
|
+
* The most rows a list holds: 20.
|
|
3943
|
+
*/
|
|
3944
|
+
public static readonly maximumRows: number;
|
|
3945
|
+
|
|
3946
|
+
/**
|
|
3947
|
+
* The open pull requests, the most recently updated first; none while signed out.
|
|
3948
|
+
*/
|
|
3949
|
+
public readonly rows: readonly HostPullRequestRow[];
|
|
3950
|
+
|
|
3951
|
+
/**
|
|
3952
|
+
* Whether the repository has more open pull requests than the 20 rows.
|
|
3953
|
+
*/
|
|
3954
|
+
public readonly hasMore: boolean;
|
|
3955
|
+
|
|
3956
|
+
/**
|
|
3957
|
+
* Whether the host was signed in to read them.
|
|
3958
|
+
*/
|
|
3959
|
+
public readonly isSignedIn: boolean;
|
|
3960
|
+
|
|
3961
|
+
/**
|
|
3962
|
+
* Makes a list from its parts.
|
|
3963
|
+
*
|
|
3964
|
+
* @param rows The rows, at most 20, and none while signed out.
|
|
3965
|
+
* @param hasMore Whether there are more, only with 20 rows.
|
|
3966
|
+
* @param isSignedIn Whether the host was signed in; true by default.
|
|
3967
|
+
* @param reader The reader the values came from, so an error names the field by its path; omitted for values that didn't come from JSON.
|
|
3968
|
+
* @throws {HostingArgumentException} Without a reader, when a part is out of its range, naming the field as the parameter, such as `hasMore`.
|
|
3969
|
+
* @throws {HostingFieldException} With a reader, when a part is out of its range, naming the field by its path, such as `$.hasMore`.
|
|
3970
|
+
* @example
|
|
3971
|
+
* ```ts
|
|
3972
|
+
* import { HostPullRequestList } from "@noldova/git.hosting.protocol";
|
|
3973
|
+
*
|
|
3974
|
+
* const empty = new HostPullRequestList([], false);
|
|
3975
|
+
* ```
|
|
3976
|
+
*/
|
|
3977
|
+
public constructor(rows: readonly HostPullRequestRow[], hasMore: boolean, isSignedIn?: boolean, reader?: JsonReader);
|
|
3978
|
+
|
|
3979
|
+
/**
|
|
3980
|
+
* The list a host answers while signed out: no rows, and not signed in.
|
|
3981
|
+
*
|
|
3982
|
+
* @returns The list.
|
|
3983
|
+
* @example
|
|
3984
|
+
* ```ts
|
|
3985
|
+
* import { HostPullRequestList } from "@noldova/git.hosting.protocol";
|
|
3986
|
+
*
|
|
3987
|
+
* const answer = HostPullRequestList.signedOut().toJson();
|
|
3988
|
+
* ```
|
|
3989
|
+
*/
|
|
3990
|
+
public static signedOut(): HostPullRequestList;
|
|
3991
|
+
|
|
3992
|
+
/**
|
|
3993
|
+
* Reads a list from its JSON.
|
|
3994
|
+
*
|
|
3995
|
+
* @param value The JSON, with exactly the fields `toJson` writes.
|
|
3996
|
+
* @param path The JSON's path, `$` by default.
|
|
3997
|
+
* @returns The list.
|
|
3998
|
+
* @throws {JsonException} When the value isn't an object, or a field is missing or of the wrong type; it comes from `@noldova/context.json`.
|
|
3999
|
+
* @throws {HostingFieldException} When the value holds an unknown field, or a field is out of its range.
|
|
4000
|
+
* @example
|
|
4001
|
+
* ```ts
|
|
4002
|
+
* import { HostPullRequestList } from "@noldova/git.hosting.protocol";
|
|
4003
|
+
*
|
|
4004
|
+
* const list = HostPullRequestList.fromJson({ rows: [], hasMore: false, isSignedIn: false });
|
|
4005
|
+
* ```
|
|
4006
|
+
*/
|
|
4007
|
+
public static fromJson(value: unknown, path?: string): HostPullRequestList;
|
|
4008
|
+
|
|
4009
|
+
/**
|
|
4010
|
+
* Writes the list as JSON: `rows`, `hasMore` and `isSignedIn`.
|
|
4011
|
+
*
|
|
4012
|
+
* @returns The JSON.
|
|
4013
|
+
* @example
|
|
4014
|
+
* ```ts
|
|
4015
|
+
* import { HostPullRequestList } from "@noldova/git.hosting.protocol";
|
|
4016
|
+
*
|
|
4017
|
+
* console.log(HostPullRequestList.signedOut().toJson());
|
|
4018
|
+
* ```
|
|
4019
|
+
*/
|
|
4020
|
+
public toJson(): JsonObject;
|
|
4021
|
+
}
|
|
4022
|
+
|
|
4023
|
+
/**
|
|
4024
|
+
* An open pull request's reference, title, page and branches, without its approvals or checks: what a host reads in one list request to find
|
|
4025
|
+
* stacks, where one pull request's base is another's head.
|
|
4026
|
+
*
|
|
4027
|
+
* @example
|
|
4028
|
+
* ```ts
|
|
4029
|
+
* import type { HostPullRequestHead } from "@noldova/git.hosting.protocol";
|
|
4030
|
+
*
|
|
4031
|
+
* const isOn = (head: HostPullRequestHead, under: HostPullRequestHead): boolean => head.baseBranch === under.headBranch;
|
|
4032
|
+
* ```
|
|
4033
|
+
*/
|
|
4034
|
+
export declare class HostPullRequestHead {
|
|
4035
|
+
/**
|
|
4036
|
+
* The pull request's reference.
|
|
4037
|
+
*/
|
|
4038
|
+
public readonly reference: HostReference;
|
|
4039
|
+
|
|
4040
|
+
/**
|
|
4041
|
+
* Its title.
|
|
4042
|
+
*/
|
|
4043
|
+
public readonly title: string;
|
|
4044
|
+
|
|
4045
|
+
/**
|
|
4046
|
+
* Its page on the host, an https address.
|
|
4047
|
+
*/
|
|
4048
|
+
public readonly url: string;
|
|
4049
|
+
|
|
4050
|
+
/**
|
|
4051
|
+
* The branch it merges from, without refs/heads/, such as "feature/sign-in".
|
|
4052
|
+
*/
|
|
4053
|
+
public readonly headBranch: string;
|
|
4054
|
+
|
|
4055
|
+
/**
|
|
4056
|
+
* The branch it merges into, without refs/heads/, such as "main", or null when the host didn't say.
|
|
4057
|
+
*/
|
|
4058
|
+
public readonly baseBranch: string | null;
|
|
4059
|
+
|
|
4060
|
+
/**
|
|
4061
|
+
* Makes a head from its parts.
|
|
4062
|
+
*
|
|
4063
|
+
* @param reference The pull request's reference.
|
|
4064
|
+
* @param title Its title, not blank.
|
|
4065
|
+
* @param url Its page, an https address with no user name or password.
|
|
4066
|
+
* @param headBranch The branch it merges from, not blank.
|
|
4067
|
+
* @param baseBranch The branch it merges into, not blank, or null when the host didn't say.
|
|
4068
|
+
* @param reader The reader the values came from, so an error names the field by its path; omitted for values that didn't come from JSON.
|
|
4069
|
+
* @throws {HostingArgumentException} Without a reader, when a part is out of its range, naming the field as the parameter, such as `headBranch`.
|
|
4070
|
+
* @throws {HostingFieldException} With a reader, when a part is out of its range, naming the field by its path, such as `$.headBranch`.
|
|
4071
|
+
* @example
|
|
4072
|
+
* ```ts
|
|
4073
|
+
* import { HostPullRequestHead, HostReference } from "@noldova/git.hosting.protocol";
|
|
4074
|
+
*
|
|
4075
|
+
* const head = new HostPullRequestHead(new HostReference("git-azure-devops", "fabrikam", "site", 214), "Add the sign-in page",
|
|
4076
|
+
* "https://dev.azure.com/fabrikam/web/_git/site/pullrequest/214", "feature/sign-in", "main");
|
|
4077
|
+
* ```
|
|
4078
|
+
*/
|
|
4079
|
+
public constructor(reference: HostReference, title: string, url: string, headBranch: string, baseBranch: string | null, reader?: JsonReader);
|
|
4080
|
+
|
|
4081
|
+
/**
|
|
4082
|
+
* Reads a head from its JSON.
|
|
4083
|
+
*
|
|
4084
|
+
* @param value The JSON, with exactly the fields `toJson` writes.
|
|
4085
|
+
* @param path The JSON's path, `$` by default.
|
|
4086
|
+
* @returns The head.
|
|
4087
|
+
* @throws {JsonException} When the value isn't an object, or a field is missing or of the wrong type; it comes from `@noldova/context.json`.
|
|
4088
|
+
* @throws {HostingFieldException} When the value holds an unknown field, or a field is out of its range.
|
|
4089
|
+
* @example
|
|
4090
|
+
* ```ts
|
|
4091
|
+
* import { HostPullRequestHead } from "@noldova/git.hosting.protocol";
|
|
4092
|
+
*
|
|
4093
|
+
* const head = HostPullRequestHead.fromJson({ reference: { host: "git-azure-devops", owner: "fabrikam", repository: "site", number: 214 },
|
|
4094
|
+
* title: "Add the sign-in page", url: "https://dev.azure.com/fabrikam/web/_git/site/pullrequest/214", headBranch: "feature/sign-in", baseBranch: "main" });
|
|
4095
|
+
* ```
|
|
4096
|
+
*/
|
|
4097
|
+
public static fromJson(value: unknown, path?: string): HostPullRequestHead;
|
|
4098
|
+
|
|
4099
|
+
/**
|
|
4100
|
+
* Writes the head as JSON: `reference`, `title`, `url`, `headBranch` and `baseBranch`.
|
|
4101
|
+
*
|
|
4102
|
+
* @returns The JSON.
|
|
4103
|
+
* @example
|
|
4104
|
+
* ```ts
|
|
4105
|
+
* import type { HostPullRequestHead } from "@noldova/git.hosting.protocol";
|
|
4106
|
+
*
|
|
4107
|
+
* const send = (head: HostPullRequestHead): string => JSON.stringify(head.toJson());
|
|
4108
|
+
* ```
|
|
4109
|
+
*/
|
|
4110
|
+
public toJson(): JsonObject;
|
|
4111
|
+
}
|
|
4112
|
+
|
|
4113
|
+
/**
|
|
4114
|
+
* A repository's open pull requests' heads, at most 100 with the newest first, whether it has more, and whether the host was signed in to read
|
|
4115
|
+
* them: the list stacks are found in, longer than `HostPullRequestList` since it reads nothing for each pull request.
|
|
4116
|
+
*
|
|
4117
|
+
* @example
|
|
4118
|
+
* ```ts
|
|
4119
|
+
* import type { HostPullRequestHeads } from "@noldova/git.hosting.protocol";
|
|
4120
|
+
*
|
|
4121
|
+
* const countOf = (heads: HostPullRequestHeads): string => `${heads.rows.length}${heads.hasMore ? "+" : ""}`;
|
|
4122
|
+
* ```
|
|
4123
|
+
*/
|
|
4124
|
+
export declare class HostPullRequestHeads {
|
|
4125
|
+
/**
|
|
4126
|
+
* The most rows a list of heads holds: 100.
|
|
4127
|
+
*/
|
|
4128
|
+
public static readonly maximumRows: number;
|
|
4129
|
+
|
|
4130
|
+
/**
|
|
4131
|
+
* The open pull requests' heads, the newest first; none while signed out.
|
|
4132
|
+
*/
|
|
4133
|
+
public readonly rows: readonly HostPullRequestHead[];
|
|
4134
|
+
|
|
4135
|
+
/**
|
|
4136
|
+
* Whether the repository has more open pull requests than the 100 rows.
|
|
4137
|
+
*/
|
|
4138
|
+
public readonly hasMore: boolean;
|
|
4139
|
+
|
|
4140
|
+
/**
|
|
4141
|
+
* Whether the host was signed in to read them.
|
|
4142
|
+
*/
|
|
4143
|
+
public readonly isSignedIn: boolean;
|
|
4144
|
+
|
|
4145
|
+
/**
|
|
4146
|
+
* Makes a list of heads from its parts.
|
|
4147
|
+
*
|
|
4148
|
+
* @param rows The rows, at most 100, and none while signed out.
|
|
4149
|
+
* @param hasMore Whether there are more, only with 100 rows.
|
|
4150
|
+
* @param isSignedIn Whether the host was signed in; true by default.
|
|
4151
|
+
* @param reader The reader the values came from, so an error names the field by its path; omitted for values that didn't come from JSON.
|
|
4152
|
+
* @throws {HostingArgumentException} Without a reader, when a part is out of its range, naming the field as the parameter, such as `hasMore`.
|
|
4153
|
+
* @throws {HostingFieldException} With a reader, when a part is out of its range, naming the field by its path, such as `$.hasMore`.
|
|
4154
|
+
* @example
|
|
4155
|
+
* ```ts
|
|
4156
|
+
* import { HostPullRequestHeads } from "@noldova/git.hosting.protocol";
|
|
4157
|
+
*
|
|
4158
|
+
* const empty = new HostPullRequestHeads([], false);
|
|
4159
|
+
* ```
|
|
4160
|
+
*/
|
|
4161
|
+
public constructor(rows: readonly HostPullRequestHead[], hasMore: boolean, isSignedIn?: boolean, reader?: JsonReader);
|
|
4162
|
+
|
|
4163
|
+
/**
|
|
4164
|
+
* The list a host answers while signed out: no rows, and not signed in.
|
|
4165
|
+
*
|
|
4166
|
+
* @returns The list.
|
|
4167
|
+
* @example
|
|
4168
|
+
* ```ts
|
|
4169
|
+
* import { HostPullRequestHeads } from "@noldova/git.hosting.protocol";
|
|
4170
|
+
*
|
|
4171
|
+
* const answer = HostPullRequestHeads.signedOut().toJson();
|
|
4172
|
+
* ```
|
|
4173
|
+
*/
|
|
4174
|
+
public static signedOut(): HostPullRequestHeads;
|
|
4175
|
+
|
|
4176
|
+
/**
|
|
4177
|
+
* Reads a list of heads from its JSON.
|
|
4178
|
+
*
|
|
4179
|
+
* @param value The JSON, with exactly the fields `toJson` writes.
|
|
4180
|
+
* @param path The JSON's path, `$` by default.
|
|
4181
|
+
* @returns The list.
|
|
4182
|
+
* @throws {JsonException} When the value isn't an object, or a field is missing or of the wrong type; it comes from `@noldova/context.json`.
|
|
4183
|
+
* @throws {HostingFieldException} When the value holds an unknown field, or a field is out of its range.
|
|
4184
|
+
* @example
|
|
4185
|
+
* ```ts
|
|
4186
|
+
* import { HostPullRequestHeads } from "@noldova/git.hosting.protocol";
|
|
4187
|
+
*
|
|
4188
|
+
* const heads = HostPullRequestHeads.fromJson({ rows: [], hasMore: false, isSignedIn: false });
|
|
4189
|
+
* ```
|
|
4190
|
+
*/
|
|
4191
|
+
public static fromJson(value: unknown, path?: string): HostPullRequestHeads;
|
|
4192
|
+
|
|
4193
|
+
/**
|
|
4194
|
+
* Writes the list as JSON: `rows`, `hasMore` and `isSignedIn`.
|
|
4195
|
+
*
|
|
4196
|
+
* @returns The JSON.
|
|
4197
|
+
* @example
|
|
4198
|
+
* ```ts
|
|
4199
|
+
* import { HostPullRequestHeads } from "@noldova/git.hosting.protocol";
|
|
4200
|
+
*
|
|
4201
|
+
* console.log(HostPullRequestHeads.signedOut().toJson());
|
|
4202
|
+
* ```
|
|
4203
|
+
*/
|
|
4204
|
+
public toJson(): JsonObject;
|
|
4205
|
+
}
|
|
4206
|
+
|
|
4207
|
+
/**
|
|
4208
|
+
* A commit a pull request brings: its id, its message's first line, its author's name and when they wrote it.
|
|
4209
|
+
*
|
|
4210
|
+
* @example
|
|
4211
|
+
* ```ts
|
|
4212
|
+
* import type { HostPullRequestCommit } from "@noldova/git.hosting.protocol";
|
|
4213
|
+
*
|
|
4214
|
+
* const shortOf = (commit: HostPullRequestCommit): string => commit.id.slice(0, 7);
|
|
4215
|
+
* ```
|
|
4216
|
+
*/
|
|
4217
|
+
export declare class HostPullRequestCommit {
|
|
4218
|
+
/**
|
|
4219
|
+
* The commit's full 40-character id.
|
|
4220
|
+
*/
|
|
4221
|
+
public readonly id: string;
|
|
4222
|
+
|
|
4223
|
+
/**
|
|
4224
|
+
* Its message's first line; empty for an empty message.
|
|
4225
|
+
*/
|
|
4226
|
+
public readonly subject: string;
|
|
4227
|
+
|
|
4228
|
+
/**
|
|
4229
|
+
* Its author's name as the commit holds it.
|
|
4230
|
+
*/
|
|
4231
|
+
public readonly author: string;
|
|
4232
|
+
|
|
4233
|
+
/**
|
|
4234
|
+
* When the author wrote it, in milliseconds since the epoch.
|
|
4235
|
+
*/
|
|
4236
|
+
public readonly authoredAt: number;
|
|
4237
|
+
|
|
4238
|
+
/**
|
|
4239
|
+
* Makes a commit from its parts.
|
|
4240
|
+
*
|
|
4241
|
+
* @param id The full 40-character id.
|
|
4242
|
+
* @param subject The message's first line.
|
|
4243
|
+
* @param author The author's name, not blank.
|
|
4244
|
+
* @param authoredAt When it was written, in milliseconds since the epoch, above zero.
|
|
4245
|
+
* @param reader The reader the values came from, so an error names the field by its path; omitted for values that didn't come from JSON.
|
|
4246
|
+
* @throws {HostingArgumentException} Without a reader, when a part is out of its range, naming the field as the parameter.
|
|
4247
|
+
* @throws {HostingFieldException} With a reader, when a part is out of its range, naming the field by its path.
|
|
4248
|
+
* @example
|
|
4249
|
+
* ```ts
|
|
4250
|
+
* import { HostPullRequestCommit } from "@noldova/git.hosting.protocol";
|
|
4251
|
+
*
|
|
4252
|
+
* const commit = new HostPullRequestCommit("9fceb02d0ae598e95dc970b74767f19372d61af8", "Fix the build", "Mona Lisa", Date.UTC(2026, 10, 23));
|
|
4253
|
+
* ```
|
|
4254
|
+
*/
|
|
4255
|
+
public constructor(id: string, subject: string, author: string, authoredAt: number, reader?: JsonReader);
|
|
4256
|
+
|
|
4257
|
+
/**
|
|
4258
|
+
* Reads it from its JSON.
|
|
4259
|
+
*
|
|
4260
|
+
* @param value The JSON, with exactly the fields `toJson` writes.
|
|
4261
|
+
* @param path The JSON's path, `$` by default.
|
|
4262
|
+
* @returns The value.
|
|
4263
|
+
* @throws {JsonException} When the value isn't an object, or a field is missing or of the wrong type; it comes from `@noldova/context.json`.
|
|
4264
|
+
* @throws {HostingFieldException} When the value holds an unknown field, or a field is out of its range.
|
|
4265
|
+
* @example
|
|
4266
|
+
* ```ts
|
|
4267
|
+
* import { HostPullRequestCommit } from "@noldova/git.hosting.protocol";
|
|
4268
|
+
*
|
|
4269
|
+
* const commit = HostPullRequestCommit.fromJson({ id: "9fceb02d0ae598e95dc970b74767f19372d61af8", subject: "Fix the build", author: "Mona Lisa", authoredAt: 1795000000000 });
|
|
4270
|
+
* ```
|
|
4271
|
+
*/
|
|
4272
|
+
public static fromJson(value: unknown, path?: string): HostPullRequestCommit;
|
|
4273
|
+
|
|
4274
|
+
/**
|
|
4275
|
+
* Writes it as JSON: `id`, `subject`, `author` and `authoredAt`.
|
|
4276
|
+
*
|
|
4277
|
+
* @returns The JSON.
|
|
4278
|
+
* @example
|
|
4279
|
+
* ```ts
|
|
4280
|
+
* import type { HostPullRequestCommit } from "@noldova/git.hosting.protocol";
|
|
4281
|
+
*
|
|
4282
|
+
* const jsonOf = (commit: HostPullRequestCommit): string => JSON.stringify(commit.toJson());
|
|
4283
|
+
* ```
|
|
4284
|
+
*/
|
|
4285
|
+
public toJson(): JsonObject;
|
|
4286
|
+
}
|
|
4287
|
+
|
|
4288
|
+
/**
|
|
4289
|
+
* The commits a pull request brings, the newest first, at most 250, and whether the host has more.
|
|
4290
|
+
*
|
|
4291
|
+
* @example
|
|
4292
|
+
* ```ts
|
|
4293
|
+
* import type { HostPullRequestCommits } from "@noldova/git.hosting.protocol";
|
|
4294
|
+
*
|
|
4295
|
+
* const countOf = (list: HostPullRequestCommits): string => `${list.commits.length}${list.hasMore ? "+" : ""}`;
|
|
4296
|
+
* ```
|
|
4297
|
+
*/
|
|
4298
|
+
export declare class HostPullRequestCommits {
|
|
4299
|
+
/**
|
|
4300
|
+
* The most commits a list holds: 250.
|
|
4301
|
+
*/
|
|
4302
|
+
public static readonly maximumCount: number;
|
|
4303
|
+
|
|
4304
|
+
/**
|
|
4305
|
+
* The commits, the newest first.
|
|
4306
|
+
*/
|
|
4307
|
+
public readonly commits: readonly HostPullRequestCommit[];
|
|
4308
|
+
|
|
4309
|
+
/**
|
|
4310
|
+
* Whether the pull request brings more than the 250 commits.
|
|
4311
|
+
*/
|
|
4312
|
+
public readonly hasMore: boolean;
|
|
4313
|
+
|
|
4314
|
+
/**
|
|
4315
|
+
* Makes a list of commits from its parts.
|
|
4316
|
+
*
|
|
4317
|
+
* @param commits The commits, at most 250.
|
|
4318
|
+
* @param hasMore Whether there are more, only with 250 commits.
|
|
4319
|
+
* @param reader The reader the values came from, so an error names the field by its path; omitted for values that didn't come from JSON.
|
|
4320
|
+
* @throws {HostingArgumentException} Without a reader, when a part is out of its range, naming the field as the parameter.
|
|
4321
|
+
* @throws {HostingFieldException} With a reader, when a part is out of its range, naming the field by its path.
|
|
4322
|
+
* @example
|
|
4323
|
+
* ```ts
|
|
4324
|
+
* import { HostPullRequestCommits } from "@noldova/git.hosting.protocol";
|
|
4325
|
+
*
|
|
4326
|
+
* const none = new HostPullRequestCommits([], false);
|
|
4327
|
+
* ```
|
|
4328
|
+
*/
|
|
4329
|
+
public constructor(commits: readonly HostPullRequestCommit[], hasMore: boolean, reader?: JsonReader);
|
|
4330
|
+
|
|
4331
|
+
/**
|
|
4332
|
+
* Reads it from its JSON.
|
|
4333
|
+
*
|
|
4334
|
+
* @param value The JSON, with exactly the fields `toJson` writes.
|
|
4335
|
+
* @param path The JSON's path, `$` by default.
|
|
4336
|
+
* @returns The value.
|
|
4337
|
+
* @throws {JsonException} When the value isn't an object, or a field is missing or of the wrong type; it comes from `@noldova/context.json`.
|
|
4338
|
+
* @throws {HostingFieldException} When the value holds an unknown field, or a field is out of its range.
|
|
4339
|
+
* @example
|
|
4340
|
+
* ```ts
|
|
4341
|
+
* import { HostPullRequestCommits } from "@noldova/git.hosting.protocol";
|
|
4342
|
+
*
|
|
4343
|
+
* const none = HostPullRequestCommits.fromJson({ commits: [], hasMore: false });
|
|
4344
|
+
* ```
|
|
4345
|
+
*/
|
|
4346
|
+
public static fromJson(value: unknown, path?: string): HostPullRequestCommits;
|
|
4347
|
+
|
|
4348
|
+
/**
|
|
4349
|
+
* Writes it as JSON: `commits` and `hasMore`.
|
|
4350
|
+
*
|
|
4351
|
+
* @returns The JSON.
|
|
4352
|
+
* @example
|
|
4353
|
+
* ```ts
|
|
4354
|
+
* import type { HostPullRequestCommits } from "@noldova/git.hosting.protocol";
|
|
4355
|
+
*
|
|
4356
|
+
* const jsonOf = (list: HostPullRequestCommits): string => JSON.stringify(list.toJson());
|
|
4357
|
+
* ```
|
|
4358
|
+
*/
|
|
4359
|
+
public toJson(): JsonObject;
|
|
4360
|
+
}
|
|
4361
|
+
|
|
4362
|
+
/**
|
|
4363
|
+
* A pull request's comment threads and whether the host has older comments than they hold, such as GitHub's answer, which keeps the newest 100 of each
|
|
4364
|
+
* kind of comment.
|
|
4365
|
+
*
|
|
4366
|
+
* @example
|
|
4367
|
+
* ```ts
|
|
4368
|
+
* import type { HostPullRequestThreads } from "@noldova/git.hosting.protocol";
|
|
4369
|
+
*
|
|
4370
|
+
* const countOf = (list: HostPullRequestThreads): string => `${list.threads.length}${list.hasMore ? "+" : ""}`;
|
|
4371
|
+
* ```
|
|
4372
|
+
*/
|
|
4373
|
+
export declare class HostPullRequestThreads {
|
|
4374
|
+
/**
|
|
4375
|
+
* The threads, oldest first by their first comment.
|
|
4376
|
+
*/
|
|
4377
|
+
public readonly threads: readonly HostThread[];
|
|
4378
|
+
|
|
4379
|
+
/**
|
|
4380
|
+
* Whether the host has older comments than the threads hold.
|
|
4381
|
+
*/
|
|
4382
|
+
public readonly hasMore: boolean;
|
|
4383
|
+
|
|
4384
|
+
/**
|
|
4385
|
+
* Makes a pull request's threads from its parts, copying the list.
|
|
4386
|
+
*
|
|
4387
|
+
* @param threads The threads.
|
|
4388
|
+
* @param hasMore Whether the host has older comments than they hold.
|
|
4389
|
+
* @example
|
|
4390
|
+
* ```ts
|
|
4391
|
+
* import { HostPullRequestThreads } from "@noldova/git.hosting.protocol";
|
|
4392
|
+
*
|
|
4393
|
+
* const none = new HostPullRequestThreads([], false);
|
|
4394
|
+
* ```
|
|
4395
|
+
*/
|
|
4396
|
+
public constructor(threads: readonly HostThread[], hasMore: boolean);
|
|
4397
|
+
|
|
4398
|
+
/**
|
|
4399
|
+
* Reads it from its JSON.
|
|
4400
|
+
*
|
|
4401
|
+
* @param value The JSON, with exactly the fields `toJson` writes.
|
|
4402
|
+
* @param path The JSON's path, `$` by default.
|
|
4403
|
+
* @returns The value.
|
|
4404
|
+
* @throws {JsonException} When the value isn't an object, or a field is missing or of the wrong type; it comes from `@noldova/context.json`.
|
|
4405
|
+
* @throws {HostingFieldException} When the value holds an unknown field, or a thread is out of its range.
|
|
4406
|
+
* @example
|
|
4407
|
+
* ```ts
|
|
4408
|
+
* import { HostPullRequestThreads } from "@noldova/git.hosting.protocol";
|
|
4409
|
+
*
|
|
4410
|
+
* const none = HostPullRequestThreads.fromJson({ threads: [], hasMore: false });
|
|
4411
|
+
* ```
|
|
4412
|
+
*/
|
|
4413
|
+
public static fromJson(value: unknown, path?: string): HostPullRequestThreads;
|
|
4414
|
+
|
|
4415
|
+
/**
|
|
4416
|
+
* Writes it as JSON: `threads` and `hasMore`.
|
|
4417
|
+
*
|
|
4418
|
+
* @returns The JSON.
|
|
4419
|
+
* @example
|
|
4420
|
+
* ```ts
|
|
4421
|
+
* import type { HostPullRequestThreads } from "@noldova/git.hosting.protocol";
|
|
4422
|
+
*
|
|
4423
|
+
* const jsonOf = (list: HostPullRequestThreads): string => JSON.stringify(list.toJson());
|
|
4424
|
+
* ```
|
|
4425
|
+
*/
|
|
4426
|
+
public toJson(): JsonObject;
|
|
4427
|
+
}
|
|
4428
|
+
|
|
4429
|
+
/**
|
|
4430
|
+
* The paths of the files that keep a pull request from merging, at most 100, and whether the host has more.
|
|
4431
|
+
*
|
|
4432
|
+
* @example
|
|
4433
|
+
* ```ts
|
|
4434
|
+
* import type { HostPullRequestConflicts } from "@noldova/git.hosting.protocol";
|
|
4435
|
+
*
|
|
4436
|
+
* const countOf = (list: HostPullRequestConflicts): string => `${list.paths.length}${list.hasMore ? "+" : ""}`;
|
|
4437
|
+
* ```
|
|
4438
|
+
*/
|
|
4439
|
+
export declare class HostPullRequestConflicts {
|
|
4440
|
+
/**
|
|
4441
|
+
* The most paths a list holds: 100.
|
|
4442
|
+
*/
|
|
4443
|
+
public static readonly maximumCount: number;
|
|
4444
|
+
|
|
4445
|
+
/**
|
|
4446
|
+
* The conflicting files' paths in the repository, such as `src/app.ts`.
|
|
4447
|
+
*/
|
|
4448
|
+
public readonly paths: readonly string[];
|
|
4449
|
+
|
|
4450
|
+
/**
|
|
4451
|
+
* Whether the pull request has more than the 100 conflicts.
|
|
4452
|
+
*/
|
|
4453
|
+
public readonly hasMore: boolean;
|
|
4454
|
+
|
|
4455
|
+
/**
|
|
4456
|
+
* Makes a list of conflicts from its parts.
|
|
4457
|
+
*
|
|
4458
|
+
* @param paths The paths, none blank, at most 100.
|
|
4459
|
+
* @param hasMore Whether there are more, only with 100 paths.
|
|
4460
|
+
* @param reader The reader the values came from, so an error names the field by its path; omitted for values that didn't come from JSON.
|
|
4461
|
+
* @throws {HostingArgumentException} Without a reader, when a part is out of its range, naming the field as the parameter.
|
|
4462
|
+
* @throws {HostingFieldException} With a reader, when a part is out of its range, naming the field by its path.
|
|
4463
|
+
* @example
|
|
4464
|
+
* ```ts
|
|
4465
|
+
* import { HostPullRequestConflicts } from "@noldova/git.hosting.protocol";
|
|
4466
|
+
*
|
|
4467
|
+
* const none = new HostPullRequestConflicts([], false);
|
|
4468
|
+
* ```
|
|
4469
|
+
*/
|
|
4470
|
+
public constructor(paths: readonly string[], hasMore: boolean, reader?: JsonReader);
|
|
4471
|
+
|
|
4472
|
+
/**
|
|
4473
|
+
* Reads it from its JSON.
|
|
4474
|
+
*
|
|
4475
|
+
* @param value The JSON, with exactly the fields `toJson` writes.
|
|
4476
|
+
* @param path The JSON's path, `$` by default.
|
|
4477
|
+
* @returns The value.
|
|
4478
|
+
* @throws {JsonException} When the value isn't an object, or a field is missing or of the wrong type; it comes from `@noldova/context.json`.
|
|
4479
|
+
* @throws {HostingFieldException} When the value holds an unknown field, or a field is out of its range.
|
|
4480
|
+
* @example
|
|
4481
|
+
* ```ts
|
|
4482
|
+
* import { HostPullRequestConflicts } from "@noldova/git.hosting.protocol";
|
|
4483
|
+
*
|
|
4484
|
+
* const none = HostPullRequestConflicts.fromJson({ paths: [], hasMore: false });
|
|
4485
|
+
* ```
|
|
4486
|
+
*/
|
|
4487
|
+
public static fromJson(value: unknown, path?: string): HostPullRequestConflicts;
|
|
4488
|
+
|
|
4489
|
+
/**
|
|
4490
|
+
* Writes it as JSON: `paths` and `hasMore`.
|
|
4491
|
+
*
|
|
4492
|
+
* @returns The JSON.
|
|
4493
|
+
* @example
|
|
4494
|
+
* ```ts
|
|
4495
|
+
* import type { HostPullRequestConflicts } from "@noldova/git.hosting.protocol";
|
|
4496
|
+
*
|
|
4497
|
+
* const jsonOf = (value: HostPullRequestConflicts): string => JSON.stringify(value.toJson());
|
|
4498
|
+
* ```
|
|
4499
|
+
*/
|
|
4500
|
+
public toJson(): JsonObject;
|
|
4501
|
+
}
|
|
4502
|
+
|
|
4503
|
+
/**
|
|
4504
|
+
* A file a pull request changes: its path, what the pull request did to it, and for a moved file the path it had.
|
|
4505
|
+
*
|
|
4506
|
+
* @example
|
|
4507
|
+
* ```ts
|
|
4508
|
+
* import type { HostPullRequestFile } from "@noldova/git.hosting.protocol";
|
|
4509
|
+
*
|
|
4510
|
+
* const labelOf = (file: HostPullRequestFile): string => file.previousPath === null ? file.path : `${file.previousPath} → ${file.path}`;
|
|
4511
|
+
* ```
|
|
4512
|
+
*/
|
|
4513
|
+
export declare class HostPullRequestFile {
|
|
4514
|
+
/**
|
|
4515
|
+
* The file's path in the repository, such as `src/app.ts`.
|
|
4516
|
+
*/
|
|
4517
|
+
public readonly path: string;
|
|
4518
|
+
|
|
4519
|
+
/**
|
|
4520
|
+
* What the pull request did to the file.
|
|
4521
|
+
*/
|
|
4522
|
+
public readonly kind: FileChangeKind;
|
|
4523
|
+
|
|
4524
|
+
/**
|
|
4525
|
+
* The path a moved file had; `null` for any other change.
|
|
4526
|
+
*/
|
|
4527
|
+
public readonly previousPath: string | null;
|
|
4528
|
+
|
|
4529
|
+
/**
|
|
4530
|
+
* Makes a changed file from its parts.
|
|
4531
|
+
*
|
|
4532
|
+
* @param path The file's path, not blank.
|
|
4533
|
+
* @param kind What the pull request did to it.
|
|
4534
|
+
* @param previousPath The path it had, not blank, for a moved file only; `null` otherwise.
|
|
4535
|
+
* @param reader The reader the values came from, so an error names the field by its path; omitted for values that didn't come from JSON.
|
|
4536
|
+
* @throws {HostingArgumentException} Without a reader, when a part is out of its range, naming the field as the parameter.
|
|
4537
|
+
* @throws {HostingFieldException} With a reader, when a part is out of its range, naming the field by its path.
|
|
4538
|
+
* @example
|
|
4539
|
+
* ```ts
|
|
4540
|
+
* import { HostPullRequestFile } from "@noldova/git.hosting.protocol";
|
|
4541
|
+
*
|
|
4542
|
+
* const added = new HostPullRequestFile("src/app.ts", "Added", null);
|
|
4543
|
+
* ```
|
|
4544
|
+
*/
|
|
4545
|
+
public constructor(path: string, kind: FileChangeKind, previousPath: string | null, reader?: JsonReader);
|
|
4546
|
+
|
|
4547
|
+
/**
|
|
4548
|
+
* Reads it from its JSON.
|
|
4549
|
+
*
|
|
4550
|
+
* @param value The JSON, with exactly the fields `toJson` writes.
|
|
4551
|
+
* @param path The JSON's path, `$` by default.
|
|
4552
|
+
* @returns The value.
|
|
4553
|
+
* @throws {JsonException} When the value isn't an object, or a field is missing or of the wrong type; it comes from `@noldova/context.json`.
|
|
4554
|
+
* @throws {HostingFieldException} When the value holds an unknown field, or a field is out of its range.
|
|
4555
|
+
* @example
|
|
4556
|
+
* ```ts
|
|
4557
|
+
* import { HostPullRequestFile } from "@noldova/git.hosting.protocol";
|
|
4558
|
+
*
|
|
4559
|
+
* const added = HostPullRequestFile.fromJson({ path: "src/app.ts", kind: "Added", previousPath: null });
|
|
4560
|
+
* ```
|
|
4561
|
+
*/
|
|
4562
|
+
public static fromJson(value: unknown, path?: string): HostPullRequestFile;
|
|
4563
|
+
|
|
4564
|
+
/**
|
|
4565
|
+
* Writes it as JSON: `path`, `kind` and `previousPath`.
|
|
4566
|
+
*
|
|
4567
|
+
* @returns The JSON.
|
|
4568
|
+
* @example
|
|
4569
|
+
* ```ts
|
|
4570
|
+
* import type { HostPullRequestFile } from "@noldova/git.hosting.protocol";
|
|
4571
|
+
*
|
|
4572
|
+
* const jsonOf = (value: HostPullRequestFile): string => JSON.stringify(value.toJson());
|
|
4573
|
+
* ```
|
|
4574
|
+
*/
|
|
4575
|
+
public toJson(): JsonObject;
|
|
4576
|
+
}
|
|
4577
|
+
|
|
4578
|
+
/**
|
|
4579
|
+
* The files a pull request changes at its latest push, at most 5000, and whether the host has more, with that push's head commit and the commit its changes count from.
|
|
4580
|
+
*
|
|
4581
|
+
* @example
|
|
4582
|
+
* ```ts
|
|
4583
|
+
* import type { HostPullRequestFiles } from "@noldova/git.hosting.protocol";
|
|
4584
|
+
*
|
|
4585
|
+
* const countOf = (list: HostPullRequestFiles): string => `${list.files.length}${list.hasMore ? "+" : ""}`;
|
|
4586
|
+
* ```
|
|
4587
|
+
*/
|
|
4588
|
+
export declare class HostPullRequestFiles {
|
|
4589
|
+
/**
|
|
4590
|
+
* The most files a list holds: 5000.
|
|
4591
|
+
*/
|
|
4592
|
+
public static readonly maximumCount: number;
|
|
4593
|
+
|
|
4594
|
+
/**
|
|
4595
|
+
* The latest push's head commit; `null` when the host doesn't show the pull request.
|
|
4596
|
+
*/
|
|
4597
|
+
public readonly sourceCommit: string | null;
|
|
4598
|
+
|
|
4599
|
+
/**
|
|
4600
|
+
* The commit the changes count from, where the target branch and the pull request's branch meet; `null` when the host doesn't say.
|
|
4601
|
+
*/
|
|
4602
|
+
public readonly commonCommit: string | null;
|
|
4603
|
+
|
|
4604
|
+
/**
|
|
4605
|
+
* The changed files, in the host's order.
|
|
4606
|
+
*/
|
|
4607
|
+
public readonly files: readonly HostPullRequestFile[];
|
|
4608
|
+
|
|
4609
|
+
/**
|
|
4610
|
+
* Whether the host lists more files than the list holds.
|
|
4611
|
+
*/
|
|
4612
|
+
public readonly hasMore: boolean;
|
|
4613
|
+
|
|
4614
|
+
/**
|
|
4615
|
+
* Makes a list of changed files from its parts.
|
|
4616
|
+
*
|
|
4617
|
+
* @param sourceCommit The head commit, 40 hexadecimal digits, or `null` with no common commit and no files.
|
|
4618
|
+
* @param commonCommit The commit the changes count from, 40 hexadecimal digits, or `null`.
|
|
4619
|
+
* @param files The files, at most 5000.
|
|
4620
|
+
* @param hasMore Whether there are more, only with a head commit.
|
|
4621
|
+
* @param reader The reader the values came from, so an error names the field by its path; omitted for values that didn't come from JSON.
|
|
4622
|
+
* @throws {HostingArgumentException} Without a reader, when a part is out of its range, naming the field as the parameter.
|
|
4623
|
+
* @throws {HostingFieldException} With a reader, when a part is out of its range, naming the field by its path.
|
|
4624
|
+
* @example
|
|
4625
|
+
* ```ts
|
|
4626
|
+
* import { HostPullRequestFiles } from "@noldova/git.hosting.protocol";
|
|
4627
|
+
*
|
|
4628
|
+
* const none = new HostPullRequestFiles(null, null, [], false);
|
|
4629
|
+
* ```
|
|
4630
|
+
*/
|
|
4631
|
+
public constructor(sourceCommit: string | null, commonCommit: string | null, files: readonly HostPullRequestFile[], hasMore: boolean, reader?: JsonReader);
|
|
4632
|
+
|
|
4633
|
+
/**
|
|
4634
|
+
* Reads it from its JSON.
|
|
4635
|
+
*
|
|
4636
|
+
* @param value The JSON, with exactly the fields `toJson` writes.
|
|
4637
|
+
* @param path The JSON's path, `$` by default.
|
|
4638
|
+
* @returns The value.
|
|
4639
|
+
* @throws {JsonException} When the value isn't an object, or a field is missing or of the wrong type; it comes from `@noldova/context.json`.
|
|
4640
|
+
* @throws {HostingFieldException} When the value holds an unknown field, or a field is out of its range.
|
|
4641
|
+
* @example
|
|
4642
|
+
* ```ts
|
|
4643
|
+
* import { HostPullRequestFiles } from "@noldova/git.hosting.protocol";
|
|
4644
|
+
*
|
|
4645
|
+
* const none = HostPullRequestFiles.fromJson({ sourceCommit: null, commonCommit: null, files: [], hasMore: false });
|
|
4646
|
+
* ```
|
|
4647
|
+
*/
|
|
4648
|
+
public static fromJson(value: unknown, path?: string): HostPullRequestFiles;
|
|
4649
|
+
|
|
4650
|
+
/**
|
|
4651
|
+
* Writes it as JSON: `sourceCommit`, `commonCommit`, `files` and `hasMore`.
|
|
4652
|
+
*
|
|
4653
|
+
* @returns The JSON.
|
|
4654
|
+
* @example
|
|
4655
|
+
* ```ts
|
|
4656
|
+
* import type { HostPullRequestFiles } from "@noldova/git.hosting.protocol";
|
|
4657
|
+
*
|
|
4658
|
+
* const jsonOf = (value: HostPullRequestFiles): string => JSON.stringify(value.toJson());
|
|
4659
|
+
* ```
|
|
4660
|
+
*/
|
|
4661
|
+
public toJson(): JsonObject;
|
|
4662
|
+
}
|
|
4663
|
+
|
|
4664
|
+
/**
|
|
4665
|
+
* One push to a pull request: its number, who pushed it and when, the commit it brought the pull request to and the commit its changes count from.
|
|
4666
|
+
*
|
|
4667
|
+
* @example
|
|
4668
|
+
* ```ts
|
|
4669
|
+
* import type { HostPullRequestUpdate } from "@noldova/git.hosting.protocol";
|
|
4670
|
+
*
|
|
4671
|
+
* const titleOf = (update: HostPullRequestUpdate): string => `Update ${update.number}`;
|
|
4672
|
+
* ```
|
|
4673
|
+
*/
|
|
4674
|
+
export declare class HostPullRequestUpdate {
|
|
4675
|
+
/**
|
|
4676
|
+
* The update's number, from 1 for the pull request's first push.
|
|
4677
|
+
*/
|
|
4678
|
+
public readonly number: number;
|
|
4679
|
+
|
|
4680
|
+
/**
|
|
4681
|
+
* Who pushed it; null when the host doesn't say.
|
|
4682
|
+
*/
|
|
4683
|
+
public readonly author: HostPerson | null;
|
|
4684
|
+
|
|
4685
|
+
/**
|
|
4686
|
+
* When it was pushed, in milliseconds since the epoch.
|
|
4687
|
+
*/
|
|
4688
|
+
public readonly createdAt: number;
|
|
4689
|
+
|
|
4690
|
+
/**
|
|
4691
|
+
* The pull request's head commit after this update.
|
|
4692
|
+
*/
|
|
4693
|
+
public readonly sourceCommit: string;
|
|
4694
|
+
|
|
4695
|
+
/**
|
|
4696
|
+
* The commit the changes count from, the last one the head shares with the target branch; null when the host names none.
|
|
4697
|
+
*/
|
|
4698
|
+
public readonly commonCommit: string | null;
|
|
4699
|
+
|
|
4700
|
+
/**
|
|
4701
|
+
* Makes an update from its parts.
|
|
4702
|
+
*
|
|
4703
|
+
* @param number The update's number, above zero.
|
|
4704
|
+
* @param author Who pushed it, or null.
|
|
4705
|
+
* @param createdAt When it was pushed, in milliseconds since the epoch, above zero.
|
|
4706
|
+
* @param sourceCommit The head commit's full id.
|
|
4707
|
+
* @param commonCommit The common commit's full id, or null.
|
|
4708
|
+
* @param reader The reader the values came from, so an error names the field by its path; omitted for values that didn't come from JSON.
|
|
4709
|
+
* @throws {HostingArgumentException} Without a reader, when a part is out of its range, naming the field as the parameter.
|
|
4710
|
+
* @throws {HostingFieldException} With a reader, when a part is out of its range, naming the field by its path.
|
|
4711
|
+
* @example
|
|
4712
|
+
* ```ts
|
|
4713
|
+
* import { HostPullRequestUpdate } from "@noldova/git.hosting.protocol";
|
|
4714
|
+
*
|
|
4715
|
+
* const update = new HostPullRequestUpdate(1, null, Date.UTC(2026, 10, 23), "9fceb02d0ae598e95dc970b74767f19372d61af8", null);
|
|
4716
|
+
* ```
|
|
4717
|
+
*/
|
|
4718
|
+
public constructor(number: number, author: HostPerson | null, createdAt: number, sourceCommit: string, commonCommit: string | null, reader?: JsonReader);
|
|
4719
|
+
|
|
4720
|
+
/**
|
|
4721
|
+
* Reads it from its JSON.
|
|
4722
|
+
*
|
|
4723
|
+
* @param value The JSON, with exactly the fields `toJson` writes.
|
|
4724
|
+
* @param path The JSON's path, `$` by default.
|
|
4725
|
+
* @returns The value.
|
|
4726
|
+
* @throws {JsonException} When the value isn't an object, or a field is missing or of the wrong type; it comes from `@noldova/context.json`.
|
|
4727
|
+
* @throws {HostingFieldException} When the value holds an unknown field, or a field is out of its range.
|
|
4728
|
+
* @example
|
|
4729
|
+
* ```ts
|
|
4730
|
+
* import { HostPullRequestUpdate } from "@noldova/git.hosting.protocol";
|
|
4731
|
+
*
|
|
4732
|
+
* const update = HostPullRequestUpdate.fromJson({ number: 1, author: null, createdAt: 1795000000000, sourceCommit: "9fceb02d0ae598e95dc970b74767f19372d61af8", commonCommit: null });
|
|
4733
|
+
* ```
|
|
4734
|
+
*/
|
|
4735
|
+
public static fromJson(value: unknown, path?: string): HostPullRequestUpdate;
|
|
4736
|
+
|
|
4737
|
+
/**
|
|
4738
|
+
* Writes it as JSON: `number`, `author`, `createdAt`, `sourceCommit` and `commonCommit`.
|
|
4739
|
+
*
|
|
4740
|
+
* @returns The JSON.
|
|
4741
|
+
* @example
|
|
4742
|
+
* ```ts
|
|
4743
|
+
* import type { HostPullRequestUpdate } from "@noldova/git.hosting.protocol";
|
|
4744
|
+
*
|
|
4745
|
+
* const jsonOf = (update: HostPullRequestUpdate): string => JSON.stringify(update.toJson());
|
|
4746
|
+
* ```
|
|
4747
|
+
*/
|
|
4748
|
+
public toJson(): JsonObject;
|
|
4749
|
+
}
|
|
4750
|
+
|
|
4751
|
+
/**
|
|
4752
|
+
* The pushes to a pull request, the newest first, at most 100, and whether the host has more.
|
|
4753
|
+
*
|
|
4754
|
+
* @example
|
|
4755
|
+
* ```ts
|
|
4756
|
+
* import type { HostPullRequestUpdates } from "@noldova/git.hosting.protocol";
|
|
4757
|
+
*
|
|
4758
|
+
* const latestOf = (list: HostPullRequestUpdates): number | null => list.updates[0]?.number ?? null;
|
|
4759
|
+
* ```
|
|
4760
|
+
*/
|
|
4761
|
+
export declare class HostPullRequestUpdates {
|
|
4762
|
+
/**
|
|
4763
|
+
* The most updates a list holds: 100.
|
|
4764
|
+
*/
|
|
4765
|
+
public static readonly maximumCount: number;
|
|
4766
|
+
|
|
4767
|
+
/**
|
|
4768
|
+
* The updates, the newest first.
|
|
4769
|
+
*/
|
|
4770
|
+
public readonly updates: readonly HostPullRequestUpdate[];
|
|
4771
|
+
|
|
4772
|
+
/**
|
|
4773
|
+
* Whether the pull request has more than the 100 updates.
|
|
4774
|
+
*/
|
|
4775
|
+
public readonly hasMore: boolean;
|
|
4776
|
+
|
|
4777
|
+
/**
|
|
4778
|
+
* Makes a list of updates from its parts.
|
|
4779
|
+
*
|
|
4780
|
+
* @param updates The updates, at most 100.
|
|
4781
|
+
* @param hasMore Whether there are more, only with 100 updates.
|
|
4782
|
+
* @param reader The reader the values came from, so an error names the field by its path; omitted for values that didn't come from JSON.
|
|
4783
|
+
* @throws {HostingArgumentException} Without a reader, when a part is out of its range, naming the field as the parameter.
|
|
4784
|
+
* @throws {HostingFieldException} With a reader, when a part is out of its range, naming the field by its path.
|
|
4785
|
+
* @example
|
|
4786
|
+
* ```ts
|
|
4787
|
+
* import { HostPullRequestUpdates } from "@noldova/git.hosting.protocol";
|
|
4788
|
+
*
|
|
4789
|
+
* const none = new HostPullRequestUpdates([], false);
|
|
4790
|
+
* ```
|
|
4791
|
+
*/
|
|
4792
|
+
public constructor(updates: readonly HostPullRequestUpdate[], hasMore: boolean, reader?: JsonReader);
|
|
4793
|
+
|
|
4794
|
+
/**
|
|
4795
|
+
* Reads it from its JSON.
|
|
4796
|
+
*
|
|
4797
|
+
* @param value The JSON, with exactly the fields `toJson` writes.
|
|
4798
|
+
* @param path The JSON's path, `$` by default.
|
|
4799
|
+
* @returns The value.
|
|
4800
|
+
* @throws {JsonException} When the value isn't an object, or a field is missing or of the wrong type; it comes from `@noldova/context.json`.
|
|
4801
|
+
* @throws {HostingFieldException} When the value holds an unknown field, or a field is out of its range.
|
|
4802
|
+
* @example
|
|
4803
|
+
* ```ts
|
|
4804
|
+
* import { HostPullRequestUpdates } from "@noldova/git.hosting.protocol";
|
|
4805
|
+
*
|
|
4806
|
+
* const none = HostPullRequestUpdates.fromJson({ updates: [], hasMore: false });
|
|
4807
|
+
* ```
|
|
4808
|
+
*/
|
|
4809
|
+
public static fromJson(value: unknown, path?: string): HostPullRequestUpdates;
|
|
4810
|
+
|
|
4811
|
+
/**
|
|
4812
|
+
* Writes it as JSON: `updates` and `hasMore`.
|
|
4813
|
+
*
|
|
4814
|
+
* @returns The JSON.
|
|
4815
|
+
* @example
|
|
4816
|
+
* ```ts
|
|
4817
|
+
* import type { HostPullRequestUpdates } from "@noldova/git.hosting.protocol";
|
|
4818
|
+
*
|
|
4819
|
+
* const jsonOf = (list: HostPullRequestUpdates): string => JSON.stringify(list.toJson());
|
|
4820
|
+
* ```
|
|
4821
|
+
*/
|
|
4822
|
+
public toJson(): JsonObject;
|
|
4823
|
+
}
|
|
4824
|
+
|
|
4825
|
+
/**
|
|
4826
|
+
* An open pull request that asks the signed-in person for a review: its reference, title, page, whether it is a draft, and when it was opened.
|
|
4827
|
+
*
|
|
4828
|
+
* @example
|
|
4829
|
+
* ```ts
|
|
4830
|
+
* import type { HostReviewRequest } from "@noldova/git.hosting.protocol";
|
|
4831
|
+
*
|
|
4832
|
+
* const describe = (request: HostReviewRequest): string => `Review #${request.reference.number} ${request.title}`;
|
|
4833
|
+
* ```
|
|
4834
|
+
*/
|
|
4835
|
+
export declare class HostReviewRequest {
|
|
4836
|
+
/**
|
|
4837
|
+
* The pull request's reference on its host.
|
|
4838
|
+
*/
|
|
4839
|
+
public readonly reference: HostReference;
|
|
4840
|
+
|
|
4841
|
+
/**
|
|
4842
|
+
* Its title, never blank.
|
|
4843
|
+
*/
|
|
4844
|
+
public readonly title: string;
|
|
4845
|
+
|
|
4846
|
+
/**
|
|
4847
|
+
* Its page on the host, an https address.
|
|
4848
|
+
*/
|
|
4849
|
+
public readonly url: string;
|
|
4850
|
+
|
|
4851
|
+
/**
|
|
4852
|
+
* Whether it is a draft.
|
|
4853
|
+
*/
|
|
4854
|
+
public readonly isDraft: boolean;
|
|
4855
|
+
|
|
4856
|
+
/**
|
|
4857
|
+
* When it was opened, in milliseconds since the Unix epoch.
|
|
4858
|
+
*/
|
|
4859
|
+
public readonly createdAt: number;
|
|
4860
|
+
|
|
4861
|
+
/**
|
|
4862
|
+
* Makes a review request from its parts.
|
|
4863
|
+
*
|
|
4864
|
+
* @param reference The pull request's reference.
|
|
4865
|
+
* @param title Its title, not blank.
|
|
4866
|
+
* @param url Its page, an https address.
|
|
4867
|
+
* @param isDraft Whether it is a draft.
|
|
4868
|
+
* @param createdAt When it was opened, a positive whole number of milliseconds since the Unix epoch.
|
|
4869
|
+
* @param reader The reader the values came from, so an error names the field by its path; omitted for values that didn't come from JSON.
|
|
4870
|
+
* @throws {HostingArgumentException} Without a reader, when a part is out of its range, naming the field as the parameter, such as `title`.
|
|
4871
|
+
* @throws {HostingFieldException} With a reader, when a part is out of its range, naming the field by its path, such as `$.title`.
|
|
4872
|
+
* @example
|
|
4873
|
+
* ```ts
|
|
4874
|
+
* import { HostReference, HostReviewRequest } from "@noldova/git.hosting.protocol";
|
|
4875
|
+
*
|
|
4876
|
+
* const request = new HostReviewRequest(new HostReference("git-github", "octocat", "hello-world", 533), "Sign in with a passkey",
|
|
4877
|
+
* "https://github.com/octocat/hello-world/pull/533", false, Date.parse("2026-11-20T09:00:00Z"));
|
|
4878
|
+
* ```
|
|
4879
|
+
*/
|
|
4880
|
+
public constructor(reference: HostReference, title: string, url: string, isDraft: boolean, createdAt: number, reader?: JsonReader);
|
|
4881
|
+
|
|
4882
|
+
/**
|
|
4883
|
+
* Reads a review request from its JSON.
|
|
4884
|
+
*
|
|
4885
|
+
* @param value The JSON, with exactly the fields `toJson` writes.
|
|
4886
|
+
* @param path The JSON's path, `$` by default.
|
|
4887
|
+
* @returns The review request.
|
|
4888
|
+
* @throws {JsonException} When the value isn't an object, or a field is missing or of the wrong type; it comes from `@noldova/context.json`.
|
|
4889
|
+
* @throws {HostingFieldException} When the value holds an unknown field, or a field is out of its range.
|
|
4890
|
+
* @example
|
|
4891
|
+
* ```ts
|
|
4892
|
+
* import { HostReviewRequest } from "@noldova/git.hosting.protocol";
|
|
4893
|
+
*
|
|
4894
|
+
* const read = (json: unknown): HostReviewRequest => HostReviewRequest.fromJson(json, "$.request");
|
|
4895
|
+
* ```
|
|
4896
|
+
*/
|
|
4897
|
+
public static fromJson(value: unknown, path?: string): HostReviewRequest;
|
|
4898
|
+
|
|
4899
|
+
/**
|
|
4900
|
+
* Writes the review request as JSON: `reference`, `title`, `url`, `isDraft` and `createdAt`.
|
|
4901
|
+
*
|
|
4902
|
+
* @returns The JSON.
|
|
4903
|
+
* @example
|
|
4904
|
+
* ```ts
|
|
4905
|
+
* import type { HostReviewRequest } from "@noldova/git.hosting.protocol";
|
|
4906
|
+
*
|
|
4907
|
+
* const send = (request: HostReviewRequest): string => JSON.stringify(request.toJson());
|
|
4908
|
+
* ```
|
|
4909
|
+
*/
|
|
4910
|
+
public toJson(): JsonObject;
|
|
4911
|
+
}
|
|
4912
|
+
|
|
4913
|
+
/**
|
|
4914
|
+
* The open pull requests on a repository that ask the signed-in person for a review, the newest first, whether the host's answer was cut, and
|
|
4915
|
+
* whether the host was signed in to read them.
|
|
4916
|
+
*
|
|
4917
|
+
* @example
|
|
4918
|
+
* ```ts
|
|
4919
|
+
* import type { HostReviewRequestList } from "@noldova/git.hosting.protocol";
|
|
4920
|
+
*
|
|
4921
|
+
* const countOf = (list: HostReviewRequestList): string => `${list.rows.length}${list.hasMore ? "+" : ""}`;
|
|
4922
|
+
* ```
|
|
4923
|
+
*/
|
|
4924
|
+
export declare class HostCommitComments {
|
|
4925
|
+
/**
|
|
4926
|
+
* The most comments a count holds: 100, one page of the host's answer.
|
|
4927
|
+
*/
|
|
4928
|
+
public static readonly maximumCount: number;
|
|
4929
|
+
|
|
4930
|
+
/**
|
|
4931
|
+
* The review comments on the commit, from 0 to 100.
|
|
4932
|
+
*/
|
|
4933
|
+
public readonly count: number;
|
|
4934
|
+
|
|
4935
|
+
/**
|
|
4936
|
+
* Whether a page of the host's answer was full, so there may be more than the count; only with comments.
|
|
4937
|
+
*/
|
|
4938
|
+
public readonly isCapped: boolean;
|
|
4939
|
+
|
|
4940
|
+
/**
|
|
4941
|
+
* The https page on the host that shows the comments; null exactly when there are none.
|
|
4942
|
+
*/
|
|
4943
|
+
public readonly url: string | null;
|
|
4944
|
+
|
|
4945
|
+
/**
|
|
4946
|
+
* Makes a count from its parts.
|
|
4947
|
+
*
|
|
4948
|
+
* @param count The comments, from 0 to 100.
|
|
4949
|
+
* @param isCapped Whether a page of the host's answer was full, only with comments.
|
|
4950
|
+
* @param url The https page that shows them, null exactly when the count is 0.
|
|
4951
|
+
* @param reader The reader the values came from, so an error names the field by its path; omitted for values that didn't come from JSON.
|
|
4952
|
+
* @throws {HostingArgumentException} Without a reader, when a part is out of its range, naming the field as the parameter, such as `count`.
|
|
4953
|
+
* @throws {HostingFieldException} With a reader, when a part is out of its range, naming the field by its path, such as `$.count`.
|
|
4954
|
+
* @example
|
|
4955
|
+
* ```ts
|
|
4956
|
+
* import { HostCommitComments } from "@noldova/git.hosting.protocol";
|
|
4957
|
+
*
|
|
4958
|
+
* const three = new HostCommitComments(3, false, "https://github.com/octocat/hello-world/commit/9fceb02d0ae598e95dc970b74767f19372d61af8");
|
|
4959
|
+
* ```
|
|
4960
|
+
*/
|
|
4961
|
+
public constructor(count: number, isCapped: boolean, url: string | null, reader?: JsonReader);
|
|
4962
|
+
|
|
4963
|
+
/**
|
|
4964
|
+
* The count a host answers when it has no comments to count: none, not capped, and no page.
|
|
4965
|
+
*
|
|
4966
|
+
* @returns The count.
|
|
4967
|
+
* @example
|
|
4968
|
+
* ```ts
|
|
4969
|
+
* import { HostCommitComments } from "@noldova/git.hosting.protocol";
|
|
4970
|
+
*
|
|
4971
|
+
* const answer = HostCommitComments.none().toJson();
|
|
4972
|
+
* ```
|
|
4973
|
+
*/
|
|
4974
|
+
public static none(): HostCommitComments;
|
|
4975
|
+
|
|
4976
|
+
/**
|
|
4977
|
+
* Reads a count from JSON, refusing a field it doesn't define.
|
|
4978
|
+
*
|
|
4979
|
+
* @param value The JSON.
|
|
4980
|
+
* @param path The JSON's path, `$` by default.
|
|
4981
|
+
* @returns The count.
|
|
4982
|
+
* @throws {JsonException} When the value isn't an object, or a field is missing or of the wrong type; it comes from `@noldova/context.json`.
|
|
4983
|
+
* @throws {HostingFieldException} When a field is unknown or out of its range.
|
|
4984
|
+
* @example
|
|
4985
|
+
* ```ts
|
|
4986
|
+
* import { HostCommitComments } from "@noldova/git.hosting.protocol";
|
|
4987
|
+
*
|
|
4988
|
+
* const comments = HostCommitComments.fromJson({ count: 0, isCapped: false, url: null });
|
|
4989
|
+
* ```
|
|
4990
|
+
*/
|
|
4991
|
+
public static fromJson(value: unknown, path?: string): HostCommitComments;
|
|
4992
|
+
|
|
4993
|
+
/**
|
|
4994
|
+
* Writes the count as JSON: `count`, `isCapped` and `url`.
|
|
4995
|
+
*
|
|
4996
|
+
* @returns The JSON.
|
|
4997
|
+
* @example
|
|
4998
|
+
* ```ts
|
|
4999
|
+
* import type { HostCommitComments } from "@noldova/git.hosting.protocol";
|
|
5000
|
+
*
|
|
5001
|
+
* const send = (comments: HostCommitComments): string => JSON.stringify(comments.toJson());
|
|
5002
|
+
* ```
|
|
5003
|
+
*/
|
|
5004
|
+
public toJson(): JsonObject;
|
|
5005
|
+
}
|
|
5006
|
+
|
|
5007
|
+
export declare class HostReviewRequestList {
|
|
5008
|
+
/**
|
|
5009
|
+
* The most rows a list holds: 100.
|
|
5010
|
+
*/
|
|
5011
|
+
public static readonly maximumRows: number;
|
|
5012
|
+
|
|
5013
|
+
/**
|
|
5014
|
+
* The review requests, the newest first; none while signed out.
|
|
5015
|
+
*/
|
|
5016
|
+
public readonly rows: readonly HostReviewRequest[];
|
|
5017
|
+
|
|
5018
|
+
/**
|
|
5019
|
+
* Whether the host's answer was cut, so the repository may have review requests past these rows. A host that reads every repository of the
|
|
5020
|
+
* account in one answer sets it on each repository's list when that answer was cut.
|
|
5021
|
+
*/
|
|
5022
|
+
public readonly hasMore: boolean;
|
|
5023
|
+
|
|
5024
|
+
/**
|
|
5025
|
+
* Whether the host was signed in to read them.
|
|
5026
|
+
*/
|
|
5027
|
+
public readonly isSignedIn: boolean;
|
|
5028
|
+
|
|
5029
|
+
/**
|
|
5030
|
+
* Makes a list from its parts.
|
|
5031
|
+
*
|
|
5032
|
+
* @param rows The rows, at most 100, and none while signed out.
|
|
5033
|
+
* @param hasMore Whether the host's answer was cut, only while signed in.
|
|
5034
|
+
* @param isSignedIn Whether the host was signed in; true by default.
|
|
5035
|
+
* @param reader The reader the values came from, so an error names the field by its path; omitted for values that didn't come from JSON.
|
|
5036
|
+
* @throws {HostingArgumentException} Without a reader, when a part is out of its range, naming the field as the parameter, such as `rows`.
|
|
5037
|
+
* @throws {HostingFieldException} With a reader, when a part is out of its range, naming the field by its path, such as `$.rows`.
|
|
5038
|
+
* @example
|
|
5039
|
+
* ```ts
|
|
5040
|
+
* import { HostReviewRequestList } from "@noldova/git.hosting.protocol";
|
|
5041
|
+
*
|
|
5042
|
+
* const empty = new HostReviewRequestList([], false);
|
|
5043
|
+
* ```
|
|
5044
|
+
*/
|
|
5045
|
+
public constructor(rows: readonly HostReviewRequest[], hasMore: boolean, isSignedIn?: boolean, reader?: JsonReader);
|
|
5046
|
+
|
|
5047
|
+
/**
|
|
5048
|
+
* The list a host answers while signed out: no rows, and not signed in.
|
|
5049
|
+
*
|
|
5050
|
+
* @returns The list.
|
|
5051
|
+
* @example
|
|
5052
|
+
* ```ts
|
|
5053
|
+
* import { HostReviewRequestList } from "@noldova/git.hosting.protocol";
|
|
5054
|
+
*
|
|
5055
|
+
* const answer = HostReviewRequestList.signedOut().toJson();
|
|
5056
|
+
* ```
|
|
5057
|
+
*/
|
|
5058
|
+
public static signedOut(): HostReviewRequestList;
|
|
5059
|
+
|
|
5060
|
+
/**
|
|
5061
|
+
* Reads a list from its JSON.
|
|
5062
|
+
*
|
|
5063
|
+
* @param value The JSON, with exactly the fields `toJson` writes.
|
|
5064
|
+
* @param path The JSON's path, `$` by default.
|
|
5065
|
+
* @returns The list.
|
|
5066
|
+
* @throws {JsonException} When the value isn't an object, or a field is missing or of the wrong type; it comes from `@noldova/context.json`.
|
|
5067
|
+
* @throws {HostingFieldException} When the value holds an unknown field, or a field is out of its range.
|
|
5068
|
+
* @example
|
|
5069
|
+
* ```ts
|
|
5070
|
+
* import { HostReviewRequestList } from "@noldova/git.hosting.protocol";
|
|
5071
|
+
*
|
|
5072
|
+
* const list = HostReviewRequestList.fromJson({ rows: [], hasMore: false, isSignedIn: false });
|
|
5073
|
+
* ```
|
|
5074
|
+
*/
|
|
5075
|
+
public static fromJson(value: unknown, path?: string): HostReviewRequestList;
|
|
5076
|
+
|
|
5077
|
+
/**
|
|
5078
|
+
* Writes the list as JSON: `rows`, `hasMore` and `isSignedIn`.
|
|
5079
|
+
*
|
|
5080
|
+
* @returns The JSON.
|
|
5081
|
+
* @example
|
|
5082
|
+
* ```ts
|
|
5083
|
+
* import { HostReviewRequestList } from "@noldova/git.hosting.protocol";
|
|
5084
|
+
*
|
|
5085
|
+
* console.log(HostReviewRequestList.signedOut().toJson());
|
|
5086
|
+
* ```
|
|
5087
|
+
*/
|
|
5088
|
+
public toJson(): JsonObject;
|
|
5089
|
+
}
|