Flask RESTX中的参数化或通用模型

时间:2020-07-03 05:43:25

标签: python rest flask flask-restplus

我正在使用Flask和Flask RESTX创建REST API。我有很多返回NotificationCompat.Builder notificationBuilder; private void startNotif(){ notificationBuilder = new NotificationCompat.Builder( this, NOTE_CHANNEL_ID) .setSmallIcon(R.drawable.mute_icon) .setContentTitle("Calm: Running") .setContentText(this.getString(R.string.calm_close_txt)) .setOngoing(true) .setContentIntent(stopIntent); startForeground(NOTIFICATION_ID, notificationBuilder.build()); } private void changeIcon(int resID, Context context){ notificationBuilder.setSmallIcon(resID); NotificationManagerCompat notificationManagerCompat = NotificationManagerCompat.from(context); notificationManagerCompat.notify(NOTIFICATION_ID, notificationBuilder.build()); } 的路线:

Page

但是,也有包含e的页面。 G。文章,评论,标签等...有什么方法可以不为每个模型创建新的页面类型吗?

page = api.model("Page", {
    "content": fields.List(fields.Nested(user)),
    "total_elements": fields.Integer,
    "total_pages": fields.Integer
})

0 个答案:

没有答案