Skip to content

Commit

Permalink
updated API docs to v0.7.0
Browse files Browse the repository at this point in the history
  • Loading branch information
martinhecher committed Aug 5, 2015
1 parent 50ca11b commit f06ae00
Show file tree
Hide file tree
Showing 8 changed files with 1,410 additions and 279 deletions.
130 changes: 84 additions & 46 deletions api/controllers/FilesController.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,75 +7,113 @@

var _storagePath = sails.config.storagePath;

module.exports = {
/**
* @apiDefine PhysicalAsset
* @apiParam (PhysicalAsset) {String} label Display name of the PhysicalAsset.
* @apiParam (PhysicalAsset) {Object} buildm JSON-LD object containing metadata
* about the PhysicalAsset as buildM schema instance.
*/

/**
* @apiDefine DigitalObject
* @apiParam (DigitalObject) {String} label Display name of the DigitalObject.
* @apiParam (DigitalObject) {String} path Absolute path of file on the server.
* @apiParam (DigitalObject) {Array} physicalAssets IDs of the PhysicalAssets this DigitalObject is related to.
* @apiParam (DigitalObject) {Object} semMD SemanticMD instance storing information about the semantic enrichment process.
* @apiParam (DigitalObject) {Array} derivatives DigitalObject instances which were created in the geometric enrichment process.
*/
/**
* @apiDefine FileParam
* @apiParam (File) {String} path Location of the File.
* @apiParam (File) {String} type Type of the File ('e57' or 'ifc-spf').
* @apiParam (File) {Number} size Size of the File in byte.
* @apiParam (File) {Boolean} directory True, if a directory, otherwise false.
* @apiParam (File) {Date} atime Last access time of the File.
* @apiParam (File) {Date} mtime Last modification time of the File.
* @apiParam (File) {Date} ctime Creation time of the File.
* @apiParam (File) {Date} createdAt Creation time of the database instance.
* @apiParam (File) {Date} updatedAt Last modification time of the database instance.
* @apiParam (File) {Number} id Database instance's unique ID.
*/

/**
* @apiDefine SemanticMD
* @apiSuccess (SemanticMD) {Array} topics List of Topics containing a set of semantic links that specify an information context.
* @apiSuccess (SemanticMD) {Array} candidates List of semantic links related to a Topic.
* @apiSuccess (SemanticMD) {Array} selections List of semantic links which will be connected to the DigitalObject in the SDAS knowledge graph.
*/
/**
* @apiDefine FileSuccess
* @apiSuccess (File) {String} path Location of the File.
* @apiSuccess (File) {String} type Type of the File ('e57' or 'ifc-spf').
* @apiSuccess (File) {Number} size Size of the File in byte.
* @apiSuccess (File) {Boolean} directory True, if a directory, otherwise false.
* @apiSuccess (File) {Date} atime Last access time of the File.
* @apiSuccess (File) {Date} mtime Last modification time of the File.
* @apiSuccess (File) {Date} ctime Creation time of the File.
* @apiSuccess (File) {Date} createdAt Creation time of the database instance.
* @apiSuccess (File) {Date} updatedAt Last modification time of the database instance.
* @apiSuccess (File) {Number} id Database instance's unique ID.
*/

module.exports = {
/**
* @api {get} /sessions/:id Request Session information
* @apiName GetSession
* @apiGroup Session
* @apiVersion 0.6.0
* @api {get} /files/:id Request File
* @apiVersion 0.7.0
* @apiName GetFile
* @apiGroup File
* @apiPermission none
*
* @apiDescription Requests a File stored on the server.
*
* @apiParam {Number} id Session's unique ID.
* @apiParam {Number} id File's unique ID.
*
* @apiSuccess {String} label Display name of the Session.
* @apiSuccess {Array} physicalAssets List of PhysicalAssets in the Session.
* @apiSuccess {Array} digitalObjects List of DigitalObjects in the Session.
* @apiSuccess {Date} createdAt Creation date of the Session.
* @apiSuccess {Date} modifiedAt date of the Session.
* @apiSuccess {Number} ID of the Session.
* @apiExample {curl} Example usage:
* curl -i http://data.duraark.eu/services/api/sessions/files/1
*
* @apiUse SemanticMD
* @apiUse FileSuccess
*
* @apiSuccessExample Success-Response:
* HTTP/1.1 200 OK
* {
* "label": "Haus 30",
* "physicalAssets": [],
* "digitalObjects": [],
* "createdAt": [],
* "modifiedAt": [],
* "id": 1,
* }
* "path": "/duraark-storage/files/Nygade_Scan1001.e57",
* "type": "e57",
* "size": 270408704,
* "directory": false,
* "atime": "2015-08-04T19:01:46.000Z",
* "mtime": "2015-07-30T16:16:08.000Z",
* "ctime": "2015-07-30T16:18:51.000Z",
* "createdAt": "2015-08-05T15:20:24.963Z",
* "updatedAt": "2015-08-05T15:20:25.005Z",
* "id": 1
* }
*
* @apiError SessionNotFound The Session was not found.
* @apiError NotFound The File was not found.
*
* @apiErrorExample Error-Response:
* HTTP/1.1 404 Not Found
* Not Found
*
*/

/**
* @api {post} /files Create File
* @apiVersion 0.7.0
* @apiName PostFile
* @apiGroup File
* @apiPermission none
*
* @apiDescription Creates a new File on the server.
*
* @apiUse FileParam
*
* @apiSuccessExample Success-Response:
* HTTP/1.1 200 OK
* {
* "error": "SessionNotFound"
* }
* "path": "/duraark-storage/files/Nygade_Scan1001.e57",
* "type": "e57",
* "size": 270408704,
* "directory": false,
* "atime": "2015-08-04T19:01:46.000Z",
* "mtime": "2015-07-30T16:16:08.000Z",
* "ctime": "2015-07-30T16:18:51.000Z",
* "createdAt": "2015-08-05T15:20:24.963Z",
* "updatedAt": "2015-08-05T15:20:25.005Z",
* "id": 1
* }
*
* @apiUse FileSuccess
*
*/

// find: function(req, res, next) {
// var files = FileService.getFileList({
// path: _storagePath
// });
//
//
// _.forEach(files, function(item, idx) {
// item.id = idx;
// });
//
//
// res.send(files).status(200);
// }
};
123 changes: 122 additions & 1 deletion api/controllers/SessionsController.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,125 @@
* @help :: See http://links.sailsjs.org/docs/controllers
*/

module.exports = {}
/**
* @apiDefine PhysicalAsset
* @apiParam (PhysicalAsset) {String} label Display name of the PhysicalAsset.
* @apiParam (PhysicalAsset) {Object} buildm JSON-LD object containing metadata
* about the PhysicalAsset as buildM schema instance.
*/

/**
* @apiDefine DigitalObject
* @apiParam (DigitalObject) {String} label Display name of the DigitalObject.
* @apiParam (DigitalObject) {String} path Absolute path of file on the server.
* @apiParam (DigitalObject) {Array} physicalAssets IDs of the PhysicalAssets this DigitalObject is related to.
* @apiParam (DigitalObject) {Object} semMD SemanticMD instance storing information about the semantic enrichment process.
* @apiParam (DigitalObject) {Array} derivatives DigitalObject instances which were created in the geometric enrichment process.
*/

/**
* @apiDefine SemanticMD
* @apiSuccess (SemanticMD) {Array} topics List of Topics containing a set of semantic links that specify an information context.
* @apiSuccess (SemanticMD) {Array} candidates List of semantic links related to a Topic.
* @apiSuccess (SemanticMD) {Array} selections List of semantic links which will be connected to the DigitalObject in the SDAS knowledge graph.
*/

module.exports = {
/**
* @api {get} /sessions/:id Request Session
* @apiVersion 0.7.0
* @apiName GetSession
* @apiGroup Session
* @apiPermission none
*
* @apiDescription Requests a Session stored on the server.
*
* @apiParam {Number} id Session's unique ID.
*
* @apiExample {curl} Example usage:
* curl -i http://data.duraark.eu/services/api/sessions/sessions/1
*
* @apiSuccess {String} label Display name of the Session.
* @apiSuccess {Array} physicalAssets List of PhysicalAssets in the Session.
* @apiSuccess {Array} digitalObjects List of DigitalObjects in the Session.
* @apiSuccess {Object} config Configuration options for this Session to set available information topics and geometric enrichment tools.
* @apiSuccess {Array} fixedInputFiles If present the WorkbenchUI will only display the files defined here. This allows to configure 'showcase' sessions.
* @apiSuccess {Date} createdAt Creation date of the Session.
* @apiSuccess {Date} modifiedAt date of the Session.
* @apiSuccess {Number} ID of the Session.
*
* @apiSuccessExample Success-Response:
* HTTP/1.1 200 OK
* {
* "label": "Haus 30",
* "physicalAssets": [],
* "digitalObjects": [],
* "config": [],
* "fixedInputFiles": [],
* "createdAt": [],
* "modifiedAt": [],
* "id": 1,
* }
*
* @apiError NotFound The Session was not found.
*
* @apiErrorExample Error-Response:
* HTTP/1.1 404 Not Found
* Not Found
*
*/

/**
* @api {post} /sessions Create Session
* @apiVersion 0.7.0
* @apiName PostSession
* @apiGroup Session
* @apiPermission none
*
* @apiDescription Creates a new Session on the server.
*
* @apiParam {String} label Display name of the Session.
* @apiParam {Array} physicalAssets List of PhysicalAssets in the Session.
* @apiParam {Array} digitalObjects List of DigitalObjects in the Session.
* @apiParam {Object} config Configuration options for this Session to set available information topics and geometric enrichment tools.
* @apiParam {Array} fixedInputFiles If present the WorkbenchUI will only display the files defined here. This allows to configure 'showcase' sessions.
* @apiParam {Date} createdAt Creation date of the Session.
* @apiParam {Date} modifiedAt date of the Session.
* @apiParam {Number} ID of the Session.
*
* @apiSuccessExample Success-Response:
* HTTP/1.1 200 OK
* {
* "label": "Haus 30",
* "physicalAssets": [],
* "digitalObjects": [],
* "config": [],
* "fixedInputFiles": [],
* "createdAt": [],
* "modifiedAt": [],
* "id": 1,
* }
*
* @apiSuccess {String} label Display name of the Session.
* @apiSuccess {Array} physicalAssets List of PhysicalAssets in the Session.
* @apiSuccess {Array} digitalObjects List of DigitalObjects in the Session.
* @apiSuccess {Object} config Configuration options for this Session to set available information topics and geometric enrichment tools.
* @apiSuccess {Array} fixedInputFiles If present the WorkbenchUI will only display the files defined here. This allows to configure 'showcase' sessions.
* @apiSuccess {Date} createdAt Creation date of the Session.
* @apiSuccess {Date} modifiedAt date of the Session.
* @apiSuccess {Number} ID of the Session.
*
*/

// find: function(req, res, next) {
// var files = FileService.getFileList({
// path: _storagePath
// });
//
// _.forEach(files, function(item, idx) {
// item.id = idx;
// });
//
// res.send(files).status(200);
// }
}
Loading

0 comments on commit f06ae00

Please sign in to comment.