Move all GrRestApiInterface to RestApiService & Element

Change-Id: I999abe8488abc2d25f12238d2c49ea4f6d64208a
This commit is contained in:
Tao Zhou
2020-08-28 18:45:12 +02:00
parent 6aee31a033
commit c54a1fcee2
5 changed files with 16 additions and 8 deletions

View File

@@ -28,7 +28,7 @@ import {htmlTemplate} from './gr-create-repo-dialog_html';
import {encodeURL, getBaseUrl} from '../../../utils/url-util';
import {page} from '../../../utils/page-wrapper-utils';
import {customElement, observe, 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 {ProjectInput, RepoName} from '../../../types/common';
import {hasOwnProperty} from '../../../utils/common-util';
import {AutocompleteQuery} from '../../shared/gr-autocomplete/gr-autocomplete';
@@ -41,7 +41,7 @@ declare global {
export interface GrCreateRepoDialog {
$: {
restAPI: GrRestApiInterface;
restAPI: RestApiService & Element;
};
}

View File

@@ -29,7 +29,7 @@ import {ListViewMixin} from '../../../mixins/gr-list-view-mixin/gr-list-view-mix
import {GerritNav} from '../../core/gr-navigation/gr-navigation';
import {customElement, property, observe, computed} from '@polymer/decorators';
import {AppElementAdminParams} from '../../gr-app-types';
import {GrRestApiInterface} from '../../shared/gr-rest-api-interface/gr-rest-api-interface';
import {RestApiService} from '../../../services/services/gr-rest-api/gr-rest-api';
import {GrOverlay} from '../../shared/gr-overlay/gr-overlay';
import {RepoName, ProjectInfoWithName} from '../../../types/common';
import {GrCreateRepoDialog} from '../gr-create-repo-dialog/gr-create-repo-dialog';
@@ -43,7 +43,7 @@ declare global {
export interface GrRepoList {
$: {
restAPI: GrRestApiInterface;
restAPI: RestApiService & Element;
createOverlay: GrOverlay;
createNewModal: GrCreateRepoDialog;
};

View File

@@ -23,8 +23,8 @@ import {LegacyElementMixin} from '@polymer/polymer/lib/legacy/legacy-element-mix
import {PolymerElement} from '@polymer/polymer/polymer-element';
import {htmlTemplate} from './gr-download-commands_html';
import {customElement, property, observe} from '@polymer/decorators';
import {GrRestApiInterface} from '../gr-rest-api-interface/gr-rest-api-interface';
import {PaperTabsElement} from '@polymer/paper-tabs/paper-tabs';
import {RestApiService} from '../../../services/services/gr-rest-api/gr-rest-api';
declare global {
interface HTMLElementTagNameMap {
@@ -35,7 +35,7 @@ declare global {
export interface GrDownloadCommands {
$: {
downloadTabs: PaperTabsElement;
restAPI: GrRestApiInterface;
restAPI: RestApiService & Element;
};
}

View File

@@ -33,7 +33,7 @@ import {
BranchInfo,
} from '../../../types/common';
import {GrLabeledAutocomplete} from '../gr-labeled-autocomplete/gr-labeled-autocomplete';
import {GrRestApiInterface} from '../gr-rest-api-interface/gr-rest-api-interface';
import {RestApiService} from '../../../services/services/gr-rest-api/gr-rest-api';
const SUGGESTIONS_LIMIT = 15;
const REF_PREFIX = 'refs/heads/';
@@ -42,7 +42,7 @@ export interface GrRepoBranchPicker {
$: {
repoInput: GrLabeledAutocomplete;
branchInput: GrLabeledAutocomplete;
restAPI: GrRestApiInterface;
restAPI: RestApiService & Element;
};
}
@customElement('gr-repo-branch-picker')

View File

@@ -72,6 +72,7 @@ import {
Password,
ProjectWatchInfo,
NameToProjectInfoMap,
ProjectInput,
} from '../../../types/common';
import {ParsedChangeInfo} from '../../../elements/shared/gr-rest-api-interface/gr-reviewer-updates-parser';
import {HttpMethod} from '../../../constants/constants';
@@ -330,6 +331,13 @@ export interface RestApiService {
errFn?: ErrorCallback
): Promise<ProjectAccessInfo | undefined>;
createRepo(config: ProjectInput & {name: RepoName}): Promise<Response>;
createRepo(
config: ProjectInput & {name: RepoName},
errFn: ErrorCallback
): Promise<Response | undefined>;
createRepo(config: ProjectInput, errFn?: ErrorCallback): Promise<Response>;
getRepo(
repo: RepoName,
errFn?: ErrorCallback