Advertisement
Guest User

Untitled

a guest
May 22nd, 2018
201
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 12.38 KB | None | 0 0
  1. openapi: 3.0.0
  2. servers:
  3. # Added by API Auto Mocking Plugin
  4. - description: SwaggerHub API Auto Mocking
  5. url: https://virtserver.swaggerhub.com/nyustit/rooms/5.0
  6. info:
  7. version: "5.0"
  8. title: Rooms
  9. description: This details the Rooms backend microservices API
  10.  
  11. # security:
  12. # - openId:
  13. # - read
  14.  
  15. paths:
  16. '/auth/login':
  17. post:
  18. description: Submits the netID and password of a user for authentication with Shibboleth
  19. requestBody:
  20. required: True
  21. content:
  22. 'application/json':
  23. schema:
  24. type: object
  25. required:
  26. - username
  27. - password
  28. properties:
  29. username:
  30. type: string
  31. example: rmr478
  32. password:
  33. type: string
  34. example: password
  35. responses:
  36. '200':
  37. description: Succesful response
  38. content:
  39. 'application/json':
  40. schema:
  41. type: object
  42. properties:
  43. token:
  44. type: string
  45. refreshToken:
  46. type: string
  47. #'/auth/token':
  48. # For refresh token
  49.  
  50. #'/auth/logout':
  51. # For logout
  52.  
  53. /closest:
  54. get:
  55. summary: Returns the closest open room
  56. parameters:
  57. - name: latitude
  58. in: query
  59. required: true
  60. description: The latitude of the user
  61. schema:
  62. type: number
  63. - name: longitude
  64. in: query
  65. required: true
  66. description: The longitude of the user
  67. schema:
  68. type: number
  69. responses:
  70. '200':
  71. description: Succesful response
  72. content:
  73. 'application/json':
  74. schema:
  75. $ref: '#/components/schemas/RoomTimes'
  76. '400':
  77. description: Latitude and/or Longitude were not provided
  78. content:
  79. 'application/json':
  80. schema:
  81. type: object
  82. properties:
  83. message:
  84. type: string
  85. example: >-
  86. [Invalid Parameters] : Latitude and/or Longitude were not
  87. provided.
  88. '/users':
  89. get:
  90. summary: Returns the given user's reservations
  91. parameters:
  92. - name: user
  93. in: header
  94. schema:
  95. type: string
  96. responses:
  97. '200':
  98. description: Successful response
  99. content:
  100. 'application/json':
  101. schema:
  102. type: array
  103. items:
  104. $ref: '#/components/schemas/Reservation'
  105. '400':
  106. description: Invalid request
  107. content:
  108. 'application/json':
  109. schema:
  110. type: object
  111. properties:
  112. message:
  113. type: string
  114. example: '[Invalid Request] : User may not be logged in.'
  115. '/locations/{locationId}':
  116. get:
  117. summary: Returns the given location's information
  118. parameters:
  119. - name: locationId
  120. in: path
  121. required: true
  122. description: 'id of the location to get, corresponds to the location shortCode'
  123. schema:
  124. type: string
  125. responses:
  126. '200':
  127. description: Successful response
  128. content:
  129. 'application/json':
  130. schema:
  131. $ref: '#/components/schemas/Location'
  132. '400':
  133. description: Invalid request
  134. content:
  135. 'application/json':
  136. schema:
  137. type: object
  138. properties:
  139. message:
  140. type: string
  141. example: >-
  142. [Invalid request] : Location ID may be misspelled or
  143. nonexistent
  144. /locations:
  145. get:
  146. responses:
  147. '200':
  148. description: Successful response
  149. content:
  150. 'application/json':
  151. schema:
  152. type: array
  153. items:
  154. $ref: '#/components/schemas/Location'
  155. '/rooms/{roomId}':
  156. get:
  157. summary: Returns the given room's information
  158. parameters:
  159. - name: roomId
  160. in: path
  161. required: true
  162. description: Id of the room to get
  163. schema:
  164. type: string
  165. responses:
  166. '200':
  167. description: Successful response
  168. content:
  169. 'application/json':
  170. schema:
  171. $ref: '#/components/schemas/RoomTimes'
  172. '400':
  173. description: Invalid request
  174. content:
  175. 'application/json':
  176. schema:
  177. type: object
  178. properties:
  179. message:
  180. type: string
  181. example: >-
  182. [Invalid Request] : Room ID may be misspelled or
  183. nonexistent
  184. /rooms:
  185. get:
  186. parameters:
  187. - name: locations
  188. in: query
  189. description: A stringified array of location shortcodes to search from
  190. required: false
  191. schema:
  192. type: string
  193. responses:
  194. '200':
  195. description: Successful request
  196. content:
  197. 'application/json':
  198. schema:
  199. type: array
  200. items:
  201. $ref: '#/components/schemas/Room'
  202. '400':
  203. description: Invalid request
  204. content:
  205. 'application/json':
  206. schema:
  207. type: object
  208. properties:
  209. message:
  210. type: string
  211. example: '[Invalid Request]'
  212. /search:
  213. # Primary feature
  214. get:
  215. parameters:
  216. - name: openTime
  217. in: query
  218. description: The starting ISO format UTC datetime for the reservation
  219. required: false
  220. schema:
  221. type: string
  222. - name: locations
  223. in: query
  224. description: A stringified array of location shortcodes to search from
  225. required: false
  226. schema:
  227. type: string
  228. responses:
  229. '200':
  230. description: Successful request
  231. content:
  232. 'application/json':
  233. schema:
  234. $ref: '#/components/schemas/RoomTimes'
  235. '400':
  236. description: Invalid request
  237. content:
  238. 'application/json':
  239. schema:
  240. type: object
  241. properties:
  242. message:
  243. type: string
  244. example: '[Invalid Request]'
  245. /reserve:
  246. post:
  247. summary: Submit a reservation
  248. responses:
  249. '201':
  250. description: Reservation made!
  251. content:
  252. 'application/json':
  253. schema:
  254. $ref: '#/components/schemas/Reservation'
  255. '400':
  256. description: 'Bad request: maybe some fields are missing?'
  257. content:
  258. 'application/json':
  259. schema:
  260. type: object
  261. properties:
  262. message:
  263. type: string
  264. example: '[Invalid Request] : RoomID missing'
  265. '500':
  266. description: Reservation failed
  267. content:
  268. 'application/json':
  269. schema:
  270. type: object
  271. properties:
  272. message:
  273. type: string
  274. example: '[Reservation Failed] : Room already reserved'
  275. requestBody:
  276. content:
  277. application/json:
  278. schema:
  279. $ref: '#/components/schemas/Reservation'
  280. description: Reservation request to make
  281. required: true
  282. # /survey:
  283.  
  284. components:
  285. schemas:
  286. Room:
  287. type: object
  288. properties:
  289. id:
  290. type: string
  291. example: BOBST_LL2_29
  292. vendorId:
  293. type: string
  294. example: 123
  295. name:
  296. type: string
  297. example: LL2 29
  298. locationId:
  299. # shortcode of location
  300. type: string
  301. example: BOBST
  302. amenities:
  303. $ref: '#/components/schemas/Amenities'
  304. capacity:
  305. type: integer
  306. example: 5
  307. RoomTimes:
  308. type: object
  309. properties:
  310. room:
  311. $ref: '#/components/schemas/Room'
  312. times:
  313. type: array
  314. items:
  315. type: object
  316. properties:
  317. openTime:
  318. $ref: '#/components/schemas/DateString'
  319. duration:
  320. type: integer
  321. example: 1
  322. closeTime:
  323. $ref: '#/components/schemas/DateString'
  324. Reservation:
  325. type: object
  326. required:
  327. - roomId
  328. - locationId
  329. - openTime
  330. properties:
  331. username:
  332. type: string
  333. example: rmr478
  334. name:
  335. type: string
  336. example: Rayat Rahman
  337. email:
  338. type: string
  339. example: fake12@nyu.edu
  340. roomId:
  341. description: Id of the room to reserve in our system
  342. example: BOBST_LL2_29
  343. type: string
  344. vendorRoomId:
  345. description: Id of the room to reserve according to vendor
  346. example: LL2_29
  347. type: string
  348. locationId:
  349. type: string
  350. example: BOBST
  351. description: Id of the location the room is in
  352. openTime:
  353. $ref: '#/components/schemas/DateString'
  354. reserveTime:
  355. $ref: '#/components/schemas/DateString'
  356. duration:
  357. type: number
  358. example: 1.5
  359. description: Decimal number of hours room is being reserved for
  360. occupants:
  361. type: integer
  362. example: 2
  363. description: the number of occupants reserved for
  364. alternates:
  365. type: string
  366. example: [fake12@nyu.edu,fake23@nyu.edu]
  367. description: a stringified array of alternate email addresses to reserve for and
  368. send confirmation emails to
  369. supplementaryFields:
  370. $ref: '#/components/schemas/SuppFields'
  371. Location:
  372. type: object
  373. properties:
  374. name:
  375. type: string
  376. example: Bobst Library
  377. id:
  378. type: string
  379. example: BOBST
  380. message:
  381. type: string
  382. description: A specific message from the vendor to users
  383. example: This location is under construction. Room reservations at this location is only accessible for entrepreneurial activities.
  384. defaultAmenities:
  385. $ref: '#/components/schemas/Amenities'
  386. address:
  387. type: string
  388. example: '70 Washington Square S, New York, NY 10012'
  389. campus:
  390. type: string
  391. example: 'wsq'
  392. latitude:
  393. type: number
  394. example: 40.729619
  395. longitude:
  396. type: number
  397. example: -73.997025
  398. Amenities:
  399. type: array
  400. items:
  401. type: object
  402. properties:
  403. name:
  404. type: string
  405. example: Coffee
  406. id:
  407. # for generating icon on frontend
  408. type: string
  409. example: 12
  410. DateString:
  411. type: string
  412. example: '2007-04-05T12:30-02:00'
  413. description: ISO Format UTC datetime of reservation start time
  414. SuppFields:
  415. type: array
  416. description: An arbitrary array describing vendor-specific questions requested during reservation requests
  417. items:
  418. type: object
  419. properties:
  420. name:
  421. type: string
  422. example: 'heard'
  423. description:
  424. type: string
  425. example: 'Where did you hear about the CoOp?'
  426. required:
  427. type: boolean
  428. example: True
  429. response:
  430. type: string
  431. example: 'NYU Newsletter'
  432. # securitySchemes:
  433. # openId:
  434. # type: openIdConnect
  435. # openIdConnectUrl: https://example.com/.well-known/openid-configuration
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement