olp-cpp-sdk  1.22.0
PublishIndexRequest.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 #include <olp/dataservice/write/generated/model/Index.h>
31 
32 namespace olp {
33 namespace dataservice {
34 namespace write {
35 namespace model {
37 class DATASERVICE_WRITE_API PublishIndexRequest {
38  public:
39  PublishIndexRequest() = default;
40  PublishIndexRequest(const PublishIndexRequest&) = default;
42  PublishIndexRequest& operator=(const PublishIndexRequest&) = default;
43  PublishIndexRequest& operator=(PublishIndexRequest&&) = default;
44  virtual ~PublishIndexRequest() = default;
45 
51  inline std::shared_ptr<std::vector<unsigned char>> GetData() const {
52  return data_;
53  }
54 
61  const std::shared_ptr<std::vector<unsigned char>>& data) {
62  data_ = data;
63  return *this;
64  }
65 
72  std::shared_ptr<std::vector<unsigned char>>&& data) {
73  data_ = std::move(data);
74  return *this;
75  }
76 
82  inline const std::string& GetLayerId() const { return layer_id_; }
83 
91  inline PublishIndexRequest& WithLayerId(const std::string& layer_id) {
92  layer_id_ = layer_id;
93  return *this;
94  }
95 
103  inline PublishIndexRequest& WithLayerId(std::string&& layer_id) {
104  layer_id_ = std::move(layer_id);
105  return *this;
106  }
107 
118  inline const boost::optional<std::string>& GetBillingTag() const {
119  return billing_tag_;
120  }
121 
130  inline PublishIndexRequest& WithBillingTag(const std::string& billing_tag) {
131  billing_tag_ = billing_tag;
132  return *this;
133  }
134 
143  inline PublishIndexRequest& WithBillingTag(std::string&& billing_tag) {
144  billing_tag_ = std::move(billing_tag);
145  return *this;
146  }
147 
159  inline const boost::optional<std::string>& GetChecksum() const {
160  return checksum_;
161  }
162 
170  inline PublishIndexRequest& WithChecksum(const std::string& checksum) {
171  checksum_ = checksum;
172  return *this;
173  }
174 
182  inline PublishIndexRequest& WithChecksum(std::string&& checksum) {
183  checksum_ = std::move(checksum);
184  return *this;
185  }
186 
198  inline const Index& GetIndex() const { return index_; }
199 
207  inline PublishIndexRequest& WithIndex(const Index& index) {
208  index_ = index;
209  return *this;
210  }
211 
220  index_ = std::move(index);
221  return *this;
222  }
223 
224  private:
225  std::shared_ptr<std::vector<unsigned char>> data_;
226 
227  std::string layer_id_;
228 
229  boost::optional<std::string> billing_tag_;
230 
231  boost::optional<std::string> checksum_;
232 
233  Index index_;
234 };
235 
236 } // namespace model
237 } // namespace write
238 } // namespace dataservice
239 } // namespace olp
Represents the index layer.
Definition: Index.h:311
Publishes data to an index layer.
Definition: PublishIndexRequest.h:37
PublishIndexRequest & WithBillingTag(std::string &&billing_tag)
Sets the billing tag for the request.
Definition: PublishIndexRequest.h:143
PublishIndexRequest & WithLayerId(std::string &&layer_id)
Sets the layer ID of the catalog where you want to store the data.
Definition: PublishIndexRequest.h:103
const std::string & GetLayerId() const
Gets the layer ID of the catalog where you want to store the data.
Definition: PublishIndexRequest.h:82
const Index & GetIndex() const
Gets the Index object that contains the index information to be published to the index layer.
Definition: PublishIndexRequest.h:198
const boost::optional< std::string > & GetChecksum() const
Gets the request checksum.
Definition: PublishIndexRequest.h:159
PublishIndexRequest & WithIndex(Index &&index)
Sets the Index object.
Definition: PublishIndexRequest.h:219
std::shared_ptr< std::vector< unsigned char > > GetData() const
Gets the data to be published to the HERE platform.
Definition: PublishIndexRequest.h:51
PublishIndexRequest & WithChecksum(const std::string &checksum)
Sets the request checksum.
Definition: PublishIndexRequest.h:170
PublishIndexRequest & WithBillingTag(const std::string &billing_tag)
Sets the billing tag for the request.
Definition: PublishIndexRequest.h:130
const boost::optional< std::string > & GetBillingTag() const
Gets the billing tag to group billing records together.
Definition: PublishIndexRequest.h:118
PublishIndexRequest & WithLayerId(const std::string &layer_id)
Sets the layer ID of the catalog where you want to store the data.
Definition: PublishIndexRequest.h:91
PublishIndexRequest & WithData(std::shared_ptr< std::vector< unsigned char >> &&data)
Sets the data to be published to the HERE platform.
Definition: PublishIndexRequest.h:71
PublishIndexRequest & WithChecksum(std::string &&checksum)
Sets the request checksum.
Definition: PublishIndexRequest.h:182
PublishIndexRequest & WithData(const std::shared_ptr< std::vector< unsigned char >> &data)
Sets the data to be published to the HERE platform.
Definition: PublishIndexRequest.h:60
PublishIndexRequest & WithIndex(const Index &index)
Sets the Index object.
Definition: PublishIndexRequest.h:207
Rules all the other namespaces.
Definition: AppleSignInProperties.h:24