Skip to content

Commit 3764101

Browse files
authored
Integrating catalog solvers api (#19)
Fixes while developing ITISFoundation/osparc-simcore#2112 * Minor updates in OAS * returns a file * Changes in file response types Added headers comment * py3 turns into rest.py::223 into string ( should modify
1 parent 3fcfb72 commit 3764101

29 files changed

+196
-117
lines changed

api/openapi.json

Lines changed: 69 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
{
22
"openapi": "3.0.2",
33
"info": {
4-
"title": "osparc public web api",
5-
"description": "**osparc-simcore public web API Specifications**\n## Python Library\n- Check the [documentation](https://itisfoundation.github.io/osparc-simcore-python-client)\n- Quick install: ``pip install git+https://github.com/ITISFoundation/osparc-simcore-python-client.git``\n",
6-
"version": "0.4.0",
4+
"title": "osparc.io web API",
5+
"description": "osparc-simcore public web API specifications",
6+
"version": "0.3.0",
77
"x-logo": {
88
"url": "https://raw.githubusercontent.com/ITISFoundation/osparc-manual/b809d93619512eb60c827b7e769c6145758378d0/_media/osparc-logo.svg",
99
"altText": "osparc-simcore logo"
@@ -221,6 +221,9 @@
221221
}
222222
}
223223
},
224+
"404": {
225+
"description": "File not found"
226+
},
224227
"422": {
225228
"description": "Validation Error",
226229
"content": {
@@ -260,13 +263,24 @@
260263
],
261264
"responses": {
262265
"200": {
263-
"description": "Successful Response",
266+
"description": "Returns a arbitrary binary data",
264267
"content": {
265-
"application/json": {
266-
"schema": {}
268+
"application/octet-stream": {
269+
"schema": {
270+
"type": "string",
271+
"format": "binary"
272+
}
273+
},
274+
"text/plain": {
275+
"schema": {
276+
"type": "string"
277+
}
267278
}
268279
}
269280
},
281+
"404": {
282+
"description": "File not found"
283+
},
270284
"422": {
271285
"description": "Validation Error",
272286
"content": {
@@ -307,7 +321,12 @@
307321
}
308322
}
309323
}
310-
}
324+
},
325+
"security": [
326+
{
327+
"HTTPBasic": []
328+
}
329+
]
311330
}
312331
},
313332
"/v0/solvers/{solver_id}": {
@@ -350,7 +369,12 @@
350369
}
351370
}
352371
}
353-
}
372+
},
373+
"security": [
374+
{
375+
"HTTPBasic": []
376+
}
377+
]
354378
}
355379
},
356380
"/v0/solvers/{solver_id}/jobs": {
@@ -506,7 +530,12 @@
506530
}
507531
}
508532
}
509-
}
533+
},
534+
"security": [
535+
{
536+
"HTTPBasic": []
537+
}
538+
]
510539
}
511540
},
512541
"/v0/jobs": {
@@ -851,7 +880,13 @@
851880
"description": "MD5 hash of the file's content"
852881
}
853882
},
854-
"description": "Describes a file stored on the server side "
883+
"description": "Describes a file stored on the server side ",
884+
"example": {
885+
"file_id": "f0e1fb11-208d-3ed2-b5ef-cab7a7398f78",
886+
"filename": "Architecture-of-Scalable-Distributed-ETL-System-whitepaper.pdf",
887+
"content_type": "application/pdf",
888+
"checksum": "de47d0e1229aa2dfb80097389094eadd-1"
889+
}
855890
},
856891
"Groups": {
857892
"title": "Groups",
@@ -1182,8 +1217,28 @@
11821217
"title": "Gravatar Id",
11831218
"maxLength": 40,
11841219
"type": "string",
1185-
"description": "Hash value of email to retrieve an avatar image from https://www.gravatar.com"
1220+
"description": "md5 hash value of email to retrieve an avatar image from https://www.gravatar.com"
11861221
}
1222+
},
1223+
"example": {
1224+
"first_name": "James",
1225+
"last_name": "Maxwell",
1226+
"login": "[email protected]",
1227+
"role": "USER",
1228+
"groups": {
1229+
"me": {
1230+
"gid": "123",
1231+
"label": "maxy",
1232+
"description": "primary group"
1233+
},
1234+
"organizations": [],
1235+
"all": {
1236+
"gid": "1",
1237+
"label": "Everyone",
1238+
"description": "all users"
1239+
}
1240+
},
1241+
"gravatar_id": "9a8930a5b20d7048e37740bac5c1ca4f"
11871242
}
11881243
},
11891244
"ProfileUpdate": {
@@ -1224,11 +1279,7 @@
12241279
"title": "Version",
12251280
"pattern": "^(0|[1-9]\\d*)(\\.(0|[1-9]\\d*)){2}(-(0|[1-9]\\d*|\\d*[-a-zA-Z][-\\da-zA-Z]*)(\\.(0|[1-9]\\d*|\\d*[-a-zA-Z][-\\da-zA-Z]*))*)?(\\+[-\\da-zA-Z]+(\\.[-\\da-zA-Z-]+)*)?$",
12261281
"type": "string",
1227-
"description": "semantic version number of the node",
1228-
"example": [
1229-
"1.0.0",
1230-
"0.0.1"
1231-
]
1282+
"description": "semantic version number of the node"
12321283
},
12331284
"id": {
12341285
"title": "Id",
@@ -1261,11 +1312,11 @@
12611312
"example": {
12621313
"name": "simcore/services/comp/isolve",
12631314
"version": "2.1.1",
1264-
"id": "42838344-03de-4ce2-8d93-589a5dcdfd05",
1315+
"id": "f7c25b7d-edd6-32a4-9751-6072e4163537",
12651316
"title": "iSolve",
12661317
"description": "EM solver",
12671318
"maintainer": "[email protected]",
1268-
"url": "https://api.osparc.io/v0/solvers/42838344-03de-4ce2-8d93-589a5dcdfd05"
1319+
"url": "https://api.osparc.io/v0/solvers/f7c25b7d-edd6-32a4-9751-6072e4163537"
12691320
}
12701321
},
12711322
"TaskStates": {

osparc/__init__.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,18 @@
33
# flake8: noqa
44

55
"""
6-
osparc public web api
6+
osparc.io web API
77
8-
9-
The version of the OpenAPI document: 0.4.0
8+
osparc-simcore public web API specifications # noqa: E501
9+
10+
The version of the OpenAPI document: 0.3.0
1011
Generated by: https://openapi-generator.tech
1112
"""
1213

1314

1415
from __future__ import absolute_import
1516

16-
__version__ = "0.4.1"
17+
__version__ = "0.3.0"
1718

1819
# import apis into sdk package
1920
from osparc.api.files_api import FilesApi

osparc/api/files_api.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
# coding: utf-8
22

33
"""
4-
osparc public web api
4+
osparc.io web API
55
6-
7-
The version of the OpenAPI document: 0.4.0
6+
osparc-simcore public web API specifications # noqa: E501
7+
8+
The version of the OpenAPI document: 0.3.0
89
Generated by: https://openapi-generator.tech
910
"""
1011

@@ -52,7 +53,7 @@ def download_file(self, file_id, **kwargs): # noqa: E501
5253
number provided, it will be total request
5354
timeout. It can also be a pair (tuple) of
5455
(connection, read) timeouts.
55-
:return: object
56+
:return: file
5657
If the method is called asynchronously,
5758
returns the request thread.
5859
"""
@@ -78,7 +79,7 @@ def download_file_with_http_info(self, file_id, **kwargs): # noqa: E501
7879
number provided, it will be total request
7980
timeout. It can also be a pair (tuple) of
8081
(connection, read) timeouts.
81-
:return: tuple(object, status_code(int), headers(HTTPHeaderDict))
82+
:return: tuple(file, status_code(int), headers(HTTPHeaderDict))
8283
If the method is called asynchronously,
8384
returns the request thread.
8485
"""
@@ -120,7 +121,7 @@ def download_file_with_http_info(self, file_id, **kwargs): # noqa: E501
120121
body_params = None
121122
# HTTP header `Accept`
122123
header_params['Accept'] = self.api_client.select_header_accept(
123-
['application/json']) # noqa: E501
124+
['application/octet-stream', 'text/plain', 'application/json']) # noqa: E501
124125

125126
# Authentication setting
126127
auth_settings = ['HTTPBasic'] # noqa: E501
@@ -133,7 +134,7 @@ def download_file_with_http_info(self, file_id, **kwargs): # noqa: E501
133134
body=body_params,
134135
post_params=form_params,
135136
files=local_var_files,
136-
response_type='object', # noqa: E501
137+
response_type='file', # noqa: E501
137138
auth_settings=auth_settings,
138139
async_req=local_var_params.get('async_req'),
139140
_return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501

osparc/api/jobs_api.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
# coding: utf-8
22

33
"""
4-
osparc public web api
4+
osparc.io web API
55
6-
7-
The version of the OpenAPI document: 0.4.0
6+
osparc-simcore public web API specifications # noqa: E501
7+
8+
The version of the OpenAPI document: 0.3.0
89
Generated by: https://openapi-generator.tech
910
"""
1011

osparc/api/meta_api.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
# coding: utf-8
22

33
"""
4-
osparc public web api
4+
osparc.io web API
55
6-
7-
The version of the OpenAPI document: 0.4.0
6+
osparc-simcore public web API specifications # noqa: E501
7+
8+
The version of the OpenAPI document: 0.3.0
89
Generated by: https://openapi-generator.tech
910
"""
1011

osparc/api/solvers_api.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
# coding: utf-8
22

33
"""
4-
osparc public web api
4+
osparc.io web API
55
6-
7-
The version of the OpenAPI document: 0.4.0
6+
osparc-simcore public web API specifications # noqa: E501
7+
8+
The version of the OpenAPI document: 0.3.0
89
Generated by: https://openapi-generator.tech
910
"""
1011

@@ -239,7 +240,7 @@ def get_solver_with_http_info(self, solver_id, **kwargs): # noqa: E501
239240
['application/json']) # noqa: E501
240241

241242
# Authentication setting
242-
auth_settings = [] # noqa: E501
243+
auth_settings = ['HTTPBasic'] # noqa: E501
243244

244245
return self.api_client.call_api(
245246
'/v0/solvers/{solver_id}', 'GET',
@@ -355,7 +356,7 @@ def get_solver_by_name_and_version_with_http_info(self, solver_name, version, **
355356
['application/json']) # noqa: E501
356357

357358
# Authentication setting
358-
auth_settings = [] # noqa: E501
359+
auth_settings = ['HTTPBasic'] # noqa: E501
359360

360361
return self.api_client.call_api(
361362
'/v0/solvers/{solver_name}/{version}', 'GET',
@@ -561,7 +562,7 @@ def list_solvers_with_http_info(self, **kwargs): # noqa: E501
561562
['application/json']) # noqa: E501
562563

563564
# Authentication setting
564-
auth_settings = [] # noqa: E501
565+
auth_settings = ['HTTPBasic'] # noqa: E501
565566

566567
return self.api_client.call_api(
567568
'/v0/solvers', 'GET',

osparc/api/users_api.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
# coding: utf-8
22

33
"""
4-
osparc public web api
4+
osparc.io web API
55
6-
7-
The version of the OpenAPI document: 0.4.0
6+
osparc-simcore public web API specifications # noqa: E501
7+
8+
The version of the OpenAPI document: 0.3.0
89
Generated by: https://openapi-generator.tech
910
"""
1011

osparc/api_client.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
# coding: utf-8
22
"""
3-
osparc public web api
3+
osparc.io web API
44
5-
6-
The version of the OpenAPI document: 0.4.0
5+
osparc-simcore public web API specifications # noqa: E501
6+
7+
The version of the OpenAPI document: 0.3.0
78
Generated by: https://openapi-generator.tech
89
"""
910

@@ -77,7 +78,7 @@ def __init__(self, configuration=None, header_name=None, header_value=None,
7778
self.default_headers[header_name] = header_value
7879
self.cookie = cookie
7980
# Set default User-Agent.
80-
self.user_agent = 'osparc-api/0.4.0/python'
81+
self.user_agent = 'osparc-api/0.3.0/python'
8182
self.client_side_validation = configuration.client_side_validation
8283

8384
def __enter__(self):
@@ -552,7 +553,7 @@ def __deserialize_file(self, response):
552553
content_disposition).group(1)
553554
path = os.path.join(os.path.dirname(path), filename)
554555

555-
with open(path, "wb") as f:
556+
with open(path, "w") as f:
556557
f.write(response.data)
557558

558559
return path

osparc/configuration.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
# coding: utf-8
22

33
"""
4-
osparc public web api
4+
osparc.io web API
55
6-
7-
The version of the OpenAPI document: 0.4.0
6+
osparc-simcore public web API specifications # noqa: E501
7+
8+
The version of the OpenAPI document: 0.3.0
89
Generated by: https://openapi-generator.tech
910
"""
1011

@@ -96,7 +97,7 @@ class Configuration(object):
9697
)
9798
"""
9899

99-
def __init__(self, host="https://api.osparc.io",
100+
def __init__(self, host="http://localhost",
100101
api_key=None, api_key_prefix=None,
101102
username=None, password=None,
102103
signing_info=None):
@@ -334,8 +335,8 @@ def to_debug_report(self):
334335
return "Python SDK Debug Report:\n"\
335336
"OS: {env}\n"\
336337
"Python Version: {pyversion}\n"\
337-
"Version of the API: 0.4.0\n"\
338-
"SDK Package version: 0.4.1".\
338+
"Version of the API: 0.3.0\n"\
339+
"SDK Package Version: 0.3.0".\
339340
format(env=sys.platform, pyversion=sys.version)
340341

341342
def get_host_settings(self):

0 commit comments

Comments
 (0)