def type_version_to_api_response( object_type_version: OntologyObjectTypeVersion, ) -> ApiResponse: object_type_data = type_version_to_type_data(object_type_version) raw_object_type: Dict[str, Any] = ObjectTypeSchema().dump(object_type_data) return ApiResponse( links=(*nav_links_for_type_version(object_type_version), ), data=raw_object_type, )
def taxonomy_to_api_response(taxonomy: Taxonomy) -> ApiResponse: taxonomy_data = taxonomy_to_taxonomy_data(taxonomy) raw_taxonomy: Dict[str, Any] = TaxonomySchema().dump(taxonomy_data) return ApiResponse( links=( *nav_links_for_taxonomy(taxonomy), *action_links_for_taxonomy(taxonomy), ), data=raw_taxonomy, )
def object_to_api_response(object: OntologyObject) -> ApiResponse: object_data = object_to_object_data(object) raw_object: Dict[str, Any] = ObjectSchema().dump(object_data) return ApiResponse( links=( *nav_links_for_object(object), *action_links_for_object(object), ), data=raw_object, )
def taxonomy_item_to_api_response(item: TaxonomyItem) -> ApiResponse: taxonomy_item_data = taxonomy_item_to_taxonomy_item_data(item) raw_taxonomy_item: Dict[str, Any] = TaxonomyItemSchema().dump( taxonomy_item_data) return ApiResponse( links=( *nav_links_for_taxonomy_item(item), *action_links_for_taxonomy_item(item), ), data=raw_taxonomy_item, )
def object_version_to_api_response( version: OntologyObjectVersion) -> ApiResponse: object_data = object_to_object_data(version) raw_object: Dict[str, Any] = ObjectSchema().dump(object_data) return ApiResponse( links=( *nav_links_for_object_version(version), # TODO *action_links_for_object_version(version), ), data=raw_object, )
def taxonomy_item_relation_to_api_response( relation: TaxonomyItemRelation) -> ApiResponse: relation_data = taxonomy_item_relation_to_taxonomy_item_relation_data( relation) raw_relation: Dict[str, Any] = TaxonomyItemRelationSchema().dump(relation_data) return ApiResponse( links=( *nav_links_for_taxonomy_item_relation(relation), *action_links_for_taxonomy_item_relation(relation), ), data=raw_relation, )
def namespace_to_api_response(namespace: Namespace) -> ApiResponse: namespace_data = namespace_to_namespace_data(namespace) raw_namespace: Dict[str, Any] = NamespaceSchema().dump(namespace_data) return ApiResponse( links=( ApiLink( href=url_for("api-v1.NamespacesView", _external=True), rel=("first", "page", "up", "collection", "ont-namespace"), resource_type="ont-namespace", schema=url_for( "api-v1.ApiSchemaView", schema_id="Namespace", _external=True ), ), *nav_links_for_namespace(namespace), *action_links_for_namespace(namespace), ), data=raw_namespace, )