Post Create/Edit
This commit is contained in:
@@ -29,6 +29,8 @@ class Posts extends Api
|
||||
// Fetch all required inputs.
|
||||
// Throw 400 error if a required one is missing.
|
||||
$content = Input::post("content");
|
||||
// This one is optional
|
||||
$limit = constrain(0, 30, intval(Input::post("l", 10)));
|
||||
if (empty($content)) throw ApiError::missingField(["content"]);
|
||||
|
||||
// Get logged in user
|
||||
@@ -36,7 +38,7 @@ class Posts extends Api
|
||||
|
||||
// Try to create a new post for logged in user.
|
||||
try {
|
||||
Response::json(Post::create($self, $content));
|
||||
Response::json(Post::create($self, $content, $limit));
|
||||
} catch (Exception $err) {
|
||||
switch ($err->getMessage()) {
|
||||
default:
|
||||
|
||||
@@ -690,6 +690,13 @@ components:
|
||||
type: number
|
||||
timezone:
|
||||
type: string
|
||||
PostCreateResponse:
|
||||
type: object
|
||||
properties:
|
||||
pages:
|
||||
type: number
|
||||
post:
|
||||
$ref: "#/components/schemas/PostResponse"
|
||||
PostListResponse:
|
||||
type: object
|
||||
properties:
|
||||
@@ -711,6 +718,8 @@ components:
|
||||
properties:
|
||||
content:
|
||||
type: string
|
||||
limit:
|
||||
type: number
|
||||
securitySchemes:
|
||||
BasicAuth:
|
||||
type: apiKey
|
||||
|
||||
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user