Class LinksBuilder

Class Documentation

class LinksBuilder

Public Functions

LinksBuilder() = default

Construct a new LinksBuilder.

LinksBuilder &self(const std::string &href)

Set the self link.

Parameters:

href – The href for the self link

Returns:

Reference to this builder for chaining

LinksBuilder &parent(const std::string &href)

Set the parent link.

Parameters:

href – The href for the parent link

Returns:

Reference to this builder for chaining

LinksBuilder &collection(const std::string &href)

Set the collection link.

Parameters:

href – The href for the collection link

Returns:

Reference to this builder for chaining

LinksBuilder &add(const std::string &rel, const std::string &href)

Add a custom link.

Parameters:
  • rel – The relation name

  • href – The href for the link

Returns:

Reference to this builder for chaining

nlohmann::json build() const

Build the final _links JSON object.

Returns:

JSON object containing all configured links