Keep RestApiService in sync with gr-rest-api-interface
Replaced existing usage on GrRestApiInterface with `RestApiService & Element` Change-Id: Id16f489ea382522c9f1c765fe44550248878f149
This commit is contained in:
@@ -27,7 +27,6 @@ import {PolymerElement} from '@polymer/polymer/polymer-element';
|
||||
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 @@ import {
|
||||
} 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;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -25,12 +25,12 @@ import {htmlTemplate} from './gr-create-group-dialog_html';
|
||||
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;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@ import {
|
||||
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 @@ interface PluginInfoWithName extends PluginInfo {
|
||||
}
|
||||
export interface GrPluginList {
|
||||
$: {
|
||||
restAPI: GrRestApiInterface;
|
||||
restAPI: RestApiService & Element;
|
||||
};
|
||||
}
|
||||
@customElement('gr-plugin-list')
|
||||
|
||||
@@ -24,7 +24,7 @@ import {PolymerElement} from '@polymer/polymer/polymer-element';
|
||||
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 @@ interface DashboardRef {
|
||||
|
||||
export interface GrRepoDashboards {
|
||||
$: {
|
||||
restAPI: GrRestApiInterface;
|
||||
restAPI: RestApiService & Element;
|
||||
};
|
||||
}
|
||||
@customElement('gr-repo-dashboards')
|
||||
|
||||
@@ -34,7 +34,7 @@ import {
|
||||
} 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 @@ declare global {
|
||||
// is converted
|
||||
export interface GrConfirmCherrypickDialog {
|
||||
$: {
|
||||
restAPI: GrRestApiInterface;
|
||||
restAPI: RestApiService & Element;
|
||||
branchInput: GrAutocomplete;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@ import {PolymerElement} from '@polymer/polymer/polymer-element';
|
||||
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 @@ const SUGGESTIONS_LIMIT = 15;
|
||||
|
||||
export interface GrConfirmMoveDialog {
|
||||
$: {
|
||||
restAPI: GrRestApiInterface;
|
||||
restAPI: RestApiService & Element;
|
||||
};
|
||||
}
|
||||
@customElement('gr-confirm-move-dialog')
|
||||
|
||||
@@ -23,10 +23,7 @@ import {LegacyElementMixin} from '@polymer/polymer/lib/legacy/legacy-element-mix
|
||||
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 @@ import {
|
||||
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 @@ interface RebaseChange {
|
||||
|
||||
export interface GrConfirmRebaseDialog {
|
||||
$: {
|
||||
restAPI: GrRestApiInterface;
|
||||
restAPI: RestApiService & Element;
|
||||
parentInput: GrAutocomplete;
|
||||
rebaseOnParentInput: HTMLInputElement;
|
||||
rebaseOnOtherInput: HTMLInputElement;
|
||||
|
||||
@@ -23,15 +23,13 @@ import {LegacyElementMixin} from '@polymer/polymer/lib/legacy/legacy-element-mix
|
||||
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;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -59,7 +59,7 @@ import {
|
||||
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 @@ if (!app) {
|
||||
|
||||
export interface GrRouter {
|
||||
$: {
|
||||
restAPI: GrRestApiInterface;
|
||||
restAPI: RestApiService & Element;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -37,12 +37,10 @@ import {
|
||||
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 @@ export class ChangeComments {
|
||||
* 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 @@ export const _testOnly_findCommentById =
|
||||
|
||||
interface GrCommentApi {
|
||||
$: {
|
||||
restAPI: GrRestApiInterface;
|
||||
restAPI: RestApiService & Element;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -691,7 +689,10 @@ class GrCommentApi extends GestureEventListeners(
|
||||
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
|
||||
);
|
||||
|
||||
@@ -28,12 +28,12 @@ import {
|
||||
} 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')
|
||||
|
||||
@@ -24,12 +24,12 @@ import {PolymerElement} from '@polymer/polymer/polymer-element';
|
||||
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')
|
||||
|
||||
@@ -25,7 +25,7 @@ import {LegacyElementMixin} from '@polymer/polymer/lib/legacy/legacy-element-mix
|
||||
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 @@ import {
|
||||
|
||||
export interface GrClaView {
|
||||
$: {
|
||||
restAPI: GrRestApiInterface;
|
||||
restAPI: RestApiService & Element;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -24,12 +24,12 @@ import {LegacyElementMixin} from '@polymer/polymer/lib/legacy/legacy-element-mix
|
||||
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;
|
||||
|
||||
@@ -22,13 +22,13 @@ import {LegacyElementMixin} from '@polymer/polymer/lib/legacy/legacy-element-mix
|
||||
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;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ import {PolymerElement} from '@polymer/polymer/polymer-element';
|
||||
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 @@ declare global {
|
||||
|
||||
export interface GrHttpPassword {
|
||||
$: {
|
||||
restAPI: GrRestApiInterface;
|
||||
restAPI: RestApiService & Element;
|
||||
generatedPasswordOverlay: GrOverlay;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -25,11 +25,11 @@ import {PolymerElement} from '@polymer/polymer/polymer-element';
|
||||
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;
|
||||
|
||||
@@ -31,7 +31,7 @@ import {
|
||||
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 @@ const NOTIFICATION_TYPES = [
|
||||
|
||||
export interface GrWatchedProjectsEditor {
|
||||
$: {
|
||||
restAPI: GrRestApiInterface;
|
||||
restAPI: RestApiService & Element;
|
||||
newFilter: HTMLInputElement;
|
||||
newProject: GrAutocomplete;
|
||||
};
|
||||
|
||||
@@ -31,9 +31,9 @@ import {
|
||||
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 @@ declare global {
|
||||
|
||||
export interface GrDateFormatter {
|
||||
$: {
|
||||
restAPI: GrRestApiInterface;
|
||||
restAPI: RestApiService & Element;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -103,7 +103,6 @@ import {
|
||||
ProjectWatchInfo,
|
||||
RepoName,
|
||||
ReviewInput,
|
||||
RobotCommentInfo,
|
||||
ServerInfo,
|
||||
SshKeyInfo,
|
||||
UrlEncodedCommentId,
|
||||
@@ -132,6 +131,8 @@ import {
|
||||
CancelConditionCallback,
|
||||
ErrorCallback,
|
||||
RestApiService,
|
||||
GetDiffCommentsOutput,
|
||||
GetDiffRobotCommentsOutput,
|
||||
} from '../../../services/services/gr-rest-api/gr-rest-api';
|
||||
import {
|
||||
CommentSide,
|
||||
@@ -247,16 +248,6 @@ interface GetDiffParams {
|
||||
|
||||
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
|
||||
@@ -2506,12 +2497,26 @@ export class GrRestApiInterface
|
||||
return this._getChangeURLAndFetch(req);
|
||||
}
|
||||
|
||||
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',
|
||||
@@ -2521,12 +2526,27 @@ export class GrRestApiInterface
|
||||
);
|
||||
}
|
||||
|
||||
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',
|
||||
@@ -2541,6 +2561,17 @@ export class GrRestApiInterface
|
||||
* is no logged in user, the request is not made and the promise yields an
|
||||
* empty object.
|
||||
*/
|
||||
getDiffDrafts(
|
||||
changeNum: ChangeNum
|
||||
): Promise<PathToCommentsInfoMap | undefined>;
|
||||
|
||||
getDiffDrafts(
|
||||
changeNum: ChangeNum,
|
||||
basePatchNum: PatchSetNum,
|
||||
patchNum: PatchSetNum,
|
||||
path: string
|
||||
): Promise<GetDiffCommentsOutput>;
|
||||
|
||||
getDiffDrafts(
|
||||
changeNum: ChangeNum,
|
||||
basePatchNum?: PatchSetNum,
|
||||
@@ -2549,7 +2580,10 @@ export class GrRestApiInterface
|
||||
) {
|
||||
return this.getLoggedIn().then(loggedIn => {
|
||||
if (!loggedIn) {
|
||||
return Promise.resolve({});
|
||||
return {};
|
||||
}
|
||||
if (!basePatchNum && !patchNum && !path) {
|
||||
return this._getDiffComments(changeNum, '/drafts');
|
||||
}
|
||||
return this._getDiffComments(
|
||||
changeNum,
|
||||
|
||||
@@ -31,6 +31,7 @@ import {
|
||||
RequestPayload,
|
||||
PreferencesInput,
|
||||
DiffPreferencesInfo,
|
||||
EditPreferencesInfo,
|
||||
DiffPreferenceInput,
|
||||
SshKeyInfo,
|
||||
RepoName,
|
||||
@@ -51,6 +52,26 @@ import {
|
||||
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 @@ export interface JsApiService {
|
||||
): 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 @@ export interface RestApiService {
|
||||
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 @@ export interface RestApiService {
|
||||
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 @@ export interface RestApiService {
|
||||
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>;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user