# Endpoint.hpp

This File On Github
Ask A Question

API: latest
module: oatpp
#include "oatpp/web/server/api/Endpoint.hpp"

# Endpoint

Endpoint - class which holds information about endpoint. It holds API documentation info, and pointer to RequestHandler

namespace oatpp { namespace web { namespace server { namespace api { 
  class Endpoint : public oatpp::base::Countable {}
}}}}

# Typedefs

Type Name Summary
oatpp::web::server::HttpRequestHandler RequestHandler Convenience typedef for oatpp::web::server::HttpRequestHandler.

# Endpoint::RequestHandler

Convenience typedef for oatpp::web::server::HttpRequestHandler.

typedef oatpp::web::server::HttpRequestHandler RequestHandler

# Endpoint::Info

Info holds API documentation information about endpoint

namespace oatpp { namespace web { namespace server { namespace api { 
  class Endpoint : public oatpp::base::Countable {
    class Info : public oatpp::base::Countable {}
  };
}}}}

# Fields

Type Name Summary
oatpp::String name Endpoint name.
oatpp::String summary Endpoint summary.
oatpp::String description Endpoint description.
oatpp::String path Endpoint path.
oatpp::String method HTTP method.
oatpp::String authorization Authorization.
oatpp::Boolean hide Hide endpoint from the documentation.
std::list<oatpp::String> tags Tags to group endpoints in the documentation.
Param body Body info.
oatpp::String bodyContentType Body content type.
std::list<ContentHints> consumes Consumes.
std::unordered_map<oatpp::String, std::shared_ptr<std::list<oatpp::String>>> securityRequirements Security Requirements
Params headers Headers.
Params pathParams Path variables.
Params queryParams Query params.
std::unordered_map<oatpp::web::protocol::http::Status, ContentHints> responses ResponseCode to {ContentType, Type} mapping. Example responses[Status::CODE_200] = {"application/json", MyDto::ObjectWrapper::Class::getType()};

# Methods

Return Type Name Summary
[none] Info Constructor;
std::shared_ptr<Info> createShared Create shared Info.
ContentHints& addConsumes Add "consumes" info to endpoint.
ContentHints& addResponse Add response info to endpoint
void addSecurityRequirement Add security requirement.
void addTag Add tag.

# Endpoint::Info::name

Endpoint name.

oatpp::String name

# Endpoint::Info::summary

Endpoint summary.

oatpp::String summary

# Endpoint::Info::description

Endpoint description.

oatpp::String description

# Endpoint::Info::path

Endpoint path.

oatpp::String path

# Endpoint::Info::method

HTTP method.

oatpp::String method

# Endpoint::Info::authorization

Authorization.

oatpp::String authorization

# Endpoint::Info::hide

Hide endpoint from the documentation.

oatpp::Boolean hide

# Endpoint::Info::tags

Tags to group endpoints in the documentation.

std::list<oatpp::String> tags

# Endpoint::Info::body

Body info.

Param body

# Endpoint::Info::bodyContentType

Body content type.

oatpp::String bodyContentType

# Endpoint::Info::consumes

Consumes.

std::list<ContentHints> consumes

# Endpoint::Info::securityRequirements

Security Requirements

std::unordered_map<oatpp::String, std::shared_ptr<std::list<oatpp::String>>> securityRequirements

# Endpoint::Info::headers

Headers.

Params headers

# Endpoint::Info::pathParams

Path variables.

Params pathParams

# Endpoint::Info::queryParams

Query params.

Params queryParams

# Endpoint::Info::responses

ResponseCode to {ContentType, Type} mapping. Example responses[Status::CODE_200] = {"application/json", MyDto::ObjectWrapper::Class::getType()};

std::unordered_map<oatpp::web::protocol::http::Status, ContentHints> responses

# Endpoint::Info::Info

Constructor;

Info()

# Endpoint::Info::createShared

Create shared Info.

  • @return

static std::shared_ptr<Info> createShared()

# Endpoint::Info::addConsumes

Add "consumes" info to endpoint.

  • @tparam T
  • @param contentType

template<class Wrapper>
ContentHints& addConsumes(const oatpp::String& contentType, const oatpp::String& description = oatpp::String())

# Endpoint::Info::addResponse

Add response info to endpoint

  • @tparam Wrapper
  • @param status
  • @param contentType
  • @param responseDescription

template<class Wrapper>
ContentHints& addResponse(const oatpp::web::protocol::http::Status& status, const oatpp::String& contentType, const oatpp::String& responseDescription = oatpp::String())

# Endpoint::Info::addSecurityRequirement

Add security requirement.

  • @param requirement
  • @param scopes

void addSecurityRequirement(const oatpp::String &requirement, const std::shared_ptr<std::list<oatpp::String>> &scopes = nullptr)

# Endpoint::Info::addTag

Add tag.

  • @param tag

void addTag(const oatpp::String& tag)

# Endpoint::Info::Param

Param holds info about parameter

namespace oatpp { namespace web { namespace server { namespace api { 
  class Endpoint : public oatpp::base::Countable {
    class Info : public oatpp::base::Countable {
      struct Param {}
    };
  };
}}}}

# Endpoint::Info::ContentHints

Hints about the response (content-type, schema, description, ...)

namespace oatpp { namespace web { namespace server { namespace api { 
  class Endpoint : public oatpp::base::Countable {
    class Info : public oatpp::base::Countable {
      struct ContentHints {}
    };
  };
}}}}

# Endpoint::Info::Params

Parameters container

namespace oatpp { namespace web { namespace server { namespace api { 
  class Endpoint : public oatpp::base::Countable {
    class Info : public oatpp::base::Countable {
      class Params {}
    };
  };
}}}}

# Fields

Type Name Summary
Param& operator Get or add param by name
  • @param name
  • @return

# Methods

Return Type Name Summary
Param& add Multiple implementations:
  1. Add parameter name to list order
  2. Add parameter name to list order

# Endpoint::Info::Params::operator

Get or add param by name

  • @param name
  • @return

Param& operator [](const oatpp::String& name)

# Endpoint::Info::Params::add

  1. Add parameter name to list order
    • @param name
    • @return new or existing parameter
    Param& add(const oatpp::String& name, oatpp::data::mapping::type::Type* type)
    
  2. Add parameter name to list order
    • @tparam T
    • @param name
    • @return new or existing parameter
    template<class T>
    Param& add(const oatpp::String& name)
    

# Endpoints

Collection of endpoints.

namespace oatpp { namespace web { namespace server { namespace api { 
  struct Endpoints {}
}}}}