Qore SwaggerDataProvider Module Reference  1.2.1
SwaggerDataProvider.qc.dox.h
1 // -*- mode: c++; indent-tabs-mode: nil -*-
3 
28 class SwaggerDataProvider : public AbstractDataProvider {
29 
30 public:
32  SwaggerSchema schema;
33 
36 
38  string uri_path = "/";
39 
41  const ProviderInfo = <DataProviderInfo>{
42  "type": "SwaggerDataProvider",
43  "supports_read": False,
44  "supports_create": False,
45  "supports_update": False,
46  "supports_upsert": False,
47  "supports_delete": False,
48  "supports_native_search": False,
49  "supports_bulk_create": False,
50  "supports_bulk_upsert": False,
51  "supports_children": True,
52  "constructor_options": ConstructorOptions,
53  "search_options": NOTHING,
54  "create_options": NOTHING,
55  "upsert_options": NOTHING,
56  "transaction_management": False,
57  "supports_schema": True,
58  "schema_type": "swagger",
59  };
60 
62  const ConstructorOptions = {
63  "schema": <DataProviderOptionInfo>{
64  "type": (
65  AbstractDataProviderType::get(StringType, NOTHING, {
66  DTT_FromFile: True,
67  DTT_FromLocation: True,
68  }),
69  AbstractDataProviderType::get(new Type("SwaggerSchema")),
70  ),
71  "desc": "the Swagger schema object or source URL",
72  "required": True,
73  },
74  "restclient": <DataProviderOptionInfo>{
75  "type": AbstractDataProviderType::get(new Type("RestClient"), NOTHING, {
76  DTT_ClientOnly: True,
77  }),
78  "desc": "the RestClient object",
79  },
80  "url": <DataProviderOptionInfo>{
81  "type": AbstractDataProviderType::get(StringType, NOTHING, {
82  DTT_ClientOnly: True,
83  }),
84  "desc": "the URL to the REST server; overrides any URL in the schema or in any RestClient object "
85  "passed as an option",
86  },
87  "restclient_options": <DataProviderOptionInfo>{
88  "type": AbstractDataProviderType::get(AutoHashType, NOTHING, {
89  DTT_ClientOnly: True,
90  }),
91  "desc": "options to the RestClient constructor; only used if a RestClient object is created for a "
92  "call",
93  },
94  };
95 
97  const HttpMethods = {
98  "GET": True,
99  "PUT": True,
100  "PATCH": True,
101  "POST": True,
102  "DELETE": True,
103  };
104 
105 protected:
107  hash<auto> path_tree;
108 
109 public:
110 
112 protected:
113  constructor(hash<auto> path_tree, string uri_path, SwaggerSchema schema, *RestClient rest);
114 public:
115 
116 
118  constructor(SwaggerSchema schema, *RestClient rest);
119 
120 
122  constructor(*hash<auto> options);
123 
124 
126  string getName();
127 
128 
130  *string getDesc();
131 
132 
134 protected:
136 public:
137 
138 
139 protected:
140  setupTree();
141 public:
142 
143 
145 
147 protected:
148  *list<string> getChildProviderNamesImpl();
149 public:
150 
151 
153 
157 protected:
158  *AbstractDataProvider getChildProviderImpl(string name);
159 public:
160 
161 
163 protected:
164  AbstractDataProvider getChildIntern(string name, *string real_name);
165 public:
166 
167 
169 protected:
170  hash<DataProviderInfo> getStaticInfoImpl();
171 public:
172 
173 
175 protected:
177 public:
178 
179 };
180 }; // end namespace swagger
hash< DataProviderInfo > getStaticInfoImpl()
Returns data provider static info.
string getName()
Returns the data provider name.
checkRestClient(RestClient rest)
Checks the REST client.
SwaggerSchema schema
The Swagger schema.
Definition: SwaggerDataProvider.qc.dox.h:32
*list< string > getChildProviderNamesImpl()
Returns a list of child data provider names, if any.
constructor(*hash< auto > options)
Creates the object from constructor options.
AbstractDataProvider getChildIntern(string name, *string real_name)
Returns the child provider for the given path component.
constructor(SwaggerSchema schema, *RestClient rest)
Creates the object from the arguments.
object getSchemaObjectImpl()
Returns the schema supporting this data provider.
*AbstractDataProvider getChildProviderImpl(string name)
Returns the given child provider or NOTHING if the given child is unknown.
*RestClient rest
The REST client object for API calls.
Definition: SwaggerDataProvider.qc.dox.h:35
constructor(hash< auto > path_tree, string uri_path, SwaggerSchema schema, *RestClient rest)
Private constructor; used when traversing the tree.
*string getDesc()
Returns the data provider description.
hash< auto > path_tree
hash of valid paths
Definition: SwaggerDataProvider.qc.dox.h:107
const True
const False
const NOTHING
Qore SwaggerDataProvider module definition.
Definition: SwaggerDataProvider.qc.dox.h:26