Skip to content

Commit a9fb579

Browse files
Add classes for comptabile versions request. (#1299)
Add classes for future API for comtabile versions request. Resolves: OAM-1338 Signed-off-by: Serhii Lozynskyi <[email protected]>
1 parent 19e8500 commit a9fb579

File tree

6 files changed

+308
-0
lines changed

6 files changed

+308
-0
lines changed

olp-cpp-sdk-dataservice-read/include/olp/dataservice/read/CatalogClient.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
#include <olp/core/porting/deprecated.h>
2828
#include <olp/dataservice/read/CatalogRequest.h>
2929
#include <olp/dataservice/read/CatalogVersionRequest.h>
30+
#include <olp/dataservice/read/CompatibleVersionsRequest.h>
3031
#include <olp/dataservice/read/DataRequest.h>
3132
#include <olp/dataservice/read/DataServiceReadApi.h>
3233
#include <olp/dataservice/read/PartitionsRequest.h>
Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
/*
2+
* Copyright (C) 2022 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 <olp/dataservice/read/DataServiceReadApi.h>
23+
#include <olp/dataservice/read/model/CatalogVersion.h>
24+
25+
#include <utility>
26+
#include <vector>
27+
28+
namespace olp {
29+
namespace dataservice {
30+
namespace read {
31+
32+
/**
33+
* @brief Contains fields required to request compatible versions for
34+
* the given catalog.
35+
*/
36+
class DATASERVICE_READ_API CompatibleVersionsRequest final {
37+
public:
38+
using Dependencies = std::vector<model::CatalogVersion>;
39+
40+
/**
41+
* @brief Gets the dependencies for the catalog versions compatibility check.
42+
*
43+
* @return The dependencies for the catalog versions compatibility check.
44+
*/
45+
inline const Dependencies& GetDependencies() const { return dependencies_; }
46+
47+
/**
48+
* @brief Sets the dependencies to check the catalog versions for
49+
* compatibility.
50+
*
51+
* @param dependencies The dependencies for the catalog versions
52+
* compatibility check.
53+
*
54+
* @return A reference to the updated `CompatibleVersionsRequest` instance.
55+
*/
56+
inline CompatibleVersionsRequest& WithDependencies(
57+
Dependencies dependencies) {
58+
dependencies_ = std::move(dependencies);
59+
return *this;
60+
}
61+
62+
/**
63+
* @brief Gets the maximum amount of versions available in the response.
64+
*
65+
* @return The maximum amount of versions available in the response.
66+
*/
67+
inline int32_t GetLimit() const { return limit_; }
68+
69+
/**
70+
* @brief Sets the maximum amount of versions available in the
71+
* response.
72+
*
73+
* @param limit The maximum amount of versions available in the
74+
* response. The default limit is 1.
75+
*
76+
* @return A reference to the updated `CompatibleVersionsRequest` instance.
77+
*/
78+
inline CompatibleVersionsRequest& WithLimit(int32_t limit) {
79+
limit_ = limit;
80+
return *this;
81+
}
82+
83+
private:
84+
Dependencies dependencies_;
85+
int32_t limit_{1};
86+
};
87+
88+
} // namespace read
89+
} // namespace dataservice
90+
} // namespace olp

olp-cpp-sdk-dataservice-read/include/olp/dataservice/read/Types.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
#include <olp/dataservice/read/model/Partitions.h>
3737
#include <olp/dataservice/read/model/VersionInfos.h>
3838
#include <olp/dataservice/read/model/VersionResponse.h>
39+
#include <olp/dataservice/read/model/VersionsResponse.h>
3940

4041
namespace olp {
4142
namespace dataservice {
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
/*
2+
* Copyright (C) 2022 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 <string>
23+
#include <utility>
24+
25+
#include <olp/dataservice/read/DataServiceReadApi.h>
26+
27+
namespace olp {
28+
namespace dataservice {
29+
namespace read {
30+
namespace model {
31+
32+
/// Represents catalog with the version.
33+
class DATASERVICE_READ_API CatalogVersion final {
34+
public:
35+
/**
36+
* @brief Gets the HRN of the catalog.
37+
*
38+
* @return The HRN of the catalog.
39+
*/
40+
const std::string& GetHrn() const { return hrn_; }
41+
42+
/**
43+
* @brief Sets the HRN of the catalog.
44+
*
45+
* @param hrn The HRN of the catalog.
46+
*/
47+
void SetHrn(std::string hrn) { hrn_ = std::move(hrn); }
48+
49+
/**
50+
* @brief Gets the version of the catalog.
51+
*
52+
* @return The version of the catalog.
53+
*/
54+
int64_t GetVersion() const { return version_; }
55+
56+
/**
57+
* @brief Sets the version of the dependent catalog.
58+
*
59+
* @param version The version of the catalog.
60+
*/
61+
void SetVersion(int64_t version) { version_ = version; }
62+
63+
private:
64+
std::string hrn_;
65+
int64_t version_{0};
66+
};
67+
68+
} // namespace model
69+
} // namespace read
70+
} // namespace dataservice
71+
} // namespace olp
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
/*
2+
* Copyright (C) 2022 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 <utility>
23+
#include <vector>
24+
25+
#include <olp/dataservice/read/DataServiceReadApi.h>
26+
#include <olp/dataservice/read/model/VersionsResponseEntry.h>
27+
28+
namespace olp {
29+
namespace dataservice {
30+
namespace read {
31+
namespace model {
32+
33+
/// Represents a result of the compatible versions request.
34+
class DATASERVICE_READ_API VersionsResponse final {
35+
public:
36+
using VersionsResponseEntries = std::vector<VersionsResponseEntry>;
37+
38+
/**
39+
* @brief Sets the information on the compatible versions.
40+
*
41+
* It contains the version numbers and dependencies for the requested catalog.
42+
*
43+
* @param entries The information on the compatible versions.
44+
*/
45+
void SetVersionResponseEntries(VersionsResponseEntries entries) {
46+
entries_ = std::move(entries);
47+
}
48+
49+
/**
50+
* @brief Gets the information on the compatible versions.
51+
*
52+
* It contains the version numbers and dependencies for the requested catalog.
53+
*
54+
* @return The information on the compatible versions.
55+
*/
56+
const VersionsResponseEntries& GetVersionResponseEntries() const {
57+
return entries_;
58+
}
59+
60+
private:
61+
VersionsResponseEntries entries_;
62+
};
63+
64+
} // namespace model
65+
} // namespace read
66+
} // namespace dataservice
67+
} // namespace olp
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
/*
2+
* Copyright (C) 2022 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 <utility>
23+
#include <vector>
24+
25+
#include <olp/dataservice/read/DataServiceReadApi.h>
26+
#include <olp/dataservice/read/model/CatalogVersion.h>
27+
28+
namespace olp {
29+
namespace dataservice {
30+
namespace read {
31+
namespace model {
32+
33+
/// Represents dependencies for the given catalog version.
34+
class DATASERVICE_READ_API VersionsResponseEntry {
35+
public:
36+
using CatalogVersions = std::vector<CatalogVersion>;
37+
38+
/**
39+
* @brief Sets the information on the dependencies.
40+
*
41+
* @param catalog_versions The information of the dependencies.
42+
*/
43+
void SetCatalogVersions(CatalogVersions catalog_versions) {
44+
catalog_versions_ = std::move(catalog_versions);
45+
}
46+
47+
/**
48+
* @brief Gets the information on the compatible versions.
49+
*
50+
* @return The information on the compatible versions.
51+
*/
52+
const CatalogVersions& GetCatalogVersions() const {
53+
return catalog_versions_;
54+
}
55+
56+
/**
57+
* @brief Gets the version of the catalog.
58+
*
59+
* @return The version of the catalog.
60+
*/
61+
int64_t GetVersion() const { return version_; }
62+
63+
/**
64+
* @brief Sets the version of the catalog.
65+
*
66+
* @param version The version of the catalog.
67+
*/
68+
void SetVersion(int64_t version) { version_ = version; }
69+
70+
private:
71+
int64_t version_{0};
72+
CatalogVersions catalog_versions_;
73+
};
74+
75+
} // namespace model
76+
} // namespace read
77+
} // namespace dataservice
78+
} // namespace olp

0 commit comments

Comments
 (0)