requestWithManyPATH<T extends HttpDataParser<T>> method

  1. @override
Future<EasyHttpRequestResponse<T>> requestWithManyPATH<T extends HttpDataParser<T>>({
  1. required T model,
  2. required String identifier,
  3. required EasyHttpType requestType,
  4. String extraUri = '',
  5. Map<String, dynamic> queryParams = const {},
  6. bool returnModel = false,
})
override

Method to make request by EasyHttpType on MANY API PATH.

Parameters:

model (required): The model that will be handled in the query. You must implement HttpDataParser.

extraUri (optional): If apart from the base api that you initialized the package with, you need to add more information.

Example:

Your api base is https://www.domain.com/api and your endpoint to consult is https://www.domain.com/api/users in this parameter you add the part of users to complete the endpoint

queryParams (optional): You can send the query parameters directly in the path, but it is more recommended to use key: value for this.

Example:

https://www.domain.com/api/users/id=3 has id = 3 as a parameter. With this property you can do this: {"id": 3}

And it will be exactly the same

returnModel(optional): You can set it to true if your service returns a json of your model that has just been created and you need that information to save it locally or to update the UI

Implementation

@override
Future<EasyHttpRequestResponse<T>>
    requestWithManyPATH<T extends HttpDataParser<T>>({
  required T model,
  required String identifier,
  required EasyHttpType requestType,
  String extraUri = '',
  Map<String, dynamic> queryParams = const {},
  bool returnModel = false,
}) async {
  if (identifier.isEmpty)
    throw Exception('Need a identifier to access to Http Client instance');

  final client = EasyHttpClient.getFromMany(identifier);
  return await _makeRequest<T>(
    client: client,
    model: model,
    requestType: requestType,
    extraUri: extraUri,
    queryParams: queryParams,
  );
}