This is an old revision of the document!
Table of Contents
ProtectedPostApiController
Layer: Controller · Source: lib/controller/api/ProtectedPostApiController.php:25 (lines 25–214)
class ProtectedPostApiController extends ApiController
Inheritance
^ Relation ^ Type ^ Meaning ^ | extends | [[scriptlog:lib:controller:apicontroller|''ApiController'']] | parent class/interface |
Constants (0)
None.
Properties (0)
None declared.
Methods (5)
^ Visibility ^ Method ^ Summary ^ Line ^ | public | ''__construct()'' | Constructor | 30 | | private | ''respondWithHtmxFallback()'' | Respond with HTMX fragment or API JSON, depending on request type. | 46 | | private | ''sendError()'' | Send an error response via HTMX or API JSON. | 70 | | public | ''unlock()'' | Unlock password-protected post | 87 | | public | ''verify()'' | Verify post password (lightweight check) | 172 |
__construct()
public function __construct()
lines 30–34 (5)
Constructor
Takes no parameters.
respondWithHtmxFallback()
private function respondWithHtmxFallback($htmxFragment, $htmxData, $apiData = null, $statusCode = 200, $apiErrorCode = null)
lines 46–60 (15)
Respond with HTMX fragment or API JSON, depending on request type.
^ Parameter ^ Type ^ Default ^ Description ^ | ''$htmxFragment'' | ''(untyped)'' | //required// | //none// | | ''$htmxData'' | ''(untyped)'' | //required// | //none// | | ''$apiData'' | ''(untyped)'' | ''null'' | //none// | | ''$statusCode'' | ''(untyped)'' | ''200'' | //none// | | ''$apiErrorCode'' | ''(untyped)'' | ''null'' | //none// |
Returns: (none declared) — bool True if HTMX response was sent
sendError()
private function sendError($message, $statusCode = 400, $errorCode = null)
lines 70–77 (8)
Send an error response via HTMX or API JSON.
^ Parameter ^ Type ^ Default ^ Description ^ | ''$message'' | ''(untyped)'' | //required// | //none// | | ''$statusCode'' | ''(untyped)'' | ''400'' | //none// | | ''$errorCode'' | ''(untyped)'' | ''null'' | //none// |
Returns: (none declared) — void
unlock()
public function unlock($params = [])
lines 87–162 (76)
Unlock password-protected post
POST /api/v1/posts/{id}/unlock
^ Parameter ^ Type ^ Default ^ Description ^ | ''$params'' | ''(untyped)'' | ''[]'' | URL parameters (post ID) |
Returns: (none declared) — void
verify()
public function verify($params = [])
lines 172–213 (42)
Verify post password (lightweight check)
POST /api/v1/posts/{id}/verify
^ Parameter ^ Type ^ Default ^ Description ^ | ''$params'' | ''(untyped)'' | ''[]'' | URL parameters (post ID) |
Returns: (none declared) — void
Imports
^ Alias ^ Fully-qualified name ^ | ''ApiController'' | [[scriptlog:lib:controller:apicontroller|''Scriptlog\Controller\ApiController'']] | | ''ApiResponse'' | [[scriptlog:lib:core:apiresponse|''Scriptlog\Core\ApiResponse'']] |
This page is generated from source by 'tools/gendoc'. Edits will be overwritten.
