use of com.google.gerrit.extensions.restapi.RestApiException in project gerrit by GerritCodeReview.
the class AccountApiImpl method setName.
@Override
public void setName(String name) throws RestApiException {
NameInput input = new NameInput();
input.name = name;
try {
putName.apply(account, input);
} catch (Exception e) {
throw asRestApiException("Cannot set account name", e);
}
}
use of com.google.gerrit.extensions.restapi.RestApiException in project gerrit by GerritCodeReview.
the class AccountApiImpl method generateHttpPassword.
@Override
public String generateHttpPassword() throws RestApiException {
HttpPasswordInput input = new HttpPasswordInput();
input.generate = true;
try {
// Response should never be 'none' for a generated password, but
// let's make sure.
Response<String> result = putHttpPassword.apply(account, input);
return result.isNone() ? null : result.value();
} catch (Exception e) {
throw asRestApiException("Cannot generate HTTP password", e);
}
}
use of com.google.gerrit.extensions.restapi.RestApiException in project gerrit by GerritCodeReview.
the class AccountApiImpl method setHttpPassword.
@Override
public String setHttpPassword(String password) throws RestApiException {
HttpPasswordInput input = new HttpPasswordInput();
input.generate = false;
input.httpPassword = password;
try {
Response<String> result = putHttpPassword.apply(account, input);
return result.isNone() ? null : result.value();
} catch (Exception e) {
throw asRestApiException("Cannot generate HTTP password", e);
}
}
use of com.google.gerrit.extensions.restapi.RestApiException in project gerrit by GerritCodeReview.
the class AccountApiImpl method get.
@Override
public com.google.gerrit.extensions.common.AccountInfo get() throws RestApiException {
AccountLoader accountLoader = accountLoaderFactory.create(true);
try {
AccountInfo ai = accountLoader.get(account.getUser().getAccountId());
accountLoader.fill();
return ai;
} catch (Exception e) {
throw asRestApiException("Cannot parse account", e);
}
}
use of com.google.gerrit.extensions.restapi.RestApiException in project gerrit by GerritCodeReview.
the class AccountApiImpl method unstarChange.
@Override
public void unstarChange(String changeId) throws RestApiException {
try {
ChangeResource rsrc = changes.parse(TopLevelResource.INSTANCE, IdString.fromUrl(changeId));
AccountResource.StarredChange starredChange = new AccountResource.StarredChange(account.getUser(), rsrc);
starredChangesDelete.apply(starredChange, new Input());
} catch (Exception e) {
throw asRestApiException("Cannot unstar change", e);
}
}
Aggregations