DDPClientCallback.java 1.9 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
package chat.rocket.android_ddp;

import android.support.annotation.Nullable;
import org.json.JSONObject;

public class DDPClientCallback {
  public static abstract class Base {
    public DDPClient client;

    public Base(DDPClient client) {
      this.client = client;
    }
  }

  public static abstract class BaseException extends Exception {
    public DDPClient client;

    public BaseException(DDPClient client) {
      this.client = client;
    }
  }

  public static class Connect extends Base {
    public String session;

    public Connect(DDPClient client, String session) {
      super(client);
      this.session = session;
    }

    public static class Failed extends BaseException {
      public String version;

      public Failed(DDPClient client, String version) {
        super(client);
        this.version = version;
      }
    }
Yusuke Iwaki's avatar
Yusuke Iwaki committed
39 40 41 42 43 44

    public static class Timeout extends BaseException {
      public Timeout(DDPClient client) {
        super(client);
      }
    }
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89
  }

  public static class Ping extends Base {
    @Nullable public String id;

    public Ping(DDPClient client, @Nullable String id) {
      super(client);
      this.id = id;
    }

    public static class Timeout extends BaseException {
      public Timeout(DDPClient client) {
        super(client);
      }
    }
  }

  public static class RPC extends Base {
    public String id;
    public String result;

    public RPC(DDPClient client, String id, String result) {
      super(client);
      this.id = id;
      this.result = result;
    }

    public static class Error extends BaseException {
      public String id;
      public JSONObject error;

      public Error(DDPClient client, String id, JSONObject error) {
        super(client);
        this.id = id;
        this.error = error;
      }
    }

    public static class Timeout extends BaseException {
      public Timeout(DDPClient client) {
        super(client);
      }
    }
  }
}