Developer API¶
A CCF application is composed of the following:
The Application Entry Point which creates the application in CCF.
A collection of
endpointshandling HTTP requests and grouped in a singleregistry. Anendpointreads and writes to the key-value store via the Key-Value Store API.
Application Entry Point¶
-
std::unique_ptr<ccf::endpoints::EndpointRegistry> ccf::make_user_endpoints(ccf::AbstractNodeContext &context)¶
To be implemented by the application. Creates a collection of endpoints which will be exposed to callers under /app.
- Parameters:
context – Access to node and host services
- Returns:
Unique pointer to the endpoint registry instance
Application Endpoint Registration¶
-
struct Endpoint : public ccf::endpoints::EndpointDefinition¶
An Endpoint represents a user-defined resource that can be invoked by authorised users via HTTP requests, over TLS. An Endpoint is accessible at a specific verb and URI, e.g. POST /app/accounts or GET /app/records.
Endpoints can read from and mutate the state of the replicated key-value store.
A CCF application is a collection of Endpoints recorded in the application’s EndpointRegistry.
Subclassed by ccf::endpoints::PathTemplatedEndpoint, ccf::js::CustomJSEndpoint
Public Functions
-
Endpoint &set_openapi_description(const std::string &description)¶
Set the OpenAPI description for the endpoint.
- Returns:
This Endpoint for further modification
-
Endpoint &set_openapi_summary(const std::string &summary)¶
Set the OpenAPI summary for the endpoint.
- Returns:
This Endpoint for further modification
-
Endpoint &set_openapi_deprecated(bool is_deprecated)¶
Set the endpoint as deprecated.
- Returns:
This Endpoint for further modification
-
Endpoint &set_openapi_deprecated_replaced(const std::string &deprecation_version, const std::string &replacement)¶
Set the endpoint as deprecated and overwrites the description to include deprecation version and point to a replacement endpoint.
- Returns:
This Endpoint for further modification
Whether the endpoint should be omitted from the OpenAPI document.
- Returns:
This Endpoint for further modification
-
Endpoint &require_operator_feature(OperatorFeature feature)¶
Add an opt-in feature which this endpoint uses. The endpoint will only be available on interfaces which have opted in to enabling all required features.
- Returns:
This Endpoint for further modification
-
Endpoint &set_openapi_description(const std::string &description)¶