mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-12 10:33:20 +00:00
Added Schema Check in bcf routes (#1671)
This commit is contained in:
+70
-39
@@ -7,6 +7,8 @@ import webbrowser
|
||||
import http.server
|
||||
import base64
|
||||
|
||||
from werkzeug.datastructures import HeaderSet
|
||||
|
||||
|
||||
client_id, client_secret = "", ""
|
||||
|
||||
@@ -142,51 +144,66 @@ class BcfClient:
|
||||
# TODO: handle error http status codes and raise exception. Follow error.json standard.
|
||||
headers = {"Authorization": "Bearer " + self.foundation_client.get_access_token()}
|
||||
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}")
|
||||
try:
|
||||
response = requests.get(f"{self.baseurl}{endpoint}", headers=headers, params=params or None)
|
||||
if response.status_code == 200:
|
||||
return response.json()
|
||||
response.raise_for_status()
|
||||
except requests.exceptions.HTTPError as e:
|
||||
print(f"message: {response.reason}' '{response.status_code}' '{ e }")
|
||||
|
||||
def post(self, endpoint, data=None, params=None):
|
||||
headers = {
|
||||
"Authorization": "Bearer " + self.foundation_client.get_access_token(),
|
||||
"Content-type": "application/json",
|
||||
}
|
||||
response = requests.post(
|
||||
f"{self.baseurl}{endpoint}",
|
||||
headers=headers,
|
||||
params=params or None,
|
||||
data=data or None,
|
||||
)
|
||||
if response.status_code == 201:
|
||||
return response.status_code, response.text
|
||||
else:
|
||||
raise Exception(f"{response.status_code}, {response.text}")
|
||||
try:
|
||||
response = requests.post(
|
||||
f"{self.baseurl}{endpoint}",
|
||||
headers=headers,
|
||||
params=params or None,
|
||||
data=data or None,
|
||||
)
|
||||
if response.status_code == 201:
|
||||
return response.status_code, response.text
|
||||
response.raise_for_status()
|
||||
except requests.exceptions.HTTPError as errh:
|
||||
print(f"message: {response.reason}' '{response.status_code}, {errh}")
|
||||
|
||||
def put(self, endpoint, data=None, params=None):
|
||||
headers = {
|
||||
"Authorization": "Bearer " + self.foundation_client.get_access_token(),
|
||||
"Content-type": "application/json",
|
||||
}
|
||||
response = requests.put(
|
||||
f"{self.baseurl}{endpoint}",
|
||||
headers=headers,
|
||||
params=params or None,
|
||||
data=data or None,
|
||||
)
|
||||
if response.status_code == 200:
|
||||
return response.status_code, response.text
|
||||
else:
|
||||
raise Exception(f"{response.status_code}, {response.text}")
|
||||
try:
|
||||
response = requests.put(
|
||||
f"{self.baseurl}{endpoint}",
|
||||
headers=headers,
|
||||
params=params or None,
|
||||
data=data or None,
|
||||
)
|
||||
if response.status_code == 200:
|
||||
return response.status_code, response.text
|
||||
response.raise_for_status()
|
||||
except requests.exceptions.HTTPError as errh:
|
||||
print(f"message: {response.reason}' '{response.status_code}, {errh}")
|
||||
|
||||
def delete(self, endpoint, params=None):
|
||||
headers = {"Authorization": "Bearer " + self.foundation_client.get_access_token()}
|
||||
resp = requests.put(
|
||||
f"{self.baseurl}{endpoint}",
|
||||
headers=headers,
|
||||
params=params or None,
|
||||
)
|
||||
return resp.status_code
|
||||
headers = {
|
||||
"Authorization": "Bearer " + self.foundation_client.get_access_token(),
|
||||
"Content-type": "application/json",
|
||||
}
|
||||
try:
|
||||
response = requests.delete(
|
||||
f"{self.baseurl}{endpoint}",
|
||||
headers=headers,
|
||||
params=params or None,
|
||||
)
|
||||
if response.status_code == 200:
|
||||
return response.status_code, response.text
|
||||
response.raise_for_status()
|
||||
except requests.exceptions.HTTPError as errh:
|
||||
print(f"message: {response.reason}' '{response.status_code}, {errh}")
|
||||
|
||||
def get_projects(self) -> list:
|
||||
return self.get(
|
||||
@@ -256,16 +273,27 @@ class BcfClient:
|
||||
return self.delete(f"/projects/{project_id}/topics/{topic_id}")
|
||||
|
||||
def get_snippet(self, project_id="", topic_id="") -> str:
|
||||
return self.get(
|
||||
f"/projects/{project_id}/topics/{topic_id}/snippet",
|
||||
{
|
||||
"project_id": project_id,
|
||||
"topic_id": topic_id,
|
||||
},
|
||||
headers = {
|
||||
"Authorization": "Bearer " + self.foundation_client.get_access_token(),
|
||||
"Content-type": "application/octet-stream",
|
||||
}
|
||||
response = requests.get(
|
||||
f"{self.baseurl}/projects/{project_id}/topics/{topic_id}/snippet",
|
||||
headers=headers,
|
||||
)
|
||||
return response.status_code, response.content
|
||||
|
||||
def update_snippet(self, project_id="", topic_id="", data=None):
|
||||
return self.put(f"/projects/{project_id}/topics", data=data)
|
||||
def update_snippet(self, project_id="", topic_id="", files=None, data=None):
|
||||
headers = {
|
||||
"Authorization": "Bearer " + self.foundation_client.get_access_token(),
|
||||
"Content-type": "application/octet-stream",
|
||||
}
|
||||
response = requests.put(
|
||||
f"{self.baseurl}/projects/{project_id}/topics/{topic_id}/snippet",
|
||||
headers=headers,
|
||||
files=files,
|
||||
)
|
||||
return response.status_code
|
||||
|
||||
def get_files_information(self, project_id="") -> list:
|
||||
return self.get(
|
||||
@@ -488,6 +516,7 @@ class BcfClient:
|
||||
project_id="",
|
||||
topic_id="",
|
||||
guid=None,
|
||||
files=None,
|
||||
data=None,
|
||||
):
|
||||
headers = {
|
||||
@@ -498,8 +527,10 @@ class BcfClient:
|
||||
f"/projects/{project_id}/topics/{topic_id}/documents",
|
||||
data=data,
|
||||
params={guid},
|
||||
files=files,
|
||||
headers=headers,
|
||||
)
|
||||
return response.status_code
|
||||
|
||||
def get_document(self, project_id="", topic_id="", document_id="") -> str:
|
||||
return self.get(
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
from operator import methodcaller
|
||||
from flask import jsonify, url_for, redirect, render_template, request, session, flash
|
||||
from flask_login import login_user, logout_user, login_required, current_user
|
||||
from flask.blueprints import Blueprint
|
||||
from werkzeug.utils import send_file
|
||||
from foundation.models import User, OAuth2AuthorizationCode, OAuth2Token, OAuth2Client
|
||||
from run import app, db
|
||||
import json
|
||||
import os
|
||||
from flask_expects_json import expects_json
|
||||
|
||||
bcf = Blueprint("bcf", __name__, template_folder="templates", url_prefix="/bcf/3.0")
|
||||
my_absolute_dirpath = os.path.abspath(os.path.dirname(__file__))
|
||||
@@ -13,6 +14,7 @@ data = open(
|
||||
f"{my_absolute_dirpath}/project.json",
|
||||
)
|
||||
jdata = json.load(data)
|
||||
schema_path = os.path.join(my_absolute_dirpath, "schemas")
|
||||
|
||||
|
||||
def validate_client(request):
|
||||
@@ -60,7 +62,12 @@ def project_details(project_id):
|
||||
return invalid_user()
|
||||
|
||||
|
||||
project_put = open(f"{schema_path}/Project/project_PUT.json")
|
||||
project_put = json.load(project_put)
|
||||
|
||||
|
||||
@bcf.route("/projects/<project_id>", methods=["PUT"])
|
||||
@expects_json(project_put)
|
||||
def update_project(project_id):
|
||||
if validate_client(request) and request.method == "PUT":
|
||||
data = request.get_json()
|
||||
@@ -69,8 +76,7 @@ def update_project(project_id):
|
||||
response = jsonify(data)
|
||||
return response
|
||||
return invalid_project()
|
||||
else:
|
||||
return invalid_user()
|
||||
return invalid_user()
|
||||
|
||||
|
||||
@bcf.route("/projects/<project_id>/extensions")
|
||||
@@ -91,14 +97,16 @@ def topics(project_id):
|
||||
if (project["project_id"]) == project_id:
|
||||
return jsonify(jdata["Topics"])
|
||||
return invalid_project()
|
||||
return invalid_user()
|
||||
|
||||
else:
|
||||
return invalid_user()
|
||||
|
||||
topic_post = open(f"{schema_path}/Collaboration/Topic/topic_POST.json")
|
||||
topic_post = json.load(topic_post)
|
||||
|
||||
|
||||
@bcf.route("/projects/<project_id>/topics/<topic_id>", methods=["POST"])
|
||||
@expects_json(topic_post)
|
||||
def create_topic(project_id, topic_id):
|
||||
|
||||
if validate_client(request) and request.method == "POST":
|
||||
body = request.get_json()
|
||||
for project in jdata["Projects"]:
|
||||
@@ -109,9 +117,7 @@ def create_topic(project_id, topic_id):
|
||||
response.status_code = 201
|
||||
return response
|
||||
return invalid_project()
|
||||
|
||||
else:
|
||||
return invalid_user()
|
||||
return invalid_user()
|
||||
|
||||
|
||||
@bcf.route("/projects/<project_id>/topics/<topic_id>")
|
||||
@@ -123,11 +129,15 @@ def topic_details(project_id, topic_id):
|
||||
if (topic["guid"]) == topic_id:
|
||||
return jsonify(topic)
|
||||
return invalid_project()
|
||||
else:
|
||||
return invalid_user()
|
||||
return invalid_user()
|
||||
|
||||
|
||||
topic_put = open(f"{schema_path}/Collaboration/Topic/topic_PUT.json")
|
||||
topic_put = json.load(topic_put)
|
||||
|
||||
|
||||
@bcf.route("/projects/<project_id>/topics/<topic_id>", methods=["PUT"])
|
||||
@expects_json(topic_put)
|
||||
def update_topic(project_id, topic_id):
|
||||
if validate_client(request) and request.method == "PUT":
|
||||
data = request.get_json()
|
||||
@@ -137,8 +147,7 @@ def update_topic(project_id, topic_id):
|
||||
if (topic["guid"]) == topic_id:
|
||||
return jsonify(data)
|
||||
return invalid_project()
|
||||
else:
|
||||
return invalid_user()
|
||||
return invalid_user()
|
||||
|
||||
|
||||
@bcf.route("/projects/<project_id>/topics/<topic_id>", methods=["DELETE"])
|
||||
@@ -148,10 +157,9 @@ def delete_topic(project_id, topic_id):
|
||||
if (project["project_id"]) == project_id:
|
||||
for topic in jdata["Topics"]:
|
||||
if (topic["guid"]) == topic_id:
|
||||
return jsonify({"OK"})
|
||||
return jsonify("OK")
|
||||
return invalid_project()
|
||||
else:
|
||||
return invalid_user()
|
||||
return invalid_user()
|
||||
|
||||
|
||||
@bcf.route("/projects/<project_id>/topics/<topic_id>/snippet", methods=["GET"])
|
||||
@@ -161,10 +169,9 @@ def get_snippet(project_id, topic_id):
|
||||
if (project["project_id"]) == project_id:
|
||||
for topic in jdata["Topics"]:
|
||||
if (topic["guid"]) == topic_id:
|
||||
return jsonify({"Get Snippet Executed successfully"})
|
||||
return send_file(f"{my_absolute_dirpath}/success.txt", download_name="snippet.txt")
|
||||
return invalid_project()
|
||||
else:
|
||||
return invalid_user()
|
||||
return invalid_user()
|
||||
|
||||
|
||||
@bcf.route("/projects/<project_id>/topics/<topic_id>/snippet", methods=["PUT"])
|
||||
@@ -175,10 +182,9 @@ def update_snippet(project_id, topic_id):
|
||||
if (project["project_id"]) == project_id:
|
||||
for topic in jdata["Topics"]:
|
||||
if (topic["guid"]) == topic_id:
|
||||
return jsonify(data)
|
||||
return jsonify("PUT Request Sucessfull")
|
||||
return invalid_project()
|
||||
else:
|
||||
return invalid_user()
|
||||
return invalid_user()
|
||||
|
||||
|
||||
@bcf.route("/projects/<project_id>/files_information", methods=["GET"])
|
||||
@@ -201,14 +207,16 @@ def get_files(project_id, topic_id):
|
||||
if (topic["guid"]) == topic_id:
|
||||
return jsonify("Get request for files successfull")
|
||||
return invalid_project()
|
||||
return invalid_user()
|
||||
|
||||
else:
|
||||
return invalid_user()
|
||||
|
||||
file_put = open(f"{schema_path}/Collaboration/File/file_PUT.json")
|
||||
file_put = json.load(file_put)
|
||||
|
||||
|
||||
@bcf.route("/projects/<project_id>/topics/<topic_id>/files", methods=["PUT"])
|
||||
@expects_json(file_put)
|
||||
def update_files(project_id, topic_id):
|
||||
|
||||
if validate_client(request) and request.method == "PUT":
|
||||
data = request.get_json()
|
||||
for project in jdata["Projects"]:
|
||||
@@ -217,9 +225,7 @@ def update_files(project_id, topic_id):
|
||||
if (topic["guid"]) == topic_id:
|
||||
return jsonify(data)
|
||||
return invalid_project()
|
||||
|
||||
else:
|
||||
return invalid_user()
|
||||
return invalid_user()
|
||||
|
||||
|
||||
@bcf.route("/projects/<project_id>/topics/<topic_id>/comments", methods=["GET"])
|
||||
@@ -231,11 +237,15 @@ def get_comments(project_id, topic_id):
|
||||
if (topic["guid"]) == topic_id:
|
||||
return jsonify(jdata["Comments"])
|
||||
return invalid_project()
|
||||
else:
|
||||
return invalid_user()
|
||||
return invalid_user()
|
||||
|
||||
|
||||
comment_post = open(f"{schema_path}/Collaboration/Comment/comment_POST.json")
|
||||
comment_post = json.load(comment_post)
|
||||
|
||||
|
||||
@bcf.route("/projects/<project_id>/topics/<topic_id>/comments", methods=["POST"])
|
||||
@expects_json(comment_post)
|
||||
def create_comments(project_id, topic_id):
|
||||
if validate_client(request) and request.method == "POST":
|
||||
data = request.get_json()
|
||||
@@ -247,8 +257,7 @@ def create_comments(project_id, topic_id):
|
||||
response.status_code = 201
|
||||
return response
|
||||
return invalid_project()
|
||||
else:
|
||||
return invalid_user()
|
||||
return invalid_user()
|
||||
|
||||
|
||||
@bcf.route("/projects/<project_id>/topics/<topic_id>/comments/<comment_id>", methods=["GET"])
|
||||
@@ -263,11 +272,15 @@ def get_comment(project_id, topic_id, comment_id):
|
||||
if (comment["guid"]) == comment_id:
|
||||
return jsonify(comment)
|
||||
return invalid_project()
|
||||
else:
|
||||
return invalid_user()
|
||||
return invalid_user()
|
||||
|
||||
|
||||
comment_put = open(f"{schema_path}/Collaboration/Comment/comment_PUT.json")
|
||||
comment_put = json.load(comment_put)
|
||||
|
||||
|
||||
@bcf.route("/projects/<project_id>/topics/<topic_id>/comments/<comment_id>", methods=["PUT"])
|
||||
@expects_json(comment_put)
|
||||
def update_comment(project_id, topic_id, comment_id):
|
||||
if validate_client(request) and request.method == "PUT":
|
||||
data = request.get_json()
|
||||
@@ -279,8 +292,7 @@ def update_comment(project_id, topic_id, comment_id):
|
||||
if (comment["guid"]) == comment_id:
|
||||
return jsonify(data)
|
||||
return invalid_project()
|
||||
else:
|
||||
return invalid_user()
|
||||
return invalid_user()
|
||||
|
||||
|
||||
@bcf.route("/projects/<project_id>/topics/<topic_id>/comments/<comment_id>", methods=["DELETE"])
|
||||
@@ -294,14 +306,11 @@ def delete_comment(project_id, topic_id, comment_id):
|
||||
if (comment["guid"]) == comment_id:
|
||||
return jsonify("OK")
|
||||
return invalid_project()
|
||||
|
||||
else:
|
||||
return invalid_user()
|
||||
return invalid_user()
|
||||
|
||||
|
||||
@bcf.route("/projects/<project_id>/topics/<topic_id>/viewpoints", methods=["GET"])
|
||||
def get_viewpoints(project_id, topic_id):
|
||||
|
||||
if validate_client(request) and request.method == "GET":
|
||||
for project in jdata["Projects"]:
|
||||
if project["project_id"] == project_id:
|
||||
@@ -309,11 +318,15 @@ def get_viewpoints(project_id, topic_id):
|
||||
if topic["guid"] == topic_id:
|
||||
return jsonify(jdata["Viewpoints"])
|
||||
return invalid_project()
|
||||
else:
|
||||
return invalid_user()
|
||||
return invalid_user()
|
||||
|
||||
|
||||
viewpoint_post = open(f"{schema_path}/Collaboration/Viewpoint/viewpoint_POST.json")
|
||||
viewpoint_post = json.load(viewpoint_post)
|
||||
|
||||
|
||||
@bcf.route("/projects/<project_id>/topics/<topic_id>/viewpoints", methods=["POST"])
|
||||
@expects_json(viewpoint_post)
|
||||
def create_viewpoints(project_id, topic_id):
|
||||
if validate_client(request) and request.method == "POST":
|
||||
for project in jdata["Projects"]:
|
||||
@@ -325,8 +338,7 @@ def create_viewpoints(project_id, topic_id):
|
||||
response.status_code = 201
|
||||
return response
|
||||
return invalid_project()
|
||||
else:
|
||||
return invalid_user()
|
||||
return invalid_user()
|
||||
|
||||
|
||||
@bcf.route("/projects/<project_id>/topics/<topic_id>/viewpoints/<viewpoint_id>", methods=["GET"])
|
||||
@@ -342,8 +354,7 @@ def get_viewpoint(project_id, topic_id, viewpoint_id):
|
||||
response.status_code = 200
|
||||
return response
|
||||
return invalid_project()
|
||||
else:
|
||||
return invalid_user()
|
||||
return invalid_user()
|
||||
|
||||
|
||||
@bcf.route("/projects/<project_id>/topics/<topic_id>/viewpoints/<viewpoint_id>", methods=["DELETE"])
|
||||
@@ -359,8 +370,7 @@ def delete_viewpoint(project_id, topic_id, viewpoint_id):
|
||||
response.status_code = 200
|
||||
return response
|
||||
return invalid_project()
|
||||
else:
|
||||
return invalid_user()
|
||||
return invalid_user()
|
||||
|
||||
|
||||
@bcf.route("/projects/<project_id>/topics/<topic_id>/viewpoints/<viewpoint_id>/snapshot", methods=["GET"])
|
||||
@@ -376,8 +386,7 @@ def get_snapshot(project_id, topic_id, viewpoint_id):
|
||||
response.status_code = 200
|
||||
return response
|
||||
return invalid_project()
|
||||
else:
|
||||
return invalid_user()
|
||||
return invalid_user()
|
||||
|
||||
|
||||
@bcf.route("/projects/<project_id>/topics/<topic_id>/viewpoints/<viewpoint_id>/bitmaps/<bitmap_id>", methods=["GET"])
|
||||
@@ -395,8 +404,7 @@ def get_bitmap(project_id, topic_id, viewpoint_id, bitmap_id):
|
||||
response.status_code = 200
|
||||
return response
|
||||
return invalid_project()
|
||||
else:
|
||||
return invalid_user()
|
||||
return invalid_user()
|
||||
|
||||
|
||||
@bcf.route("/projects/<project_id>/topics/<topic_id>/viewpoints/<viewpoint_id>/selection", methods=["GET"])
|
||||
@@ -412,8 +420,7 @@ def get_selection(project_id, topic_id, viewpoint_id):
|
||||
response.status_code = 200
|
||||
return response
|
||||
return invalid_project()
|
||||
else:
|
||||
return invalid_user()
|
||||
return invalid_user()
|
||||
|
||||
|
||||
@bcf.route("/projects/<project_id>/topics/<topic_id>/viewpoints/<viewpoint_id>/coloring", methods=["GET"])
|
||||
@@ -429,8 +436,7 @@ def get_coloring(project_id, topic_id, viewpoint_id):
|
||||
response.status_code = 200
|
||||
return response
|
||||
return invalid_project()
|
||||
else:
|
||||
return invalid_user()
|
||||
return invalid_user()
|
||||
|
||||
|
||||
@bcf.route("/projects/<project_id>/topics/<topic_id>/viewpoints/<viewpoint_id>/visibility", methods=["GET"])
|
||||
@@ -446,13 +452,11 @@ def get_visibility(project_id, topic_id, viewpoint_id):
|
||||
response.status_code = 200
|
||||
return response
|
||||
return invalid_project()
|
||||
else:
|
||||
return invalid_user()
|
||||
return invalid_user()
|
||||
|
||||
|
||||
@bcf.route("/projects/<project_id>/topics/<topic_id>/related_topics", methods=["GET"])
|
||||
def get_related_topics(project_id, topic_id):
|
||||
|
||||
if validate_client(request) and request.method == "GET":
|
||||
for project in jdata["Projects"]:
|
||||
if (project["project_id"]) == project_id:
|
||||
@@ -460,14 +464,16 @@ def get_related_topics(project_id, topic_id):
|
||||
if (topic["guid"]) == topic_id:
|
||||
return jsonify(jdata["RelatedTopics"])
|
||||
return invalid_project()
|
||||
return response
|
||||
else:
|
||||
return invalid_user()
|
||||
return invalid_user()
|
||||
|
||||
|
||||
related_topics_put = open(f"{schema_path}/Collaboration/RelatedTopic/related_topic_PUT.json")
|
||||
related_topics_put = json.load(related_topics_put)
|
||||
|
||||
|
||||
@bcf.route("/projects/<project_id>/topics/<topic_id>/related_topics", methods=["PUT"])
|
||||
@expects_json(related_topics_put)
|
||||
def update_related_topics(project_id, topic_id):
|
||||
|
||||
if validate_client(request) and request.method == "PUT":
|
||||
data = request.get_json()
|
||||
for project in jdata["Projects"]:
|
||||
@@ -476,14 +482,11 @@ def update_related_topics(project_id, topic_id):
|
||||
if (topic["guid"]) == topic_id:
|
||||
return jsonify(data)
|
||||
return invalid_project()
|
||||
|
||||
else:
|
||||
return invalid_user()
|
||||
return invalid_user()
|
||||
|
||||
|
||||
@bcf.route("/projects/<project_id>/topics/<topic_id>/document_references", methods=["GET"])
|
||||
def get_document_references(project_id, topic_id):
|
||||
|
||||
if validate_client(request) and request.method == "GET":
|
||||
for project in jdata["Projects"]:
|
||||
if (project["project_id"]) == project_id:
|
||||
@@ -491,14 +494,16 @@ def get_document_references(project_id, topic_id):
|
||||
if (topic["guid"]) == topic_id:
|
||||
return jsonify(jdata["DocumentReferences"])
|
||||
return invalid_project()
|
||||
return invalid_user()
|
||||
|
||||
else:
|
||||
return invalid_user()
|
||||
|
||||
document_reference_post = open(f"{schema_path}/Collaboration/DocumentReference/document_reference_POST.json")
|
||||
document_reference_post = json.load(document_reference_post)
|
||||
|
||||
|
||||
@bcf.route("/projects/<project_id>/topics/<topic_id>/document_references", methods=["POST"])
|
||||
@expects_json(document_reference_post)
|
||||
def create_document_references(project_id, topic_id):
|
||||
|
||||
if validate_client(request) and request.method == "POST":
|
||||
data = request.get_json()
|
||||
for project in jdata["Projects"]:
|
||||
@@ -509,17 +514,19 @@ def create_document_references(project_id, topic_id):
|
||||
response.status_code = 201
|
||||
return response
|
||||
return invalid_project()
|
||||
return invalid_user()
|
||||
|
||||
else:
|
||||
return invalid_user()
|
||||
|
||||
document_reference_put = open(f"{schema_path}/Collaboration/DocumentReference/document_reference_PUT.json")
|
||||
document_reference_put = json.load(document_reference_put)
|
||||
|
||||
|
||||
@bcf.route(
|
||||
"/projects/<project_id>/topics/<topic_id>/document_references/<document_reference_id>",
|
||||
methods=["PUT"],
|
||||
)
|
||||
@expects_json(document_reference_put)
|
||||
def update_document_references(project_id, topic_id, document_reference_id):
|
||||
|
||||
if validate_client(request) and request.method == "PUT":
|
||||
data = request.get_json()
|
||||
for project in jdata["Projects"]:
|
||||
@@ -530,14 +537,11 @@ def update_document_references(project_id, topic_id, document_reference_id):
|
||||
if (document["guid"]) == document_reference_id:
|
||||
return jsonify(data)
|
||||
return invalid_project()
|
||||
|
||||
else:
|
||||
return invalid_user()
|
||||
return invalid_user()
|
||||
|
||||
|
||||
@bcf.route("/projects/<project_id>/topics/<topic_id>/documents", methods=["GET"])
|
||||
def get_documents(project_id, topic_id):
|
||||
|
||||
if validate_client(request) and request.method == "GET":
|
||||
for project in jdata["Projects"]:
|
||||
if (project["project_id"]) == project_id:
|
||||
@@ -545,14 +549,11 @@ def get_documents(project_id, topic_id):
|
||||
if (topic["guid"]) == topic_id:
|
||||
return jsonify(jdata["Documents"])
|
||||
return invalid_project()
|
||||
|
||||
else:
|
||||
return invalid_user()
|
||||
return invalid_user()
|
||||
|
||||
|
||||
@bcf.route("/projects/<project_id>/topics/<topic_id>/documents", methods=["POST"])
|
||||
def create_documents(project_id, topic_id):
|
||||
|
||||
if validate_client(request) and request.method == "POST":
|
||||
data = request.get_json()
|
||||
for project in jdata["Projects"]:
|
||||
@@ -563,14 +564,11 @@ def create_documents(project_id, topic_id):
|
||||
response.status_code = 201
|
||||
return response
|
||||
return invalid_project()
|
||||
|
||||
else:
|
||||
return invalid_user()
|
||||
return invalid_user()
|
||||
|
||||
|
||||
@bcf.route("/projects/<project_id>/topics/<topic_id>/documents/<document_id>", methods=["GET"])
|
||||
def get_document(project_id, topic_id, document_id):
|
||||
|
||||
if validate_client(request) and request.method == "GET":
|
||||
for project in jdata["Projects"]:
|
||||
if (project["project_id"]) == project_id:
|
||||
@@ -578,29 +576,23 @@ def get_document(project_id, topic_id, document_id):
|
||||
if (topic["guid"]) == topic_id:
|
||||
for document in jdata["Documents"]:
|
||||
if (document["guid"]) == document_id:
|
||||
return jsonify(document)
|
||||
return send_file(f"{my_absolute_dirpath}/success.txt", download_name="document.txt")
|
||||
return invalid_project()
|
||||
|
||||
else:
|
||||
return invalid_user()
|
||||
return invalid_user()
|
||||
|
||||
|
||||
@bcf.route("/projects/<project_id>/topics/events", methods=["GET"])
|
||||
def get_events(project_id):
|
||||
|
||||
if validate_client(request) and request.method == "GET":
|
||||
for project in jdata["Projects"]:
|
||||
if (project["project_id"]) == project_id:
|
||||
return jsonify(jdata["Events"])
|
||||
return invalid_project()
|
||||
|
||||
else:
|
||||
return invalid_user()
|
||||
return invalid_user()
|
||||
|
||||
|
||||
@bcf.route("/projects/<project_id>/topics/<topic_id>/events", methods=["GET"])
|
||||
def get_topic_events(project_id, topic_id):
|
||||
|
||||
if validate_client(request) and request.method == "GET":
|
||||
for project in jdata["Projects"]:
|
||||
if (project["project_id"]) == project_id:
|
||||
@@ -610,22 +602,17 @@ def get_topic_events(project_id, topic_id):
|
||||
if (event["topic_guid"]) == topic_id:
|
||||
return jsonify(event)
|
||||
return invalid_project()
|
||||
|
||||
else:
|
||||
return invalid_user()
|
||||
return invalid_user()
|
||||
|
||||
|
||||
@bcf.route("/projects/<project_id>/topics/comments/events", methods=["GET"])
|
||||
def get_comments_events(project_id):
|
||||
|
||||
if validate_client(request) and request.method == "GET":
|
||||
for project in jdata["Projects"]:
|
||||
if (project["project_id"]) == project_id:
|
||||
return jsonify(jdata["EventComments"])
|
||||
return invalid_project()
|
||||
|
||||
else:
|
||||
return invalid_user()
|
||||
return invalid_user()
|
||||
|
||||
|
||||
@bcf.route(
|
||||
@@ -633,7 +620,6 @@ def get_comments_events(project_id):
|
||||
methods=["GET"],
|
||||
)
|
||||
def get_comment_events(project_id, topic_id, comment_id):
|
||||
|
||||
if validate_client(request) and request.method == "GET":
|
||||
for project in jdata["Projects"]:
|
||||
if (project["project_id"]) == project_id:
|
||||
@@ -643,6 +629,4 @@ def get_comment_events(project_id, topic_id, comment_id):
|
||||
if (comment["comment_guid"]) == comment_id:
|
||||
return jsonify(comment)
|
||||
return invalid_project()
|
||||
|
||||
else:
|
||||
return invalid_user()
|
||||
return invalid_user()
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"title": "comment_actions",
|
||||
"required": false,
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string",
|
||||
"enum": ["update",
|
||||
"delete"]
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"title": "project_actions",
|
||||
"required": false,
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string",
|
||||
"enum": ["update",
|
||||
"createTopic",
|
||||
"createDocument"]
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
{
|
||||
"title": "topic_actions",
|
||||
"required": false,
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string",
|
||||
"enum": ["update",
|
||||
"updateBimSnippet",
|
||||
"updateRelatedTopics",
|
||||
"updateDocumentReferences",
|
||||
"updateFiles",
|
||||
"createComment",
|
||||
"createViewpoint",
|
||||
"delete"]
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"required": false,
|
||||
"type": "array",
|
||||
"items": {
|
||||
"enum": ["delete"]
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
{
|
||||
"title": "comment_GET",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"guid": {
|
||||
"required": true,
|
||||
"type": "string"
|
||||
},
|
||||
"date": {
|
||||
"required": true,
|
||||
"type": "string"
|
||||
},
|
||||
"author": {
|
||||
"required": true,
|
||||
"type": "string"
|
||||
},
|
||||
"comment": {
|
||||
"required": true,
|
||||
"type": "string"
|
||||
},
|
||||
"topic_guid": {
|
||||
"required": true,
|
||||
"type": "string"
|
||||
},
|
||||
"viewpoint_guid": {
|
||||
"type": ["string",
|
||||
"null"]
|
||||
},
|
||||
"modified_date": {
|
||||
"type": ["string",
|
||||
"null"]
|
||||
},
|
||||
"modified_author": {
|
||||
"type": ["string",
|
||||
"null"]
|
||||
},
|
||||
"authorization": {
|
||||
"type": "object",
|
||||
"required": false,
|
||||
"properties": {
|
||||
"comment_actions": {
|
||||
"$ref": "../Action/comment_actions.json"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
{
|
||||
"title": "comment_POST",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"guid": {
|
||||
"type": ["string",
|
||||
"null"]
|
||||
},
|
||||
"comment": {
|
||||
"required": true,
|
||||
"type": "string"
|
||||
},
|
||||
"viewpoint_guid": {
|
||||
"type": ["string",
|
||||
"null"]
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
{
|
||||
"title": "comment_PUT",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"comment": {
|
||||
"required": true,
|
||||
"type": "string"
|
||||
},
|
||||
"viewpoint_guid": {
|
||||
"type": ["string",
|
||||
"null"]
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
{
|
||||
"title": "document_GET",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"guid": {
|
||||
"required": true,
|
||||
"type": "string"
|
||||
},
|
||||
"filename": {
|
||||
"required": true,
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
{
|
||||
"$schema": "http://json-schema.org/draft-03/schema#",
|
||||
"title": "document_reference_GET",
|
||||
"description": "Schema for a single document reference GET, BCF REST API.",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"guid": {
|
||||
"required": true,
|
||||
"type": "string"
|
||||
},
|
||||
"document_guid": {
|
||||
"type": ["string", "null"]
|
||||
},
|
||||
"url": {
|
||||
"type": ["string", "null"]
|
||||
},
|
||||
"description": {
|
||||
"type": ["string", "null"]
|
||||
}
|
||||
}
|
||||
}
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
{
|
||||
"title": "document_reference_POST",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"guid": {
|
||||
"type": ["string", "null"]
|
||||
},
|
||||
"document_guid": {
|
||||
"type": ["string", "null"]
|
||||
},
|
||||
"url": {
|
||||
"type": ["string", "null"]
|
||||
},
|
||||
"description": {
|
||||
"type": ["string", "null"]
|
||||
}
|
||||
}
|
||||
}
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
{
|
||||
"title": "document_reference_PUT",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"document_guid": {
|
||||
"type": ["string", "null"]
|
||||
},
|
||||
"url": {
|
||||
"type": ["string", "null"]
|
||||
},
|
||||
"description": {
|
||||
"type": ["string", "null"]
|
||||
}
|
||||
}
|
||||
}
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
{
|
||||
"title": "comment_event_GET",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"comment_guid": {
|
||||
"required": true,
|
||||
"type": "string"
|
||||
},
|
||||
"topic_guid": {
|
||||
"required": true,
|
||||
"type": "string"
|
||||
},
|
||||
"date": {
|
||||
"required": true,
|
||||
"type": "string"
|
||||
},
|
||||
"author": {
|
||||
"required": true,
|
||||
"type": "string"
|
||||
},
|
||||
"actions": {
|
||||
"type": "array",
|
||||
"minItems": 1,
|
||||
"items": {
|
||||
"$ref": "event_action.json"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
{
|
||||
"title": "event_action",
|
||||
"type": ["object", "null"],
|
||||
"properties": {
|
||||
"type": {
|
||||
"required": true,
|
||||
"type": "string"
|
||||
},
|
||||
"value": {
|
||||
"type": ["string",
|
||||
"null"]
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
{
|
||||
"title": "topic_event_GET",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"topic_guid": {
|
||||
"required": true,
|
||||
"type": "string"
|
||||
},
|
||||
"date": {
|
||||
"required": true,
|
||||
"type": "string"
|
||||
},
|
||||
"author": {
|
||||
"required": true,
|
||||
"type": "string"
|
||||
},
|
||||
"actions": {
|
||||
"type": "array",
|
||||
"minItems": 1,
|
||||
"items": {
|
||||
"$ref": "event_action.json"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
{
|
||||
"$schema": "http://json-schema.org/draft-03/schema#",
|
||||
"title": "file_GET",
|
||||
"description": "Schema for a single file GET, BCF REST API.",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"ifc_project": {
|
||||
"type": ["string",
|
||||
"null"]
|
||||
},
|
||||
"ifc_spatial_structure_element": {
|
||||
"type": ["string",
|
||||
"null"]
|
||||
},
|
||||
"filename": {
|
||||
"type": ["string",
|
||||
"null"]
|
||||
},
|
||||
"date": {
|
||||
"type": ["string",
|
||||
"null"]
|
||||
},
|
||||
"reference": {
|
||||
"type": ["string",
|
||||
"null"]
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
{
|
||||
"title": "file_PUT",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"ifc_project": {
|
||||
"type": ["string",
|
||||
"null"]
|
||||
},
|
||||
"ifc_spatial_structure_element": {
|
||||
"type": ["string",
|
||||
"null"]
|
||||
},
|
||||
"filename": {
|
||||
"type": ["string",
|
||||
"null"]
|
||||
},
|
||||
"date": {
|
||||
"type": ["string",
|
||||
"null"]
|
||||
},
|
||||
"reference": {
|
||||
"type": ["string",
|
||||
"null"]
|
||||
}
|
||||
}
|
||||
}
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
{
|
||||
"$schema": "http://json-schema.org/draft-03/schema#",
|
||||
"title": "project_file_display_information",
|
||||
"description": "Schema for the display information of a project file, BCF REST API.",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"field_display_name": {
|
||||
"required": true,
|
||||
"type": "string"
|
||||
},
|
||||
"field_value": {
|
||||
"required": true,
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
{
|
||||
"title": "project_file_information",
|
||||
"description": "Schema for a single project file information, BCF REST API.",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"display_information": {
|
||||
"type": "array",
|
||||
"items": { "$ref": "project_file_display_information.json" },
|
||||
"default": []
|
||||
},
|
||||
"file": { "$ref": "file_GET.json" }
|
||||
}
|
||||
}
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"description": "Schema for the listing the response of the GET project files information service",
|
||||
"title": "project_files_information_GET",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "project_file_information.json"
|
||||
}
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"$schema": "http://json-schema.org/draft-03/schema#",
|
||||
"title": "related_topic_GET",
|
||||
"description": "Schema for single related topic GET, BCF REST API.",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"related_topic_guid": {
|
||||
"required": true,
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"$schema": "http://json-schema.org/draft-03/schema#",
|
||||
"title": "related_topic_PUT",
|
||||
"description": "Schema for related topic PUT, BCF REST API.",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"related_topic_guid": {
|
||||
"required": true,
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"title": "bim_snippet",
|
||||
"type": ["object",
|
||||
"null"],
|
||||
"properties": {
|
||||
"snippet_type": {
|
||||
"required": true,
|
||||
"type": "string"
|
||||
},
|
||||
"is_external": {
|
||||
"required": true,
|
||||
"type": "boolean"
|
||||
},
|
||||
"reference": {
|
||||
"required": true,
|
||||
"type": "string"
|
||||
},
|
||||
"reference_schema": {
|
||||
"required": true,
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,101 @@
|
||||
{
|
||||
"title": "topic_GET",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"guid": {
|
||||
"required": true,
|
||||
"type": "string"
|
||||
},
|
||||
"server_assigned_id": {
|
||||
"required": true,
|
||||
"type": "string"
|
||||
},
|
||||
"topic_type": {
|
||||
"type": ["string",
|
||||
"null"]
|
||||
},
|
||||
"topic_status": {
|
||||
"type": ["string",
|
||||
"null"]
|
||||
},
|
||||
"reference_links": {
|
||||
"type": ["array",
|
||||
"null"],
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"title": {
|
||||
"required": true,
|
||||
"type": "string"
|
||||
},
|
||||
"priority": {
|
||||
"type": ["string",
|
||||
"null"]
|
||||
},
|
||||
"index": {
|
||||
"type": [
|
||||
"integer",
|
||||
"null"
|
||||
]
|
||||
},
|
||||
"labels": {
|
||||
"type": ["array",
|
||||
"null"],
|
||||
"items": {
|
||||
"type": ["string",
|
||||
"null"]
|
||||
}
|
||||
},
|
||||
"creation_date": {
|
||||
"required": true,
|
||||
"type": "string"
|
||||
},
|
||||
"creation_author": {
|
||||
"required": true,
|
||||
"type": "string"
|
||||
},
|
||||
"modified_date": {
|
||||
"type": "string"
|
||||
},
|
||||
"modified_author": {
|
||||
"type": ["string",
|
||||
"null"]
|
||||
},
|
||||
"assigned_to": {
|
||||
"type": ["string",
|
||||
"null"]
|
||||
},
|
||||
"stage": {
|
||||
"type": ["string",
|
||||
"null"]
|
||||
},
|
||||
"description": {
|
||||
"type": ["string",
|
||||
"null"]
|
||||
},
|
||||
"bim_snippet": {
|
||||
"$ref": "bim_snippet.json"
|
||||
},
|
||||
"due_date": {
|
||||
"type": ["string",
|
||||
"null"]
|
||||
},
|
||||
"authorization": {
|
||||
"type": "object",
|
||||
"required": false,
|
||||
"properties": {
|
||||
"topic_actions": {
|
||||
"$ref": "../Action/topic_actions.json"
|
||||
},
|
||||
"topic_status": {
|
||||
"type": ["array",
|
||||
"null"],
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
{
|
||||
"$schema": "http://json-schema.org/draft-03/schema#",
|
||||
"title": "topic_POST",
|
||||
"description": "Schema for topic POST, BCF REST API.",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"guid": {
|
||||
"type": ["string",
|
||||
"null"]
|
||||
},
|
||||
"topic_type": {
|
||||
"type": ["string",
|
||||
"null"]
|
||||
},
|
||||
"topic_status": {
|
||||
"type": ["string",
|
||||
"null"]
|
||||
},
|
||||
"reference_links": {
|
||||
"type": ["array",
|
||||
"null"],
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"title": {
|
||||
"required": true,
|
||||
"type": "string"
|
||||
},
|
||||
"priority": {
|
||||
"type": ["string",
|
||||
"null"]
|
||||
},
|
||||
"index": {
|
||||
"type": [
|
||||
"integer",
|
||||
"null"
|
||||
]
|
||||
},
|
||||
"labels": {
|
||||
"type": ["array",
|
||||
"null"],
|
||||
"items": {
|
||||
"type": ["string",
|
||||
"null"]
|
||||
}
|
||||
},
|
||||
"assigned_to": {
|
||||
"type": ["string",
|
||||
"null"]
|
||||
},
|
||||
"stage": {
|
||||
"type": ["string",
|
||||
"null"]
|
||||
},
|
||||
"description": {
|
||||
"type": ["string",
|
||||
"null"]
|
||||
},
|
||||
"bim_snippet": {
|
||||
"$ref": "bim_snippet.json"
|
||||
},
|
||||
"due_date": {
|
||||
"type": ["string",
|
||||
"null"]
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
{
|
||||
"$schema": "http://json-schema.org/draft-03/schema#",
|
||||
"title": "topic_PUT",
|
||||
"description": "Schema for topic PUT, BCF REST API.",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"topic_type": {
|
||||
"type": ["string",
|
||||
"null"]
|
||||
},
|
||||
"topic_status": {
|
||||
"type": ["string",
|
||||
"null"]
|
||||
},
|
||||
"reference_links": {
|
||||
"type": ["array",
|
||||
"null"],
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"title": {
|
||||
"required": true,
|
||||
"type": "string"
|
||||
},
|
||||
"priority": {
|
||||
"type": ["string",
|
||||
"null"]
|
||||
},
|
||||
"index": {
|
||||
"type": [
|
||||
"integer",
|
||||
"null"
|
||||
]
|
||||
},
|
||||
"labels": {
|
||||
"type": ["array",
|
||||
"null"],
|
||||
"items": {
|
||||
"type": ["string",
|
||||
"null"]
|
||||
}
|
||||
},
|
||||
"assigned_to": {
|
||||
"type": ["string",
|
||||
"null"]
|
||||
},
|
||||
"stage": {
|
||||
"type": ["string",
|
||||
"null"]
|
||||
},
|
||||
"description": {
|
||||
"type": ["string",
|
||||
"null"]
|
||||
},
|
||||
"bim_snippet": {
|
||||
"$ref": "bim_snippet.json"
|
||||
},
|
||||
"due_date": {
|
||||
"type": ["string",
|
||||
"null"]
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
{
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"guid": {
|
||||
"type": "string"
|
||||
},
|
||||
"bitmap_type": {
|
||||
"type": "string",
|
||||
"enum": ["jpg", "png"]
|
||||
},
|
||||
"location": {
|
||||
"$ref": "location.json"
|
||||
},
|
||||
"normal": {
|
||||
"$ref": "direction.json"
|
||||
},
|
||||
"up": {
|
||||
"$ref": "direction.json"
|
||||
},
|
||||
"height": {
|
||||
"type": "number"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
{
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"bitmap_type": {
|
||||
"type": "string",
|
||||
"enum": ["jpg", "png"]
|
||||
},
|
||||
"bitmap_data": {
|
||||
"type": "string",
|
||||
"format": "base64"
|
||||
},
|
||||
"location": {
|
||||
"$ref": "location.json"
|
||||
},
|
||||
"normal": {
|
||||
"$ref": "direction.json"
|
||||
},
|
||||
"up": {
|
||||
"$ref": "direction.json"
|
||||
},
|
||||
"height": {
|
||||
"type": "number"
|
||||
}
|
||||
}
|
||||
}
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
{
|
||||
"title": "clipping_plane",
|
||||
"type": ["object",
|
||||
"null"],
|
||||
"properties": {
|
||||
"location": {
|
||||
"$ref": "location.json"
|
||||
},
|
||||
"direction": {
|
||||
"$ref": "direction.json"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"title": "coloring",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"color": {
|
||||
"type": "string"
|
||||
},
|
||||
"components": {
|
||||
"$ref": "component_list.json"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
{
|
||||
"$schema": "http://json-schema.org/draft-03/schema#",
|
||||
"title": "coloring_GET",
|
||||
"description": "Schema for coloring GET, BCF REST API.",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"coloring": {
|
||||
"type": ["array", "null"],
|
||||
"items": {
|
||||
"$ref": "coloring.json"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
{
|
||||
"title": "component",
|
||||
"type": ["object"],
|
||||
"properties": {
|
||||
"ifc_guid": {
|
||||
"type": ["string", "null"]
|
||||
},
|
||||
"originating_system": {
|
||||
"type": ["string", "null"]
|
||||
},
|
||||
"authoring_tool_id": {
|
||||
"type": ["string", "null"]
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"title": "component list",
|
||||
"type": ["array", "null"],
|
||||
"items": {
|
||||
"$ref": "component.json"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
{
|
||||
"title": "components",
|
||||
"type": ["object", "null"],
|
||||
"properties": {
|
||||
"selection": {
|
||||
"$ref": "component_list.json"
|
||||
},
|
||||
"coloring": {
|
||||
"type": ["array", "null"],
|
||||
"items": {
|
||||
"$ref": "coloring.json"
|
||||
}
|
||||
},
|
||||
"visibility": {
|
||||
"$ref": "visibility.json"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
{
|
||||
"title": "direction",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"x": {
|
||||
"type": "number"
|
||||
},
|
||||
"y": {
|
||||
"type": "number"
|
||||
},
|
||||
"z": {
|
||||
"type": "number"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"title": "line",
|
||||
"type": ["object", "null"],
|
||||
"properties": {
|
||||
"start_point": {
|
||||
"$ref": "point.json"
|
||||
},
|
||||
"end_point": {
|
||||
"$ref": "point.json"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
{
|
||||
"title": "location",
|
||||
"type": ["object",
|
||||
"null"],
|
||||
"properties": {
|
||||
"x": {
|
||||
"type": "number"
|
||||
},
|
||||
"y": {
|
||||
"type": "number"
|
||||
},
|
||||
"z": {
|
||||
"type": "number"
|
||||
}
|
||||
}
|
||||
}
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"title": "orthogonal_camera",
|
||||
"type": ["object",
|
||||
"null"],
|
||||
"properties": {
|
||||
"camera_view_point": {
|
||||
"$ref": "point.json"
|
||||
},
|
||||
"camera_direction": {
|
||||
"$ref": "direction.json"
|
||||
},
|
||||
"camera_up_vector": {
|
||||
"$ref": "direction.json"
|
||||
},
|
||||
"view_to_world_scale": {
|
||||
"type": "number"
|
||||
},
|
||||
"aspect_ratio": {
|
||||
"type": "number"
|
||||
}
|
||||
}
|
||||
}
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"title": "perspective_camera",
|
||||
"type": ["object",
|
||||
"null"],
|
||||
"properties": {
|
||||
"camera_view_point": {
|
||||
"$ref": "point.json"
|
||||
},
|
||||
"camera_direction": {
|
||||
"$ref": "direction.json"
|
||||
},
|
||||
"camera_up_vector": {
|
||||
"$ref": "direction.json"
|
||||
},
|
||||
"field_of_view": {
|
||||
"type": "number"
|
||||
},
|
||||
"aspect_ratio": {
|
||||
"type": "number"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
{
|
||||
"title": "point",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"x": {
|
||||
"type": "number"
|
||||
},
|
||||
"y": {
|
||||
"type": "number"
|
||||
},
|
||||
"z": {
|
||||
"type": "number"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"$schema": "http://json-schema.org/draft-03/schema#",
|
||||
"title": "selection_GET",
|
||||
"description": "Schema for selection GET, BCF REST API.",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"selection": {
|
||||
"$ref": "component_list.json"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"title": "snapshot_GET",
|
||||
"type": ["object", "null"],
|
||||
"properties": {
|
||||
"snapshot_type": {
|
||||
"type": ["string"],
|
||||
"enum": ["jpg", "png"]
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
{
|
||||
"title": "snapshot_POST",
|
||||
"type": ["object", "null"],
|
||||
"properties": {
|
||||
"snapshot_type": {
|
||||
"type": ["string"],
|
||||
"enum": ["jpg", "png"]
|
||||
},
|
||||
"snapshot_data": {
|
||||
"type": ["string"],
|
||||
"format": "base64"
|
||||
}
|
||||
}
|
||||
}
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
{
|
||||
"title": "view_setup_hints",
|
||||
"type": ["object", "null"],
|
||||
"properties": {
|
||||
"spaces_visible": {
|
||||
"type": "boolean",
|
||||
"default": "false"
|
||||
},
|
||||
"space_boundaries_visible": {
|
||||
"type": "boolean",
|
||||
"default": "false"
|
||||
},
|
||||
"openings_visible": {
|
||||
"type": "boolean",
|
||||
"default": "false"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
{
|
||||
"title": "viewpoint_GET",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"index": {
|
||||
"type": [
|
||||
"integer",
|
||||
"null"
|
||||
]
|
||||
},
|
||||
"guid": {
|
||||
"required": true,
|
||||
"type": "string"
|
||||
},
|
||||
"orthogonal_camera": {
|
||||
"$ref": "orthogonal_camera.json"
|
||||
},
|
||||
"perspective_camera": {
|
||||
"$ref": "perspective_camera.json"
|
||||
},
|
||||
"lines": {
|
||||
"type": ["array", "null"],
|
||||
"items": {
|
||||
"$ref": "line.json"
|
||||
}
|
||||
},
|
||||
"clipping_planes": {
|
||||
"type": ["array", "null"],
|
||||
"items": {
|
||||
"$ref": "clipping_plane.json"
|
||||
}
|
||||
},
|
||||
"bitmaps": {
|
||||
"type": ["array", "null"],
|
||||
"items": {
|
||||
"$ref": "bitmap_GET.json"
|
||||
}
|
||||
},
|
||||
"snapshot": {
|
||||
"$ref": "snapshot_GET.json"
|
||||
},
|
||||
"authorization": {
|
||||
"type": "object",
|
||||
"required": false,
|
||||
"properties": {
|
||||
"viewpoint_actions": {
|
||||
"$ref": "../Action/viewpoint_actions.json"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+46
@@ -0,0 +1,46 @@
|
||||
{
|
||||
"title": "viewpoint_POST",
|
||||
"type": [ "object" ],
|
||||
"properties": {
|
||||
"guid": {
|
||||
"type": ["string",
|
||||
"null"]
|
||||
},
|
||||
"index": {
|
||||
"type": [
|
||||
"integer",
|
||||
"null"
|
||||
]
|
||||
},
|
||||
"orthogonal_camera": {
|
||||
"$ref": "orthogonal_camera.json"
|
||||
},
|
||||
"perspective_camera": {
|
||||
"$ref": "perspective_camera.json"
|
||||
},
|
||||
"lines": {
|
||||
"type": ["array", "null"],
|
||||
"items": {
|
||||
"$ref": "line.json"
|
||||
}
|
||||
},
|
||||
"clipping_planes": {
|
||||
"type": ["array", "null"],
|
||||
"items": {
|
||||
"$ref": "clipping_plane.json"
|
||||
}
|
||||
},
|
||||
"bitmaps": {
|
||||
"type": ["array", "null"],
|
||||
"items": {
|
||||
"$ref": "bitmap_POST.json"
|
||||
}
|
||||
},
|
||||
"snapshot": {
|
||||
"$ref": "snapshot_POST.json"
|
||||
},
|
||||
"components": {
|
||||
"$ref": "components.json"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
{
|
||||
"title": "visibility",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"default_visibility": {
|
||||
"type": "boolean",
|
||||
"default": "false"
|
||||
},
|
||||
"exceptions": {
|
||||
"$ref": "component_list.json"
|
||||
},
|
||||
"view_setup_hints": {
|
||||
"$ref": "view_setup_hints.json"
|
||||
}
|
||||
}
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"$schema": "http://json-schema.org/draft-03/schema#",
|
||||
"title": "visibility_GET",
|
||||
"description": "Schema for visibility GET, BCF REST API.",
|
||||
"type": "object",
|
||||
|
||||
"properties": {
|
||||
"visibility": {
|
||||
"$ref": "visibility.json"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,78 @@
|
||||
{
|
||||
"title": "extensions_GET",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"topic_type": {
|
||||
"required": true,
|
||||
"type": ["array",
|
||||
"null"],
|
||||
"items": {
|
||||
"type": ["string",
|
||||
"null"]
|
||||
}
|
||||
},
|
||||
"topic_status": {
|
||||
"required": true,
|
||||
"type": ["array",
|
||||
"null"],
|
||||
"items": {
|
||||
"type": ["string",
|
||||
"null"]
|
||||
}
|
||||
},
|
||||
"topic_label": {
|
||||
"required": true,
|
||||
"type": ["array",
|
||||
"null"],
|
||||
"items": {
|
||||
"type": ["string",
|
||||
"null"]
|
||||
}
|
||||
},
|
||||
"snippet_type": {
|
||||
"required": true,
|
||||
"type": ["array",
|
||||
"null"],
|
||||
"items": {
|
||||
"type": ["string",
|
||||
"null"]
|
||||
}
|
||||
},
|
||||
"priority": {
|
||||
"required": true,
|
||||
"type": ["array",
|
||||
"null"],
|
||||
"items": {
|
||||
"type": ["string",
|
||||
"null"]
|
||||
}
|
||||
},
|
||||
"users": {
|
||||
"required": true,
|
||||
"type": ["array",
|
||||
"null"],
|
||||
"items": {
|
||||
"type": ["string",
|
||||
"null"]
|
||||
}
|
||||
},
|
||||
"stage": {
|
||||
"required": true,
|
||||
"type": ["array",
|
||||
"null"],
|
||||
"items": {
|
||||
"type": ["string",
|
||||
"null"]
|
||||
}
|
||||
},
|
||||
"project_actions": {
|
||||
"$ref": "../Collaboration/Action/project_actions.json"
|
||||
},
|
||||
"topic_actions": {
|
||||
"$ref": "../Collaboration/Action/topic_actions.json"
|
||||
},
|
||||
"comment_actions": {
|
||||
"$ref": "../Collaboration/Action/comment_actions.json"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
{
|
||||
"$schema": "http://json-schema.org/draft-03/schema#",
|
||||
"title": "project_GET",
|
||||
"description": "Schema for single project GET, BCF REST API.",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"project_id": {
|
||||
"type": "string",
|
||||
"required": true
|
||||
},
|
||||
"name": {
|
||||
"type": "string",
|
||||
"required": true
|
||||
},
|
||||
"authorization": {
|
||||
"type": "object",
|
||||
"required": false,
|
||||
"properties": {
|
||||
"project_actions": {
|
||||
"$ref": "../Collaboration/Action/project_actions.json"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"$schema": "http://json-schema.org/draft-03/schema#",
|
||||
"title": "project_PUT",
|
||||
"description": "Schema for project PUT, BCF REST API.",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"name": {
|
||||
"type": "string",
|
||||
"required": true
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
{
|
||||
"title": "user_GET",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"id": {
|
||||
"required": true,
|
||||
"type": "string"
|
||||
},
|
||||
"name": {
|
||||
"type": ["string",
|
||||
"null"]
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"$schema": "http://json-schema.org/draft-03/schema#",
|
||||
"title": "Error",
|
||||
"description": "Schema for error, BCF REST API.",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"message": {
|
||||
"type": "string",
|
||||
"required": true
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
Your request was successfull
|
||||
Reference in New Issue
Block a user