Keep RestApiService in sync with gr-rest-api-interface
Replaced existing usage on GrRestApiInterface with
`RestApiService & Element`
Change-Id: Id16f489ea382522c9f1c765fe44550248878f149
diff --git a/polygerrit-ui/app/elements/admin/gr-create-change-dialog/gr-create-change-dialog.ts b/polygerrit-ui/app/elements/admin/gr-create-change-dialog/gr-create-change-dialog.ts
index 4168632..66f7586 100644
--- a/polygerrit-ui/app/elements/admin/gr-create-change-dialog/gr-create-change-dialog.ts
+++ b/polygerrit-ui/app/elements/admin/gr-create-change-dialog/gr-create-change-dialog.ts
@@ -27,7 +27,6 @@
import {htmlTemplate} from './gr-create-change-dialog_html';
import {GerritNav} from '../../core/gr-navigation/gr-navigation';
import {customElement, property, observe} from '@polymer/decorators';
-import {GrRestApiInterface} from '../../shared/gr-rest-api-interface/gr-rest-api-interface';
import {
RepoName,
BranchName,
@@ -37,13 +36,14 @@
} from '../../../types/common';
import {InheritedBooleanInfoConfiguredValue} from '../../../constants/constants';
import {hasOwnProperty} from '../../../utils/common-util';
+import {RestApiService} from '../../../services/services/gr-rest-api/gr-rest-api';
const SUGGESTIONS_LIMIT = 15;
const REF_PREFIX = 'refs/heads/';
export interface GrCreateChangeDialog {
$: {
- restAPI: GrRestApiInterface;
+ restAPI: RestApiService & Element;
privateChangeCheckBox: HTMLInputElement;
};
}
diff --git a/polygerrit-ui/app/elements/admin/gr-create-group-dialog/gr-create-group-dialog.ts b/polygerrit-ui/app/elements/admin/gr-create-group-dialog/gr-create-group-dialog.ts
index b120645..e8b5d78 100644
--- a/polygerrit-ui/app/elements/admin/gr-create-group-dialog/gr-create-group-dialog.ts
+++ b/polygerrit-ui/app/elements/admin/gr-create-group-dialog/gr-create-group-dialog.ts
@@ -25,12 +25,12 @@
import {encodeURL, getBaseUrl} from '../../../utils/url-util';
import {page} from '../../../utils/page-wrapper-utils';
import {customElement, property, observe} from '@polymer/decorators';
-import {GrRestApiInterface} from '../../shared/gr-rest-api-interface/gr-rest-api-interface';
+import {RestApiService} from '../../../services/services/gr-rest-api/gr-rest-api';
import {GroupId} from '../../../types/common';
export interface GrCreateGroupDialog {
$: {
- restAPI: GrRestApiInterface;
+ restAPI: RestApiService & Element;
};
}
diff --git a/polygerrit-ui/app/elements/admin/gr-plugin-list/gr-plugin-list.ts b/polygerrit-ui/app/elements/admin/gr-plugin-list/gr-plugin-list.ts
index 3b3c72e..5039972 100644
--- a/polygerrit-ui/app/elements/admin/gr-plugin-list/gr-plugin-list.ts
+++ b/polygerrit-ui/app/elements/admin/gr-plugin-list/gr-plugin-list.ts
@@ -27,7 +27,7 @@
ListViewParams,
} from '../../../mixins/gr-list-view-mixin/gr-list-view-mixin';
import {customElement, property} from '@polymer/decorators';
-import {GrRestApiInterface} from '../../shared/gr-rest-api-interface/gr-rest-api-interface';
+import {RestApiService} from '../../../services/services/gr-rest-api/gr-rest-api';
import {ErrorCallback} from '../../../services/services/gr-rest-api/gr-rest-api';
import {PluginInfo} from '../../../types/common';
@@ -36,7 +36,7 @@
}
export interface GrPluginList {
$: {
- restAPI: GrRestApiInterface;
+ restAPI: RestApiService & Element;
};
}
@customElement('gr-plugin-list')
diff --git a/polygerrit-ui/app/elements/admin/gr-repo-dashboards/gr-repo-dashboards.ts b/polygerrit-ui/app/elements/admin/gr-repo-dashboards/gr-repo-dashboards.ts
index 919d76a..d9d8560 100644
--- a/polygerrit-ui/app/elements/admin/gr-repo-dashboards/gr-repo-dashboards.ts
+++ b/polygerrit-ui/app/elements/admin/gr-repo-dashboards/gr-repo-dashboards.ts
@@ -24,7 +24,7 @@
import {htmlTemplate} from './gr-repo-dashboards_html';
import {GerritNav} from '../../core/gr-navigation/gr-navigation';
import {customElement, property} from '@polymer/decorators';
-import {GrRestApiInterface} from '../../shared/gr-rest-api-interface/gr-rest-api-interface';
+import {RestApiService} from '../../../services/services/gr-rest-api/gr-rest-api';
import {RepoName, DashboardId, DashboardInfo} from '../../../types/common';
import {ErrorCallback} from '../../../services/services/gr-rest-api/gr-rest-api';
@@ -35,7 +35,7 @@
export interface GrRepoDashboards {
$: {
- restAPI: GrRestApiInterface;
+ restAPI: RestApiService & Element;
};
}
@customElement('gr-repo-dashboards')
diff --git a/polygerrit-ui/app/elements/change/gr-confirm-cherrypick-dialog/gr-confirm-cherrypick-dialog.ts b/polygerrit-ui/app/elements/change/gr-confirm-cherrypick-dialog/gr-confirm-cherrypick-dialog.ts
index 5b124f9..ae9254a 100644
--- a/polygerrit-ui/app/elements/change/gr-confirm-cherrypick-dialog/gr-confirm-cherrypick-dialog.ts
+++ b/polygerrit-ui/app/elements/change/gr-confirm-cherrypick-dialog/gr-confirm-cherrypick-dialog.ts
@@ -34,7 +34,7 @@
} from '../../../types/common';
import {ReportingService} from '../../../services/gr-reporting/gr-reporting';
import {customElement, property, observe} from '@polymer/decorators';
-import {GrRestApiInterface} from '../../shared/gr-rest-api-interface/gr-rest-api-interface';
+import {RestApiService} from '../../../services/services/gr-rest-api/gr-rest-api';
import {
GrAutocomplete,
AutocompleteSuggestion,
@@ -67,7 +67,7 @@
// is converted
export interface GrConfirmCherrypickDialog {
$: {
- restAPI: GrRestApiInterface;
+ restAPI: RestApiService & Element;
branchInput: GrAutocomplete;
};
}
diff --git a/polygerrit-ui/app/elements/change/gr-confirm-move-dialog/gr-confirm-move-dialog.ts b/polygerrit-ui/app/elements/change/gr-confirm-move-dialog/gr-confirm-move-dialog.ts
index bc4ff45..e9cf19e 100644
--- a/polygerrit-ui/app/elements/change/gr-confirm-move-dialog/gr-confirm-move-dialog.ts
+++ b/polygerrit-ui/app/elements/change/gr-confirm-move-dialog/gr-confirm-move-dialog.ts
@@ -24,7 +24,7 @@
import {htmlTemplate} from './gr-confirm-move-dialog_html';
import {KeyboardShortcutMixin} from '../../../mixins/keyboard-shortcut-mixin/keyboard-shortcut-mixin';
import {customElement, property} from '@polymer/decorators';
-import {GrRestApiInterface} from '../../shared/gr-rest-api-interface/gr-rest-api-interface';
+import {RestApiService} from '../../../services/services/gr-rest-api/gr-rest-api';
import {RepoName, BranchName} from '../../../types/common';
import {AutocompleteSuggestion} from '../../shared/gr-autocomplete/gr-autocomplete';
@@ -32,7 +32,7 @@
export interface GrConfirmMoveDialog {
$: {
- restAPI: GrRestApiInterface;
+ restAPI: RestApiService & Element;
};
}
@customElement('gr-confirm-move-dialog')
diff --git a/polygerrit-ui/app/elements/change/gr-confirm-rebase-dialog/gr-confirm-rebase-dialog.ts b/polygerrit-ui/app/elements/change/gr-confirm-rebase-dialog/gr-confirm-rebase-dialog.ts
index d274cd8..76e53c3 100644
--- a/polygerrit-ui/app/elements/change/gr-confirm-rebase-dialog/gr-confirm-rebase-dialog.ts
+++ b/polygerrit-ui/app/elements/change/gr-confirm-rebase-dialog/gr-confirm-rebase-dialog.ts
@@ -23,10 +23,7 @@
import {PolymerElement} from '@polymer/polymer/polymer-element';
import {htmlTemplate} from './gr-confirm-rebase-dialog_html';
import {customElement, property, observe} from '@polymer/decorators';
-import {
- GrRestApiInterface,
- ChangeNum,
-} from '../../shared/gr-rest-api-interface/gr-rest-api-interface';
+import {ChangeNum} from '../../shared/gr-rest-api-interface/gr-rest-api-interface';
import {hasOwnProperty} from '../../../utils/common-util';
import {LegacyChangeId, BranchName} from '../../../types/common';
import {
@@ -34,6 +31,7 @@
AutocompleteQuery,
AutocompleteSuggestion,
} from '../../shared/gr-autocomplete/gr-autocomplete';
+import {RestApiService} from '../../../services/services/gr-rest-api/gr-rest-api';
interface RebaseChange {
name: string;
@@ -42,7 +40,7 @@
export interface GrConfirmRebaseDialog {
$: {
- restAPI: GrRestApiInterface;
+ restAPI: RestApiService & Element;
parentInput: GrAutocomplete;
rebaseOnParentInput: HTMLInputElement;
rebaseOnOtherInput: HTMLInputElement;
diff --git a/polygerrit-ui/app/elements/change/gr-included-in-dialog/gr-included-in-dialog.ts b/polygerrit-ui/app/elements/change/gr-included-in-dialog/gr-included-in-dialog.ts
index ddeba70..ccb403a 100644
--- a/polygerrit-ui/app/elements/change/gr-included-in-dialog/gr-included-in-dialog.ts
+++ b/polygerrit-ui/app/elements/change/gr-included-in-dialog/gr-included-in-dialog.ts
@@ -23,15 +23,13 @@
import {PolymerElement} from '@polymer/polymer/polymer-element';
import {htmlTemplate} from './gr-included-in-dialog_html';
import {customElement, property} from '@polymer/decorators';
-import {
- GrRestApiInterface,
- ChangeNum,
-} from '../../shared/gr-rest-api-interface/gr-rest-api-interface';
+import {ChangeNum} from '../../shared/gr-rest-api-interface/gr-rest-api-interface';
import {IncludedInInfo} from '../../../types/common';
+import {RestApiService} from '../../../services/services/gr-rest-api/gr-rest-api';
export interface GrIncludedInDialog {
$: {
- restAPI: GrRestApiInterface;
+ restAPI: RestApiService & Element;
};
}
diff --git a/polygerrit-ui/app/elements/core/gr-router/gr-router.ts b/polygerrit-ui/app/elements/core/gr-router/gr-router.ts
index 74de20d..3ffd819 100644
--- a/polygerrit-ui/app/elements/core/gr-router/gr-router.ts
+++ b/polygerrit-ui/app/elements/core/gr-router/gr-router.ts
@@ -59,7 +59,7 @@
ServerInfo,
UrlEncodedCommentId,
} from '../../../types/common';
-import {GrRestApiInterface} from '../../shared/gr-rest-api-interface/gr-rest-api-interface';
+import {RestApiService} from '../../../services/services/gr-rest-api/gr-rest-api';
import {
AppElement,
AppElementParams,
@@ -261,7 +261,7 @@
export interface GrRouter {
$: {
- restAPI: GrRestApiInterface;
+ restAPI: RestApiService & Element;
};
}
diff --git a/polygerrit-ui/app/elements/diff/gr-comment-api/gr-comment-api.ts b/polygerrit-ui/app/elements/diff/gr-comment-api/gr-comment-api.ts
index 2cca5bf..0b57879 100644
--- a/polygerrit-ui/app/elements/diff/gr-comment-api/gr-comment-api.ts
+++ b/polygerrit-ui/app/elements/diff/gr-comment-api/gr-comment-api.ts
@@ -37,12 +37,10 @@
RobotCommentInfo,
UrlEncodedCommentId,
} from '../../../types/common';
-import {
- ChangeNum,
- GrRestApiInterface,
-} from '../../shared/gr-rest-api-interface/gr-rest-api-interface';
+import {ChangeNum} from '../../shared/gr-rest-api-interface/gr-rest-api-interface';
import {hasOwnProperty} from '../../../utils/common-util';
import {CommentSide} from '../../../constants/constants';
+import {RestApiService} from '../../../services/services/gr-rest-api/gr-rest-api';
export interface HumanCommentInfoWithPath extends CommentInfo {
path: string;
@@ -121,9 +119,9 @@
* elements of that which uses the gr-comment-api.
*/
constructor(
- comments: PathToCommentsInfoMap,
- robotComments: PathToRobotCommentsInfoMap,
- drafts: PathToCommentsInfoMap,
+ comments: PathToCommentsInfoMap | undefined,
+ robotComments: PathToRobotCommentsInfoMap | undefined,
+ drafts: PathToCommentsInfoMap | undefined,
changeNum: ChangeNum
) {
this._comments = this._addPath(comments);
@@ -648,7 +646,7 @@
interface GrCommentApi {
$: {
- restAPI: GrRestApiInterface;
+ restAPI: RestApiService & Element;
};
}
@@ -691,7 +689,10 @@
return Promise.all(promises).then(([comments, robotComments, drafts]) => {
this._changeComments = new ChangeComments(
comments,
- robotComments,
+ // TODO(TS): Promise.all somehow resolve all types to
+ // PathToCommentsInfoMap given its PathToRobotCommentsInfoMap
+ // returned from the second promise
+ robotComments as PathToRobotCommentsInfoMap,
drafts,
changeNum
);
diff --git a/polygerrit-ui/app/elements/documentation/gr-documentation-search/gr-documentation-search.ts b/polygerrit-ui/app/elements/documentation/gr-documentation-search/gr-documentation-search.ts
index f527c65..e343962 100644
--- a/polygerrit-ui/app/elements/documentation/gr-documentation-search/gr-documentation-search.ts
+++ b/polygerrit-ui/app/elements/documentation/gr-documentation-search/gr-documentation-search.ts
@@ -28,12 +28,12 @@
} from '../../../mixins/gr-list-view-mixin/gr-list-view-mixin';
import {getBaseUrl} from '../../../utils/url-util';
import {customElement, property} from '@polymer/decorators';
-import {GrRestApiInterface} from '../../shared/gr-rest-api-interface/gr-rest-api-interface';
+import {RestApiService} from '../../../services/services/gr-rest-api/gr-rest-api';
import {DocResult} from '../../../types/common';
export interface GrDocumentationSearch {
$: {
- restAPI: GrRestApiInterface;
+ restAPI: RestApiService & Element;
};
}
@customElement('gr-documentation-search')
diff --git a/polygerrit-ui/app/elements/settings/gr-agreements-list/gr-agreements-list.ts b/polygerrit-ui/app/elements/settings/gr-agreements-list/gr-agreements-list.ts
index 1a881355..5523be1 100644
--- a/polygerrit-ui/app/elements/settings/gr-agreements-list/gr-agreements-list.ts
+++ b/polygerrit-ui/app/elements/settings/gr-agreements-list/gr-agreements-list.ts
@@ -24,12 +24,12 @@
import {htmlTemplate} from './gr-agreements-list_html';
import {getBaseUrl} from '../../../utils/url-util';
import {customElement, property} from '@polymer/decorators';
-import {GrRestApiInterface} from '../../shared/gr-rest-api-interface/gr-rest-api-interface';
+import {RestApiService} from '../../../services/services/gr-rest-api/gr-rest-api';
import {ContributorAgreementInfo} from '../../../types/common';
export interface GrAgreementsList {
$: {
- restAPI: GrRestApiInterface;
+ restAPI: RestApiService & Element;
};
}
@customElement('gr-agreements-list')
diff --git a/polygerrit-ui/app/elements/settings/gr-cla-view/gr-cla-view.ts b/polygerrit-ui/app/elements/settings/gr-cla-view/gr-cla-view.ts
index bfafb48..28cd672 100644
--- a/polygerrit-ui/app/elements/settings/gr-cla-view/gr-cla-view.ts
+++ b/polygerrit-ui/app/elements/settings/gr-cla-view/gr-cla-view.ts
@@ -25,7 +25,7 @@
import {PolymerElement} from '@polymer/polymer/polymer-element';
import {htmlTemplate} from './gr-cla-view_html';
import {getBaseUrl} from '../../../utils/url-util';
-import {GrRestApiInterface} from '../../shared/gr-rest-api-interface/gr-rest-api-interface';
+import {RestApiService} from '../../../services/services/gr-rest-api/gr-rest-api';
import {customElement, property} from '@polymer/decorators';
import {
ServerInfo,
@@ -35,7 +35,7 @@
export interface GrClaView {
$: {
- restAPI: GrRestApiInterface;
+ restAPI: RestApiService & Element;
};
}
diff --git a/polygerrit-ui/app/elements/settings/gr-edit-preferences/gr-edit-preferences.ts b/polygerrit-ui/app/elements/settings/gr-edit-preferences/gr-edit-preferences.ts
index 9253a03..d49cb5a 100644
--- a/polygerrit-ui/app/elements/settings/gr-edit-preferences/gr-edit-preferences.ts
+++ b/polygerrit-ui/app/elements/settings/gr-edit-preferences/gr-edit-preferences.ts
@@ -24,12 +24,12 @@
import {PolymerElement} from '@polymer/polymer/polymer-element';
import {htmlTemplate} from './gr-edit-preferences_html';
import {customElement, property} from '@polymer/decorators';
-import {GrRestApiInterface} from '../../shared/gr-rest-api-interface/gr-rest-api-interface';
+import {RestApiService} from '../../../services/services/gr-rest-api/gr-rest-api';
import {EditPreferencesInfo} from '../../../types/common';
export interface GrEditPreferences {
$: {
- restAPI: GrRestApiInterface;
+ restAPI: RestApiService & Element;
editSyntaxHighlighting: HTMLInputElement;
showAutoCloseBrackets: HTMLInputElement;
showIndentWithTabs: HTMLInputElement;
diff --git a/polygerrit-ui/app/elements/settings/gr-group-list/gr-group-list.ts b/polygerrit-ui/app/elements/settings/gr-group-list/gr-group-list.ts
index e6799e9..d631c53 100644
--- a/polygerrit-ui/app/elements/settings/gr-group-list/gr-group-list.ts
+++ b/polygerrit-ui/app/elements/settings/gr-group-list/gr-group-list.ts
@@ -22,13 +22,13 @@
import {PolymerElement} from '@polymer/polymer/polymer-element';
import {htmlTemplate} from './gr-group-list_html';
import {GerritNav} from '../../core/gr-navigation/gr-navigation';
-import {GrRestApiInterface} from '../../shared/gr-rest-api-interface/gr-rest-api-interface';
+import {RestApiService} from '../../../services/services/gr-rest-api/gr-rest-api';
import {customElement, property} from '@polymer/decorators';
import {GroupInfo, GroupId} from '../../../types/common';
export interface GrGroupList {
$: {
- restAPI: GrRestApiInterface;
+ restAPI: RestApiService & Element;
};
}
diff --git a/polygerrit-ui/app/elements/settings/gr-http-password/gr-http-password.ts b/polygerrit-ui/app/elements/settings/gr-http-password/gr-http-password.ts
index 79dc60e..02683e3 100644
--- a/polygerrit-ui/app/elements/settings/gr-http-password/gr-http-password.ts
+++ b/polygerrit-ui/app/elements/settings/gr-http-password/gr-http-password.ts
@@ -26,7 +26,7 @@
import {htmlTemplate} from './gr-http-password_html';
import {property, customElement} from '@polymer/decorators';
import {GrOverlay} from '../../shared/gr-overlay/gr-overlay';
-import {GrRestApiInterface} from '../../shared/gr-rest-api-interface/gr-rest-api-interface';
+import {RestApiService} from '../../../services/services/gr-rest-api/gr-rest-api';
declare global {
interface HTMLElementTagNameMap {
@@ -36,7 +36,7 @@
export interface GrHttpPassword {
$: {
- restAPI: GrRestApiInterface;
+ restAPI: RestApiService & Element;
generatedPasswordOverlay: GrOverlay;
};
}
diff --git a/polygerrit-ui/app/elements/settings/gr-registration-dialog/gr-registration-dialog.ts b/polygerrit-ui/app/elements/settings/gr-registration-dialog/gr-registration-dialog.ts
index d167252..0e85e4a 100644
--- a/polygerrit-ui/app/elements/settings/gr-registration-dialog/gr-registration-dialog.ts
+++ b/polygerrit-ui/app/elements/settings/gr-registration-dialog/gr-registration-dialog.ts
@@ -25,11 +25,11 @@
import {htmlTemplate} from './gr-registration-dialog_html';
import {customElement, property, observe} from '@polymer/decorators';
import {ServerInfo, AccountDetailInfo} from '../../../types/common';
-import {GrRestApiInterface} from '../../shared/gr-rest-api-interface/gr-rest-api-interface';
+import {RestApiService} from '../../../services/services/gr-rest-api/gr-rest-api';
export interface GrRegistrationDialog {
$: {
- restAPI: GrRestApiInterface;
+ restAPI: RestApiService & Element;
name: HTMLInputElement;
username: HTMLInputElement;
email: HTMLSelectElement;
diff --git a/polygerrit-ui/app/elements/settings/gr-watched-projects-editor/gr-watched-projects-editor.ts b/polygerrit-ui/app/elements/settings/gr-watched-projects-editor/gr-watched-projects-editor.ts
index f178094..e1adae5 100644
--- a/polygerrit-ui/app/elements/settings/gr-watched-projects-editor/gr-watched-projects-editor.ts
+++ b/polygerrit-ui/app/elements/settings/gr-watched-projects-editor/gr-watched-projects-editor.ts
@@ -31,7 +31,7 @@
GrAutocomplete,
AutocompleteSuggestion,
} from '../../shared/gr-autocomplete/gr-autocomplete';
-import {GrRestApiInterface} from '../../shared/gr-rest-api-interface/gr-rest-api-interface';
+import {RestApiService} from '../../../services/services/gr-rest-api/gr-rest-api';
import {hasOwnProperty} from '../../../utils/common-util';
import {ProjectWatchInfo} from '../../../types/common';
@@ -45,7 +45,7 @@
export interface GrWatchedProjectsEditor {
$: {
- restAPI: GrRestApiInterface;
+ restAPI: RestApiService & Element;
newFilter: HTMLInputElement;
newProject: GrAutocomplete;
};
diff --git a/polygerrit-ui/app/elements/shared/gr-date-formatter/gr-date-formatter.ts b/polygerrit-ui/app/elements/shared/gr-date-formatter/gr-date-formatter.ts
index 1d6492a..bb32246 100644
--- a/polygerrit-ui/app/elements/shared/gr-date-formatter/gr-date-formatter.ts
+++ b/polygerrit-ui/app/elements/shared/gr-date-formatter/gr-date-formatter.ts
@@ -31,9 +31,9 @@
formatDate,
utcOffsetString,
} from '../../../utils/date-util';
-import {GrRestApiInterface} from '../gr-rest-api-interface/gr-rest-api-interface';
import {TimeFormat, DateFormat} from '../../../constants/constants';
import {assertNever} from '../../../utils/common-util';
+import {RestApiService} from '../../../services/services/gr-rest-api/gr-rest-api';
const TimeFormats = {
TIME_12: 'h:mm A', // 2:14 PM
@@ -78,7 +78,7 @@
export interface GrDateFormatter {
$: {
- restAPI: GrRestApiInterface;
+ restAPI: RestApiService & Element;
};
}
diff --git a/polygerrit-ui/app/elements/shared/gr-rest-api-interface/gr-rest-api-interface.ts b/polygerrit-ui/app/elements/shared/gr-rest-api-interface/gr-rest-api-interface.ts
index af72cb1..fb9f120 100644
--- a/polygerrit-ui/app/elements/shared/gr-rest-api-interface/gr-rest-api-interface.ts
+++ b/polygerrit-ui/app/elements/shared/gr-rest-api-interface/gr-rest-api-interface.ts
@@ -103,7 +103,6 @@
ProjectWatchInfo,
RepoName,
ReviewInput,
- RobotCommentInfo,
ServerInfo,
SshKeyInfo,
UrlEncodedCommentId,
@@ -132,6 +131,8 @@
CancelConditionCallback,
ErrorCallback,
RestApiService,
+ GetDiffCommentsOutput,
+ GetDiffRobotCommentsOutput,
} from '../../../services/services/gr-rest-api/gr-rest-api';
import {
CommentSide,
@@ -247,16 +248,6 @@
type SendChangeRequest = SendRawChangeRequest | SendJSONChangeRequest;
-interface GetDiffCommentsOutput {
- baseComments: CommentInfo[];
- comments: CommentInfo[];
-}
-
-interface GetDiffRobotCommentsOutput {
- baseComments: RobotCommentInfo[];
- comments: RobotCommentInfo[];
-}
-
export function _testOnlyResetGrRestApiSharedObjects() {
// TODO(TS): The commented code below didn't do anything.
// It is impossible to reject an existing promise. Should be rewritten in a
@@ -2507,11 +2498,25 @@
}
getDiffComments(
+ changeNum: ChangeNum
+ ): Promise<PathToCommentsInfoMap | undefined>;
+
+ getDiffComments(
+ changeNum: ChangeNum,
+ basePatchNum: PatchSetNum,
+ patchNum: PatchSetNum,
+ path: string
+ ): Promise<GetDiffCommentsOutput>;
+
+ getDiffComments(
changeNum: ChangeNum,
basePatchNum?: PatchSetNum,
patchNum?: PatchSetNum,
path?: string
) {
+ if (!basePatchNum && !patchNum && !path) {
+ return this._getDiffComments(changeNum, '/comments');
+ }
return this._getDiffComments(
changeNum,
'/comments',
@@ -2522,11 +2527,26 @@
}
getDiffRobotComments(
+ changeNum: ChangeNum
+ ): Promise<PathToRobotCommentsInfoMap | undefined>;
+
+ getDiffRobotComments(
+ changeNum: ChangeNum,
+ basePatchNum: PatchSetNum,
+ patchNum: PatchSetNum,
+ path: string
+ ): Promise<GetDiffRobotCommentsOutput>;
+
+ getDiffRobotComments(
changeNum: ChangeNum,
basePatchNum?: PatchSetNum,
patchNum?: PatchSetNum,
path?: string
) {
+ if (!basePatchNum && !patchNum && !path) {
+ return this._getDiffComments(changeNum, '/robotcomments');
+ }
+
return this._getDiffComments(
changeNum,
'/robotcomments',
@@ -2542,6 +2562,17 @@
* empty object.
*/
getDiffDrafts(
+ changeNum: ChangeNum
+ ): Promise<PathToCommentsInfoMap | undefined>;
+
+ getDiffDrafts(
+ changeNum: ChangeNum,
+ basePatchNum: PatchSetNum,
+ patchNum: PatchSetNum,
+ path: string
+ ): Promise<GetDiffCommentsOutput>;
+
+ getDiffDrafts(
changeNum: ChangeNum,
basePatchNum?: PatchSetNum,
patchNum?: PatchSetNum,
@@ -2549,7 +2580,10 @@
) {
return this.getLoggedIn().then(loggedIn => {
if (!loggedIn) {
- return Promise.resolve({});
+ return {};
+ }
+ if (!basePatchNum && !patchNum && !path) {
+ return this._getDiffComments(changeNum, '/drafts');
}
return this._getDiffComments(
changeNum,
diff --git a/polygerrit-ui/app/services/services/gr-rest-api/gr-rest-api.ts b/polygerrit-ui/app/services/services/gr-rest-api/gr-rest-api.ts
index 4280224..6aa00d0 100644
--- a/polygerrit-ui/app/services/services/gr-rest-api/gr-rest-api.ts
+++ b/polygerrit-ui/app/services/services/gr-rest-api/gr-rest-api.ts
@@ -31,6 +31,7 @@
RequestPayload,
PreferencesInput,
DiffPreferencesInfo,
+ EditPreferencesInfo,
DiffPreferenceInput,
SshKeyInfo,
RepoName,
@@ -51,6 +52,26 @@
GroupInfo,
GroupOptionsInput,
BranchInfo,
+ ConfigInfo,
+ ReviewInput,
+ EditInfo,
+ ChangeId,
+ DashboardInfo,
+ ProjectAccessInfoMap,
+ IncludedInInfo,
+ RobotCommentInfo,
+ CommentInfo,
+ PathToCommentsInfoMap,
+ PathToRobotCommentsInfoMap,
+ CommentInput,
+ GroupInput,
+ PluginInfo,
+ DocResult,
+ ContributorAgreementInfo,
+ ContributorAgreementInput,
+ Password,
+ ProjectWatchInfo,
+ NameToProjectInfoMap,
} from '../../../types/common';
import {ParsedChangeInfo} from '../../../elements/shared/gr-rest-api-interface/gr-reviewer-updates-parser';
import {HttpMethod} from '../../../constants/constants';
@@ -119,6 +140,16 @@
): RestApiTagNameMap[K];
}
+export interface GetDiffCommentsOutput {
+ baseComments: CommentInfo[];
+ comments: CommentInfo[];
+}
+
+export interface GetDiffRobotCommentsOutput {
+ baseComments: RobotCommentInfo[];
+ comments: RobotCommentInfo[];
+}
+
export interface RestApiService {
// TODO(TS): unclear what is a second parameter. Looks like it is a mistake
// and it must be removed
@@ -207,6 +238,26 @@
getDiffPreferences(): Promise<DiffPreferencesInfo | undefined>;
saveDiffPreferences(prefs: DiffPreferenceInput): Promise<Response>;
+ saveDiffPreferences(
+ prefs: DiffPreferenceInput,
+ errFn: ErrorCallback
+ ): Promise<Response | undefined>;
+ saveDiffPreferences(
+ prefs: DiffPreferenceInput,
+ errFn?: ErrorCallback
+ ): Promise<Response>;
+
+ getEditPreferences(): Promise<EditPreferencesInfo | undefined>;
+
+ saveEditPreferences(prefs: EditPreferencesInfo): Promise<Response>;
+ saveEditPreferences(
+ prefs: EditPreferencesInfo,
+ errFn: ErrorCallback
+ ): Promise<Response | undefined>;
+ saveEditPreferences(
+ prefs: EditPreferencesInfo,
+ errFn?: ErrorCallback
+ ): Promise<Response>;
getAccountEmails(): Promise<EmailInfo[] | undefined>;
deleteAccountEmail(email: string): Promise<Response>;
@@ -284,6 +335,18 @@
errFn?: ErrorCallback
): Promise<ProjectInfo | undefined>;
+ getRepoDashboards(
+ repo: RepoName,
+ errFn?: ErrorCallback
+ ): Promise<DashboardInfo[] | undefined>;
+
+ getRepoAccess(repo: RepoName): Promise<ProjectAccessInfoMap | undefined>;
+
+ getProjectConfig(
+ repo: RepoName,
+ errFn?: ErrorCallback
+ ): Promise<ConfigInfo | undefined>;
+
getCapabilities(
errFn?: ErrorCallback
): Promise<CapabilityInfoMap | undefined>;
@@ -320,4 +383,188 @@
groupId: GroupId,
options: GroupOptionsInput
): Promise<Response>;
+
+ saveChangeReview(
+ changeNum: ChangeNum,
+ patchNum: PatchSetNum,
+ review: ReviewInput
+ ): Promise<Response>;
+ saveChangeReview(
+ changeNum: ChangeNum,
+ patchNum: PatchSetNum,
+ review: ReviewInput,
+ errFn: ErrorCallback
+ ): Promise<Response | undefined>;
+ saveChangeReview(
+ changeNum: ChangeNum,
+ patchNum: PatchSetNum,
+ review: ReviewInput,
+ errFn?: ErrorCallback
+ ): Promise<Response>;
+
+ getChangeEdit(
+ changeNum: ChangeNum,
+ downloadCommands?: boolean
+ ): Promise<false | EditInfo | undefined>;
+
+ createChange(
+ project: RepoName,
+ branch: BranchName,
+ subject: string,
+ topic?: string,
+ isPrivate?: boolean,
+ workInProgress?: boolean,
+ baseChange?: ChangeId,
+ baseCommit?: string
+ ): Promise<ChangeInfo | undefined>;
+
+ getChangeIncludedIn(
+ changeNum: ChangeNum
+ ): Promise<IncludedInInfo | undefined>;
+
+ getFromProjectLookup(changeNum: ChangeNum): Promise<RepoName | undefined>;
+
+ saveDiffDraft(
+ changeNum: ChangeNum,
+ patchNum: PatchSetNum,
+ draft: CommentInput
+ ): Promise<Response>;
+
+ getDiffChangeDetail(
+ changeNum: ChangeNum,
+ errFn?: ErrorCallback,
+ cancelCondition?: CancelConditionCallback
+ ): Promise<ChangeInfo | undefined | null>;
+
+ getDiffComments(
+ changeNum: ChangeNum
+ ): Promise<PathToCommentsInfoMap | undefined>;
+ getDiffComments(
+ changeNum: ChangeNum,
+ basePatchNum: PatchSetNum,
+ patchNum: PatchSetNum,
+ path: string
+ ): Promise<GetDiffCommentsOutput>;
+ getDiffComments(
+ changeNum: ChangeNum,
+ basePatchNum?: PatchSetNum,
+ patchNum?: PatchSetNum,
+ path?: string
+ ):
+ | Promise<PathToCommentsInfoMap | undefined>
+ | Promise<GetDiffCommentsOutput>;
+
+ getDiffRobotComments(
+ changeNum: ChangeNum
+ ): Promise<PathToRobotCommentsInfoMap | undefined>;
+ getDiffRobotComments(
+ changeNum: ChangeNum,
+ basePatchNum: PatchSetNum,
+ patchNum: PatchSetNum,
+ path: string
+ ): Promise<GetDiffRobotCommentsOutput>;
+ getDiffRobotComments(
+ changeNum: ChangeNum,
+ basePatchNum?: PatchSetNum,
+ patchNum?: PatchSetNum,
+ path?: string
+ ):
+ | Promise<GetDiffRobotCommentsOutput>
+ | Promise<PathToRobotCommentsInfoMap | undefined>;
+
+ getDiffDrafts(
+ changeNum: ChangeNum
+ ): Promise<PathToCommentsInfoMap | undefined>;
+ getDiffDrafts(
+ changeNum: ChangeNum,
+ basePatchNum: PatchSetNum,
+ patchNum: PatchSetNum,
+ path: string
+ ): Promise<GetDiffCommentsOutput>;
+ getDiffDrafts(
+ changeNum: ChangeNum,
+ basePatchNum?: PatchSetNum,
+ patchNum?: PatchSetNum,
+ path?: string
+ ):
+ | Promise<GetDiffCommentsOutput>
+ | Promise<PathToCommentsInfoMap | undefined>;
+
+ createGroup(config: GroupInput & {name: string}): Promise<Response>;
+ createGroup(
+ config: GroupInput & {name: string},
+ errFn: ErrorCallback
+ ): Promise<Response | undefined>;
+ createGroup(config: GroupInput, errFn?: ErrorCallback): Promise<Response>;
+
+ getPlugins(
+ filter: string,
+ pluginsPerPage: number,
+ offset?: number,
+ errFn?: ErrorCallback
+ ): Promise<{[pluginName: string]: PluginInfo} | undefined>;
+
+ getChanges(
+ changesPerPage?: number,
+ query?: string,
+ offset?: 'n,z' | number,
+ options?: string
+ ): Promise<ChangeInfo[] | undefined>;
+ getChanges(
+ changesPerPage?: number,
+ query?: string[],
+ offset?: 'n,z' | number,
+ options?: string
+ ): Promise<ChangeInfo[][] | undefined>;
+ /**
+ * @return If opt_query is an
+ * array, _fetchJSON will return an array of arrays of changeInfos. If it
+ * is unspecified or a string, _fetchJSON will return an array of
+ * changeInfos.
+ */
+ getChanges(
+ changesPerPage?: number,
+ query?: string | string[],
+ offset?: 'n,z' | number,
+ options?: string
+ ): Promise<ChangeInfo[] | ChangeInfo[][] | undefined>;
+
+ getDocumentationSearches(filter: string): Promise<DocResult[] | undefined>;
+
+ getAccountAgreements(): Promise<ContributorAgreementInfo[] | undefined>;
+
+ getAccountGroups(): Promise<GroupInfo[] | undefined>;
+
+ saveAccountAgreement(name: ContributorAgreementInput): Promise<Response>;
+
+ generateAccountHttpPassword(): Promise<Password>;
+
+ setAccountName(name: string, errFn?: ErrorCallback): Promise<void>;
+
+ setAccountUsername(username: string, errFn?: ErrorCallback): Promise<void>;
+
+ getWatchedProjects(): Promise<ProjectWatchInfo[] | undefined>;
+
+ saveWatchedProjects(
+ projects: ProjectWatchInfo[],
+ errFn?: ErrorCallback
+ ): Promise<ProjectWatchInfo[]>;
+
+ deleteWatchedProjects(
+ projects: ProjectWatchInfo[]
+ ): Promise<Response | undefined>;
+ deleteWatchedProjects(
+ projects: ProjectWatchInfo[],
+ errFn: ErrorCallback
+ ): Promise<Response | undefined>;
+ deleteWatchedProjects(
+ projects: ProjectWatchInfo[],
+ errFn?: ErrorCallback
+ ): Promise<Response | undefined>;
+
+ getSuggestedProjects(
+ inputVal: string,
+ n?: number,
+ errFn?: ErrorCallback
+ ): Promise<NameToProjectInfoMap | undefined>;
}