updated routes (#1661)

This commit is contained in:
Prabhat Singh
2021-08-17 03:18:55 +05:30
committed by GitHub
parent ee0d594f9f
commit 1b4d0bf577
3 changed files with 820 additions and 489 deletions
+15 -5
View File
@@ -141,33 +141,43 @@ class BcfClient:
def get(self, endpoint, params=None, is_auth_required=False):
# TODO: handle error http status codes and raise exception. Follow error.json standard.
headers = {"Authorization": "Bearer " + self.foundation_client.get_access_token()}
return requests.get(f"{self.baseurl}{endpoint}", headers=headers, params=params or None).json()
response = requests.get(f"{self.baseurl}{endpoint}", headers=headers, params=params or None)
if response.status_code == 200:
return response.json()
else:
raise Exception(f"{response.status_code}, {response.text}")
def post(self, endpoint, data=None, params=None):
headers = {
"Authorization": "Bearer " + self.foundation_client.get_access_token(),
"Content-type": "application/json",
}
resp = requests.post(
response = requests.post(
f"{self.baseurl}{endpoint}",
headers=headers,
params=params or None,
data=data or None,
)
return resp.status_code, resp.text
if response.status_code == 201:
return response.status_code, response.text
else:
raise Exception(f"{response.status_code}, {response.text}")
def put(self, endpoint, data=None, params=None):
headers = {
"Authorization": "Bearer " + self.foundation_client.get_access_token(),
"Content-type": "application/json",
}
resp = requests.put(
response = requests.put(
f"{self.baseurl}{endpoint}",
headers=headers,
params=params or None,
data=data or None,
)
return resp.status_code, resp.text
if response.status_code == 200:
return response.status_code, response.text
else:
raise Exception(f"{response.status_code}, {response.text}")
def delete(self, endpoint, params=None):
headers = {"Authorization": "Bearer " + self.foundation_client.get_access_token()}
@@ -67,5 +67,378 @@
"comment_actions": [
"update"
]
}],
"Topics": [{
"guid": "A245F4F2-2C01-B43B-B612-5E456BEF8116",
"server_assigned_id": "ISSUE-00001",
"creation_author": "Architect@example.com",
"title": "Example topic 1",
"labels": [
"Architecture",
"Structural"
],
"creation_date": "2013-10-21T17:34:22.409Z"
}, {
"guid": "A211FCC2-3A3B-EAA4-C321-DE22ABC8414",
"server_assigned_id": "ISSUE-00078",
"creation_author": "Architect@example.com",
"title": "Example topic 2",
"labels": [
"Architecture",
"Heating",
"Electrical"
],
"creation_date": "2014-11-19T14:24:11.316Z"
},
{
"guid": "B345F4F2-3A04-B43B-A713-5E456BEF8228",
"server_assigned_id": "ISSUE-00549",
"creation_author": "Architect@example.com",
"creation_date": "2016-08-01T17:34:22.409Z",
"topic_type": "Clash",
"topic_status": "open",
"title": "Example topic 3",
"priority": "high",
"labels": [
"Architecture",
"Heating"
],
"assigned_to": "harry.muster@example.com",
"bim_snippet": {
"snippet_type": "clash",
"is_external": true,
"reference": "https://example.com/bcf/1.0/ADFE23AA11BCFF444122BB",
"reference_schema": "https://example.com/bcf/1.0/clash.xsd"
},
"authorization": {
"topic_actions": [
"createComment",
"createViewpoint"
]
}
}
],
"Files":[{
"display_information": [{
"field_display_name": "Model Name",
"field_value": "ARCH-Z100-051"
}, {
"field_display_name": "Revision Date",
"field_value": "May 3 2020"
}],
"file": {
"ifc_project": "0J$yPqHBD12v72y4qF6XcD",
"file_name": "OfficeBuilding_Architecture_0001.ifc",
"reference": "https://example.com/files/0J$yPqHBD12v72y4qF6XcD_0001.ifc"
}
}, {
"display_information": [{
"field_display_name": "Model Name",
"field_value": "MEP-Z100-015"
}, {
"field_display_name": "Revision Date",
"field_value": "Apr 30 2020"
}],
"file": {
"ifc_project": "3hwBHP91jBRwPsmyf$3Hea",
"file_name": "OfficeBuilding_Heating_0003.ifc",
"reference": "cf37bae6-0900-46be-b37f-b34754fe0b4a"
}
}],
"Comments":[
{
"guid": "C4215F4D-AC45-A43A-D615-AA456BEF832B",
"date": "2016-08-01T12:34:22.409Z",
"author": "max.muster@example.com",
"comment": "Clash found",
"topic_guid": "B345F4F2-3A04-B43B-A713-5E456BEF8228",
"authorization": {
"comment_actions": [
"update"
]
}
},
{
"guid": "A333FCA8-1A31-CAAC-A321-BB33ABC8414",
"date": "2016-08-01T14:24:11.316Z",
"author": "bob.heater@example.com",
"comment": "will rework the heating model",
"topic_guid": "B345F4F2-3A04-B43B-A713-5E456BEF8228"
}
],
"RelatedTopics":[{
"related_topic_guid": "db49df2b-0e42-473b-a3ee-f7b785d783c4"
}, {
"related_topic_guid": "6963a846-54d1-4050-954d-607cd5e48aa3"
}],
"Viewpoints":[{
"guid": "b24a82e9-f67b-43b8-bda0-4946abf39624",
"perspective_camera": {
"camera_view_point": {
"x": 0.0,
"y": 0.0,
"z": 0.0
},
"camera_direction": {
"x": 1.0,
"y": 1.0,
"z": 2.0
},
"camera_up_vector": {
"x": 0.0,
"y": 0.0,
"z": 1.0
},
"field_of_view": 90.0,
"aspect_ratio": 1.33
},
"lines": [{
"start_point": {
"x": 2.0,
"y": 1.0,
"z": 1.0
},
"end_point": {
"x": 0.0,
"y": 1.0,
"z": 0.7
}
}],
"clipping_planes": [{
"location": {
"x": 0.7,
"y": 0.3,
"z": -0.2
},
"direction": {
"x": 1.0,
"y": 0.4,
"z": 0.1
}
}]
}, {
"guid": "a11a82e7-e66c-34b4-ada1-5846abf39133",
"perspective_camera": {
"camera_view_point": {
"x": 0.0,
"y": 0.0,
"z": 0.0
},
"camera_direction": {
"x": 1.0,
"y": 1.0,
"z": 2.0
},
"camera_up_vector": {
"x": 0.0,
"y": 0.0,
"z": 1.0
},
"field_of_view": 90.0,
"aspect_ratio": 1.33
},
"lines": [{
"start_point": {
"x": 1.0,
"y": 1.0,
"z": 1.0
},
"end_point": {
"x": 0.0,
"y": 0.0,
"z": 0.0
}
}],
"clipping_planes": [{
"location": {
"x": 0.5,
"y": 0.5,
"z": 0.5
},
"direction": {
"x": 1.0,
"y": 0.0,
"z": 0.0
}
}],
"coloring": [
{
"color": "#ff0000",
"components": [
{
"ifc_guid": "2MF28NhmDBiRVyFakgdbCT",
"originating_system": "Example CAD Application",
"authoring_tool_id": "EXCAD/v1.0"
},
{
"ifc_guid": "3$cshxZO9AJBebsni$z9Yk"
}
]
}
],
"visibility": {
"default_visibility": true,
"exceptions": [
{
"ifc_guid": "2MF28NhmDBiRVyFakgdbCT",
"originating_system": "Example CAD Application",
"authoring_tool_id": "EXCAD/v1.0"
},
{
"ifc_guid": "3$cshxZO9AJBebsni$z9Yk"
}
],
"view_setup_hints": {
"spaces_visible": true,
"space_boundaries_visible": false,
"openings_visible": true
}
}
},
{
"guid": "a11a82e7-e66c-34b4-ada1-5846abf39133",
"index": 10,
"perspective_camera": {
"camera_view_point": {
"x": 0,
"y": 0,
"z": 0
},
"camera_direction": {
"x": 1,
"y": 1,
"z": 2
},
"camera_up_vector": {
"x": 0,
"y": 0,
"z": 1
},
"field_of_view": 90,
"aspect_ratio": 1.33
},
"lines": [
{
"start_point": {
"x": 1,
"y": 1,
"z": 1
},
"end_point": {
"x": 0,
"y": 0,
"z": 0
}
}
],
"clipping_planes": [
{
"location": {
"x": 0.5,
"y": 0.5,
"z": 0.5
},
"direction": {
"x": 1,
"y": 0,
"z": 0
}
}
],
"bitmaps": [
{
"guid": "20c1cb56-315f-4a0a-922d-ed7a4a8edf55",
"bitmap_type": "jpg",
"location": {
"x": 10,
"y": -10,
"z": 7
},
"normal": {
"x": -1,
"y": 1.25,
"z": 0
},
"up": {
"x": -5.4,
"y": -4.3,
"z": 1
},
"height": 1666
}
],
"snapshot": {
"snapshot_type": "png"
},
"selection": [
{
"ifc_guid": "2MF28NhmDBiRVyFakgdbCT",
"originating_system": "Example CAD Application",
"authoring_tool_id": "EXCAD/v1.0"
},
{
"ifc_guid": "3$cshxZO9AJBebsni$z9Yk"
}
]
}],
"DocumentReferences":[{
"guid": "212ab37a-6122-448e-86fc-86503183b520",
"url": "http://example.com/files/LegalRequirements.pdf",
"description": "The legal requirements for buildings."
}, {
"guid": "6cbfe31d-95c3-4f4d-92a6-420c23698721",
"document_guid": "472ab37a-6122-448e-86fc-86503183b520",
"description": "The building owners global design parameters for buildings."
}],
"Documents":[{
"guid": "472ab37a-6122-448e-86fc-86503183b520",
"filename": "LegalRequirements.pdf"
}, {
"guid": "6cbfe31d-95c3-4f4d-92a6-420c23698721",
"filename": "DesignParameters.pdf"
}],
"Events": [{
"topic_guid": "A211FCC2-3A3B-EAA4-C321-DE22ABC8414",
"date": "2014-11-19T14:24:11.316Z",
"author": "Architect@example.com",
"events": [
{
"type": "status_updated",
"value": "Closed"
}
]
}, {
"topic_guid": "A245F4F2-2C01-B43B-B612-5E456BEF8116",
"date": "2013-10-21T17:34:22.409Z",
"author": "Architect@example.com",
"events": [
{
"type": "type_updated",
"value": "Warning"
}
]
}],
"EventComments":[{
"comment_guid": "C4215F4D-AC45-A43A-D615-AA456BEF832B",
"topic_guid": "A211FCC2-3A3B-EAA4-C321-DE22ABC8414",
"date": "2014-11-19T14:24:11.316Z",
"author": "Architect@example.com",
"events": [
{
"type": "comment_created",
"value": null
}
]
}, {
"comment_guid": "C4215F4D-AC45-A43A-D615-AA456BEF832B",
"topic_guid": "A245F4F2-2C01-B43B-B612-5E456BEF8116",
"date": "2013-10-21T17:34:22.409Z",
"author": "Architect@example.com",
"events": [
{
"type": "viewpoint_updated",
"value": "b24a82e9-f67b-43b8-bda0-4946abf39624"
}
]
}]
}
File diff suppressed because it is too large Load Diff