PACS System 0.1.0
PACS DICOM system library
Loading...
Searching...
No Matches
rest_types.h File Reference

Common types and utilities for REST API. More...

#include <cstdint>
#include <string>
#include <string_view>
Include dependency graph for rest_types.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  kcenon::pacs::web::api_error
 Standard API error structure. More...
 

Namespaces

namespace  kcenon
 
namespace  kcenon::pacs
 
namespace  kcenon::pacs::web
 

Enumerations

enum class  kcenon::pacs::web::http_status : std::uint16_t {
  kcenon::pacs::web::ok = 200 , kcenon::pacs::web::created = 201 , kcenon::pacs::web::accepted = 202 , kcenon::pacs::web::no_content = 204 ,
  kcenon::pacs::web::bad_request = 400 , kcenon::pacs::web::unauthorized = 401 , kcenon::pacs::web::forbidden = 403 , kcenon::pacs::web::not_found = 404 ,
  kcenon::pacs::web::method_not_allowed = 405 , kcenon::pacs::web::conflict = 409 , kcenon::pacs::web::unprocessable_entity = 422 , kcenon::pacs::web::internal_server_error = 500 ,
  kcenon::pacs::web::not_implemented = 501 , kcenon::pacs::web::service_unavailable = 503
}
 Common HTTP status codes. More...
 

Functions

std::string kcenon::pacs::web::to_json (const api_error &error)
 Create JSON error response body.
 
std::string kcenon::pacs::web::make_error_json (std::string_view code, std::string_view message)
 Create JSON error response body with details.
 
std::string kcenon::pacs::web::make_success_json (std::string_view message="OK")
 Create success response with optional message.
 
std::string kcenon::pacs::web::json_escape (std::string_view s)
 Escape a string for JSON.
 

Detailed Description

Common types and utilities for REST API.

This file provides common types, JSON utilities, and error response helpers for the REST API server.

Author
kcenon
Since
1.0.0

Definition in file rest_types.h.