Motion Master 6.0.0-alpha.86
Next-generation motion control software
Loading...
Searching...
No Matches
client.h
Go to the documentation of this file.
1#pragma once
2
3#include <chrono>
4#include <expected>
5#include <string>
6#include <utility>
7
8#include "net/http_client.h"
9
22
23namespace mm::auto_tuning {
24
30class Client {
31 public:
34 explicit Client(std::string baseUrl) : baseUrl_(std::move(baseUrl)) {}
35
46 std::expected<mm::net::Response, std::string> run(
47 const std::string& requestBody,
48 std::chrono::seconds timeout = std::chrono::seconds{30}) const;
49
55 std::expected<mm::net::Response, std::string> spec() const;
56
58 const std::string& baseUrl() const { return baseUrl_; }
59
60 private:
61 std::string baseUrl_;
62};
63
64} // namespace mm::auto_tuning
Talks to one running auto-tuning process.
Definition client.h:30
std::expected< mm::net::Response, std::string > run(const std::string &requestBody, std::chrono::seconds timeout=std::chrono::seconds{30}) const
Runs one function.
Definition client.cc:7
std::expected< mm::net::Response, std::string > spec() const
Fetches the program's own OpenAPI document.
Definition client.cc:12
const std::string & baseUrl() const
The address this client was built with.
Definition client.h:58
Client(std::string baseUrl)
Binds to a running process.
Definition client.h:34
A blocking HTTP client for the calls Motion Master makes out.
Definition client.cc:5
std::chrono::milliseconds timeout
Definition somanet_procedures.cc:438