Skip to content

Commit

Permalink
Merge branch 'master' into postRoomDataAPI
Browse files Browse the repository at this point in the history
* master:
  GET Bot Data api (#452)

# Conflicts:
#	api/v1/controllers/botData.js
#	api/v1/helpers/nouns/botData.js
#	api/v1/swagger.yaml
  • Loading branch information
tausifmuzaffar committed Aug 1, 2017
2 parents 5a94308 + 9f2517b commit 67e88ba
Show file tree
Hide file tree
Showing 4 changed files with 414 additions and 0 deletions.
28 changes: 28 additions & 0 deletions api/v1/controllers/botData.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@

const helper = require('../helpers/nouns/botData');
const doPost = require('../helpers/verbs/doPost');
const doFind = require('../helpers/verbs/doFind');
const doGet = require('../helpers/verbs/doGet');
const doPatch = require('../helpers/verbs/doPatch');
const doDelete = require('../helpers/verbs/doDelete');

Expand Down Expand Up @@ -44,6 +46,19 @@ module.exports = {
doPatch(req, res, next, helper);
},

/**
* GET /botData/, /room/{roomID}/bot/{botID}/data, /room/{roomID}/data
*
* Finds zero or more botData and sends them back in the response.
*
* @param {IncomingMessage} req - The request object
* @param {ServerResponse} res - The response object
* @param {Function} next - The next middleware function in the stack
*/
findBotData(req, res, next) {
doFind(req, res, next, helper);
},

/**
* POST /botData
*
Expand All @@ -57,4 +72,17 @@ module.exports = {
doPost(req, res, next, helper);
},

/**
* GET /botData/{key}
*
* Retrieves the botData and sends it back in the response.
*
* @param {IncomingMessage} req - The request object
* @param {ServerResponse} res - The response object
* @param {Function} next - The next middleware function in the stack
*/
getBotData(req, res, next) {
doGet(req, res, next, helper);
},

}; // exports
1 change: 1 addition & 0 deletions api/v1/helpers/nouns/botData.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ const m = 'BotData';
module.exports = {
apiLinks: {
POST: `Create a new ${m}`,
GET: `Retrieve ${m}`,
PATCH: `Update selected attributes of ${m}`,
DELETE: `Delete ${m}`,
},
Expand Down
146 changes: 146 additions & 0 deletions api/v1/swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7539,6 +7539,39 @@ paths:
# =============================================================================
/botData:
x-swagger-router-controller: botData
get:
tags: [ botData ]
operationId: findBotData
parameters:
-
name: name
description: Filter botData by name
in: query
required: false
type: string
-
$ref: "#/parameters/limitParam"
-
$ref: "#/parameters/offsetParam"
responses:
200:
description: >-
Success, returns all botData
schema:
type: array
items:
$ref: "#/definitions/BotDataResponse"
400:
$ref: "#/responses/400"
401:
$ref: "#/responses/401"
403:
$ref: "#/responses/403"
404:
$ref: "#/responses/404"
default:
$ref: "#/responses/genericError"

post:
security:
- jwt: []
Expand Down Expand Up @@ -7597,6 +7630,40 @@ paths:
# ---------------------------------------------------------------------------
/botData/{key}:
x-swagger-router-controller: botData
get:
summary: Retrieve a botData
tags: [ botData ]
operationId: getBotData
parameters:
-
name: key
in: path
description: >-
The id or name of the botData to retrieve
required: true
type: string
-
$ref: "#/parameters/limitParam"
-
$ref: "#/parameters/offsetParam"
responses:
200:
description: >-
Success, returns specified botData
schema:
type: array
items:
$ref: "#/definitions/BotDataResponse"
400:
$ref: "#/responses/400"
401:
$ref: "#/responses/401"
404:
$ref: "#/responses/404"
default:
$ref: "#/responses/genericError"


patch:
security:
- jwt: []
Expand Down Expand Up @@ -7684,6 +7751,85 @@ paths:
default:
$ref: "#/responses/genericError"

# ---------------------------------------------------------------------------
/rooms/{roomId}/data:
x-swagger-router-controller: botData
get:
summary: Retrieve bot data from a room
tags: [ rooms ]
operationId: findBotData
parameters:
-
name: roomId
in: path
description: >-
The id of the room to retrieve bot data from
required: true
type: integer
-
$ref: "#/parameters/limitParam"
-
$ref: "#/parameters/offsetParam"
responses:
200:
description: >-
Success, returns specified bot data
schema:
type: array
items:
$ref: "#/definitions/BotDataResponse"
400:
$ref: "#/responses/400"
401:
$ref: "#/responses/401"
404:
$ref: "#/responses/404"
default:
$ref: "#/responses/genericError"

# ---------------------------------------------------------------------------
/rooms/{roomId}/bots/{botId}/data:
x-swagger-router-controller: botData
get:
summary: Retrieve bot data from a room from a specific bot
tags: [ rooms ]
operationId: findBotData
parameters:
-
name: roomId
in: path
description: >-
The id of the room to retrieve bot data from
required: true
type: integer
-
name: botId
in: path
description: >-
The id of the bot which people want to reference
required: true
type: string
-
$ref: "#/parameters/limitParam"
-
$ref: "#/parameters/offsetParam"
responses:
200:
description: >-
Success, returns specified bot data
schema:
type: array
items:
$ref: "#/definitions/BotDataResponse"
400:
$ref: "#/responses/400"
401:
$ref: "#/responses/401"
404:
$ref: "#/responses/404"
default:
$ref: "#/responses/genericError"

# =============================================================================
/roomTypes:
x-swagger-router-controller: roomTypes
Expand Down

0 comments on commit 67e88ba

Please sign in to comment.