olp-cpp-sdk  1.22.0
IndexLayerClient.h
1 /*
2  * Copyright (C) 2019-2021 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 
24 #include <olp/core/client/ApiError.h>
25 #include <olp/core/client/ApiNoResult.h>
26 #include <olp/core/client/ApiResponse.h>
27 #include <olp/core/client/OlpClientSettings.h>
28 #include <olp/core/porting/deprecated.h>
29 #include <olp/dataservice/write/DataServiceWriteApi.h>
30 #include <olp/dataservice/write/generated/model/ResponseOkSingle.h>
31 #include <olp/dataservice/write/model/DeleteIndexDataRequest.h>
32 #include <olp/dataservice/write/model/PublishIndexRequest.h>
33 #include <olp/dataservice/write/model/UpdateIndexRequest.h>
34 
35 namespace olp {
36 namespace client {
37 struct Error;
38 class HRN;
39 } // namespace client
40 
41 namespace dataservice {
42 namespace write {
43 class IndexLayerClientImpl;
44 
45 using PublishIndexResult = olp::dataservice::write::model::ResponseOkSingle;
46 using PublishIndexResponse =
47  client::ApiResponse<PublishIndexResult, client::ApiError>;
48 using PublishIndexCallback = std::function<void(PublishIndexResponse response)>;
49 
50 using DeleteIndexDataResponse =
51  client::ApiResponse<client::ApiNoResult, client::ApiError>;
52 using DeleteIndexDataCallback =
53  std::function<void(DeleteIndexDataResponse response)>;
54 
55 using UpdateIndexResponse =
56  client::ApiResponse<client::ApiNoResult, client::ApiError>;
57 using UpdateIndexCallback = std::function<void(UpdateIndexResponse response)>;
58 
60 class DATASERVICE_WRITE_API IndexLayerClient {
61  public:
70 
79 
92 
107  model::PublishIndexRequest request, PublishIndexCallback callback);
108 
121  model::DeleteIndexDataRequest request, DeleteIndexDataCallback callback);
122 
133 
142  model::UpdateIndexRequest request);
143 
155  UpdateIndexCallback callback);
156 
157  private:
158  std::shared_ptr<IndexLayerClientImpl> impl_;
159 };
160 
161 } // namespace write
162 } // namespace dataservice
163 } // namespace olp
A wrapper template that you can use to cancel a request or wait for it to finalize.
Definition: ApiResponse.h:281
Cancels service requests.
Definition: CancellationToken.h:33
Allows a Here Resource Name (HRN) to be passed to the operations that require it.
Definition: HRN.h:34
Publishes data to an index layer.
Definition: IndexLayerClient.h:60
IndexLayerClient(client::HRN catalog, client::OlpClientSettings settings)
Creates the IndexLayerClient instance.
olp::client::CancellableFuture< UpdateIndexResponse > UpdateIndex(model::UpdateIndexRequest request)
Updates index information in the index layer.
olp::client::CancellableFuture< PublishIndexResponse > PublishIndex(model::PublishIndexRequest request)
Publishes the index to the index layer.
olp::client::CancellationToken UpdateIndex(model::UpdateIndexRequest request, UpdateIndexCallback callback)
Updates index information in the index layer.
olp::client::CancellationToken DeleteIndexData(model::DeleteIndexDataRequest request, DeleteIndexDataCallback callback)
Deletes the data blob that is stored under the index layer.
olp::client::CancellationToken PublishIndex(model::PublishIndexRequest request, PublishIndexCallback callback)
Publishes the index to the index layer.
olp::client::CancellableFuture< DeleteIndexDataResponse > DeleteIndexData(model::DeleteIndexDataRequest request)
Deletes the data blob that is stored under the index layer.
void CancelPendingRequests()
Cancels all the ongoing operations that this client started.
Deletes index data from an index layer.
Definition: DeleteIndexDataRequest.h:34
Publishes data to an index layer.
Definition: PublishIndexRequest.h:37
Represents a response to a successful data upload operation to a catalog layer.
Definition: ResponseOkSingle.h:34
Updates an index in an index layer.
Definition: UpdateIndexRequest.h:37
Rules all the other namespaces.
Definition: AppleSignInProperties.h:24
Configures the behavior of the OlpClient class.
Definition: OlpClientSettings.h:180