Qore SwaggerDataProvider Module Reference  1.0
SwaggerDataProvider.qc.dox.h
1 // -*- mode: c++; indent-tabs-mode: nil -*-
3 
25 // minimum required Qore version
26 // assume local scope for variables, do not use "$" signs
27 // require type definitions everywhere
28 // strict argument handling
29 // enable all warnings
30 
34 class SwaggerDataProvider : public AbstractDataProvider {
35 
36 public:
38  SwaggerSchema schema;
39 
41  *RestClient rest;
42 
44  string uri_path = "/";
45 
47  const ProviderInfo = <DataProviderInfo>{
48  "type": "SwaggerDataProvider",
49  "supports_read": False,
50  "supports_create": False,
51  "supports_update": False,
52  "supports_upsert": False,
53  "supports_delete": False,
54  "supports_native_search": False,
55  "supports_bulk_create": False,
56  "supports_bulk_upsert": False,
57  "supports_children": True,
58  "constructor_options": ConstructorOptions,
59  "search_options": NOTHING,
60  "create_options": NOTHING,
61  "upsert_options": NOTHING,
62  "transaction_management": False,
63  };
64 
66  const ConstructorOptions = {
67  "schema": <DataProviderOptionInfo>{
68  "type": (
69  AbstractDataProviderType::get(StringType),
70  AbstractDataProviderType::get(new Type("SwaggerSchema")),
71  ),
72  "desc": "the Swagger schema object or source URL",
73  "required": True,
74  },
75  "restclient": <DataProviderOptionInfo>{
76  "type": AbstractDataProviderType::get(new Type("RestClient")),
77  "desc": "the RestClient object",
78  },
79  "url": <DataProviderOptionInfo>{
80  "type": AbstractDataProviderType::get(StringType),
81  "desc": "the URL to the REST server; overrides any URL in the schema or in any RestClient object "
82  "passed as an option",
83  },
84  "restclient_options": <DataProviderOptionInfo>{
85  "type": AbstractDataProviderType::get(AutoHashType),
86  "desc": "options to the RestClient constructor; only used if a RestClient object is created for a "
87  "call",
88  },
89  };
90 
92  const HttpMethods = {
93  "GET": True,
94  "PUT": True,
95  "PATCH": True,
96  "POST": True,
97  "DELETE": True,
98  };
99 
100 protected:
102  hash<auto> path_tree;
103 
104 public:
105 
107 protected:
108  constructor(hash<auto> path_tree, string uri_path, SwaggerSchema schema, *RestClient rest);
109 public:
110 
111 
113  constructor(SwaggerSchema schema, *RestClient rest);
114 
115 
117  constructor(*hash<auto> options);
118 
119 
121  string getName();
122 
123 
125 protected:
126  checkRestClient(RestClient rest);
127 public:
128 
129 
130 protected:
131  setupTree();
132 public:
133 
134 
136 
138 protected:
139  *list<string> getChildProviderNamesImpl();
140 public:
141 
142 
144 
148 protected:
149  *AbstractDataProvider getChildProviderImpl(string name);
150 public:
151 
152 
154 protected:
155  AbstractDataProvider getChildIntern(string name, *string real_name);
156 public:
157 
158 
160 protected:
161  hash<DataProviderInfo> getStaticInfoImpl();
162 public:
163 
164 };
165 }; // end namespace swagger
SwaggerSchema schema
The Swagger schema.
Definition: SwaggerDataProvider.qc.dox.h:38
const True
const False
Qore SwaggerDataProvider module definition.
Definition: SwaggerDataProvider.qc.dox.h:32
*RestClient rest
The REST client object for API calls.
Definition: SwaggerDataProvider.qc.dox.h:41
const NOTHING
hash< auto > path_tree
hash of valid paths
Definition: SwaggerDataProvider.qc.dox.h:102