Search in sources :

Example 26 with RestApi

use of com.google.gerrit.client.rpc.RestApi in project gerrit by GerritCodeReview.

the class ChangeEditApi method get.

/** Get file (or commit message) contents. */
public static void get(PatchSet.Id id, String path, boolean base, HttpCallback<NativeString> cb) {
    RestApi api;
    if (id.get() != 0) {
        // Read from a published revision, when change edit doesn't
        // exist for the caller, or is not currently active.
        api = ChangeApi.revision(id).view("files").id(path).view("content");
    } else if (Patch.COMMIT_MSG.equals(path)) {
        api = editMessage(id.getParentKey().get()).addParameter("base", base);
    } else {
        api = editFile(id.getParentKey().get(), path).addParameter("base", base);
    }
    api.get(cb);
}
Also used : RestApi(com.google.gerrit.client.rpc.RestApi)

Example 27 with RestApi

use of com.google.gerrit.client.rpc.RestApi in project gerrit by GerritCodeReview.

the class DiffApi method list.

public static void list(PatchSet.Id id, PatchSet.Id base, AsyncCallback<NativeMap<FileInfo>> cb) {
    RestApi api = ChangeApi.revision(id).view("files");
    if (base != null) {
        if (base.get() < 0) {
            api.addParameter("parent", -base.get());
        } else {
            api.addParameter("base", base.get());
        }
    }
    api.get(NativeMap.copyKeysIntoChildren("path", cb));
}
Also used : RestApi(com.google.gerrit.client.rpc.RestApi)

Example 28 with RestApi

use of com.google.gerrit.client.rpc.RestApi in project gerrit by GerritCodeReview.

the class GroupApi method createGroup.

/** Create a new group */
public static void createGroup(String groupName, AsyncCallback<GroupInfo> cb) {
    JavaScriptObject in = JavaScriptObject.createObject();
    new RestApi("/groups/").id(groupName).ifNoneMatch().put(in, cb);
}
Also used : RestApi(com.google.gerrit.client.rpc.RestApi) JavaScriptObject(com.google.gwt.core.client.JavaScriptObject)

Example 29 with RestApi

use of com.google.gerrit.client.rpc.RestApi in project gerrit by GerritCodeReview.

the class GroupApi method setGroupDescription.

/** Set description for a group */
public static void setGroupDescription(AccountGroup.UUID group, String description, AsyncCallback<VoidResult> cb) {
    RestApi call = group(group).view("description");
    if (description != null && !description.isEmpty()) {
        GroupInput in = GroupInput.create();
        in.description(description);
        call.put(in, cb);
    } else {
        call.delete(cb);
    }
}
Also used : RestApi(com.google.gerrit.client.rpc.RestApi)

Example 30 with RestApi

use of com.google.gerrit.client.rpc.RestApi in project gerrit by GerritCodeReview.

the class GroupMap method match.

public static void match(String match, int limit, int start, AsyncCallback<GroupMap> cb) {
    RestApi call = groups();
    if (match != null) {
        call.addParameter("m", match);
    }
    if (limit > 0) {
        call.addParameter("n", limit);
    }
    if (start > 0) {
        call.addParameter("S", start);
    }
    call.get(NativeMap.copyKeysIntoChildren(cb));
}
Also used : RestApi(com.google.gerrit.client.rpc.RestApi)

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