merged AI doc, some new pages
This commit is contained in:
@@ -1,3 +1,27 @@
|
||||
//! \~\file pihttpclient.h
|
||||
//! \~\ingroup HTTP
|
||||
//! \~\brief
|
||||
//! \~english Public HTTP client request API
|
||||
//! \~russian Публичный API HTTP-клиента для выполнения запросов
|
||||
/*
|
||||
PIP - Platform Independent Primitives
|
||||
Public HTTP client request API
|
||||
Ivan Pelipenko peri4ko@yandex.ru
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Lesser General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef pihttpclient_h
|
||||
#define pihttpclient_h
|
||||
|
||||
@@ -13,57 +37,65 @@ public:
|
||||
};
|
||||
|
||||
|
||||
//! \~english Main HTTP client class for performing requests with event callbacks.
|
||||
//! \~russian Основной класс HTTP-клиента для выполнения запросов с callback-ми событий.
|
||||
//! \~\ingroup HTTP
|
||||
//! \~\brief
|
||||
//! \~english Asynchronous HTTP client request with completion callbacks.
|
||||
//! \~russian Асинхронный HTTP-запрос клиента с callback-ами завершения.
|
||||
class PIP_HTTP_CLIENT_EXPORT PIHTTPClient: private PIHTTPClientBase {
|
||||
friend class PIHTTPClientBase;
|
||||
friend class CurlThreadPool;
|
||||
|
||||
|
||||
public:
|
||||
//! \~english Creates a new HTTP request instance with the specified URL, method and message.
|
||||
//! \~russian Создает новый экземпляр HTTP-запроса с указанным URL, методом и сообщением.
|
||||
//! \~english Creates a request object for the specified URL, method and initial message data.
|
||||
//! \~russian Создает объект запроса для указанного URL, метода и начальных данных сообщения.
|
||||
static PIHTTPClient * create(const PIString & url, PIHTTP::Method method = PIHTTP::Method::Get, const PIHTTP::MessageConst & req = {});
|
||||
|
||||
//! \~english Sets a callback for successful request completion (no parameters).
|
||||
//! \~russian Устанавливает callback для успешного завершения запроса (без параметров).
|
||||
|
||||
//! \~english Sets a callback invoked when the transfer completes successfully.
|
||||
//! \~russian Устанавливает callback, вызываемый при успешном завершении передачи.
|
||||
PIHTTPClient * onFinish(std::function<void()> f);
|
||||
|
||||
//! \~english Sets a callback for successful request completion (with response).
|
||||
//! \~russian Устанавливает callback для успешного завершения запроса (с ответом).
|
||||
//! \~english Sets a callback invoked when the transfer completes successfully and provides the parsed reply.
|
||||
//! \~russian Устанавливает callback, вызываемый при успешном завершении передачи, и передает разобранный ответ.
|
||||
PIHTTPClient * onFinish(std::function<void(const PIHTTP::MessageConst &)> f);
|
||||
|
||||
//! \~english Sets a callback for request errors (no parameters).
|
||||
//! \~russian Устанавливает callback для ошибок запроса (без параметров).
|
||||
//! \~english Sets a callback invoked when the transfer fails with a transport-level error.
|
||||
//! \~russian Устанавливает callback, вызываемый при ошибке передачи на транспортном уровне.
|
||||
PIHTTPClient * onError(std::function<void()> f);
|
||||
|
||||
//! \~english Sets a callback for request errors (with error response).
|
||||
//! \~russian Устанавливает callback для ошибок запроса (с ответом об ошибке).
|
||||
//! \~english Sets a callback invoked when the transfer fails with a transport-level error and provides the partial reply state.
|
||||
//! \~russian Устанавливает callback, вызываемый при ошибке передачи на транспортном уровне, и передает текущее состояние ответа.
|
||||
PIHTTPClient * onError(std::function<void(const PIHTTP::MessageConst &)> f);
|
||||
|
||||
//! \~english Sets a callback for request abortion (no parameters).
|
||||
//! \~russian Устанавливает callback для прерывания запроса (без параметров).
|
||||
//! \~english Sets a callback invoked when the request is aborted.
|
||||
//! \~russian Устанавливает callback, вызываемый при прерывании запроса.
|
||||
PIHTTPClient * onAbort(std::function<void()> f);
|
||||
|
||||
//! \~english Sets a callback for request abortion (with abort response).
|
||||
//! \~russian Устанавливает callback для прерывания запроса (с ответом о прерывании).
|
||||
//! \~english Sets a callback invoked when the request is aborted and provides the current reply state.
|
||||
//! \~russian Устанавливает callback, вызываемый при прерывании запроса, и передает текущее состояние ответа.
|
||||
PIHTTPClient * onAbort(std::function<void(const PIHTTP::MessageConst &)> f);
|
||||
|
||||
//! \~english Setup request to ignore SSL errors. Need to call before \a start().
|
||||
//! \~russian Устанавливает игнорирование ошибок SSL. Необходимо вызывать перед \a start().
|
||||
|
||||
//! \~english Disables SSL verification checks for this request. Call \b before \a start().
|
||||
//! \~russian Отключает проверки SSL для этого запроса. Вызывайте \b до \a start().
|
||||
PIHTTPClient * ignoreSSLErrors();
|
||||
|
||||
//! \~english Starts the HTTP request execution.
|
||||
//! \~russian Начинает выполнение HTTP-запроса.
|
||||
|
||||
//! \~english Queues the request for asynchronous execution.
|
||||
//! \~russian Ставит запрос в очередь на асинхронное выполнение.
|
||||
void start();
|
||||
|
||||
//! \~english Aborts the current HTTP request.
|
||||
//! \~russian Прерывает текущий HTTP-запрос.
|
||||
//! \~english Requests cancellation of the running transfer.
|
||||
//! \~russian Запрашивает отмену выполняющейся передачи.
|
||||
void abort();
|
||||
|
||||
//! \~english Returns the last error message.
|
||||
//! \~russian Возвращает последнее сообщение об ошибке.
|
||||
|
||||
//! \~english Returns the last transport error message.
|
||||
//! \~russian Возвращает последнее сообщение об ошибке транспортного уровня.
|
||||
PIString lastError() const { return last_error; }
|
||||
|
||||
|
||||
private:
|
||||
NO_COPY_CLASS(PIHTTPClient)
|
||||
PIHTTPClient();
|
||||
|
||||
@@ -1,7 +1,19 @@
|
||||
//! \~\file pihttpclientmodule.h
|
||||
//! \~\ingroup HTTPClient
|
||||
//! \~\brief
|
||||
//! \~english HTTP client module includes for PIP library
|
||||
//! \~russian Модуль инклюдов HTTP клиента для библиотеки PIP
|
||||
//! \details
|
||||
//! \~english
|
||||
//! This file includes all HTTP client module headers providing async HTTP client functionality
|
||||
//! using libcurl for performing HTTP requests with callbacks.
|
||||
//! \~russian
|
||||
//! Этот файл включает все заголовки модуля HTTP клиента, предоставляющие функциональность
|
||||
//! асинхронного HTTP клиента с использованием libcurl.
|
||||
/*
|
||||
PIP - Platform Independent Primitives
|
||||
Module includes
|
||||
Ivan Pelipenko peri4ko@yandex.ru, Andrey Bychkov work.a.b@yandex.ru
|
||||
Ivan Pelipenko peri4ko@yandex.ru
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Lesser General Public License as published by
|
||||
@@ -16,28 +28,20 @@
|
||||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
//! \defgroup HTTPServer HTTPServer
|
||||
//! \defgroup HTTPClient HTTPClient
|
||||
//! \~\brief
|
||||
//! \~english HTTP client
|
||||
//! \~russian HTTP сервер
|
||||
//!
|
||||
//! \~\details
|
||||
//! \~english \section cmake_module_HTTPServer Building with CMake
|
||||
//! \~russian \section cmake_module_HTTPServer Сборка с использованием CMake
|
||||
//! \~russian HTTP клиент
|
||||
//!
|
||||
//! \~\code
|
||||
//! find_package(PIP REQUIRED)
|
||||
//! target_link_libraries([target] PIP::HTTPServer)
|
||||
//! target_link_libraries([target] PIP::HTTPClient)
|
||||
//! \endcode
|
||||
//!
|
||||
//! \~english \par Common
|
||||
//! \~russian \par Общее
|
||||
//!
|
||||
//! \~\details
|
||||
//! \~english
|
||||
//! These files provides HTTP server based on libmicrohttpd
|
||||
//!
|
||||
//! These files provide HTTP client functionality using libcurl for performing asynchronous HTTP requests with callbacks.
|
||||
//! \~russian
|
||||
//! Эти файлы обеспечивают HTTP сервер, основанный на libmicrohttpd
|
||||
//! Эти файлы предоставляют функциональность HTTP клиента с использованием libcurl для выполнения асинхронных HTTP запросов с callback-ми.
|
||||
//!
|
||||
//! \~\authors
|
||||
//! \~english
|
||||
|
||||
Reference in New Issue
Block a user