use of com.google.gerrit.client.rpc.RestApi in project gerrit by GerritCodeReview.
the class MyProfileScreen method display.
void display(AccountInfo account) {
if (Gerrit.info().plugin().hasAvatars()) {
avatar.setAccount(account, 93, false);
new RestApi("/accounts/").id("self").view("avatar.change.url").get(new AsyncCallback<NativeString>() {
@Override
public void onSuccess(NativeString changeUrl) {
changeAvatar.setHref(changeUrl.asString());
changeAvatar.setVisible(true);
}
@Override
public void onFailure(Throwable caught) {
}
});
}
int row = 0;
if (Gerrit.info().auth().siteHasUsernames()) {
info.setWidget(row++, fieldIdx, new UsernameField());
}
info.setText(row++, fieldIdx, account.name());
info.setText(row++, fieldIdx, account.email());
info.setText(row++, fieldIdx, mediumFormat(account.registeredOn()));
info.setText(row, fieldIdx, account.getId().toString());
}
use of com.google.gerrit.client.rpc.RestApi in project gerrit by GerritCodeReview.
the class AccountApi method setName.
/** Set the account name */
public static void setName(String account, String name, AsyncCallback<NativeString> cb) {
AccountNameInput input = AccountNameInput.create();
input.name(name);
new RestApi("/accounts/").id(account).view("name").put(input, cb);
}
use of com.google.gerrit.client.rpc.RestApi in project gerrit by GerritCodeReview.
the class AccountApi method setUsername.
/** Set the username */
public static void setUsername(String account, String username, AsyncCallback<NativeString> cb) {
UsernameInput input = UsernameInput.create();
input.username(username);
new RestApi("/accounts/").id(account).view("username").put(input, cb);
}
use of com.google.gerrit.client.rpc.RestApi in project gerrit by GerritCodeReview.
the class AccountApi method generateHttpPassword.
/** Generate a new HTTP password */
public static void generateHttpPassword(String account, AsyncCallback<NativeString> cb) {
HttpPasswordInput in = HttpPasswordInput.create();
in.generate(true);
new RestApi("/accounts/").id(account).view("password.http").put(in, cb);
}
use of com.google.gerrit.client.rpc.RestApi in project gerrit by GerritCodeReview.
the class AccountApi method registerEmail.
/** Register a new email address */
public static void registerEmail(String account, String email, AsyncCallback<EmailInfo> cb) {
JavaScriptObject in = JavaScriptObject.createObject();
new RestApi("/accounts/").id(account).view("emails").id(email).ifNoneMatch().put(in, cb);
}
Aggregations