Search in sources :

Example 1 with RestApi

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());
}
Also used : NativeString(com.google.gerrit.client.rpc.NativeString) RestApi(com.google.gerrit.client.rpc.RestApi) GerritUiExtensionPoint(com.google.gerrit.client.GerritUiExtensionPoint)

Example 2 with RestApi

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);
}
Also used : RestApi(com.google.gerrit.client.rpc.RestApi)

Example 3 with RestApi

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);
}
Also used : RestApi(com.google.gerrit.client.rpc.RestApi)

Example 4 with RestApi

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);
}
Also used : RestApi(com.google.gerrit.client.rpc.RestApi)

Example 5 with RestApi

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);
}
Also used : RestApi(com.google.gerrit.client.rpc.RestApi) JavaScriptObject(com.google.gwt.core.client.JavaScriptObject)

Aggregations

RestApi (com.google.gerrit.client.rpc.RestApi)42 JavaScriptObject (com.google.gwt.core.client.JavaScriptObject)8 ChangeInfo (com.google.gerrit.client.info.ChangeInfo)3 EditInfo (com.google.gerrit.client.info.ChangeInfo.EditInfo)2 CallbackGroup (com.google.gerrit.client.rpc.CallbackGroup)2 AsyncCallback (com.google.gwt.user.client.rpc.AsyncCallback)2 Anchor (com.google.gwt.user.client.ui.Anchor)2 HorizontalPanel (com.google.gwt.user.client.ui.HorizontalPanel)2 InlineLabel (com.google.gwt.user.client.ui.InlineLabel)2 ArrayList (java.util.ArrayList)2 GerritUiExtensionPoint (com.google.gerrit.client.GerritUiExtensionPoint)1 ActionInfo (com.google.gerrit.client.info.ActionInfo)1 RevisionInfo (com.google.gerrit.client.info.ChangeInfo.RevisionInfo)1 GerritCallback (com.google.gerrit.client.rpc.GerritCallback)1 NativeMap (com.google.gerrit.client.rpc.NativeMap)1 NativeString (com.google.gerrit.client.rpc.NativeString)1 ListChangesOption (com.google.gerrit.extensions.client.ListChangesOption)1 Change (com.google.gerrit.reviewdb.client.Change)1 Project (com.google.gerrit.reviewdb.client.Project)1 JsArray (com.google.gwt.core.client.JsArray)1