LlamaLib  v2.0.2
Cross-platform library for local LLMs
Loading...
Searching...
No Matches
ios_http_transport.h
1#pragma once
2#include <string>
3#include <vector>
4#include <memory>
5
6typedef void (*CharArrayFnWithContext)(const char *, void* context);
7
8// Result structure
9struct HttpResult {
10 std::string body;
11 int status_code;
12 std::string error_message;
13 bool success;
14
15 HttpResult() : status_code(0), success(false) {}
16};
17
19public:
20 IOSHttpTransport(const std::string &host, bool use_ssl, int port = -1);
22
23 // POST request with context support
24 // callback: receives null-terminated strings with context
25 // cancel_flag: pointer to bool that can be set to true to cancel
26 HttpResult post_request(
27 const std::string &path,
28 const std::string &body,
29 const std::vector<std::pair<std::string, std::string>> &headers,
30 CharArrayFnWithContext callback = nullptr,
31 void* callback_context = nullptr,
32 bool *cancel_flag = nullptr);
33
34 // Configuration
35 void set_timeout(double timeout_seconds);
36
37 // Utility
38 std::string get_last_error() const;
39
40private:
41 class Impl;
42 std::unique_ptr<Impl> pImpl;
43};