// Autogenerated from Pigeon (v0.1.4), do not edit directly.
// See also: https://pub.dev/packages/pigeon

package com.bruce3x.flutter_qiniu_upload;

import io.flutter.plugin.common.BasicMessageChannel;
import io.flutter.plugin.common.BinaryMessenger;
import io.flutter.plugin.common.StandardMessageCodec;
import java.util.ArrayList;
import java.util.HashMap;

/** Generated class from Pigeon. */
@SuppressWarnings("unused")
public class Api {

  /** Generated class from Pigeon that represents data sent in messages. */
  public static class QiniuUploadResult {
    private String requestId;
    public String getRequestId() { return requestId; }
    public void setRequestId(String setterArg) { this.requestId = setterArg; }

    HashMap toMap() {
      HashMap<String, Object> toMapResult = new HashMap<>();
      toMapResult.put("requestId", requestId);
      return toMapResult;
    }
    static QiniuUploadResult fromMap(HashMap map) {
      QiniuUploadResult fromMapResult = new QiniuUploadResult();
      Object requestId = map.get("requestId");
      fromMapResult.requestId = (String)requestId;
      return fromMapResult;
    }
  }

  /** Generated class from Pigeon that represents data sent in messages. */
  public static class QiniuUploadRequest {
    private String key;
    public String getKey() { return key; }
    public void setKey(String setterArg) { this.key = setterArg; }

    private String token;
    public String getToken() { return token; }
    public void setToken(String setterArg) { this.token = setterArg; }

    private String file;
    public String getFile() { return file; }
    public void setFile(String setterArg) { this.file = setterArg; }

    HashMap toMap() {
      HashMap<String, Object> toMapResult = new HashMap<>();
      toMapResult.put("key", key);
      toMapResult.put("token", token);
      toMapResult.put("file", file);
      return toMapResult;
    }
    static QiniuUploadRequest fromMap(HashMap map) {
      QiniuUploadRequest fromMapResult = new QiniuUploadRequest();
      Object key = map.get("key");
      fromMapResult.key = (String)key;
      Object token = map.get("token");
      fromMapResult.token = (String)token;
      Object file = map.get("file");
      fromMapResult.file = (String)file;
      return fromMapResult;
    }
  }

  /** Generated class from Pigeon that represents data sent in messages. */
  public static class QiniuTaskUpdate {
    private String requestId;
    public String getRequestId() { return requestId; }
    public void setRequestId(String setterArg) { this.requestId = setterArg; }

    private Double percent;
    public Double getPercent() { return percent; }
    public void setPercent(Double setterArg) { this.percent = setterArg; }

    HashMap toMap() {
      HashMap<String, Object> toMapResult = new HashMap<>();
      toMapResult.put("requestId", requestId);
      toMapResult.put("percent", percent);
      return toMapResult;
    }
    static QiniuTaskUpdate fromMap(HashMap map) {
      QiniuTaskUpdate fromMapResult = new QiniuTaskUpdate();
      Object requestId = map.get("requestId");
      fromMapResult.requestId = (String)requestId;
      Object percent = map.get("percent");
      fromMapResult.percent = (Double)percent;
      return fromMapResult;
    }
  }

  /** Generated class from Pigeon that represents data sent in messages. */
  public static class QiniuTaskComplete {
    private String requestId;
    public String getRequestId() { return requestId; }
    public void setRequestId(String setterArg) { this.requestId = setterArg; }

    private String hash;
    public String getHash() { return hash; }
    public void setHash(String setterArg) { this.hash = setterArg; }

    private String key;
    public String getKey() { return key; }
    public void setKey(String setterArg) { this.key = setterArg; }

    HashMap toMap() {
      HashMap<String, Object> toMapResult = new HashMap<>();
      toMapResult.put("requestId", requestId);
      toMapResult.put("hash", hash);
      toMapResult.put("key", key);
      return toMapResult;
    }
    static QiniuTaskComplete fromMap(HashMap map) {
      QiniuTaskComplete fromMapResult = new QiniuTaskComplete();
      Object requestId = map.get("requestId");
      fromMapResult.requestId = (String)requestId;
      Object hash = map.get("hash");
      fromMapResult.hash = (String)hash;
      Object key = map.get("key");
      fromMapResult.key = (String)key;
      return fromMapResult;
    }
  }

  /** Generated class from Pigeon that represents data sent in messages. */
  public static class QiniuTaskCancellation {
    private String requestId;
    public String getRequestId() { return requestId; }
    public void setRequestId(String setterArg) { this.requestId = setterArg; }

    HashMap toMap() {
      HashMap<String, Object> toMapResult = new HashMap<>();
      toMapResult.put("requestId", requestId);
      return toMapResult;
    }
    static QiniuTaskCancellation fromMap(HashMap map) {
      QiniuTaskCancellation fromMapResult = new QiniuTaskCancellation();
      Object requestId = map.get("requestId");
      fromMapResult.requestId = (String)requestId;
      return fromMapResult;
    }
  }

  /** Generated class from Pigeon that represents data sent in messages. */
  public static class QiniuTaskError {
    private String requestId;
    public String getRequestId() { return requestId; }
    public void setRequestId(String setterArg) { this.requestId = setterArg; }

    private String error;
    public String getError() { return error; }
    public void setError(String setterArg) { this.error = setterArg; }

    private Long statusCode;
    public Long getStatusCode() { return statusCode; }
    public void setStatusCode(Long setterArg) { this.statusCode = setterArg; }

    HashMap toMap() {
      HashMap<String, Object> toMapResult = new HashMap<>();
      toMapResult.put("requestId", requestId);
      toMapResult.put("error", error);
      toMapResult.put("statusCode", statusCode);
      return toMapResult;
    }
    static QiniuTaskError fromMap(HashMap map) {
      QiniuTaskError fromMapResult = new QiniuTaskError();
      Object requestId = map.get("requestId");
      fromMapResult.requestId = (String)requestId;
      Object error = map.get("error");
      fromMapResult.error = (String)error;
      Object statusCode = map.get("statusCode");
      fromMapResult.statusCode = (statusCode == null) ? null : ((statusCode instanceof Integer) ? (Integer)statusCode : (Long)statusCode);
      return fromMapResult;
    }
  }

  /** Generated interface from Pigeon that represents a handler of messages from Flutter.*/
  public interface QiniuHostApi {
    QiniuUploadResult upload(QiniuUploadRequest arg);
    void cancel(QiniuUploadResult arg);

    /** Sets up an instance of `QiniuHostApi` to handle messages through the `binaryMessenger` */
    static void setup(BinaryMessenger binaryMessenger, QiniuHostApi api) {
      {
        BasicMessageChannel<Object> channel =
            new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.QiniuHostApi.upload", new StandardMessageCodec());
        if (api != null) {
          channel.setMessageHandler((message, reply) -> {
            HashMap<String, HashMap> wrapped = new HashMap<>();
            try {
              @SuppressWarnings("ConstantConditions")
              QiniuUploadRequest input = QiniuUploadRequest.fromMap((HashMap)message);
              QiniuUploadResult output = api.upload(input);
              wrapped.put("result", output.toMap());
            }
            catch (Exception exception) {
              wrapped.put("error", wrapError(exception));
            }
            reply.reply(wrapped);
          });
        } else {
          channel.setMessageHandler(null);
        }
      }
      {
        BasicMessageChannel<Object> channel =
            new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.QiniuHostApi.cancel", new StandardMessageCodec());
        if (api != null) {
          channel.setMessageHandler((message, reply) -> {
            HashMap<String, HashMap> wrapped = new HashMap<>();
            try {
              @SuppressWarnings("ConstantConditions")
              QiniuUploadResult input = QiniuUploadResult.fromMap((HashMap)message);
              api.cancel(input);
              wrapped.put("result", null);
            }
            catch (Exception exception) {
              wrapped.put("error", wrapError(exception));
            }
            reply.reply(wrapped);
          });
        } else {
          channel.setMessageHandler(null);
        }
      }
    }
  }

  /** Generated class from Pigeon that represents Flutter messages that can be called from Java.*/
  public static class QiniuFlutterApi {
    private final BinaryMessenger binaryMessenger;
    public QiniuFlutterApi(BinaryMessenger argBinaryMessenger){
      this.binaryMessenger = argBinaryMessenger;
    }
    public interface Reply<T> {
      void reply(T reply);
    }
    public void taskUpdate(QiniuTaskUpdate argInput, Reply<Void> callback) {
      BasicMessageChannel<Object> channel =
          new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.QiniuFlutterApi.taskUpdate", new StandardMessageCodec());
      HashMap inputMap = argInput.toMap();
      channel.send(inputMap, channelReply -> {
        callback.reply(null);
      });
    }
    public void taskComplete(QiniuTaskComplete argInput, Reply<Void> callback) {
      BasicMessageChannel<Object> channel =
          new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.QiniuFlutterApi.taskComplete", new StandardMessageCodec());
      HashMap inputMap = argInput.toMap();
      channel.send(inputMap, channelReply -> {
        callback.reply(null);
      });
    }
    public void taskCancelled(QiniuTaskCancellation argInput, Reply<Void> callback) {
      BasicMessageChannel<Object> channel =
          new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.QiniuFlutterApi.taskCancelled", new StandardMessageCodec());
      HashMap inputMap = argInput.toMap();
      channel.send(inputMap, channelReply -> {
        callback.reply(null);
      });
    }
    public void taskError(QiniuTaskError argInput, Reply<Void> callback) {
      BasicMessageChannel<Object> channel =
          new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.QiniuFlutterApi.taskError", new StandardMessageCodec());
      HashMap inputMap = argInput.toMap();
      channel.send(inputMap, channelReply -> {
        callback.reply(null);
      });
    }
  }
  private static HashMap wrapError(Exception exception) {
    HashMap<String, Object> errorMap = new HashMap<>();
    errorMap.put("message", exception.toString());
    errorMap.put("code", null);
    errorMap.put("details", null);
    return errorMap;
  }
}

{'avg_line_length': 38.5338078291815, 'max_line_length': 138, 'alphanum_fraction': 0.6727927595123753, 'licenses': ['MIT'], 'repository_name': 'bruce3x/flutter_qiniu_upload', 'path': 'android/src/main/kotlin/com/bruce3x/flutter_qiniu_upload/Api.java', 'size': 10828, 'lang': 'Java'}