searchAuthorResponse method
Endpoint used: GET /author
Search for an author by the author's name
and return limit
number of results (10 by default) in a http response.
Implementation
Future<http.Response> searchAuthorResponse(
String? name,
int? limit,
int? offset,
List<String>? ids,
List<String>? includes,
) async {
var _name = (name == null) ? '' : '&name=$name';
var _limit = (limit == null) ? '' : '&limit=$limit';
var _offset = (offset == null) ? '' : '&offset=$offset';
var _ids = '';
if (ids != null) {
ids.forEach((element) {
_ids = _ids + '&ids[]=$element';
});
}
var _includes = '';
if (includes != null) {
includes.forEach((element) {
_includes = _includes + '&includes[]=$element';
});
}
final unencodedPath = '/author';
final uri =
'https://$AUTHORITY$unencodedPath?$_name$_limit$_offset$_ids$_includes';
var response = http.get(Uri.parse(uri), headers: {
HttpHeaders.contentTypeHeader: 'application/json',
});
return response;
}