feat:增加博客卡片内容
This commit is contained in:
31
lib/apis/blog.dart
Normal file
31
lib/apis/blog.dart
Normal file
@@ -0,0 +1,31 @@
|
||||
import 'package:blog_app/models/blog.dart';
|
||||
import 'package:blog_app/models/common.dart';
|
||||
import 'package:blog_app/utils/http_utils.dart';
|
||||
import 'package:blog_app/utils/index.dart';
|
||||
|
||||
Future<PageResult<Blog>> queryBlogByPageApi(int currentPage, int pageSize) {
|
||||
return HttpUtil().get<PageResult<Blog>>(
|
||||
"/blog/page",
|
||||
queryParameters: {"currentPage": currentPage, "pageSize": pageSize},
|
||||
converter: (data) => convertPageResponse(data, Blog.fromJson),
|
||||
);
|
||||
}
|
||||
|
||||
Future<List<Blog>> queryBlogByConditionApi(
|
||||
String category,
|
||||
String title,
|
||||
int year,
|
||||
) {
|
||||
return HttpUtil().get<List<Blog>>(
|
||||
"/blog/condition",
|
||||
queryParameters: {"category": category, "title": title, "year": year},
|
||||
converter: (data) => convertListResponse<Blog>(data, Blog.fromJson),
|
||||
);
|
||||
}
|
||||
|
||||
Future<Blog> queryBlogByIdApi(int id) {
|
||||
return HttpUtil().get<Blog>(
|
||||
"blog/$id/content",
|
||||
converter: (data) => Blog.fromJson(data),
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user