Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sending list<int> in a multipart request #316

Closed
alihabbash opened this issue Dec 28, 2021 · 1 comment
Closed

Sending list<int> in a multipart request #316

alihabbash opened this issue Dec 28, 2021 · 1 comment

Comments

@alihabbash
Copy link

alihabbash commented Dec 28, 2021

I'm trying to send a list (it's not a file) within a multipart request
The api gives me an error the days must be an array
My way of doing it like this:

  @Post(path: Urls.REGISTER)
  @Multipart()
  Future<Response> register({
    @Part(ApiConst.PHONE_NUM_FIELD) required String phone,
    @Part(ApiConst.CONFIRM_CODE_FIELD) required String confirmCode,
    @Part(ApiConst.FIRST_NAME_FIELD) required String firstName,
    @Part(ApiConst.LAST_NAME_FIELD) required String lastName,
    @Part(ApiConst.BIRTH_DATE_FIELD) required String birthDate,
    @Part(ApiConst.GENDER_FIELD) required String gender,
    @Part(ApiConst.CITY_ID_FIELD) required int cityId,
    @Part(ApiConst.NATIONAL_ID_FIELD) required String nationalNum,
    @Part(ApiConst.VEHICLE_ID_FIELD) required int vehicleId,
    @Part(ApiConst.VEHICLE_NUMBER_FIELD) required String vehicleNumber,
    @Part(ApiConst.MADE_YEAR_FIELD) required String madeYear,
    @Part(ApiConst.VEHICLE_COLOR_FIELD) required String vehicleColor,
    @Part(ApiConst.VEHICLE_SUB_BRAND_FIELD) required String vehicleSubBrand,
    @Part(ApiConst.VEHICLE_CLASS_ID_FIELD) required int vehicleClassId,
    @Part(ApiConst.SECOND_WORK_CITY_ID_FIELD) int? secondWorkCity,
    @Part(ApiConst.WORK_DAYS_FIELD) List<int>? workDaysIds,
    @PartFile(ApiConst.VEHICLE_LICENSE_FIELD)
        required String vehicleLicenseFilePath,
    @PartFile(ApiConst.DRIVER_LICENSE_FIELD)
        required String driverLicenseFilePath,
    @PartFile(ApiConst.VEHICLE_REAR_FIELD) required String vehicleRearFilePath,
    @PartFile(ApiConst.VEHICLE_FRONT_FIELD)
        required String vehicleFrontFilePath,
    @PartFile(ApiConst.NON_CONVICTION_FIELD)
        required String nonConvictionFilePath,
  });
@Simouche
Copy link

how did you fix this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants