Ignition Fuel_tools

API Reference

8.0.0~pre1
FuelClient.hh
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2017 Open Source Robotics Foundation
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 */
17 
18 #ifndef IGNITION_FUEL_TOOLS_FUELCLIENT_HH_
19 #define IGNITION_FUEL_TOOLS_FUELCLIENT_HH_
20 
21 #include <memory>
22 #include <string>
23 #include <vector>
24 #include <ignition/common/URI.hh>
25 
30 
31 #ifdef _WIN32
32 // Disable warning C4251 which is triggered by
33 // std::unique_ptr
34 #pragma warning(push)
35 #pragma warning(disable: 4251)
36 #endif
37 
38 namespace ignition
39 {
40  namespace fuel_tools
41  {
43  class ClientConfig;
44  class CollectionIdentifier;
45  class FuelClientPrivate;
46  class LocalCache;
47  class ModelIdentifier;
48  class ServerConfig;
49 
51  class IGNITION_FUEL_TOOLS_VISIBLE FuelClient
52  {
54  public: FuelClient();
55 
60  public: FuelClient(const ClientConfig &_config,
61  const Rest &_rest = Rest());
62 
71  public: IGN_DEPRECATED(6) FuelClient(const ClientConfig &_config,
72  const Rest &_rest,
73  LocalCache *_cache);
74 
76  public: ~FuelClient();
77 
80  public: ClientConfig &Config();
81 
87  public: Result ModelDetails(const ModelIdentifier &_id,
88  ModelIdentifier &_model) const;
89 
96  public: Result ModelDetails(const ModelIdentifier &_id,
97  ModelIdentifier &_model,
98  const std::vector<std::string> &_headers) const;
99 
100 
110  public: ModelIter Models(const ServerConfig &_server);
111 
121  public: ModelIter Models(const ServerConfig &_server) const;
122 
127  public: Result WorldDetails(const WorldIdentifier &_id,
128  WorldIdentifier &_world) const;
129 
135  public: Result WorldDetails(const WorldIdentifier &_id,
136  WorldIdentifier &_world,
137  const std::vector<std::string> &_headers) const;
138 
145  public: WorldIter Worlds(const ServerConfig &_server) const;
146 
154  public: ModelIter Models(const ModelIdentifier &_id);
155 
163  public: ModelIter Models(const ModelIdentifier &_id) const;
164 
169  public: ModelIter Models(const CollectionIdentifier &_id) const;
170 
174  public: WorldIter Worlds(const WorldIdentifier &_id) const;
175 
180  public: WorldIter Worlds(const CollectionIdentifier &_id) const;
181 
188  public: Result UploadModel(const std::string &_pathToModelDir,
189  const ModelIdentifier &_id,
190  const std::vector<std::string> &_headers,
191  bool _private = false);
192 
201  public: Result UploadModel(const std::string &_pathToModelDir,
202  const ModelIdentifier &_id,
203  const std::vector<std::string> &_headers,
204  bool _private,
205  const std::string &_owner);
206 
210  public: Result IGN_DEPRECATED(6) DeleteModel(const ModelIdentifier &_id);
211 
217  public: Result DeleteUrl(const ignition::common::URI &_uri,
218  const std::vector<std::string> &_headers);
219 
224  public: Result DownloadModel(const ModelIdentifier &_id);
225 
231  public: Result DownloadModel(const ModelIdentifier &_id,
232  const std::vector<std::string> &_headers);
233 
238  public: Result DownloadWorld(WorldIdentifier &_id);
239 
245  public: Result DownloadWorld(WorldIdentifier &_id,
246  const std::vector<std::string> &_headers);
247 
254  public: Result DownloadModel(const common::URI &_modelUrl,
255  std::string &_path);
256 
263  public: Result DownloadWorld(const common::URI &_worldUrl,
264  std::string &_path);
265 
271  public: Result CachedModel(const common::URI &_modelUrl,
272  std::string &_path);
273 
278  public: bool CachedModel(const common::URI &_modelUrl);
279 
285  public: Result CachedWorld(const common::URI &_worldUrl,
286  std::string &_path);
287 
292  public: bool CachedWorld(const common::URI &_worldUrl);
293 
300  public: Result CachedModelFile(const common::URI &_fileUrl,
301  std::string &_path);
302 
309  public: Result CachedWorldFile(const common::URI &_fileUrl,
310  std::string &_path);
311 
321  public: bool ParseModelUrl(const common::URI &_modelUrl,
322  ModelIdentifier &_id);
323 
333  public: bool ParseWorldUrl(const common::URI &_worldUrl,
334  WorldIdentifier &_id);
335 
345  public: bool ParseModelFileUrl(const common::URI &_modelFileUrl,
346  ModelIdentifier &_id,
347  std::string &_filePath);
348 
358  public: bool ParseWorldFileUrl(const common::URI &_worldFileUrl,
359  WorldIdentifier &_id,
360  std::string &_filePath);
361 
372  public: void PopulateLicenses(const ServerConfig &_server);
373 
383  public: Result PatchModel(
385  const std::vector<std::string> &_headers);
386 
400  public: Result PatchModel(
402  const std::vector<std::string> &_headers,
403  const std::string &_pathToModelDir);
404 
413  public: bool ParseCollectionUrl(const common::URI &_url,
414  CollectionIdentifier &_id);
415 
419  public: bool UpdateModels(const std::vector<std::string> &_headers);
420 
424  public: bool UpdateWorlds(const std::vector<std::string> &_headers);
425 
429  private: void AddServerConfigParametersToHeaders(
430  const ignition::fuel_tools::ServerConfig &_serverConfig,
431  std::vector<std::string> &_headers) const;
432 
434  private: std::unique_ptr<FuelClientPrivate> dataPtr;
435  };
436  }
437 }
438 
439 #ifdef _MSC_VER
440 #pragma warning(pop)
441 #endif
442 
443 #endif
High level interface to ignition fuel.
Definition: FuelClient.hh:51
High level interface to ignition fuel.
Definition: ClientConfig.hh:109
Class for managing stuff in the local cache.
Definition: LocalCache.hh:46
Defines how to identify a world.
Definition: WorldIdentifier.hh:42
class for iterating through worlds
Definition: WorldIter.hh:42
Class describing a result of an operation.
Definition: Result.hh:90
Defines how to identify a model.
Definition: ModelIdentifier.hh:45
STL class.
A helper class for making REST requests.
Definition: RestClient.hh:82
Defines how to identify a collection.
Definition: CollectionIdentifier.hh:42
Describes options needed for a server.
Definition: ClientConfig.hh:47
STL class.
class for iterating through models
Definition: ModelIter.hh:43