1 /*
2  * Copyright (c) 2022 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #ifndef COMMUNICATIONNETSTACK_FETCH_REQUEST_H
17 #define COMMUNICATIONNETSTACK_FETCH_REQUEST_H
18 
19 #include <map>
20 #include <string>
21 
22 namespace OHOS::NetStack::Fetch {
23 class FetchRequest final {
24 public:
25     FetchRequest();
26 
27     void SetUrl(const std::string &url);
28 
29     void SetMethod(const std::string &method);
30 
31     void SetBody(const void *data, size_t length);
32 
33     void SetHeader(const std::string &key, const std::string &val);
34 
35     [[nodiscard]] const std::string &GetUrl() const;
36 
37     [[nodiscard]] const std::string &GetMethod() const;
38 
39     [[nodiscard]] const std::string &GetBody() const;
40 
41     [[nodiscard]] const std::map<std::string, std::string> &GetHeader() const;
42 
43 private:
44     std::string url_;
45 
46     std::string body_;
47 
48     std::string method_;
49 
50     std::map<std::string, std::string> header_;
51 };
52 } // namespace OHOS::NetStack::Fetch
53 
54 #endif /* COMMUNICATIONNETSTACK_FETCH_REQUEST_H */
55