olp-cpp-sdk 1.24.0
Loading...
Searching...
No Matches
HarCaptureAdapter.h
1/*
2 * Copyright (C) 2025 HERE Europe B.V.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 *
16 * SPDX-License-Identifier: Apache-2.0
17 * License-Filename: LICENSE
18 */
19
20#pragma once
21
22#include <string>
23#include <memory>
24
25#include <olp/core/CoreApi.h>
26#include <olp/core/http/Network.h>
27
28namespace olp {
29namespace http {
30
54class CORE_API HarCaptureAdapter final : public Network {
55 public:
64 HarCaptureAdapter(std::shared_ptr<Network> network, std::string har_out_path);
65
66 ~HarCaptureAdapter() override;
67
71 SendOutcome Send(NetworkRequest request, Payload payload, Callback callback,
72 HeaderCallback header_callback,
73 DataCallback data_callback) override;
74
78 void Cancel(RequestId id) override;
79
80 private:
81 class HarCaptureAdapterImpl;
82 std::shared_ptr<HarCaptureAdapterImpl> impl_;
83};
84
85} // namespace http
86} // namespace olp
A network adapter that captures HTTP requests and responses, generating a HAR (HTTP Archive) file.
Definition HarCaptureAdapter.h:54
void Cancel(RequestId id) override
Cancels the request associated with the given RequestId.
HarCaptureAdapter(std::shared_ptr< Network > network, std::string har_out_path)
Constructs a HarCaptureAdapter instance.
SendOutcome Send(NetworkRequest request, Payload payload, Callback callback, HeaderCallback header_callback, DataCallback data_callback) override
Sends the network request.
A network request abstraction for an HTTP request.
Definition NetworkRequest.h:34
An HTTP client abstraction.
Definition Network.h:38
std::function< void(const std::uint8_t *data, std::uint64_t offset, std::size_t length)> DataCallback
The callback that is called when a chunk of data is received.
Definition Network.h:49
std::shared_ptr< std::ostream > Payload
The request and response payload type.
Definition Network.h:52
std::function< void(std::string key, std::string value)> HeaderCallback
The callback that is called when a header is received.
Definition Network.h:45
std::function< void(NetworkResponse response)> Callback
The callback that is called when the request is processed or canceled.
Definition Network.h:41
Rrepresents the outcome of a network request.
Definition NetworkTypes.h:76
std::uint64_t RequestId
A unique request ID.
Definition NetworkTypes.h:41
Rules all the other namespaces.
Definition AppleSignInProperties.h:24