import 'dart:convert';

import 'package:dio/dio.dart';
import 'package:keyboard/data/api/request/upload_request.dart';
import 'package:keyboard/data/api/response/upload_result_bean.dart';
import 'package:retrofit/error_logger.dart';
import 'package:retrofit/http.dart';
import '../../base/base_response.dart';

part 'atmob_file_api.c.dart';
// part 'atmob_file_api.g.dart';

/// 注：每次生成前，要将.c改成.g，生成后，再重命名为.c
/// 以及要修改文件上传的代码，将下面1）、2）的代码，改为3）的代码
/// 1）final _data = <String, dynamic>{};
/// 2）_data.addAll(request.toJson());
/// 改为 => 3）final _data =FormData.fromMap(request.toJson());

@RestApi()
abstract class AtmobFileApi {
  factory AtmobFileApi(Dio dio, {String baseUrl}) = _AtmobFileApi;

  /// 文件上传
  @MultiPart()
  @POST("/project/keyboard/v1/upload/image")
  Future<BaseResponse<UploadResultBean>> uploadImage(
    @Body() UploadRequest request,
  );
}
