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);
}
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));
}
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);
}
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);
}
}
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));
}
Aggregations