Ben Rohlfs | 9ec190e | 2021-07-05 17:11:13 +0200 | [diff] [blame] | 1 | /** |
| 2 | * @license |
| 3 | * Copyright (C) 2021 The Android Open Source Project |
| 4 | * |
| 5 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 6 | * you may not use this file except in compliance with the License. |
| 7 | * You may obtain a copy of the License at |
| 8 | * |
| 9 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | * |
| 11 | * Unless required by applicable law or agreed to in writing, software |
| 12 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 14 | * See the License for the specific language governing permissions and |
| 15 | * limitations under the License. |
| 16 | */ |
| 17 | |
| 18 | /** |
| 19 | * rest-api.ts contains all entities from the Gerrit REST API that are also |
| 20 | * relevant to plugins and gr-diff users. These entities should be exactly what |
| 21 | * the backend defines and returns and should eventually be generated. |
| 22 | * |
| 23 | * Sorting order: |
| 24 | * - enums in alphabetical order |
| 25 | * - types and interfaces in alphabetical order |
| 26 | * - type checking functions after their corresponding type |
| 27 | */ |
| 28 | |
| 29 | /** |
| 30 | * enums ======================================================================= |
| 31 | */ |
| 32 | |
Ben Rohlfs | 9ec190e | 2021-07-05 17:11:13 +0200 | [diff] [blame] | 33 | /** |
Ben Rohlfs | c830b27 | 2021-07-09 12:32:00 +0200 | [diff] [blame] | 34 | * The authentication type that is configured on the server. |
| 35 | * https://gerrit-review.googlesource.com/Documentation/rest-api-config.html#auth-info |
| 36 | */ |
| 37 | export enum AuthType { |
| 38 | OPENID = 'OPENID', |
| 39 | OPENID_SSO = 'OPENID_SSO', |
| 40 | OAUTH = 'OAUTH', |
| 41 | HTTP = 'HTTP', |
| 42 | HTTP_LDAP = 'HTTP_LDAP', |
| 43 | CLIENT_SSL_CERT_LDAP = 'CLIENT_SSL_CERT_LDAP', |
| 44 | LDAP = 'LDAP', |
| 45 | LDAP_BIND = 'LDAP_BIND', |
| 46 | CUSTOM_EXTENSION = 'CUSTOM_EXTENSION', |
| 47 | DEVELOPMENT_BECOME_ANY_ACCOUNT = 'DEVELOPMENT_BECOME_ANY_ACCOUNT', |
| 48 | } |
| 49 | |
| 50 | /** |
Ben Rohlfs | 9ec190e | 2021-07-05 17:11:13 +0200 | [diff] [blame] | 51 | * @desc Specifies status for a change |
| 52 | */ |
| 53 | export enum ChangeStatus { |
| 54 | ABANDONED = 'ABANDONED', |
| 55 | MERGED = 'MERGED', |
| 56 | NEW = 'NEW', |
| 57 | } |
| 58 | |
| 59 | /** |
Ben Rohlfs | cab9421 | 2021-07-08 12:51:56 +0200 | [diff] [blame] | 60 | * The type in ConfigParameterInfo entity. |
| 61 | * https://gerrit-review.googlesource.com/Documentation/rest-api-projects.html#config-parameter-info |
| 62 | */ |
| 63 | export enum ConfigParameterInfoType { |
| 64 | // Should be kept in sync with |
| 65 | // gerrit/java/com/google/gerrit/extensions/api/projects/ProjectConfigEntryType.java. |
| 66 | STRING = 'STRING', |
| 67 | INT = 'INT', |
| 68 | LONG = 'LONG', |
| 69 | BOOLEAN = 'BOOLEAN', |
| 70 | LIST = 'LIST', |
| 71 | ARRAY = 'ARRAY', |
| 72 | } |
| 73 | |
| 74 | /** |
Ben Rohlfs | c830b27 | 2021-07-09 12:32:00 +0200 | [diff] [blame] | 75 | * @desc Used for server config of accounts |
| 76 | */ |
| 77 | export enum DefaultDisplayNameConfig { |
| 78 | USERNAME = 'USERNAME', |
| 79 | FIRST_NAME = 'FIRST_NAME', |
| 80 | FULL_NAME = 'FULL_NAME', |
| 81 | } |
| 82 | |
| 83 | /** |
| 84 | * Account fields that are editable |
| 85 | * https://gerrit-review.googlesource.com/Documentation/rest-api-config.html#auth-info |
| 86 | */ |
| 87 | export enum EditableAccountField { |
| 88 | FULL_NAME = 'FULL_NAME', |
| 89 | USER_NAME = 'USER_NAME', |
| 90 | REGISTER_NEW_EMAIL = 'REGISTER_NEW_EMAIL', |
| 91 | } |
| 92 | |
| 93 | /** |
Ben Rohlfs | 9ec190e | 2021-07-05 17:11:13 +0200 | [diff] [blame] | 94 | * @desc The status of the file |
| 95 | */ |
| 96 | export enum FileInfoStatus { |
| 97 | ADDED = 'A', |
| 98 | DELETED = 'D', |
| 99 | RENAMED = 'R', |
| 100 | COPIED = 'C', |
| 101 | REWRITTEN = 'W', |
| 102 | // Modifed = 'M', // but API not set it if the file was modified |
| 103 | UNMODIFIED = 'U', // Not returned by BE, but added by UI for certain files |
| 104 | } |
| 105 | |
| 106 | /** |
| 107 | * @desc The status of the file |
| 108 | */ |
| 109 | export enum GpgKeyInfoStatus { |
| 110 | BAD = 'BAD', |
| 111 | OK = 'OK', |
| 112 | TRUSTED = 'TRUSTED', |
| 113 | } |
| 114 | |
| 115 | /** |
| 116 | * Enum for all http methods used in Gerrit. |
| 117 | */ |
| 118 | export enum HttpMethod { |
| 119 | HEAD = 'HEAD', |
| 120 | POST = 'POST', |
| 121 | GET = 'GET', |
| 122 | DELETE = 'DELETE', |
| 123 | PUT = 'PUT', |
| 124 | } |
| 125 | |
| 126 | /** |
Ben Rohlfs | cab9421 | 2021-07-08 12:51:56 +0200 | [diff] [blame] | 127 | * Enum for possible configured value in InheritedBooleanInfo. |
| 128 | * https://gerrit-review.googlesource.com/Documentation/rest-api-projects.html#inherited-boolean-info |
| 129 | */ |
| 130 | export enum InheritedBooleanInfoConfiguredValue { |
| 131 | TRUE = 'TRUE', |
| 132 | FALSE = 'FALSE', |
| 133 | INHERITED = 'INHERITED', |
| 134 | } |
| 135 | |
| 136 | /** |
Ben Rohlfs | c830b27 | 2021-07-09 12:32:00 +0200 | [diff] [blame] | 137 | * This setting determines when Gerrit computes if a change is mergeable or not. |
| 138 | * https://gerrit-review.googlesource.com/Documentation/config-gerrit.html#change.mergeabilityComputationBehavior |
| 139 | */ |
| 140 | export enum MergeabilityComputationBehavior { |
| 141 | API_REF_UPDATED_AND_CHANGE_REINDEX = 'API_REF_UPDATED_AND_CHANGE_REINDEX', |
| 142 | REF_UPDATED_AND_CHANGE_REINDEX = 'REF_UPDATED_AND_CHANGE_REINDEX', |
| 143 | NEVER = 'NEVER', |
| 144 | } |
| 145 | |
| 146 | /** |
Ben Rohlfs | 9ec190e | 2021-07-05 17:11:13 +0200 | [diff] [blame] | 147 | * @desc The status of fixing the problem |
| 148 | */ |
| 149 | export enum ProblemInfoStatus { |
| 150 | FIXED = 'FIXED', |
| 151 | FIX_FAILED = 'FIX_FAILED', |
| 152 | } |
| 153 | |
| 154 | /** |
Ben Rohlfs | cab9421 | 2021-07-08 12:51:56 +0200 | [diff] [blame] | 155 | * @desc The state of the projects |
| 156 | */ |
| 157 | export enum ProjectState { |
| 158 | ACTIVE = 'ACTIVE', |
| 159 | READ_ONLY = 'READ_ONLY', |
| 160 | HIDDEN = 'HIDDEN', |
| 161 | } |
| 162 | |
| 163 | /** |
Ben Rohlfs | 9ec190e | 2021-07-05 17:11:13 +0200 | [diff] [blame] | 164 | * @desc The reviewer state |
| 165 | */ |
| 166 | export enum RequirementStatus { |
| 167 | OK = 'OK', |
| 168 | NOT_READY = 'NOT_READY', |
| 169 | RULE_ERROR = 'RULE_ERROR', |
| 170 | } |
| 171 | |
| 172 | /** |
| 173 | * @desc The reviewer state |
| 174 | */ |
| 175 | export enum ReviewerState { |
| 176 | REVIEWER = 'REVIEWER', |
| 177 | CC = 'CC', |
| 178 | REMOVED = 'REMOVED', |
| 179 | } |
| 180 | |
| 181 | /** |
| 182 | * @desc The patchset kind |
| 183 | */ |
| 184 | export enum RevisionKind { |
| 185 | REWORK = 'REWORK', |
| 186 | TRIVIAL_REBASE = 'TRIVIAL_REBASE', |
| 187 | MERGE_FIRST_PARENT_UPDATE = 'MERGE_FIRST_PARENT_UPDATE', |
| 188 | NO_CODE_CHANGE = 'NO_CODE_CHANGE', |
| 189 | NO_CHANGE = 'NO_CHANGE', |
| 190 | } |
| 191 | |
| 192 | /** |
| 193 | * All supported submit types. |
| 194 | * https://gerrit-review.googlesource.com/Documentation/rest-api-projects.html#submit-type-info |
| 195 | */ |
| 196 | export enum SubmitType { |
| 197 | MERGE_IF_NECESSARY = 'MERGE_IF_NECESSARY', |
| 198 | FAST_FORWARD_ONLY = 'FAST_FORWARD_ONLY', |
| 199 | REBASE_IF_NECESSARY = 'REBASE_IF_NECESSARY', |
| 200 | REBASE_ALWAYS = 'REBASE_ALWAYS', |
| 201 | MERGE_ALWAYS = 'MERGE_ALWAYS ', |
| 202 | CHERRY_PICK = 'CHERRY_PICK', |
| 203 | INHERIT = 'INHERIT', |
| 204 | } |
| 205 | |
| 206 | /** |
| 207 | * types and interfaces ======================================================== |
| 208 | */ |
| 209 | |
| 210 | // This is a "meta type", so it comes first and is not sored alphabetically with |
| 211 | // the other types. |
| 212 | export type BrandType<T, BrandName extends string> = T & |
| 213 | {[__brand in BrandName]: never}; |
| 214 | |
| 215 | export type AccountId = BrandType<number, '_accountId'>; |
| 216 | |
| 217 | /** |
| 218 | * The AccountInfo entity contains information about an account. |
| 219 | * https://gerrit-review.googlesource.com/Documentation/rest-api-accounts.html#account-info |
| 220 | */ |
| 221 | export declare interface AccountInfo { |
| 222 | // Normally _account_id is defined (for known Gerrit users), but users can |
| 223 | // also be CCed just with their email address. So you have to be prepared that |
| 224 | // _account_id is undefined, but then email must be set. |
| 225 | _account_id?: AccountId; |
| 226 | name?: string; |
| 227 | display_name?: string; |
| 228 | // Must be set, if _account_id is undefined. |
| 229 | email?: EmailAddress; |
| 230 | secondary_emails?: string[]; |
| 231 | username?: string; |
| 232 | avatars?: AvatarInfo[]; |
| 233 | _more_accounts?: boolean; // not set if false |
| 234 | status?: string; // status message of the account |
| 235 | inactive?: boolean; // not set if false |
frankborden2@gmail.com | c1ef127 | 2021-09-03 15:42:38 +0200 | [diff] [blame] | 236 | tags?: string[]; |
Ben Rohlfs | 9ec190e | 2021-07-05 17:11:13 +0200 | [diff] [blame] | 237 | } |
| 238 | |
| 239 | /** |
Frank Borden | e0d1a58 | 2021-09-06 11:48:38 +0000 | [diff] [blame] | 240 | * The AccountDetailInfo entity contains detailed information about an account. |
| 241 | * https://gerrit-review.googlesource.com/Documentation/rest-api-accounts.html#account-detail-info |
| 242 | */ |
Ben Rohlfs | 22b0148 | 2021-09-28 11:28:19 +0200 | [diff] [blame] | 243 | export declare interface AccountDetailInfo extends AccountInfo { |
Frank Borden | e0d1a58 | 2021-09-06 11:48:38 +0000 | [diff] [blame] | 244 | registered_on: Timestamp; |
| 245 | } |
| 246 | |
| 247 | /** |
Ben Rohlfs | c830b27 | 2021-07-09 12:32:00 +0200 | [diff] [blame] | 248 | * The AccountsConfigInfo entity contains information about Gerrit configuration |
| 249 | * from the accounts section. |
| 250 | * https://gerrit-review.googlesource.com/Documentation/rest-api-config.html#accounts-config-info |
| 251 | */ |
Ben Rohlfs | 22b0148 | 2021-09-28 11:28:19 +0200 | [diff] [blame] | 252 | export declare interface AccountsConfigInfo { |
Ben Rohlfs | c830b27 | 2021-07-09 12:32:00 +0200 | [diff] [blame] | 253 | visibility: string; |
| 254 | default_display_name: DefaultDisplayNameConfig; |
| 255 | } |
| 256 | |
| 257 | /** |
Ben Rohlfs | 9ec190e | 2021-07-05 17:11:13 +0200 | [diff] [blame] | 258 | * The ActionInfo entity describes a REST API call the client can make to |
| 259 | * manipulate a resource. These are frequently implemented by plugins and may |
| 260 | * be discovered at runtime. |
| 261 | * https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#action-info |
| 262 | */ |
| 263 | export declare interface ActionInfo { |
| 264 | method?: HttpMethod; // Most actions use POST, PUT or DELETE to cause state changes. |
| 265 | label?: string; // Short title to display to a user describing the action |
| 266 | title?: string; // Longer text to display describing the action |
| 267 | enabled?: boolean; // not set if false |
| 268 | } |
| 269 | |
| 270 | export declare interface ActionNameToActionInfoMap { |
| 271 | [actionType: string]: ActionInfo | undefined; |
| 272 | // List of actions explicitly used in code: |
| 273 | wip?: ActionInfo; |
| 274 | publishEdit?: ActionInfo; |
| 275 | rebaseEdit?: ActionInfo; |
| 276 | deleteEdit?: ActionInfo; |
| 277 | edit?: ActionInfo; |
| 278 | stopEdit?: ActionInfo; |
| 279 | download?: ActionInfo; |
| 280 | rebase?: ActionInfo; |
| 281 | cherrypick?: ActionInfo; |
| 282 | move?: ActionInfo; |
| 283 | revert?: ActionInfo; |
| 284 | revert_submission?: ActionInfo; |
| 285 | abandon?: ActionInfo; |
| 286 | submit?: ActionInfo; |
| 287 | topic?: ActionInfo; |
| 288 | hashtags?: ActionInfo; |
| 289 | assignee?: ActionInfo; |
| 290 | ready?: ActionInfo; |
| 291 | includedIn?: ActionInfo; |
| 292 | } |
| 293 | |
| 294 | /** |
| 295 | * The ApprovalInfo entity contains information about an approval from auser |
| 296 | * for a label on a change. |
| 297 | * https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#approval-info |
| 298 | */ |
| 299 | export declare interface ApprovalInfo extends AccountInfo { |
| 300 | value?: number; |
| 301 | permitted_voting_range?: VotingRangeInfo; |
| 302 | date?: Timestamp; |
| 303 | tag?: ReviewInputTag; |
| 304 | post_submit?: boolean; // not set if false |
| 305 | } |
| 306 | |
| 307 | /** |
| 308 | * The AttentionSetInfo entity contains details of users that are in the attention set. |
| 309 | * https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#attention-set-info |
| 310 | */ |
| 311 | export declare interface AttentionSetInfo { |
| 312 | account: AccountInfo; |
| 313 | last_update?: Timestamp; |
| 314 | reason?: string; |
Marija Savtchouk | 546976f | 2021-07-19 17:48:02 +0100 | [diff] [blame] | 315 | reason_account?: AccountInfo; |
Ben Rohlfs | 9ec190e | 2021-07-05 17:11:13 +0200 | [diff] [blame] | 316 | } |
| 317 | |
| 318 | /** |
Ben Rohlfs | c830b27 | 2021-07-09 12:32:00 +0200 | [diff] [blame] | 319 | * The AuthInfo entity contains information about the authentication |
| 320 | * configuration of the Gerrit server. |
| 321 | * https://gerrit-review.googlesource.com/Documentation/rest-api-config.html#auth-info |
| 322 | */ |
Ben Rohlfs | 22b0148 | 2021-09-28 11:28:19 +0200 | [diff] [blame] | 323 | export declare interface AuthInfo { |
Ben Rohlfs | c830b27 | 2021-07-09 12:32:00 +0200 | [diff] [blame] | 324 | auth_type: AuthType; // docs incorrectly names it 'type' |
| 325 | use_contributor_agreements?: boolean; |
| 326 | contributor_agreements?: ContributorAgreementInfo[]; |
| 327 | editable_account_fields: EditableAccountField[]; |
| 328 | login_url?: string; |
| 329 | login_text?: string; |
| 330 | switch_account_url?: string; |
| 331 | register_url?: string; |
| 332 | register_text?: string; |
| 333 | edit_full_name_url?: string; |
| 334 | http_password_url?: string; |
| 335 | git_basic_auth_policy?: string; |
| 336 | } |
| 337 | |
| 338 | /** |
Ben Rohlfs | 9ec190e | 2021-07-05 17:11:13 +0200 | [diff] [blame] | 339 | * The AvartarInfo entity contains information about an avatar image ofan |
| 340 | * account. |
| 341 | * https://gerrit-review.googlesource.com/Documentation/rest-api-accounts.html#avatar-info |
| 342 | */ |
| 343 | export declare interface AvatarInfo { |
| 344 | url: string; |
| 345 | height: number; |
| 346 | width: number; |
| 347 | } |
| 348 | |
| 349 | export type BasePatchSetNum = BrandType<'PARENT' | number, '_patchSet'>; |
| 350 | // The refs/heads/ prefix is omitted in Branch name |
| 351 | |
| 352 | export type BranchName = BrandType<string, '_branchName'>; |
| 353 | |
Ben Rohlfs | c830b27 | 2021-07-09 12:32:00 +0200 | [diff] [blame] | 354 | /** |
| 355 | * The ChangeConfigInfo entity contains information about Gerrit configuration |
| 356 | * from the change section. |
| 357 | * https://gerrit-review.googlesource.com/Documentation/rest-api-config.html#change-config-info |
| 358 | */ |
Ben Rohlfs | 22b0148 | 2021-09-28 11:28:19 +0200 | [diff] [blame] | 359 | export declare interface ChangeConfigInfo { |
Ben Rohlfs | c830b27 | 2021-07-09 12:32:00 +0200 | [diff] [blame] | 360 | allow_blame?: boolean; |
| 361 | large_change: number; |
| 362 | update_delay: number; |
| 363 | submit_whole_topic?: boolean; |
| 364 | disable_private_changes?: boolean; |
| 365 | mergeability_computation_behavior: MergeabilityComputationBehavior; |
| 366 | enable_assignee: boolean; |
| 367 | } |
| 368 | |
Ben Rohlfs | 9ec190e | 2021-07-05 17:11:13 +0200 | [diff] [blame] | 369 | export type ChangeId = BrandType<string, '_changeId'>; |
| 370 | |
| 371 | /** |
| 372 | * The ChangeInfo entity contains information about a change. |
| 373 | * https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#change-info |
| 374 | */ |
| 375 | export declare interface ChangeInfo { |
| 376 | id: ChangeInfoId; |
| 377 | project: RepoName; |
| 378 | branch: BranchName; |
| 379 | topic?: TopicName; |
| 380 | attention_set?: IdToAttentionSetMap; |
| 381 | assignee?: AccountInfo; |
| 382 | hashtags?: Hashtag[]; |
| 383 | change_id: ChangeId; |
| 384 | subject: string; |
| 385 | status: ChangeStatus; |
| 386 | created: Timestamp; |
| 387 | updated: Timestamp; |
| 388 | submitted?: Timestamp; |
| 389 | submitter?: AccountInfo; |
| 390 | starred?: boolean; // not set if false |
| 391 | stars?: StarLabel[]; |
| 392 | reviewed?: boolean; // not set if false |
| 393 | submit_type?: SubmitType; |
| 394 | mergeable?: boolean; |
| 395 | submittable?: boolean; |
| 396 | insertions: number; // Number of inserted lines |
| 397 | deletions: number; // Number of deleted lines |
| 398 | total_comment_count?: number; |
| 399 | unresolved_comment_count?: number; |
| 400 | _number: NumericChangeId; |
| 401 | owner: AccountInfo; |
| 402 | actions?: ActionNameToActionInfoMap; |
| 403 | requirements?: Requirement[]; |
| 404 | labels?: LabelNameToInfoMap; |
| 405 | permitted_labels?: LabelNameToValueMap; |
| 406 | removable_reviewers?: AccountInfo[]; |
| 407 | // This is documented as optional, but actually always set. |
| 408 | reviewers: Reviewers; |
| 409 | pending_reviewers?: AccountInfo[]; |
| 410 | reviewer_updates?: ReviewerUpdateInfo[]; |
| 411 | messages?: ChangeMessageInfo[]; |
| 412 | current_revision?: CommitId; |
| 413 | revisions?: {[revisionId: string]: RevisionInfo}; |
| 414 | tracking_ids?: TrackingIdInfo[]; |
| 415 | _more_changes?: boolean; // not set if false |
| 416 | problems?: ProblemInfo[]; |
| 417 | is_private?: boolean; // not set if false |
| 418 | work_in_progress?: boolean; // not set if false |
| 419 | has_review_started?: boolean; // not set if false |
| 420 | revert_of?: NumericChangeId; |
| 421 | submission_id?: ChangeSubmissionId; |
| 422 | cherry_pick_of_change?: NumericChangeId; |
| 423 | cherry_pick_of_patch_set?: PatchSetNum; |
| 424 | contains_git_conflicts?: boolean; |
| 425 | internalHost?: string; // TODO(TS): provide an explanation what is its |
Milutin Kristofic | 3424f6e | 2021-08-05 13:02:16 +0200 | [diff] [blame] | 426 | submit_requirements?: SubmitRequirementResultInfo[]; |
Ben Rohlfs | 9ec190e | 2021-07-05 17:11:13 +0200 | [diff] [blame] | 427 | } |
| 428 | |
| 429 | // The ID of the change in the format "'<project>~<branch>~<Change-Id>'" |
| 430 | export type ChangeInfoId = BrandType<string, '_changeInfoId'>; |
| 431 | |
| 432 | export type ChangeMessageId = BrandType<string, '_changeMessageId'>; |
| 433 | |
| 434 | /** |
| 435 | * The ChangeMessageInfo entity contains information about a message attached |
| 436 | * to a change. |
| 437 | * https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#change-message-info |
| 438 | */ |
| 439 | export declare interface ChangeMessageInfo { |
| 440 | id: ChangeMessageId; |
| 441 | author?: AccountInfo; |
| 442 | reviewer?: AccountInfo; |
| 443 | updated_by?: AccountInfo; |
| 444 | real_author?: AccountInfo; |
| 445 | date: Timestamp; |
| 446 | message: string; |
| 447 | accounts_in_message?: AccountInfo[]; |
| 448 | tag?: ReviewInputTag; |
| 449 | _revision_number?: PatchSetNum; |
| 450 | } |
| 451 | |
| 452 | // This ID is equal to the numeric ID of the change that triggered the |
| 453 | // submission. If the change that triggered the submission also has a topic, it |
| 454 | // will be "<id>-<topic>" of the change that triggered the submission |
| 455 | // The callers must not rely on the format of the submission ID. |
| 456 | export type ChangeSubmissionId = BrandType< |
| 457 | string | number, |
| 458 | '_changeSubmissionId' |
| 459 | >; |
| 460 | |
Ben Rohlfs | c830b27 | 2021-07-09 12:32:00 +0200 | [diff] [blame] | 461 | export type CloneCommandMap = {[name: string]: string}; |
| 462 | |
Ben Rohlfs | cab9421 | 2021-07-08 12:51:56 +0200 | [diff] [blame] | 463 | /** |
| 464 | * The CommentLinkInfo entity describes acommentlink. |
| 465 | * https://gerrit-review.googlesource.com/Documentation/rest-api-projects.html#commentlink-info |
| 466 | */ |
Ben Rohlfs | 22b0148 | 2021-09-28 11:28:19 +0200 | [diff] [blame] | 467 | export declare interface CommentLinkInfo { |
Ben Rohlfs | cab9421 | 2021-07-08 12:51:56 +0200 | [diff] [blame] | 468 | match: string; |
| 469 | link?: string; |
| 470 | enabled?: boolean; |
| 471 | html?: string; |
| 472 | } |
| 473 | |
Ben Rohlfs | 22b0148 | 2021-09-28 11:28:19 +0200 | [diff] [blame] | 474 | export declare interface CommentLinks { |
Ben Rohlfs | cab9421 | 2021-07-08 12:51:56 +0200 | [diff] [blame] | 475 | [name: string]: CommentLinkInfo; |
| 476 | } |
| 477 | |
Ben Rohlfs | 9ec190e | 2021-07-05 17:11:13 +0200 | [diff] [blame] | 478 | export type CommitId = BrandType<string, '_commitId'>; |
| 479 | |
| 480 | /** |
| 481 | * The CommitInfo entity contains information about a commit. |
| 482 | * https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#commit-info |
| 483 | */ |
| 484 | export declare interface CommitInfo { |
| 485 | commit?: CommitId; |
| 486 | parents: ParentCommitInfo[]; |
| 487 | author: GitPersonInfo; |
| 488 | committer: GitPersonInfo; |
| 489 | subject: string; |
| 490 | message: string; |
| 491 | web_links?: WebLinkInfo[]; |
| 492 | resolve_conflicts_web_links?: WebLinkInfo[]; |
| 493 | } |
| 494 | |
Ben Rohlfs | 22b0148 | 2021-09-28 11:28:19 +0200 | [diff] [blame] | 495 | export declare interface ConfigArrayParameterInfo |
| 496 | extends ConfigParameterInfoBase { |
Ben Rohlfs | cab9421 | 2021-07-08 12:51:56 +0200 | [diff] [blame] | 497 | type: ConfigParameterInfoType.ARRAY; |
| 498 | values: string[]; |
| 499 | } |
| 500 | |
| 501 | /** |
| 502 | * The ConfigInfo entity contains information about the effective |
| 503 | * project configuration. |
| 504 | * https://gerrit-review.googlesource.com/Documentation/rest-api-projects.html#config-info |
| 505 | */ |
Ben Rohlfs | 22b0148 | 2021-09-28 11:28:19 +0200 | [diff] [blame] | 506 | export declare interface ConfigInfo { |
Ben Rohlfs | cab9421 | 2021-07-08 12:51:56 +0200 | [diff] [blame] | 507 | description?: string; |
| 508 | use_contributor_agreements?: InheritedBooleanInfo; |
| 509 | use_content_merge?: InheritedBooleanInfo; |
| 510 | use_signed_off_by?: InheritedBooleanInfo; |
| 511 | create_new_change_for_all_not_in_target?: InheritedBooleanInfo; |
| 512 | require_change_id?: InheritedBooleanInfo; |
| 513 | enable_signed_push?: InheritedBooleanInfo; |
| 514 | require_signed_push?: InheritedBooleanInfo; |
| 515 | reject_implicit_merges?: InheritedBooleanInfo; |
| 516 | private_by_default: InheritedBooleanInfo; |
| 517 | work_in_progress_by_default: InheritedBooleanInfo; |
| 518 | max_object_size_limit: MaxObjectSizeLimitInfo; |
| 519 | default_submit_type: SubmitTypeInfo; |
| 520 | submit_type: SubmitType; |
| 521 | match_author_to_committer_date?: InheritedBooleanInfo; |
| 522 | state?: ProjectState; |
| 523 | commentlinks: CommentLinks; |
| 524 | plugin_config?: PluginNameToPluginParametersMap; |
| 525 | actions?: {[viewName: string]: ActionInfo}; |
| 526 | reject_empty_commit?: InheritedBooleanInfo; |
| 527 | } |
| 528 | |
Ben Rohlfs | 22b0148 | 2021-09-28 11:28:19 +0200 | [diff] [blame] | 529 | export declare interface ConfigListParameterInfo |
| 530 | extends ConfigParameterInfoBase { |
Ben Rohlfs | cab9421 | 2021-07-08 12:51:56 +0200 | [diff] [blame] | 531 | type: ConfigParameterInfoType.LIST; |
| 532 | permitted_values?: string[]; |
| 533 | } |
| 534 | |
| 535 | export type ConfigParameterInfo = |
| 536 | | ConfigParameterInfoBase |
| 537 | | ConfigArrayParameterInfo |
| 538 | | ConfigListParameterInfo; |
| 539 | |
| 540 | /** |
| 541 | * The ConfigParameterInfo entity describes a project configurationparameter. |
| 542 | * https://gerrit-review.googlesource.com/Documentation/rest-api-projects.html#config-parameter-info |
| 543 | */ |
Ben Rohlfs | 22b0148 | 2021-09-28 11:28:19 +0200 | [diff] [blame] | 544 | export declare interface ConfigParameterInfoBase { |
Ben Rohlfs | cab9421 | 2021-07-08 12:51:56 +0200 | [diff] [blame] | 545 | display_name?: string; |
| 546 | description?: string; |
| 547 | warning?: string; |
| 548 | type: ConfigParameterInfoType; |
| 549 | value?: string; |
| 550 | values?: string[]; |
| 551 | editable?: boolean; |
| 552 | permitted_values?: string[]; |
| 553 | inheritable?: boolean; |
| 554 | configured_value?: string; |
| 555 | inherited_value?: string; |
| 556 | } |
| 557 | |
Ben Rohlfs | c830b27 | 2021-07-09 12:32:00 +0200 | [diff] [blame] | 558 | // https://gerrit-review.googlesource.com/Documentation/rest-api-accounts.html#contributor-agreement-info |
Ben Rohlfs | 22b0148 | 2021-09-28 11:28:19 +0200 | [diff] [blame] | 559 | export declare interface ContributorAgreementInfo { |
Ben Rohlfs | c830b27 | 2021-07-09 12:32:00 +0200 | [diff] [blame] | 560 | name: string; |
| 561 | description: string; |
| 562 | url: string; |
| 563 | auto_verify_group?: GroupInfo; |
| 564 | } |
| 565 | |
Ben Rohlfs | 9ec190e | 2021-07-05 17:11:13 +0200 | [diff] [blame] | 566 | /** |
| 567 | * LabelInfo when DETAILED_LABELS are requested. |
| 568 | * https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#_fields_set_by_code_detailed_labels_code |
| 569 | */ |
| 570 | export declare interface DetailedLabelInfo extends LabelCommonInfo { |
| 571 | // This is not set when the change has no reviewers. |
| 572 | all?: ApprovalInfo[]; |
| 573 | // Docs claim that 'values' is optional, but it is actually always set. |
| 574 | values?: LabelValueToDescriptionMap; // A map of all values that are allowed for this label |
| 575 | default_value?: number; |
| 576 | } |
| 577 | |
| 578 | export function isDetailedLabelInfo( |
| 579 | label: LabelInfo |
| 580 | ): label is DetailedLabelInfo | (QuickLabelInfo & DetailedLabelInfo) { |
| 581 | return !!(label as DetailedLabelInfo).values; |
| 582 | } |
| 583 | |
Ben Rohlfs | c830b27 | 2021-07-09 12:32:00 +0200 | [diff] [blame] | 584 | /** |
| 585 | * The DownloadInfo entity contains information about supported download |
| 586 | * options. |
| 587 | * https://gerrit-review.googlesource.com/Documentation/rest-api-config.html#download-info |
| 588 | */ |
Ben Rohlfs | 22b0148 | 2021-09-28 11:28:19 +0200 | [diff] [blame] | 589 | export declare interface DownloadInfo { |
Ben Rohlfs | c830b27 | 2021-07-09 12:32:00 +0200 | [diff] [blame] | 590 | schemes: SchemesInfoMap; |
| 591 | archives: string[]; |
| 592 | } |
| 593 | |
| 594 | /** |
| 595 | * The DownloadSchemeInfo entity contains information about a supported download |
| 596 | * scheme and its commands. |
| 597 | * https://gerrit-review.googlesource.com/Documentation/rest-api-config.html |
| 598 | */ |
Ben Rohlfs | 22b0148 | 2021-09-28 11:28:19 +0200 | [diff] [blame] | 599 | export declare interface DownloadSchemeInfo { |
Ben Rohlfs | c830b27 | 2021-07-09 12:32:00 +0200 | [diff] [blame] | 600 | url: string; |
| 601 | is_auth_required: boolean; |
| 602 | is_auth_supported: boolean; |
| 603 | commands: string; |
| 604 | clone_commands: CloneCommandMap; |
| 605 | } |
| 606 | |
Ben Rohlfs | 9ec190e | 2021-07-05 17:11:13 +0200 | [diff] [blame] | 607 | export type EmailAddress = BrandType<string, '_emailAddress'>; |
| 608 | |
| 609 | /** |
| 610 | * The FetchInfo entity contains information about how to fetch a patchset via |
| 611 | * a certain protocol. |
| 612 | * https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#fetch-info |
| 613 | */ |
| 614 | export declare interface FetchInfo { |
| 615 | url: string; |
| 616 | ref: string; |
| 617 | commands?: {[commandName: string]: string}; |
| 618 | } |
| 619 | |
| 620 | /** |
| 621 | * The FileInfo entity contains information about a file in a patch set. |
| 622 | * https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#file-info |
| 623 | */ |
| 624 | export declare interface FileInfo { |
| 625 | status?: FileInfoStatus; |
| 626 | binary?: boolean; // not set if false |
| 627 | old_path?: string; |
| 628 | lines_inserted?: number; |
| 629 | lines_deleted?: number; |
| 630 | size_delta: number; // in bytes |
| 631 | size: number; // in bytes |
| 632 | } |
| 633 | |
Ben Rohlfs | c830b27 | 2021-07-09 12:32:00 +0200 | [diff] [blame] | 634 | /** |
| 635 | * The GerritInfo entity contains information about Gerrit configuration from |
| 636 | * the gerrit section. |
| 637 | * https://gerrit-review.googlesource.com/Documentation/rest-api-config.html#gerrit-info |
| 638 | */ |
Ben Rohlfs | 22b0148 | 2021-09-28 11:28:19 +0200 | [diff] [blame] | 639 | export declare interface GerritInfo { |
Ben Rohlfs | c830b27 | 2021-07-09 12:32:00 +0200 | [diff] [blame] | 640 | all_projects: string; // Doc contains incorrect name |
| 641 | all_users: string; // Doc contains incorrect name |
| 642 | doc_search: boolean; |
| 643 | doc_url?: string; |
| 644 | edit_gpg_keys?: boolean; |
| 645 | report_bug_url?: string; |
| 646 | // The following property is missed in doc |
| 647 | primary_weblink_name?: string; |
| 648 | } |
| 649 | |
Ben Rohlfs | 9ec190e | 2021-07-05 17:11:13 +0200 | [diff] [blame] | 650 | export type GitRef = BrandType<string, '_gitRef'>; |
| 651 | // The 40-char (plus spaces) hex GPG key fingerprint |
| 652 | |
| 653 | export type GpgKeyFingerprint = BrandType<string, '_gpgKeyFingerprint'>; |
| 654 | // The 8-char hex GPG key ID. |
| 655 | |
| 656 | export type GpgKeyId = BrandType<string, '_gpgKeyId'>; |
| 657 | |
| 658 | /** |
| 659 | * The GpgKeyInfo entity contains information about a GPG public key. |
| 660 | * https://gerrit-review.googlesource.com/Documentation/rest-api-accounts.html#gpg-key-info |
| 661 | */ |
| 662 | export declare interface GpgKeyInfo { |
| 663 | id?: GpgKeyId; |
| 664 | fingerprint?: GpgKeyFingerprint; |
| 665 | user_ids?: OpenPgpUserIds[]; |
| 666 | key?: string; // ASCII armored public key material |
| 667 | status?: GpgKeyInfoStatus; |
| 668 | problems?: string[]; |
| 669 | } |
| 670 | |
| 671 | /** |
| 672 | * The GitPersonInfo entity contains information about theauthor/committer of |
| 673 | * a commit. |
| 674 | * https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#git-person-info |
| 675 | */ |
| 676 | export declare interface GitPersonInfo { |
| 677 | name: string; |
| 678 | email: EmailAddress; |
| 679 | date: Timestamp; |
| 680 | tz: TimezoneOffset; |
| 681 | } |
| 682 | |
Ben Rohlfs | c830b27 | 2021-07-09 12:32:00 +0200 | [diff] [blame] | 683 | export type GroupId = BrandType<string, '_groupId'>; |
| 684 | |
| 685 | /** |
| 686 | * The GroupInfo entity contains information about a group. This can be a |
| 687 | * Gerrit internal group, or an external group that is known to Gerrit. |
| 688 | * https://gerrit-review.googlesource.com/Documentation/rest-api-groups.html#group-info |
| 689 | */ |
Ben Rohlfs | 22b0148 | 2021-09-28 11:28:19 +0200 | [diff] [blame] | 690 | export declare interface GroupInfo { |
Ben Rohlfs | c830b27 | 2021-07-09 12:32:00 +0200 | [diff] [blame] | 691 | id: GroupId; |
| 692 | name?: GroupName; |
| 693 | url?: string; |
| 694 | options?: GroupOptionsInfo; |
| 695 | description?: string; |
Paladox none | 613f0c2 | 2021-08-11 07:08:01 +0000 | [diff] [blame] | 696 | group_id?: number; |
Ben Rohlfs | c830b27 | 2021-07-09 12:32:00 +0200 | [diff] [blame] | 697 | owner?: string; |
| 698 | owner_id?: string; |
| 699 | created_on?: string; |
| 700 | _more_groups?: boolean; |
| 701 | members?: AccountInfo[]; |
| 702 | includes?: GroupInfo[]; |
| 703 | } |
| 704 | |
| 705 | export type GroupName = BrandType<string, '_groupName'>; |
| 706 | |
| 707 | /** |
| 708 | * Options of the group. |
| 709 | * https://gerrit-review.googlesource.com/Documentation/rest-api-groups.html |
| 710 | */ |
Ben Rohlfs | 22b0148 | 2021-09-28 11:28:19 +0200 | [diff] [blame] | 711 | export declare interface GroupOptionsInfo { |
Ben Rohlfs | c830b27 | 2021-07-09 12:32:00 +0200 | [diff] [blame] | 712 | visible_to_all: boolean; |
| 713 | } |
| 714 | |
Ben Rohlfs | 9ec190e | 2021-07-05 17:11:13 +0200 | [diff] [blame] | 715 | export type Hashtag = BrandType<string, '_hashtag'>; |
| 716 | |
| 717 | export type IdToAttentionSetMap = {[accountId: string]: AttentionSetInfo}; |
| 718 | |
Ben Rohlfs | cab9421 | 2021-07-08 12:51:56 +0200 | [diff] [blame] | 719 | /** |
| 720 | * A boolean value that can also be inherited. |
| 721 | * https://gerrit-review.googlesource.com/Documentation/rest-api-projects.html#inherited-boolean-info |
| 722 | */ |
Ben Rohlfs | 22b0148 | 2021-09-28 11:28:19 +0200 | [diff] [blame] | 723 | export declare interface InheritedBooleanInfo { |
Ben Rohlfs | cab9421 | 2021-07-08 12:51:56 +0200 | [diff] [blame] | 724 | value: boolean; |
| 725 | configured_value: InheritedBooleanInfoConfiguredValue; |
| 726 | inherited_value?: boolean; |
| 727 | } |
| 728 | |
Ben Rohlfs | 9ec190e | 2021-07-05 17:11:13 +0200 | [diff] [blame] | 729 | export declare interface LabelCommonInfo { |
| 730 | optional?: boolean; // not set if false |
| 731 | } |
| 732 | |
| 733 | export type LabelNameToInfoMap = {[labelName: string]: LabelInfo}; |
| 734 | |
| 735 | // {Verified: ["-1", " 0", "+1"]} |
| 736 | export type LabelNameToValueMap = {[labelName: string]: string[]}; |
| 737 | |
| 738 | /** |
| 739 | * The LabelInfo entity contains information about a label on a change, always |
| 740 | * corresponding to the current patch set. |
| 741 | * https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#label-info |
| 742 | */ |
| 743 | export type LabelInfo = |
| 744 | | QuickLabelInfo |
| 745 | | DetailedLabelInfo |
| 746 | | (QuickLabelInfo & DetailedLabelInfo); |
| 747 | |
Ben Rohlfs | 3900e07 | 2021-08-20 11:43:05 +0200 | [diff] [blame] | 748 | export type LabelNameToLabelTypeInfoMap = {[labelName: string]: LabelTypeInfo}; |
| 749 | |
| 750 | /** |
| 751 | * The LabelTypeInfo entity contains metadata about the labels that a project |
| 752 | * has. |
| 753 | * https://gerrit-review.googlesource.com/Documentation/rest-api-projects.html#label-type-info |
| 754 | */ |
Ben Rohlfs | 22b0148 | 2021-09-28 11:28:19 +0200 | [diff] [blame] | 755 | export declare interface LabelTypeInfo { |
Ben Rohlfs | 3900e07 | 2021-08-20 11:43:05 +0200 | [diff] [blame] | 756 | values: LabelTypeInfoValues; |
| 757 | default_value: number; |
| 758 | } |
| 759 | |
| 760 | export type LabelTypeInfoValues = {[value: string]: string}; |
| 761 | |
Ben Rohlfs | 9ec190e | 2021-07-05 17:11:13 +0200 | [diff] [blame] | 762 | // The map maps the values (“-2”, “-1”, " `0`", “+1”, “+2”) to the value descriptions. |
| 763 | export type LabelValueToDescriptionMap = {[labelValue: string]: string}; |
| 764 | |
Ben Rohlfs | cab9421 | 2021-07-08 12:51:56 +0200 | [diff] [blame] | 765 | /** |
| 766 | * The MaxObjectSizeLimitInfo entity contains information about the max object |
| 767 | * size limit of a project. |
| 768 | * https://gerrit-review.googlesource.com/Documentation/rest-api-projects.html#max-object-size-limit-info |
| 769 | */ |
Ben Rohlfs | 22b0148 | 2021-09-28 11:28:19 +0200 | [diff] [blame] | 770 | export declare interface MaxObjectSizeLimitInfo { |
Ben Rohlfs | cab9421 | 2021-07-08 12:51:56 +0200 | [diff] [blame] | 771 | value?: string; |
| 772 | configured_value?: string; |
| 773 | summary?: string; |
| 774 | } |
| 775 | |
Ben Rohlfs | 9ec190e | 2021-07-05 17:11:13 +0200 | [diff] [blame] | 776 | export type NumericChangeId = BrandType<number, '_numericChangeId'>; |
| 777 | // OpenPGP User IDs (https://tools.ietf.org/html/rfc4880#section-5.11). |
| 778 | |
| 779 | export type OpenPgpUserIds = BrandType<string, '_openPgpUserIds'>; |
| 780 | |
| 781 | /** |
| 782 | * The parent commits of this commit as a list of CommitInfo entities. |
| 783 | * In each parent only the commit and subject fields are populated. |
| 784 | * https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#commit-info |
| 785 | */ |
| 786 | export declare interface ParentCommitInfo { |
| 787 | commit: CommitId; |
| 788 | subject: string; |
| 789 | } |
| 790 | |
| 791 | export type PatchSetNum = BrandType<'PARENT' | 'edit' | number, '_patchSet'>; |
| 792 | |
| 793 | /** |
Ben Rohlfs | c830b27 | 2021-07-09 12:32:00 +0200 | [diff] [blame] | 794 | * The PluginConfigInfo entity contains information about Gerrit extensions by |
| 795 | * plugins. |
| 796 | * https://gerrit-review.googlesource.com/Documentation/rest-api-config.html#plugin-config-info |
| 797 | */ |
Ben Rohlfs | 22b0148 | 2021-09-28 11:28:19 +0200 | [diff] [blame] | 798 | export declare interface PluginConfigInfo { |
Ben Rohlfs | c830b27 | 2021-07-09 12:32:00 +0200 | [diff] [blame] | 799 | has_avatars: boolean; |
| 800 | // Exists in Java class, but not mentioned in docs. |
| 801 | js_resource_paths: string[]; |
| 802 | } |
| 803 | |
| 804 | /** |
Ben Rohlfs | cab9421 | 2021-07-08 12:51:56 +0200 | [diff] [blame] | 805 | * Plugin configuration values as map which maps the plugin name to a map of parameter names to values |
| 806 | * https://gerrit-review.googlesource.com/Documentation/rest-api-projects.html#config-input |
| 807 | */ |
| 808 | export type PluginNameToPluginParametersMap = { |
| 809 | [pluginName: string]: PluginParameterToConfigParameterInfoMap; |
| 810 | }; |
| 811 | |
| 812 | export type PluginParameterToConfigParameterInfoMap = { |
| 813 | [parameterName: string]: ConfigParameterInfo; |
| 814 | }; |
| 815 | |
| 816 | /** |
Ben Rohlfs | 9ec190e | 2021-07-05 17:11:13 +0200 | [diff] [blame] | 817 | * The ProblemInfo entity contains a description of a potential consistency |
| 818 | * problem with a change. These are not related to the code review process, |
| 819 | * but rather indicate some inconsistency in Gerrit’s database or repository |
| 820 | * metadata related to the enclosing change. |
| 821 | * https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#problem-info |
| 822 | */ |
| 823 | export declare interface ProblemInfo { |
| 824 | message: string; |
| 825 | status?: ProblemInfoStatus; // Only set if a fix was attempted |
| 826 | outcome?: string; |
| 827 | } |
| 828 | |
| 829 | /** |
Ben Rohlfs | 3900e07 | 2021-08-20 11:43:05 +0200 | [diff] [blame] | 830 | * The ProjectInfo entity contains information about a project |
| 831 | * https://gerrit-review.googlesource.com/Documentation/rest-api-projects.html#project-info |
| 832 | */ |
Ben Rohlfs | 22b0148 | 2021-09-28 11:28:19 +0200 | [diff] [blame] | 833 | export declare interface ProjectInfo { |
Ben Rohlfs | 3900e07 | 2021-08-20 11:43:05 +0200 | [diff] [blame] | 834 | id: UrlEncodedRepoName; |
| 835 | // name is not set if returned in a map where the project name is used as |
| 836 | // map key |
| 837 | name?: RepoName; |
| 838 | // ?-<n> if the parent project is not visible (<n> is a number which |
| 839 | // is increased for each non-visible project). |
| 840 | parent?: RepoName; |
| 841 | description?: string; |
| 842 | state?: ProjectState; |
| 843 | branches?: {[branchName: string]: CommitId}; |
| 844 | // labels is filled for Create Project and Get Project calls. |
| 845 | labels?: LabelNameToLabelTypeInfoMap; |
| 846 | // Links to the project in external sites |
| 847 | web_links?: WebLinkInfo[]; |
| 848 | } |
| 849 | |
Ben Rohlfs | 22b0148 | 2021-09-28 11:28:19 +0200 | [diff] [blame] | 850 | export declare interface ProjectInfoWithName extends ProjectInfo { |
Ben Rohlfs | 3900e07 | 2021-08-20 11:43:05 +0200 | [diff] [blame] | 851 | name: RepoName; |
| 852 | } |
| 853 | |
| 854 | /** |
Ben Rohlfs | 9ec190e | 2021-07-05 17:11:13 +0200 | [diff] [blame] | 855 | * The PushCertificateInfo entity contains information about a pushcertificate |
| 856 | * provided when the user pushed for review with git push |
| 857 | * --signed HEAD:refs/for/<branch>. Only used when signed push is |
| 858 | * enabled on the server. |
| 859 | * https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#push-certificate-info |
| 860 | */ |
| 861 | export declare interface PushCertificateInfo { |
| 862 | certificate: string; |
| 863 | key: GpgKeyInfo; |
| 864 | } |
| 865 | |
| 866 | export declare interface QuickLabelInfo extends LabelCommonInfo { |
| 867 | approved?: AccountInfo; |
| 868 | rejected?: AccountInfo; |
| 869 | recommended?: AccountInfo; |
| 870 | disliked?: AccountInfo; |
| 871 | blocking?: boolean; // not set if false |
| 872 | value?: number; // The voting value of the user who recommended/disliked this label on the change if it is not “+1”/“-1”. |
| 873 | default_value?: number; |
| 874 | } |
| 875 | |
| 876 | export function isQuickLabelInfo( |
| 877 | l: LabelInfo |
| 878 | ): l is QuickLabelInfo | (QuickLabelInfo & DetailedLabelInfo) { |
| 879 | const quickLabelInfo = l as QuickLabelInfo; |
| 880 | return ( |
| 881 | quickLabelInfo.approved !== undefined || |
| 882 | quickLabelInfo.rejected !== undefined || |
| 883 | quickLabelInfo.recommended !== undefined || |
| 884 | quickLabelInfo.disliked !== undefined || |
| 885 | quickLabelInfo.blocking !== undefined || |
| 886 | quickLabelInfo.blocking !== undefined || |
| 887 | quickLabelInfo.value !== undefined |
| 888 | ); |
| 889 | } |
| 890 | |
Ben Rohlfs | c830b27 | 2021-07-09 12:32:00 +0200 | [diff] [blame] | 891 | /** |
| 892 | * The ReceiveInfo entity contains information about the configuration of |
| 893 | * git-receive-pack behavior on the server. |
| 894 | * https://gerrit-review.googlesource.com/Documentation/rest-api-config.html#receive-info |
| 895 | */ |
Ben Rohlfs | 22b0148 | 2021-09-28 11:28:19 +0200 | [diff] [blame] | 896 | export declare interface ReceiveInfo { |
Ben Rohlfs | c830b27 | 2021-07-09 12:32:00 +0200 | [diff] [blame] | 897 | enable_signed_push?: string; |
| 898 | } |
| 899 | |
Ben Rohlfs | 9ec190e | 2021-07-05 17:11:13 +0200 | [diff] [blame] | 900 | export type RepoName = BrandType<string, '_repoName'>; |
| 901 | |
| 902 | /** |
| 903 | * The Requirement entity contains information about a requirement relative to |
| 904 | * a change. |
| 905 | * https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#requirement |
| 906 | */ |
| 907 | export declare interface Requirement { |
| 908 | status: RequirementStatus; |
| 909 | fallbackText: string; // A human readable reason |
| 910 | type: RequirementType; |
| 911 | } |
| 912 | |
| 913 | export type RequirementType = BrandType<string, '_requirementType'>; |
| 914 | |
| 915 | /** |
| 916 | * The reviewers as a map that maps a reviewer state to a list of AccountInfo |
| 917 | * entities. Possible reviewer states are REVIEWER, CC and REMOVED. |
| 918 | * REVIEWER: Users with at least one non-zero vote on the change. |
| 919 | * CC: Users that were added to the change, but have not voted. |
| 920 | * REMOVED: Users that were previously reviewers on the change, but have been removed. |
| 921 | */ |
| 922 | export type Reviewers = Partial<Record<ReviewerState, AccountInfo[]>>; |
| 923 | |
| 924 | /** |
| 925 | * The ReviewerUpdateInfo entity contains information about updates to change’s |
| 926 | * reviewers set. |
| 927 | * https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#review-update-info |
| 928 | */ |
| 929 | export declare interface ReviewerUpdateInfo { |
| 930 | updated: Timestamp; |
| 931 | updated_by: AccountInfo; |
| 932 | reviewer: AccountInfo; |
| 933 | state: ReviewerState; |
| 934 | } |
| 935 | |
| 936 | export type ReviewInputTag = BrandType<string, '_reviewInputTag'>; |
| 937 | |
| 938 | /** |
| 939 | * The RevisionInfo entity contains information about a patch set.Not all |
| 940 | * fields are returned by default. Additional fields can be obtained by |
| 941 | * adding o parameters as described in Query Changes. |
| 942 | * https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#revision-info |
| 943 | * basePatchNum is present in case RevisionInfo is of type 'edit' |
| 944 | */ |
| 945 | export declare interface RevisionInfo { |
| 946 | kind: RevisionKind; |
| 947 | _number: PatchSetNum; |
| 948 | created: Timestamp; |
| 949 | uploader: AccountInfo; |
| 950 | ref: GitRef; |
| 951 | fetch?: {[protocol: string]: FetchInfo}; |
| 952 | commit?: CommitInfo; |
| 953 | files?: {[filename: string]: FileInfo}; |
| 954 | actions?: ActionNameToActionInfoMap; |
| 955 | reviewed?: boolean; |
| 956 | commit_with_footers?: boolean; |
| 957 | push_certificate?: PushCertificateInfo; |
| 958 | description?: string; |
| 959 | basePatchNum?: BasePatchSetNum; |
| 960 | } |
| 961 | |
Ben Rohlfs | c830b27 | 2021-07-09 12:32:00 +0200 | [diff] [blame] | 962 | export type SchemesInfoMap = {[name: string]: DownloadSchemeInfo}; |
| 963 | |
| 964 | /** |
| 965 | * The ServerInfo entity contains information about the configuration of the |
| 966 | * Gerrit server. |
| 967 | * https://gerrit-review.googlesource.com/Documentation/rest-api-config.html#server-info |
| 968 | */ |
Ben Rohlfs | 22b0148 | 2021-09-28 11:28:19 +0200 | [diff] [blame] | 969 | export declare interface ServerInfo { |
Ben Rohlfs | c830b27 | 2021-07-09 12:32:00 +0200 | [diff] [blame] | 970 | accounts: AccountsConfigInfo; |
| 971 | auth: AuthInfo; |
| 972 | change: ChangeConfigInfo; |
| 973 | download: DownloadInfo; |
| 974 | gerrit: GerritInfo; |
| 975 | // docs mentions index property, but it doesn't exists in Java class |
| 976 | // index: IndexConfigInfo; |
| 977 | note_db_enabled?: boolean; |
| 978 | plugin: PluginConfigInfo; |
| 979 | receive?: ReceiveInfo; |
| 980 | sshd?: SshdInfo; |
| 981 | suggest: SuggestInfo; |
| 982 | user: UserConfigInfo; |
| 983 | default_theme?: string; |
| 984 | } |
| 985 | |
| 986 | /** |
| 987 | * The SshdInfo entity contains information about Gerrit configuration from the sshd section. |
| 988 | * https://gerrit-review.googlesource.com/Documentation/rest-api-config.html#sshd-info |
| 989 | * This entity doesn’t contain any data, but the presence of this (empty) entity |
| 990 | * in the ServerInfo entity means that SSHD is enabled on the server. |
| 991 | */ |
| 992 | export type SshdInfo = {}; |
| 993 | |
Ben Rohlfs | 9ec190e | 2021-07-05 17:11:13 +0200 | [diff] [blame] | 994 | export type StarLabel = BrandType<string, '_startLabel'>; |
| 995 | // Timestamps are given in UTC and have the format |
| 996 | // "'yyyy-mm-dd hh:mm:ss.fffffffff'" |
| 997 | // where "'ffffffffff'" represents nanoseconds. |
| 998 | |
Ben Rohlfs | cab9421 | 2021-07-08 12:51:56 +0200 | [diff] [blame] | 999 | /** |
| 1000 | * Information about the default submittype of a project, taking into account |
| 1001 | * project inheritance. |
| 1002 | * https://gerrit-review.googlesource.com/Documentation/rest-api-projects.html#submit-type-info |
| 1003 | */ |
Ben Rohlfs | 22b0148 | 2021-09-28 11:28:19 +0200 | [diff] [blame] | 1004 | export declare interface SubmitTypeInfo { |
Ben Rohlfs | cab9421 | 2021-07-08 12:51:56 +0200 | [diff] [blame] | 1005 | value: Exclude<SubmitType, SubmitType.INHERIT>; |
| 1006 | configured_value: SubmitType; |
| 1007 | inherited_value: Exclude<SubmitType, SubmitType.INHERIT>; |
| 1008 | } |
| 1009 | |
Ben Rohlfs | c830b27 | 2021-07-09 12:32:00 +0200 | [diff] [blame] | 1010 | /** |
| 1011 | * The SuggestInfo entity contains information about Gerritconfiguration from |
| 1012 | * the suggest section. |
| 1013 | * https://gerrit-review.googlesource.com/Documentation/rest-api-config.html#suggest-info |
| 1014 | */ |
Ben Rohlfs | 22b0148 | 2021-09-28 11:28:19 +0200 | [diff] [blame] | 1015 | export declare interface SuggestInfo { |
Ben Rohlfs | c830b27 | 2021-07-09 12:32:00 +0200 | [diff] [blame] | 1016 | from: number; |
| 1017 | } |
| 1018 | |
Ben Rohlfs | 9ec190e | 2021-07-05 17:11:13 +0200 | [diff] [blame] | 1019 | export type Timestamp = BrandType<string, '_timestamp'>; |
| 1020 | // The timezone offset from UTC in minutes |
| 1021 | |
| 1022 | export type TimezoneOffset = BrandType<number, '_timezoneOffset'>; |
| 1023 | |
| 1024 | export type TopicName = BrandType<string, '_topicName'>; |
| 1025 | |
| 1026 | export type TrackingId = BrandType<string, '_trackingId'>; |
| 1027 | |
| 1028 | /** |
| 1029 | * The TrackingIdInfo entity describes a reference to an external tracking |
| 1030 | * system. |
| 1031 | * https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#tracking-id-info |
| 1032 | */ |
| 1033 | export declare interface TrackingIdInfo { |
| 1034 | system: string; |
| 1035 | id: TrackingId; |
| 1036 | } |
| 1037 | |
| 1038 | /** |
Ben Rohlfs | c830b27 | 2021-07-09 12:32:00 +0200 | [diff] [blame] | 1039 | * The UserConfigInfo entity contains information about Gerrit configuration |
| 1040 | * from the user section. |
| 1041 | * https://gerrit-review.googlesource.com/Documentation/rest-api-config.html#user-config-info |
| 1042 | */ |
Ben Rohlfs | 22b0148 | 2021-09-28 11:28:19 +0200 | [diff] [blame] | 1043 | export declare interface UserConfigInfo { |
Ben Rohlfs | c830b27 | 2021-07-09 12:32:00 +0200 | [diff] [blame] | 1044 | anonymous_coward_name: string; |
| 1045 | } |
| 1046 | |
| 1047 | /** |
Ben Rohlfs | 9ec190e | 2021-07-05 17:11:13 +0200 | [diff] [blame] | 1048 | * The VotingRangeInfo entity describes the continuous voting range from minto |
| 1049 | * max values. |
| 1050 | * https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#voting-range-info |
| 1051 | */ |
| 1052 | export declare interface VotingRangeInfo { |
| 1053 | min: number; |
| 1054 | max: number; |
| 1055 | } |
| 1056 | |
| 1057 | /** |
| 1058 | * The WebLinkInfo entity describes a link to an external site. |
| 1059 | * https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#web-link-info |
| 1060 | */ |
| 1061 | export declare interface WebLinkInfo { |
| 1062 | /** The link name. */ |
| 1063 | name: string; |
| 1064 | /** The link URL. */ |
| 1065 | url: string; |
| 1066 | /** URL to the icon of the link. */ |
Paladox none | 17f0c4e | 2021-08-11 03:45:30 +0000 | [diff] [blame] | 1067 | image_url?: string; |
Paladox none | 61aae56 | 2021-08-11 06:47:13 +0000 | [diff] [blame] | 1068 | /* The links target. */ |
| 1069 | target?: string; |
Ben Rohlfs | 9ec190e | 2021-07-05 17:11:13 +0200 | [diff] [blame] | 1070 | } |
Milutin Kristofic | 3424f6e | 2021-08-05 13:02:16 +0200 | [diff] [blame] | 1071 | |
| 1072 | /** |
| 1073 | * The SubmitRequirementResultInfo describes the result of evaluating |
| 1074 | * a submit requirement on a change. |
| 1075 | * https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#submit-requirement-result-info |
| 1076 | */ |
| 1077 | export declare interface SubmitRequirementResultInfo { |
| 1078 | name: string; |
| 1079 | description?: string; |
Milutin Kristofic | 5852682 | 2021-08-06 12:18:36 +0200 | [diff] [blame] | 1080 | status: SubmitRequirementStatus; |
Milutin Kristofic | 3424f6e | 2021-08-05 13:02:16 +0200 | [diff] [blame] | 1081 | applicability_expression_result?: SubmitRequirementExpressionInfo; |
| 1082 | submittability_expression_result: SubmitRequirementExpressionInfo; |
| 1083 | override_expression_result?: SubmitRequirementExpressionInfo; |
Milutin Kristofic | 7e65e99 | 2021-10-21 20:55:05 +0200 | [diff] [blame] | 1084 | is_legacy?: boolean; |
Milutin Kristofic | 3424f6e | 2021-08-05 13:02:16 +0200 | [diff] [blame] | 1085 | } |
| 1086 | |
| 1087 | /** |
| 1088 | * The SubmitRequirementExpressionInfo describes the result of evaluating |
| 1089 | * a single submit requirement expression, for example label:code-review=+2. |
| 1090 | * https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#submit-requirement-expression-info |
| 1091 | */ |
| 1092 | export declare interface SubmitRequirementExpressionInfo { |
| 1093 | expression: string; |
| 1094 | fulfilled: boolean; |
Milutin Kristofic | 8fc3d8f8 | 2021-08-10 20:25:21 +0200 | [diff] [blame] | 1095 | passing_atoms: string[]; |
| 1096 | failing_atoms: string[]; |
Milutin Kristofic | 3424f6e | 2021-08-05 13:02:16 +0200 | [diff] [blame] | 1097 | } |
Milutin Kristofic | 5852682 | 2021-08-06 12:18:36 +0200 | [diff] [blame] | 1098 | |
| 1099 | /** |
| 1100 | * Status describing the result of evaluating the submit requirement. |
| 1101 | * https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#submit-requirement-result-info |
| 1102 | */ |
| 1103 | export enum SubmitRequirementStatus { |
| 1104 | SATISFIED = 'SATISFIED', |
| 1105 | UNSATISFIED = 'UNSATISFIED', |
| 1106 | OVERRIDDEN = 'OVERRIDDEN', |
| 1107 | NOT_APPLICABLE = 'NOT_APPLICABLE', |
| 1108 | } |
Ben Rohlfs | 3900e07 | 2021-08-20 11:43:05 +0200 | [diff] [blame] | 1109 | |
| 1110 | export type UrlEncodedRepoName = BrandType<string, '_urlEncodedRepoName'>; |