dxcpp.h
1 // Copyright (C) 2013-2016 DNAnexus, Inc.
2 //
3 // This file is part of dx-toolkit (DNAnexus platform client libraries).
4 //
5 // Licensed under the Apache License, Version 2.0 (the "License"); you may
6 // not use this file except in compliance with the License. You may obtain a
7 // copy of the License at
8 //
9 // http://www.apache.org/licenses/LICENSE-2.0
10 //
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
13 // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
14 // License for the specific language governing permissions and limitations
15 // under the License.
16 
17 #ifndef DXCPP_H
18 #define DXCPP_H
19 
20 #include <stdlib.h>
21 #include <stdint.h>
22 #include <map>
23 #include <string>
24 #include "dxjson/dxjson.h"
25 
26 // A macro to allow unused variable (without throwing warning)
27 // Does work for GCC, will need to be expanded for other compilers.
28 #ifdef UNUSED
29 #elif defined(__GNUC__)
30 # define UNUSED(x) UNUSED_ ## x __attribute__((unused))
31 #elif defined(__LCLINT__)
32 # define UNUSED(x) /*@unused@*/ x
33 #else
34 # define UNUSED(x) x
35 #endif
36 
37 namespace dx {
38  namespace config {
39  std::string& APISERVER_HOST();
40  std::string& APISERVER_PORT();
41  std::string& APISERVER_PROTOCOL();
42  JSON& SECURITY_CONTEXT();
43  std::string& JOB_ID();
44  std::string& WORKSPACE_ID();
45  std::string& PROJECT_CONTEXT_ID();
46 
52  std::string APISERVER();
53 
58  std::string& CURRENT_PROJECT();
59  const std::string& API_VERSION();
60  }
61 
73  dx::JSON DXHTTPRequest(const std::string &resource, const std::string &data, const bool safeToRetry = false,
74  const std::map<std::string, std::string> &headers = std::map<std::string, std::string>());
75 
81  bool loadFromEnvironment();
82 
83  namespace Nonce {
84  std::string nonce();
85  dx::JSON updateNonce(const dx::JSON &input_params);
86  }
87 }
88 
89 #include "exceptions.h"
90 #include "exec_utils.h"
91 #include "api.h"
92 #include "bindings.h"
93 
94 #endif
Automatically generated API method wrappers.
bool loadFromEnvironment()
Definition: dxcpp.cc:451
Exception classes.
An executable object that can be published for others to discover.
Definition: api.cc:7
Useful utilities for interfacing with app(let)&#39;s execution environment.
Data objects and related functions.