Add extensions-api for accounts

It's an initial skeleton only at the moment.
Methods for getting an account and starChange / unstarChange are
available which will also be implemented in the upcoming REST client.

Change-Id: I1a8d0cbe9106a1bccdad29cbb1c9a313a844909a
This commit is contained in:
Urs Wolfer
2014-04-27 21:12:41 +02:00
parent 844063d312
commit 2a83139d60
3 changed files with 93 additions and 0 deletions

View File

@@ -14,11 +14,13 @@
package com.google.gerrit.extensions.api;
import com.google.gerrit.extensions.api.accounts.Accounts;
import com.google.gerrit.extensions.api.changes.Changes;
import com.google.gerrit.extensions.api.projects.Projects;
import com.google.gerrit.extensions.restapi.NotImplementedException;
public interface GerritApi {
public Accounts accounts();
public Changes changes();
public Projects projects();
@@ -27,6 +29,11 @@ public interface GerritApi {
* when adding new methods to the interface.
**/
public class NotImplemented implements GerritApi {
@Override
public Accounts accounts() {
throw new NotImplementedException();
}
@Override
public Changes changes() {
throw new NotImplementedException();

View File

@@ -0,0 +1,47 @@
// Copyright (C) 2014 The Android Open Source Project
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package com.google.gerrit.extensions.api.accounts;
import com.google.gerrit.extensions.common.AccountInfo;
import com.google.gerrit.extensions.restapi.NotImplementedException;
import com.google.gerrit.extensions.restapi.RestApiException;
public interface AccountApi {
AccountInfo get() throws RestApiException;
void starChange(String id) throws RestApiException;
void unstarChange(String id) throws RestApiException;
/**
* A default implementation which allows source compatibility
* when adding new methods to the interface.
**/
public class NotImplemented implements AccountApi {
@Override
public AccountInfo get() throws RestApiException {
throw new NotImplementedException();
}
@Override
public void starChange(String id) throws RestApiException {
throw new NotImplementedException();
}
@Override
public void unstarChange(String id) throws RestApiException {
throw new NotImplementedException();
}
}
}

View File

@@ -0,0 +1,39 @@
// Copyright (C) 2014 The Android Open Source Project
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package com.google.gerrit.extensions.api.accounts;
import com.google.gerrit.extensions.restapi.NotImplementedException;
import com.google.gerrit.extensions.restapi.RestApiException;
public interface Accounts {
AccountApi id(String id) throws RestApiException;
AccountApi self() throws RestApiException;
/**
* A default implementation which allows source compatibility
* when adding new methods to the interface.
**/
public class NotImplemented implements Accounts {
@Override
public AccountApi id(String id) throws RestApiException {
throw new NotImplementedException();
}
@Override
public AccountApi self() throws RestApiException {
throw new NotImplementedException();
}
}
}