2 # ==================================================================================
3 # Copyright (c) 2020 HCL Technologies Limited.
5 # Licensed under the Apache License, Version 2.0 (the "License");
6 # you may not use this file except in compliance with the License.
7 # You may obtain a copy of the License at
9 # http://www.apache.org/licenses/LICENSE-2.0
11 # Unless required by applicable law or agreed to in writing, software
12 # distributed under the License is distributed on an "AS IS" BASIS,
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 # See the License for the specific language governing permissions and
15 # limitations under the License.
16 # ==================================================================================
18 #ifndef _CPPREST_SDK_WRAPPER_H
19 #define _CPPREST_SDK_WRAPPER_H
22 #include<cpprest/http_client.h>
23 #include<cpprest/filestream.h>
24 #include<cpprest/uri.h>
25 #include<cpprest/json.h>
27 #include <cpprest/http_listener.h>
28 #include"nlohmann/json.hpp"
42 //utility::string_t body;
45 typedef struct oran_resp
48 std::string SubscriptionId;
54 utility::string_t baseUrl;
56 //utility::string_t resp_url=U("http://0.0.0.0:8080/ric/v1/subscriptions/response");
57 std::string resp_url = "http://0.0.0.0:8080/ric/v1/subscriptions/response";//default response url
58 web::http::experimental::listener::http_listener listener;
60 void response_listener();
63 void SetbaseUrl(std::string);
64 std::string getBaseUrl();
65 //O-RAN specific api calls
66 oresponse_t post_subscriptions(const nlohmann::json & json, std::string path);
67 int delete_subscriptions(std::string Id, std::string path);
68 response_t get_subscriptions(std::string path);
69 response_t get_config(std::string path);
72 virtual response_t do_get(std::string path);
73 virtual response_t do_post(const nlohmann::json & json, std::string path);
74 virtual response_t do_del(std::string Id, std::string path);
75 //virtual response_t do_post(const web::json::value & json, std::string path);
76 cpprestclient(std::string base_url, std::function<void(web::http::http_request)>callback);
77 cpprestclient(std::string base_url,std::string response_url, std::function<void(web::http::http_request)>callback);
78 cpprestclient(std::string base_url);
79 virtual ~cpprestclient(){}
80 //void start_response_listener();
81 void stop_response_listener();