Package com.google.gerrit.client.rpc

Examples of com.google.gerrit.client.rpc.RestApi


import com.google.gwt.http.client.URL;

/** Projects available from {@code /projects/}. */
public class ProjectMap extends NativeMap<ProjectInfo> {
  public static void all(AsyncCallback<ProjectMap> callback) {
    new RestApi("/projects/")
        .addParameterRaw("type", "ALL")
        .addParameterTrue("all")
        .addParameterTrue("d") // description
        .send(NativeMap.copyKeysIntoChildren(callback));
  }
View Full Code Here


        .addParameterTrue("d") // description
        .send(NativeMap.copyKeysIntoChildren(callback));
  }

  public static void permissions(AsyncCallback<ProjectMap> callback) {
    new RestApi("/projects/")
        .addParameterRaw("type", "PERMISSIONS")
        .addParameterTrue("all")
        .addParameterTrue("d") // description
        .send(NativeMap.copyKeysIntoChildren(callback));
  }
View Full Code Here

        .addParameterTrue("d") // description
        .send(NativeMap.copyKeysIntoChildren(callback));
  }

  public static void suggest(String prefix, int limit, AsyncCallback<ProjectMap> cb) {
    new RestApi("/projects/" + URL.encode(prefix).replaceAll("[?]", "%3F"))
        .addParameterRaw("type", "ALL")
        .addParameter("n", limit)
        .addParameterTrue("d") // description
        .send(NativeMap.copyKeysIntoChildren(cb));
  }
View Full Code Here

import com.google.gwtjsonrpc.common.AsyncCallback;

/** Plugins available from {@code /plugins/}. */
public class PluginMap extends NativeMap<PluginInfo> {
  public static void all(AsyncCallback<PluginMap> callback) {
    new RestApi("/plugins/")
        .send(NativeMap.copyKeysIntoChildren(callback));
  }
View Full Code Here

import com.google.gwtjsonrpc.common.AsyncCallback;

/** Capabilities the caller has from {@code /accounts/self/capabilities}.  */
public class AccountCapabilities extends JavaScriptObject {
  public static void all(AsyncCallback<AccountCapabilities> cb, String... filter) {
    RestApi api = new RestApi("/accounts/self/capabilities");
    for (String name : filter) {
      api.addParameter("q", name);
    }
    api.send(cb);
  }
View Full Code Here

  /** Run 2 or more queries in a single remote invocation. */
  public static void query(
      AsyncCallback<NativeList<ChangeList>> callback, String... queries) {
    assert queries.length >= 2; // At least 2 is required for correct result.
    RestApi call = new RestApi(URI);
    for (String q : queries) {
      call.addParameterRaw("q", KeyUtil.encode(q));
    }
    call.send(callback);
  }
View Full Code Here

  }

  public static void prev(String query,
      int limit, String sortkey,
      AsyncCallback<ChangeList> callback) {
    RestApi call = newQuery(query);
    if (limit > 0) {
      call.addParameter("n", limit);
    }
    if (!PagedSingleListScreen.MIN_SORTKEY.equals(sortkey)) {
      call.addParameter("P", sortkey);
    }
    call.send(callback);
  }
View Full Code Here

  }

  public static void next(String query,
      int limit, String sortkey,
      AsyncCallback<ChangeList> callback) {
    RestApi call = newQuery(query);
    if (limit > 0) {
      call.addParameter("n", limit);
    }
    if (!PagedSingleListScreen.MAX_SORTKEY.equals(sortkey)) {
      call.addParameter("N", sortkey);
    }
    call.send(callback);
  }
View Full Code Here

    }
    call.send(callback);
  }

  private static RestApi newQuery(String query) {
    RestApi call = new RestApi(URI);
    // The server default is ?q=status:open so don't repeat it.
    if (!"status:open".equals(query) && !"is:open".equals(query)) {
      call.addParameterRaw("q", KeyUtil.encode(query));
    }
    return call;
  }
View Full Code Here

TOP

Related Classes of com.google.gerrit.client.rpc.RestApi

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.