use of com.google.gerrit.client.rpc.RestApi in project gerrit by GerritCodeReview.
the class AccountApi method deleteSshKeys.
/**
* Delete SSH keys. For each key to be deleted a separate DELETE request is fired to the server.
* The {@code onSuccess} method of the provided callback is invoked once after all requests
* succeeded. If any request fails the callbacks' {@code onFailure} method is invoked. In a
* failure case it can be that still some of the keys were successfully deleted.
*/
public static void deleteSshKeys(String account, Set<Integer> sequenceNumbers, AsyncCallback<VoidResult> cb) {
CallbackGroup group = new CallbackGroup();
for (int seq : sequenceNumbers) {
new RestApi("/accounts/").id(account).view("sshkeys").id(seq).delete(group.add(cb));
cb = CallbackGroup.emptyCallback();
}
group.done();
}
use of com.google.gerrit.client.rpc.RestApi in project gerrit by GerritCodeReview.
the class AvatarImage method loadAvatar.
private void loadAvatar(AccountInfo account, int size, boolean addPopup) {
if (!Gerrit.info().plugin().hasAvatars()) {
setVisible(false);
return;
}
// TODO Kill /accounts/*/avatar URL.
String u = account.email();
if (Gerrit.isSignedIn() && u.equals(Gerrit.getUserAccount().email())) {
u = "self";
}
RestApi api = new RestApi("/accounts/").id(u).view("avatar");
if (size > 0) {
api.addParameter("s", size);
setSize("", size + "px");
}
setVisible(false);
setUrl(api.url());
popup(account, addPopup);
}
use of com.google.gerrit.client.rpc.RestApi in project gerrit by GerritCodeReview.
the class ChangeScreen method loadChangeInfo.
void loadChangeInfo(boolean fg, AsyncCallback<ChangeInfo> cb) {
RestApi call = ChangeApi.detail(changeId.get());
EnumSet<ListChangesOption> opts = EnumSet.of(ListChangesOption.ALL_REVISIONS, ListChangesOption.CHANGE_ACTIONS);
if (enableSignedPush()) {
opts.add(ListChangesOption.PUSH_CERTIFICATES);
}
ChangeList.addOptions(call, opts);
if (!fg) {
call.background();
}
call.get(cb);
}
use of com.google.gerrit.client.rpc.RestApi in project gerrit by GerritCodeReview.
the class ChangeGlue method onAction.
public static void onAction(ChangeInfo change, ActionInfo action, ActionButton button) {
RestApi api = ChangeApi.change(change.legacyId().get()).view(action.id());
JavaScriptObject f = get(action.id());
if (f != null) {
ActionContext c = ActionContext.create(api);
c.set(action);
c.set(change);
c.button(button);
ApiGlue.invoke(f, c);
} else {
DefaultActions.invoke(change, action, api);
}
}
use of com.google.gerrit.client.rpc.RestApi in project gerrit by GerritCodeReview.
the class EditGlue method onAction.
public static void onAction(ChangeInfo change, EditInfo edit, ActionInfo action, ActionButton button) {
RestApi api = ChangeApi.edit(change.legacyId().get()).view(action.id());
JavaScriptObject f = get(action.id());
if (f != null) {
ActionContext c = ActionContext.create(api);
c.set(action);
c.set(change);
c.set(edit);
c.button(button);
ApiGlue.invoke(f, c);
} else {
DefaultActions.invoke(change, action, api);
}
}
Aggregations