olp-cpp-sdk  1.22.0
PublishDataRequest.h
1 /*
2  * Copyright (C) 2019-2023 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 <memory>
23 #include <string>
24 #include <utility>
25 #include <vector>
26 
27 #include <boost/optional.hpp>
28 
29 #include <olp/dataservice/write/DataServiceWriteApi.h>
30 
31 namespace olp {
32 namespace dataservice {
33 namespace write {
34 namespace model {
36 class DATASERVICE_WRITE_API PublishDataRequest {
37  public:
38  PublishDataRequest() = default;
39  PublishDataRequest(const PublishDataRequest&) = default;
41  PublishDataRequest& operator=(const PublishDataRequest&) = default;
42  PublishDataRequest& operator=(PublishDataRequest&&) = default;
43  virtual ~PublishDataRequest() = default;
44 
50  inline std::shared_ptr<std::vector<unsigned char>> GetData() const {
51  return data_;
52  }
53 
60  const std::shared_ptr<std::vector<unsigned char>>& data) {
61  data_ = data;
62  return *this;
63  }
64 
71  std::shared_ptr<std::vector<unsigned char>>&& data) {
72  data_ = std::move(data);
73  return *this;
74  }
75 
81  inline const std::string& GetLayerId() const { return layer_id_; }
82 
90  inline PublishDataRequest& WithLayerId(const std::string& layer_id) {
91  layer_id_ = layer_id;
92  return *this;
93  }
94 
102  inline PublishDataRequest& WithLayerId(std::string&& layer_id) {
103  layer_id_ = std::move(layer_id);
104  return *this;
105  }
106 
116  inline const boost::optional<std::string>& GetTraceId() const {
117  return trace_id_;
118  }
119 
129  inline PublishDataRequest& WithTraceId(const std::string& trace_id) {
130  trace_id_ = trace_id;
131  return *this;
132  }
133 
143  inline PublishDataRequest& WithTraceId(std::string&& trace_id) {
144  trace_id_ = std::move(trace_id);
145  return *this;
146  }
147 
158  inline const boost::optional<std::string>& GetBillingTag() const {
159  return billing_tag_;
160  }
161 
169  inline PublishDataRequest& WithBillingTag(const std::string& billing_tag) {
170  billing_tag_ = billing_tag;
171  return *this;
172  }
173 
182  inline PublishDataRequest& WithBillingTag(std::string&& billing_tag) {
183  billing_tag_ = std::move(billing_tag);
184  return *this;
185  }
186 
198  inline const boost::optional<std::string>& GetChecksum() const {
199  return checksum_;
200  }
201 
209  inline PublishDataRequest& WithChecksum(const std::string& checksum) {
210  checksum_ = checksum;
211  return *this;
212  }
213 
221  inline PublishDataRequest& WithChecksum(std::string&& checksum) {
222  checksum_ = std::move(checksum);
223  return *this;
224  }
225 
226  private:
227  std::shared_ptr<std::vector<unsigned char>> data_;
228 
229  std::string layer_id_;
230 
231  boost::optional<std::string> trace_id_;
232 
233  boost::optional<std::string> billing_tag_;
234 
235  boost::optional<std::string> checksum_;
236 };
237 
238 } // namespace model
239 } // namespace write
240 } // namespace dataservice
241 } // namespace olp
Publishes data to a stream layer.
Definition: PublishDataRequest.h:36
PublishDataRequest & WithTraceId(const std::string &trace_id)
Sets the trace ID of the request.
Definition: PublishDataRequest.h:129
PublishDataRequest & WithChecksum(const std::string &checksum)
Sets the request checksum.
Definition: PublishDataRequest.h:209
const boost::optional< std::string > & GetTraceId() const
Gets the trace ID of the request.
Definition: PublishDataRequest.h:116
PublishDataRequest & WithLayerId(std::string &&layer_id)
Sets the layer ID of the catalog where you want to store the data.
Definition: PublishDataRequest.h:102
PublishDataRequest & WithBillingTag(const std::string &billing_tag)
Sets the billing tag for the request.
Definition: PublishDataRequest.h:169
const std::string & GetLayerId() const
Gets the layer ID of the catalog where you want to store the data.
Definition: PublishDataRequest.h:81
PublishDataRequest & WithTraceId(std::string &&trace_id)
Sets the trace ID of the request.
Definition: PublishDataRequest.h:143
PublishDataRequest & WithData(const std::shared_ptr< std::vector< unsigned char >> &data)
Sets the data to be published to the HERE platform.
Definition: PublishDataRequest.h:59
PublishDataRequest & WithLayerId(const std::string &layer_id)
Sets the layer ID of the catalog where you want to store the data.
Definition: PublishDataRequest.h:90
PublishDataRequest & WithData(std::shared_ptr< std::vector< unsigned char >> &&data)
Sets the data to be published to the HERE platform.
Definition: PublishDataRequest.h:70
PublishDataRequest & WithChecksum(std::string &&checksum)
Sets the request checksum.
Definition: PublishDataRequest.h:221
const boost::optional< std::string > & GetChecksum() const
Gets the request checksum.
Definition: PublishDataRequest.h:198
std::shared_ptr< std::vector< unsigned char > > GetData() const
Gets the data to be published to the HERE platform.
Definition: PublishDataRequest.h:50
PublishDataRequest & WithBillingTag(std::string &&billing_tag)
Sets the billing tag for the request.
Definition: PublishDataRequest.h:182
const boost::optional< std::string > & GetBillingTag() const
Gets the billing tag to group billing records together.
Definition: PublishDataRequest.h:158
Rules all the other namespaces.
Definition: AppleSignInProperties.h:24