Scriptlog Docs

Scriptlog Documentation

Code reference for the Scriptlog codebase

User Tools

Site Tools


scriptlog:lib:core:apiresponse

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
scriptlog:lib:core:apiresponse [2026/09/26 09:09] – admin adminscriptlog:lib:core:apiresponse [2026/09/26 09:34] (current) – admin admin
Line 14: Line 14:
 ======= Constants (18) ======= ======= Constants (18) =======
  
-  ^ Visibility ^ Name ^ Value ^ Line ^ +^ Visibility ^ Name ^ Value ^ Line ^ 
-  | ''-'' | ''HTTP_OK'' | ''200;'' | 29 | +| ''-'' | ''HTTP_OK'' | ''200;'' | 29 | 
-  | ''-'' | ''HTTP_CREATED'' | ''201;'' | 30 | +| ''-'' | ''HTTP_CREATED'' | ''201;'' | 30 | 
-  | ''-'' | ''HTTP_NO_CONTENT'' | ''204;'' | 31 | +| ''-'' | ''HTTP_NO_CONTENT'' | ''204;'' | 31 | 
-  | ''-'' | ''HTTP_BAD_REQUEST'' | ''400;'' | 32 | +| ''-'' | ''HTTP_BAD_REQUEST'' | ''400;'' | 32 | 
-  | ''-'' | ''HTTP_UNAUTHORIZED'' | ''401;'' | 33 | +| ''-'' | ''HTTP_UNAUTHORIZED'' | ''401;'' | 33 | 
-  | ''-'' | ''HTTP_FORBIDDEN'' | ''403;'' | 34 | +| ''-'' | ''HTTP_FORBIDDEN'' | ''403;'' | 34 | 
-  | ''-'' | ''HTTP_NOT_FOUND'' | ''404;'' | 35 | +| ''-'' | ''HTTP_NOT_FOUND'' | ''404;'' | 35 | 
-  | ''-'' | ''HTTP_METHOD_NOT_ALLOWED'' | ''405;'' | 36 | +| ''-'' | ''HTTP_METHOD_NOT_ALLOWED'' | ''405;'' | 36 | 
-  | ''-'' | ''HTTP_NOT_ACCEPTABLE'' | ''406;'' | 37 | +| ''-'' | ''HTTP_NOT_ACCEPTABLE'' | ''406;'' | 37 | 
-  | ''-'' | ''HTTP_UNSUPPORTED_MEDIA_TYPE'' | ''415;'' | 38 | +| ''-'' | ''HTTP_UNSUPPORTED_MEDIA_TYPE'' | ''415;'' | 38 | 
-  | ''-'' | ''HTTP_CONFLICT'' | ''409;'' | 39 | +| ''-'' | ''HTTP_CONFLICT'' | ''409;'' | 39 | 
-  | ''-'' | ''HTTP_UNPROCESSABLE_ENTITY'' | ''422;'' | 40 | +| ''-'' | ''HTTP_UNPROCESSABLE_ENTITY'' | ''422;'' | 40 | 
-  | ''-'' | ''HTTP_TOO_MANY_REQUESTS'' | ''429;'' | 41 | +| ''-'' | ''HTTP_TOO_MANY_REQUESTS'' | ''429;'' | 41 | 
-  | ''-'' | ''HTTP_INTERNAL_SERVER_ERROR'' | ''500;'' | 42 | +| ''-'' | ''HTTP_INTERNAL_SERVER_ERROR'' | ''500;'' | 42 | 
-  | ''-'' | ''HTTP_SERVICE_UNAVAILABLE'' | ''503;'' | 43 | +| ''-'' | ''HTTP_SERVICE_UNAVAILABLE'' | ''503;'' | 43 | 
-  | ''-'' | ''RATE_LIMIT'' | ''60;'' | 48 | +| ''-'' | ''RATE_LIMIT'' | ''60;'' | 48 | 
-  | ''-'' | ''RATE_WINDOW'' | ''60;'' | 49 | +| ''-'' | ''RATE_WINDOW'' | ''60;'' | 49 | 
-  | ''-'' | ''CACHE_TTL'' | ''300;'' | 54 |+| ''-'' | ''CACHE_TTL'' | ''300;'' | 54 |
  
-======= Properties (1) =======+======= Properties (4) =======
  
-  ^ Visibility ^ Type ^ Name ^ Default ^ Line ^ +^ Visibility ^ Type ^ Name ^ Default ^ Line ^ 
-  | ''private static'' | ''static'' | ''$pendingHeaders'' | ''[];'' | 66 |+| ''private static'' | ''static'' | ''$rateLimitRemaining'' |  | 59 | 
 +| ''private static'' | ''static'' | ''$rateLimitReset'' |  | 60 | 
 +| ''private static'' | ''static'' | ''$rateLimitLimit'' |  | 61 | 
 +| ''private static'' | ''static'' | ''$pendingHeaders'' | ''[]'' | 66 |
  
 ======= Methods (29) ======= ======= Methods (29) =======
  
-  ^ Visibility ^ Method ^ Summary ^ Line ^ +^ Visibility ^ Method ^ Summary ^ Line ^ 
-  | public static | ''initRateLimit()'' | Initialize rate limiting (fallback when RateLimiter class not loaded) | 74 | +| public static | ''initRateLimit()'' | Initialize rate limiting (fallback when RateLimiter class not loaded) | 74 | 
-  | public static | ''setRateLimitHeaders()'' | Set rate limit headers from RateLimiter result or fallback | 86 | +| public static | ''setRateLimitHeaders()'' | Set rate limit headers from RateLimiter result or fallback | 86 | 
-  | public static | ''withHeader()'' | Queue a header to be sent with the response | 109 | +| public static | ''withHeader()'' | Queue a header to be sent with the response | 109 | 
-  | public static | ''withEtag()'' | Set ETag header for cache validation | 121 | +| public static | ''withEtag()'' | Set ETag header for cache validation | 121 | 
-  | public static | ''withLastModified()'' | Set Last-Modified header for cache validation | 136 | +| public static | ''withLastModified()'' | Set Last-Modified header for cache validation | 136 | 
-  | public static | ''withLocation()'' | Set Location header for redirect or created resource | 150 | +| public static | ''withLocation()'' | Set Location header for redirect or created resource | 150 | 
-  | public static | ''checkEtagMatch()'' | Check If-None-Match header against provided ETag | 162 | +| public static | ''checkEtagMatch()'' | Check If-None-Match header against provided ETag | 162 | 
-  | public static | ''checkModifiedSince()'' | Check If-Modified-Since header against provided timestamp | 193 | +| public static | ''checkModifiedSince()'' | Check If-Modified-Since header against provided timestamp | 193 | 
-  | public static | ''notModified()'' | Send a 304 Not Modified response | 215 | +| public static | ''notModified()'' | Send a 304 Not Modified response | 215 | 
-  | private static | ''setCacheHeaders()'' | Set cache headers based on HTTP method | 231 | +| private static | ''setCacheHeaders()'' | Set cache headers based on HTTP method | 231 | 
-  | public static | ''success()'' | Send a successful JSON response | 264 | +| public static | ''success()'' | Send a successful JSON response | 264 | 
-  | public static | ''created()'' | Send a created response (201) | 289 | +| public static | ''created()'' | Send a created response (201) | 289 | 
-  | public static | ''noContent()'' | Send a no content response (204) | 314 | +| public static | ''noContent()'' | Send a no content response (204) | 314 | 
-  | public static | ''error()'' | Send an error response | 328 | +| public static | ''error()'' | Send an error response | 328 | 
-  | public static | ''badRequest()'' | Send a 400 Bad Request error | 353 | +| public static | ''badRequest()'' | Send a 400 Bad Request error | 353 | 
-  | public static | ''unauthorized()'' | Send a 401 Unauthorized error | 364 | +| public static | ''unauthorized()'' | Send a 401 Unauthorized error | 364 | 
-  | public static | ''forbidden()'' | Send a 403 Forbidden error | 375 | +| public static | ''forbidden()'' | Send a 403 Forbidden error | 375 | 
-  | public static | ''notAcceptable()'' | Send a 406 Not Acceptable error | 387 | +| public static | ''notAcceptable()'' | Send a 406 Not Acceptable error | 387 | 
-  | public static | ''unsupportedMediaType()'' | Send a 415 Unsupported Media Type error | 399 | +| public static | ''unsupportedMediaType()'' | Send a 415 Unsupported Media Type error | 399 | 
-  | public static | ''conflict()'' | Send a 409 Conflict error | 410 | +| public static | ''conflict()'' | Send a 409 Conflict error | 410 | 
-  | public static | ''notFound()'' | Send a 404 Not Found error | 421 | +| public static | ''notFound()'' | Send a 404 Not Found error | 421 | 
-  | public static | ''unprocessableEntity()'' | Send a 422 Unprocessable Entity error | 433 | +| public static | ''unprocessableEntity()'' | Send a 422 Unprocessable Entity error | 433 | 
-  | public static | ''tooManyRequests()'' | Send a 429 Too Many Requests error | 445 | +| public static | ''tooManyRequests()'' | Send a 429 Too Many Requests error | 445 | 
-  | public static | ''methodNotAllowed()'' | Send a method not allowed error | 458 | +| public static | ''methodNotAllowed()'' | Send a method not allowed error | 458 | 
-  | public static | ''paginated()'' | Send a paginated response with HATEOAS links | 475 | +| public static | ''paginated()'' | Send a paginated response with HATEOAS links | 475 | 
-  | public static | ''validateAccept()'' | Validate Accept header against supported types | 507 | +| public static | ''validateAccept()'' | Validate Accept header against supported types | 507 | 
-  | private static | ''send()'' | Send raw JSON response | 544 | +| private static | ''send()'' | Send raw JSON response | 544 | 
-  | private static | ''getErrorCode()'' | Get error code from status code | 586 | +| private static | ''getErrorCode()'' | Get error code from status code | 586 | 
-  | public static | ''setCorsHeaders()'' | Set CORS headers for cross-origin requests | 612 |+| public static | ''setCorsHeaders()'' | Set CORS headers for cross-origin requests | 612 |
  
  
Line 83: Line 86:
 Initialize rate limiting (fallback when RateLimiter class not loaded) Initialize rate limiting (fallback when RateLimiter class not loaded)
  
-  ^ Parameter ^ Type ^ Default ^ Description ^ +^  Parameter ^  Type ^  Default ^  Description ^ 
-  | ''$limit'' | ''(untyped)'' | ''self::RATE_LIMIT'' | //none// | +|  ''$limit'' |  ''(untyped)'' |  ''self::RATE_LIMIT'' |  //none// | 
-  | ''$window'' | ''(untyped)'' | ''self::RATE_WINDOW'' | //none// |+|  ''$window'' |  ''(untyped)'' |  ''self::RATE_WINDOW'' |  //none// |
  
 **Returns:** ''(none declared)'' **Returns:** ''(none declared)''
Line 100: Line 103:
 Set rate limit headers from RateLimiter result or fallback Set rate limit headers from RateLimiter result or fallback
  
-  ^ Parameter ^ Type ^ Default ^ Description ^ +^  Parameter ^  Type ^  Default ^  Description ^ 
-  | ''$rateResult'' | ''(untyped)'' | ''null'' | RateLimiter check result |+|  ''$rateResult'' |  ''(untyped)'' |  ''null'' |  RateLimiter check result |
  
 **Returns:** ''(none declared)'' **Returns:** ''(none declared)''
Line 116: Line 119:
 Queue a header to be sent with the response Queue a header to be sent with the response
  
-  ^ Parameter ^ Type ^ Default ^ Description ^ +^  Parameter ^  Type ^  Default ^  Description ^ 
-  | ''$header'' | ''(untyped)'' | //required// | //none// |+|  ''$header'' |  ''(untyped)'' |  //required// |  //none// |
  
 **Returns:** ''(none declared)'' — void **Returns:** ''(none declared)'' — void
Line 132: Line 135:
 Set ETag header for cache validation Set ETag header for cache validation
  
-  ^ Parameter ^ Type ^ Default ^ Description ^ +^  Parameter ^  Type ^  Default ^  Description ^ 
-  | ''$etag'' | ''(untyped)'' | //required// | ETag value (will be quoted automatically) | +|  ''$etag'' |  ''(untyped)'' |  //required// |  ETag value (will be quoted automatically) | 
-  | ''$weak'' | ''(untyped)'' | ''false'' | Whether this is a weak validator |+|  ''$weak'' |  ''(untyped)'' |  ''false'' |  Whether this is a weak validator |
  
 **Returns:** ''(none declared)'' — void **Returns:** ''(none declared)'' — void
Line 149: Line 152:
 Set Last-Modified header for cache validation Set Last-Modified header for cache validation
  
-  ^ Parameter ^ Type ^ Default ^ Description ^ +^  Parameter ^  Type ^  Default ^  Description ^ 
-  | ''$timestamp'' | ''(untyped)'' | //required// | Unix timestamp or HTTP date string |+|  ''$timestamp'' |  ''(untyped)'' |  //required// |  Unix timestamp or HTTP date string |
  
 **Returns:** ''(none declared)'' — void **Returns:** ''(none declared)'' — void
Line 165: Line 168:
 Set Location header for redirect or created resource Set Location header for redirect or created resource
  
-  ^ Parameter ^ Type ^ Default ^ Description ^ +^  Parameter ^  Type ^  Default ^  Description ^ 
-  | ''$url'' | ''(untyped)'' | //required// | //none// |+|  ''$url'' |  ''(untyped)'' |  //required// |  //none// |
  
 **Returns:** ''(none declared)'' — void **Returns:** ''(none declared)'' — void
Line 183: Line 186:
 Returns true if client should use cached version (send 304) Returns true if client should use cached version (send 304)
  
-  ^ Parameter ^ Type ^ Default ^ Description ^ +^  Parameter ^  Type ^  Default ^  Description ^ 
-  | ''$etag'' | ''(untyped)'' | //required// | Current ETag for the resource |+|  ''$etag'' |  ''(untyped)'' |  //required// |  Current ETag for the resource |
  
 **Returns:** ''(none declared)'' — bool True if 304 should be sent **Returns:** ''(none declared)'' — bool True if 304 should be sent
Line 201: Line 204:
 Returns true if client should use cached version (send 304) Returns true if client should use cached version (send 304)
  
-  ^ Parameter ^ Type ^ Default ^ Description ^ +^  Parameter ^  Type ^  Default ^  Description ^ 
-  | ''$timestamp'' | ''(untyped)'' | //required// | Unix timestamp or HTTP date string |+|  ''$timestamp'' |  ''(untyped)'' |  //required// |  Unix timestamp or HTTP date string |
  
 **Returns:** ''(none declared)'' — bool True if 304 should be sent **Returns:** ''(none declared)'' — bool True if 304 should be sent
Line 232: Line 235:
 Set cache headers based on HTTP method Set cache headers based on HTTP method
  
-  ^ Parameter ^ Type ^ Default ^ Description ^ +^  Parameter ^  Type ^  Default ^  Description ^ 
-  | ''$statusCode'' | ''(untyped)'' | //required// | //none// | +|  ''$statusCode'' |  ''(untyped)'' |  //required// |  //none// | 
-  | ''$ttl'' | ''(untyped)'' | ''self::CACHE_TTL'' | Cache TTL in seconds (default 300) |+|  ''$ttl'' |  ''(untyped)'' |  ''self::CACHE_TTL'' |  Cache TTL in seconds (default 300) |
  
 **Returns:** ''(none declared)'' — void **Returns:** ''(none declared)'' — void
Line 249: Line 252:
 Send a successful JSON response Send a successful JSON response
  
-  ^ Parameter ^ Type ^ Default ^ Description ^ +^  Parameter ^  Type ^  Default ^  Description ^ 
-  | ''$data'' | ''(untyped)'' | ''null'' | The data to be encoded as JSON | +|  ''$data'' |  ''(untyped)'' |  ''null'' |  The data to be encoded as JSON | 
-  | ''$statusCode'' | ''(untyped)'' | ''self::HTTP_OK'' | HTTP status code (default: 200) | +|  ''$statusCode'' |  ''(untyped)'' |  ''self::HTTP_OK'' |  HTTP status code (default: 200) | 
-  | ''$message'' | ''(untyped)'' | ''null'' | Optional success message | +|  ''$message'' |  ''(untyped)'' |  ''null'' |  Optional success message | 
-  | ''$links'' | ''(untyped)'' | ''[]'' | Optional HATEOAS links | +|  ''$links'' |  ''(untyped)'' |  ''[]'' |  Optional HATEOAS links | 
-  | ''$ttl'' | ''(untyped)'' | ''self::CACHE_TTL'' | Cache TTL in seconds |+|  ''$ttl'' |  ''(untyped)'' |  ''self::CACHE_TTL'' |  Cache TTL in seconds |
  
 **Returns:** ''(none declared)'' — void **Returns:** ''(none declared)'' — void
Line 269: Line 272:
 Send a created response (201) Send a created response (201)
  
-  ^ Parameter ^ Type ^ Default ^ Description ^ +^  Parameter ^  Type ^  Default ^  Description ^ 
-  | ''$data'' | ''(untyped)'' | //required// | The created resource data | +|  ''$data'' |  ''(untyped)'' |  //required// |  The created resource data | 
-  | ''$message'' | ''(untyped)'' | '''Resource created successfully''' | Optional success message | +|  ''$message'' |  ''(untyped)'' |  '''Resource created successfully''' |  Optional success message | 
-  | ''$links'' | ''(untyped)'' | ''[]'' | Optional HATEOAS links | +|  ''$links'' |  ''(untyped)'' |  ''[]'' |  Optional HATEOAS links | 
-  | ''$locationUrl'' | ''(untyped)'' | ''null'' | Optional Location header URL |+|  ''$locationUrl'' |  ''(untyped)'' |  ''null'' |  Optional Location header URL |
  
 **Returns:** ''(none declared)'' — void **Returns:** ''(none declared)'' — void
Line 303: Line 306:
 Send an error response Send an error response
  
-  ^ Parameter ^ Type ^ Default ^ Description ^ +^  Parameter ^  Type ^  Default ^  Description ^ 
-  | ''$message'' | ''(untyped)'' | //required// | Error message | +|  ''$message'' |  ''(untyped)'' |  //required// |  Error message | 
-  | ''$statusCode'' | ''(untyped)'' | ''self::HTTP_INTERNAL_SERVER_ERROR'' | HTTP status code | +|  ''$statusCode'' |  ''(untyped)'' |  ''self::HTTP_INTERNAL_SERVER_ERROR'' |  HTTP status code | 
-  | ''$errorCode'' | ''(untyped)'' | ''null'' | Optional machine-readable error code | +|  ''$errorCode'' |  ''(untyped)'' |  ''null'' |  Optional machine-readable error code | 
-  | ''$errors'' | ''(untyped)'' | ''null'' | Optional validation errors array |+|  ''$errors'' |  ''(untyped)'' |  ''null'' |  Optional validation errors array |
  
 **Returns:** ''(none declared)'' — void **Returns:** ''(none declared)'' — void
Line 322: Line 325:
 Send a 400 Bad Request error Send a 400 Bad Request error
  
-  ^ Parameter ^ Type ^ Default ^ Description ^ +^  Parameter ^  Type ^  Default ^  Description ^ 
-  | ''$message'' | ''(untyped)'' | '''Bad Request''' | Error message | +|  ''$message'' |  ''(untyped)'' |  '''Bad Request''' |  Error message | 
-  | ''$errors'' | ''(untyped)'' | ''null'' | Optional validation errors |+|  ''$errors'' |  ''(untyped)'' |  ''null'' |  Optional validation errors |
  
 **Returns:** ''(none declared)'' — void **Returns:** ''(none declared)'' — void
Line 339: Line 342:
 Send a 401 Unauthorized error Send a 401 Unauthorized error
  
-  ^ Parameter ^ Type ^ Default ^ Description ^ +^  Parameter ^  Type ^  Default ^  Description ^ 
-  | ''$message'' | ''(untyped)'' | '''Unauthorized - Authentication required''' | Error message |+|  ''$message'' |  ''(untyped)'' |  '''Unauthorized - Authentication required''' |  Error message |
  
 **Returns:** ''(none declared)'' — void **Returns:** ''(none declared)'' — void
Line 355: Line 358:
 Send a 403 Forbidden error Send a 403 Forbidden error
  
-  ^ Parameter ^ Type ^ Default ^ Description ^ +^  Parameter ^  Type ^  Default ^  Description ^ 
-  | ''$message'' | ''(untyped)'' | '''Forbidden - Access denied''' | Error message |+|  ''$message'' |  ''(untyped)'' |  '''Forbidden - Access denied''' |  Error message |
  
 **Returns:** ''(none declared)'' — void **Returns:** ''(none declared)'' — void
Line 371: Line 374:
 Send a 406 Not Acceptable error Send a 406 Not Acceptable error
  
-  ^ Parameter ^ Type ^ Default ^ Description ^ +^  Parameter ^  Type ^  Default ^  Description ^ 
-  | ''$message'' | ''(untyped)'' | '''Not Acceptable - Requested media type not supported''' | Error message | +|  ''$message'' |  ''(untyped)'' |  '''Not Acceptable - Requested media type not supported''' |  Error message | 
-  | ''$supportedTypes'' | ''(untyped)'' | ''['application/json']'' | List of supported content types |+|  ''$supportedTypes'' |  ''(untyped)'' |  ''['application/json']'' |  List of supported content types |
  
 **Returns:** ''(none declared)'' — void **Returns:** ''(none declared)'' — void
Line 388: Line 391:
 Send a 415 Unsupported Media Type error Send a 415 Unsupported Media Type error
  
-  ^ Parameter ^ Type ^ Default ^ Description ^ +^  Parameter ^  Type ^  Default ^  Description ^ 
-  | ''$message'' | ''(untyped)'' | '''Unsupported Media Type''' | Error message |+|  ''$message'' |  ''(untyped)'' |  '''Unsupported Media Type''' |  Error message |
  
 **Returns:** ''(none declared)'' — void **Returns:** ''(none declared)'' — void
Line 404: Line 407:
 Send a 409 Conflict error Send a 409 Conflict error
  
-  ^ Parameter ^ Type ^ Default ^ Description ^ +^  Parameter ^  Type ^  Default ^  Description ^ 
-  | ''$message'' | ''(untyped)'' | '''Conflict - Resource already exists''' | Error message |+|  ''$message'' |  ''(untyped)'' |  '''Conflict - Resource already exists''' |  Error message |
  
 **Returns:** ''(none declared)'' — void **Returns:** ''(none declared)'' — void
Line 420: Line 423:
 Send a 404 Not Found error Send a 404 Not Found error
  
-  ^ Parameter ^ Type ^ Default ^ Description ^ +^  Parameter ^  Type ^  Default ^  Description ^ 
-  | ''$message'' | ''(untyped)'' | '''Resource not found''' | Error message |+|  ''$message'' |  ''(untyped)'' |  '''Resource not found''' |  Error message |
  
 **Returns:** ''(none declared)'' — void **Returns:** ''(none declared)'' — void
Line 436: Line 439:
 Send a 422 Unprocessable Entity error Send a 422 Unprocessable Entity error
  
-  ^ Parameter ^ Type ^ Default ^ Description ^ +^  Parameter ^  Type ^  Default ^  Description ^ 
-  | ''$message'' | ''(untyped)'' | '''Validation failed''' | Error message | +|  ''$message'' |  ''(untyped)'' |  '''Validation failed''' |  Error message | 
-  | ''$errors'' | ''(untyped)'' | ''null'' | Validation errors |+|  ''$errors'' |  ''(untyped)'' |  ''null'' |  Validation errors |
  
 **Returns:** ''(none declared)'' — void **Returns:** ''(none declared)'' — void
Line 453: Line 456:
 Send a 429 Too Many Requests error Send a 429 Too Many Requests error
  
-  ^ Parameter ^ Type ^ Default ^ Description ^ +^  Parameter ^  Type ^  Default ^  Description ^ 
-  | ''$message'' | ''(untyped)'' | '''Too many requests - Please slow down''' | Error message | +|  ''$message'' |  ''(untyped)'' |  '''Too many requests - Please slow down''' |  Error message | 
-  | ''$retryAfter'' | ''(untyped)'' | ''60'' | Seconds until retry |+|  ''$retryAfter'' |  ''(untyped)'' |  ''60'' |  Seconds until retry |
  
 **Returns:** ''(none declared)'' — void **Returns:** ''(none declared)'' — void
Line 470: Line 473:
 Send a method not allowed error Send a method not allowed error
  
-  ^ Parameter ^ Type ^ Default ^ Description ^ +^  Parameter ^  Type ^  Default ^  Description ^ 
-  | ''$message'' | ''(untyped)'' | '''Method not allowed''' | Error message | +|  ''$message'' |  ''(untyped)'' |  '''Method not allowed''' |  Error message | 
-  | ''$allowedMethods'' | ''(untyped)'' | '''GET, POST, PUT, DELETE, PATCH, OPTIONS''' | Comma-separated list of allowed methods |+|  ''$allowedMethods'' |  ''(untyped)'' |  '''GET, POST, PUT, DELETE, PATCH, OPTIONS''' |  Comma-separated list of allowed methods |
  
 **Returns:** ''(none declared)'' — void **Returns:** ''(none declared)'' — void
Line 487: Line 490:
 Send a paginated response with HATEOAS links Send a paginated response with HATEOAS links
  
-  ^ Parameter ^ Type ^ Default ^ Description ^ +^  Parameter ^  Type ^  Default ^  Description ^ 
-  | ''$data'' | ''(untyped)'' | //required// | The paginated data | +|  ''$data'' |  ''(untyped)'' |  //required// |  The paginated data | 
-  | ''$currentPage'' | ''(untyped)'' | //required// | Current page number | +|  ''$currentPage'' |  ''(untyped)'' |  //required// |  Current page number | 
-  | ''$perPage'' | ''(untyped)'' | //required// | Items per page | +|  ''$perPage'' |  ''(untyped)'' |  //required// |  Items per page | 
-  | ''$totalItems'' | ''(untyped)'' | //required// | Total number of items | +|  ''$totalItems'' |  ''(untyped)'' |  //required// |  Total number of items | 
-  | ''$links'' | ''(untyped)'' | ''[]'' | Optional HATEOAS links | +|  ''$links'' |  ''(untyped)'' |  ''[]'' |  Optional HATEOAS links | 
-  | ''$ttl'' | ''(untyped)'' | ''self::CACHE_TTL'' | Cache TTL in seconds |+|  ''$ttl'' |  ''(untyped)'' |  ''self::CACHE_TTL'' |  Cache TTL in seconds |
  
 **Returns:** ''(none declared)'' — void **Returns:** ''(none declared)'' — void
Line 510: Line 513:
 Returns true if request is acceptable Returns true if request is acceptable
  
-  ^ Parameter ^ Type ^ Default ^ Description ^ +^  Parameter ^  Type ^  Default ^  Description ^ 
-  | ''$supportedTypes'' | ''(untyped)'' | ''['application/json', '*/*']'' | List of supported MIME types |+|  ''$supportedTypes'' |  ''(untyped)'' |  ''['application/json', '*/*']'' |  List of supported MIME types |
  
 **Returns:** ''(none declared)'' — bool **Returns:** ''(none declared)'' — bool
Line 526: Line 529:
 Send raw JSON response Send raw JSON response
  
-  ^ Parameter ^ Type ^ Default ^ Description ^ +^  Parameter ^  Type ^  Default ^  Description ^ 
-  | ''$data'' | ''(untyped)'' | //required// | Data to be encoded | +|  ''$data'' |  ''(untyped)'' |  //required// |  Data to be encoded | 
-  | ''$statusCode'' | ''(untyped)'' | //required// | HTTP status code | +|  ''$statusCode'' |  ''(untyped)'' |  //required// |  HTTP status code | 
-  | ''$ttl'' | ''(untyped)'' | ''self::CACHE_TTL'' | Cache TTL in seconds |+|  ''$ttl'' |  ''(untyped)'' |  ''self::CACHE_TTL'' |  Cache TTL in seconds |
  
 **Returns:** ''(none declared)'' — void **Returns:** ''(none declared)'' — void
Line 544: Line 547:
 Get error code from status code Get error code from status code
  
-  ^ Parameter ^ Type ^ Default ^ Description ^ +^  Parameter ^  Type ^  Default ^  Description ^ 
-  | ''$statusCode'' | ''(untyped)'' | //required// | HTTP status code |+|  ''$statusCode'' |  ''(untyped)'' |  //required// |  HTTP status code |
  
 **Returns:** ''(none declared)'' — string Machine-readable error code **Returns:** ''(none declared)'' — string Machine-readable error code
Line 560: Line 563:
 Set CORS headers for cross-origin requests Set CORS headers for cross-origin requests
  
-  ^ Parameter ^ Type ^ Default ^ Description ^ +^  Parameter ^  Type ^  Default ^  Description ^ 
-  | ''$origin'' | ''(untyped)'' | '''*''' | Allowed origin (default: *) |+|  ''$origin'' |  ''(untyped)'' |  '''*''' |  Allowed origin (default: *) |
  
 **Returns:** ''(none declared)'' — void **Returns:** ''(none declared)'' — void
scriptlog/lib/core/apiresponse.1790413761.txt.gz · Last modified: by admin