Arachne 1.0
Arachne - the perpetual stitcher of Wikidata entities.
Loading...
Searching...
No Matches
corespace::call_preview Struct Reference

#include <include/utils.hpp>

Public Member Functions

bool has_param (std::string_view key) const
 Check whether a query parameter with key key exists.
std::string get_param (std::string_view key) const
 Retrieve the first value for query parameter key.

Public Attributes

http_method method
 HTTP method to use for the request (GET, POST, etc.).
std::string url
 Full request URL (excluding query parameters).
parameter_list query_params
parameter_list form_params
std::string body
std::string content_type
 Content-Type header value for the request body.
std::string accept
 Accept header value indicating expected response format.
int timeout_sec = -1
 Per-request timeout in seconds (-1 for default).
bool use_form_body { false }

Detailed Description

Definition at line 255 of file utils.hpp.

Member Function Documentation

◆ get_param()

std::string corespace::call_preview::get_param ( std::string_view key) const
nodiscard

Retrieve the first value for query parameter key.

Parameters
keyKey to search for.
Returns
Value associated with key or empty string if not found.

Definition at line 130 of file utils.cpp.

130 {
131 for (const auto& [fst, snd] : query_params) {
132 if (fst == key) {
133 return snd;
134 }
135 }
136 return {};
137}
parameter_list query_params
Definition utils.hpp:261

◆ has_param()

bool corespace::call_preview::has_param ( std::string_view key) const
nodiscard

Check whether a query parameter with key key exists.

Parameters
keyKey to search for.
Returns
true if a parameter with the given key is present.

Definition at line 124 of file utils.cpp.

124 {
125 return std::ranges::any_of(query_params, [&](const auto& p) {
126 return p.first == key;
127 });
128}

Member Data Documentation

◆ accept

std::string corespace::call_preview::accept

Accept header value indicating expected response format.

Definition at line 271 of file utils.hpp.

◆ body

std::string corespace::call_preview::body

Raw request body (used for POST requests with non-form content, e.g., JSON or SPARQL).

Definition at line 266 of file utils.hpp.

Referenced by arachnespace::pheidippides::build_call_preview().

◆ content_type

std::string corespace::call_preview::content_type

Content-Type header value for the request body.

Definition at line 269 of file utils.hpp.

Referenced by arachnespace::pheidippides::build_call_preview().

◆ form_params

parameter_list corespace::call_preview::form_params

Parameters to be sent in the request body as form data (for POST requests with form encoding).

Definition at line 264 of file utils.hpp.

◆ method

http_method corespace::call_preview::method
Initial value:

HTTP method to use for the request (GET, POST, etc.).

Definition at line 256 of file utils.hpp.

256 {
258 };

Referenced by arachnespace::pheidippides::build_call_preview().

◆ query_params

parameter_list corespace::call_preview::query_params

Parameters to be appended to the URL as a query string (for GET/URL-encoded requests).

Definition at line 261 of file utils.hpp.

◆ timeout_sec

int corespace::call_preview::timeout_sec = -1

Per-request timeout in seconds (-1 for default).

Definition at line 272 of file utils.hpp.

Referenced by arachnespace::pheidippides::build_call_preview().

◆ url

std::string corespace::call_preview::url

Full request URL (excluding query parameters).

Definition at line 259 of file utils.hpp.

Referenced by arachnespace::pheidippides::build_call_preview().

◆ use_form_body

bool corespace::call_preview::use_form_body { false }

If true, send form_params as the request body; otherwise, use raw body.

Definition at line 273 of file utils.hpp.

273{ false };

Referenced by arachnespace::pheidippides::build_call_preview().


The documentation for this struct was generated from the following files: