Advertisement
Guest User

Untitled

a guest
Feb 28th, 2018
262
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 11.88 KB | None | 0 0
  1. swagger: '2.0'
  2. info:
  3. version: 1.0.0
  4. title: Swagger
  5. termsOfService: 'http://swagger.io/terms/'
  6. contact:
  7. email: apiteam@swagger.io
  8. license:
  9. name: Apache 2.0
  10. url: 'http://www.apache.org/licenses/LICENSE-2.0.html'
  11. tags:
  12. - name: medication
  13. description: Operations about medication
  14. - name: user
  15. description: Operations about user
  16. externalDocs:
  17. description: Find out more about our store
  18. url: 'http://swagger.io'
  19. schemes:
  20. - http
  21. paths:
  22.  
  23. /medications:
  24. post:
  25. tags:
  26. - medication
  27. summary: Create medication
  28. description: Create medication
  29. operationId: createMedication
  30. produces:
  31. - application/json
  32. parameters:
  33. - in: body
  34. name: body
  35. description: Medication object
  36. required: true
  37. schema:
  38. $ref: '#/definitions/CreateMedicationModel'
  39. responses:
  40. '201':
  41. description: successfully added
  42. schema:
  43. $ref: '#/definitions/MedicationModel'
  44. '4XX':
  45. schema:
  46. type: array
  47. items:
  48. $ref: '#/definitions/ErrorModel'
  49. get:
  50. tags:
  51. - medication
  52. summary: Get user's medications
  53. description: Get user's meeications
  54. operationId: getMedications
  55. produces:
  56. - application/json
  57. responses:
  58. '200':
  59. description: successful operation
  60. schema:
  61. type: array
  62. items:
  63. $ref: '#/definitions/MedicationModel'
  64. '4XX':
  65. schema:
  66. type: array
  67. items:
  68. $ref: '#/definitions/ErrorModel'
  69. /orders:
  70. get:
  71. tags:
  72. - order
  73. summary: Get user's orders
  74. description: Get user's orders
  75. operationId: getOrders
  76. produces:
  77. - application/json
  78. responses:
  79. '200':
  80. description: successful operation
  81. schema:
  82. type: array
  83. items:
  84. $ref: '#/definitions/OrderModel'
  85. '4XX':
  86. schema:
  87. type: array
  88. items:
  89. $ref: '#/definitions/ErrorModel'
  90.  
  91. /users:
  92. post:
  93. security: []
  94. tags:
  95. - user
  96. summary: Create user
  97. description: Register
  98. operationId: createUser
  99. produces:
  100. - application/json
  101. parameters:
  102. - in: body
  103. name: body
  104. description: User object
  105. required: true
  106. schema:
  107. $ref: '#/definitions/CreateUserModel'
  108. responses:
  109. '4XX':
  110. schema:
  111. type: array
  112. items:
  113. $ref: '#/definitions/ErrorModel'
  114. '201':
  115. description: successful operation
  116. schema:
  117. $ref: '#/definitions/CreateUserModel'
  118. put:
  119. tags:
  120. - user
  121. summary: Updated user
  122. description: This can only be done by the logged in user.
  123. operationId: updateUser
  124. produces:
  125. - application/json
  126. parameters:
  127. - in: body
  128. name: body
  129. description: Updated user object
  130. required: false
  131. schema:
  132. $ref: '#/definitions/CreateUserModel'
  133. responses:
  134. '4XX':
  135. schema:
  136. $ref: '#/definitions/ErrorModel'
  137. '202':
  138. description: accepted
  139. schema:
  140. $ref: '#/definitions/User'
  141. /users/me:
  142. get:
  143. tags:
  144. - user
  145. summary: Gets current user
  146. description: ""
  147. produces:
  148. - application/json
  149. responses:
  150. '200':
  151. description: successful operation
  152. schema:
  153. $ref: '#/definitions/User'
  154. '4XX':
  155. schema:
  156. type: array
  157. items:
  158. $ref: '#/definitions/ErrorModel'
  159.  
  160. /users/sessions:
  161. post:
  162. security: []
  163. tags:
  164. - user
  165. summary: Logs user into the system
  166. description: Login
  167. operationId: loginUser
  168. produces:
  169. - application/json
  170. parameters:
  171. - in: body
  172. name: body
  173. description: User object
  174. required: true
  175. schema:
  176. $ref: '#/definitions/LoginUserModel'
  177. responses:
  178. '200':
  179. description: successful operation
  180. schema:
  181. $ref: '#/definitions/SessionTokenModel'
  182. '4XX':
  183. schema:
  184. type: array
  185. items:
  186. $ref: '#/definitions/ErrorModel'
  187. /user/validateAccount: # Every field of the user's model should be validated and return what is missing
  188. put:
  189. security: []
  190. tags:
  191. - user
  192. summary: Checks users information
  193. operationId: validateAccount
  194. produces:
  195. - application/json
  196. parameters:
  197. - in: body
  198. name: body
  199. description: Updated user object
  200. required: false
  201. schema:
  202. $ref: '#/definitions/CreateUserModel'
  203. responses:
  204. '200':
  205. description: successful operation
  206. '4XX':
  207. schema:
  208. type: array
  209. items:
  210. $ref: '#/definitions/ErrorModel'
  211. /services:
  212. get:
  213. tags:
  214. - service
  215. summary: Gets all services
  216. operationId: getServices
  217. produces:
  218. - application/json
  219. responses:
  220. '200':
  221. description: successful operation
  222. schema:
  223. $ref: '#/definitions/ServiceModel'
  224. '4XX':
  225. schema:
  226. type: array
  227. items:
  228. $ref: '#/definitions/ErrorModel'
  229.  
  230. /services/{id}:
  231. get:
  232. tags:
  233. - service
  234. summary: Represents a service model
  235. description: Represents a single service model
  236. operationId: getServiceById
  237. produces:
  238. - application/json
  239. parameters:
  240. - in: path
  241. name: id
  242. description: Service ID
  243. required: true
  244. schema:
  245. type: integer
  246. format: int64
  247. responses:
  248. '200':
  249. description: successful operation
  250. schema:
  251. $ref: '#/definitions/SingleServiceModel'
  252. '4XX':
  253. schema:
  254. type: array
  255. items:
  256. $ref: '#/definitions/ErrorModel'
  257. /pharmacies:
  258. get:
  259. tags:
  260. - pharmacies
  261. summary: Get all pharmacies
  262. description: Get all pharmacies
  263. operationId: getPharmacies
  264. produces:
  265. - application/json
  266. parameters:
  267. - in: query
  268. name: name
  269. description: pharmacy's name
  270. required: false
  271. schema:
  272. type: string
  273. - in: query
  274. name: longitude
  275. description: pharmacy's longitude
  276. required: false
  277. schema:
  278. type: string
  279. - in: query
  280. name: latitude
  281. description: pharmacy's latitude
  282. required: false
  283. schema:
  284. type: string
  285. responses:
  286. '200':
  287. description: successful operation
  288. schema:
  289. $ref: '#/definitions/PharmacyModel'
  290. '4XX':
  291. schema:
  292. type: array
  293. items:
  294. $ref: '#/definitions/ErrorModel'
  295. /contact:
  296. get:
  297. tags:
  298. - contact
  299. summary: Get user's current pharmacy
  300. description: Get user's current pharmacy
  301. operationId: getPharmacy
  302. produces:
  303. - application/json
  304. responses:
  305. '200':
  306. description: successful operation
  307. schema:
  308. $ref: '#/definitions/PharmacyModel'
  309. '4XX':
  310. schema:
  311. type: array
  312. items:
  313. $ref: '#/definitions/ErrorModel'
  314.  
  315.  
  316. components:
  317. securitySchemes:
  318. bearerAuth:
  319. type: http
  320. scheme: bearer
  321. bearerFormat: JWT
  322. security:
  323. - bearerAuth: []
  324. definitions:
  325. CreateMedicationModel:
  326. type: object
  327. properties:
  328. name:
  329. type: string
  330. reminder:
  331. type: string
  332. description: Reminder Status
  333. enum:
  334. - morning
  335. - noon
  336. - evening
  337. - night
  338. quantity:
  339. type: string
  340. MedicationModel:
  341. type: object
  342. properties:
  343. id:
  344. type: integer
  345. name:
  346. type: string
  347. reminder:
  348. type: string
  349. description: Reminder Status
  350. enum:
  351. - morning
  352. - noon
  353. - evening
  354. - night
  355. quantity:
  356. type: string
  357. AddressModel:
  358. type: object
  359. properties:
  360. latitude:
  361. type: number
  362. longitude:
  363. type: number
  364. name:
  365. type: string
  366. ContactModel:
  367. type: object
  368. properties:
  369. address:
  370. $ref: '#/definitions/AddressModel'
  371. phone:
  372. type: string
  373. email:
  374. type: string
  375. SessionTokenModel:
  376. type: object
  377. properties:
  378. sessionToken:
  379. type: string
  380. LoginUserModel:
  381. type: object
  382. properties:
  383. username:
  384. type: string
  385. password:
  386. type: string
  387. CreateUserModel:
  388. type: object
  389. properties:
  390. phapharmacyId:
  391. type: integer
  392. format: int64
  393. name:
  394. type: string
  395. password:
  396. type: string
  397. dateOfBirth:
  398. type: string
  399. phone:
  400. type: string
  401. email:
  402. type: string
  403. address:
  404. $ref: '#/definitions/AddressModel'
  405. insuranceCardNumber:
  406. type: integer
  407. format: int64
  408. xml:
  409. name: User
  410. PriceModel:
  411. type: object
  412. properties:
  413. currency:
  414. type: string
  415. value:
  416. type: number
  417.  
  418. OrderModel:
  419. type: object
  420. properties:
  421. id:
  422. type: integer
  423. format: int64
  424. status:
  425. type: string
  426. enum:
  427. - active
  428. - on-hold
  429. - cancelled
  430. - completed
  431. - entered-in-error
  432. - stopped
  433. - draft
  434. - unknown
  435. images:
  436. items:
  437. type: string
  438.  
  439. date:
  440. type: string
  441. pharmacy:
  442. $ref: '#/definitions/PharmacyModel'
  443. price:
  444. $ref: '#/definitions/PriceModel'
  445. ServiceModel:
  446. type: object
  447. properties:
  448. id:
  449. type: integer
  450. format: int64
  451. title:
  452. type: string
  453. format: int64
  454. SingleServiceModel:
  455. type: object
  456. properties:
  457. id:
  458. type: integer
  459. format: int64
  460. imageURL:
  461. type: string
  462. title:
  463. type: string
  464. description:
  465. type: string
  466. linkURL:
  467. type: string
  468. PharmacyModel:
  469. type: object
  470. properties:
  471. id:
  472. type: integer
  473. format: int64
  474. name:
  475. type: string
  476. addresses:
  477. items:
  478. $ref: '#/definitions/AddressModel'
  479. contacts:
  480. items:
  481. $ref: '#/definitions/ContactModel'
  482. User:
  483. type: object
  484. properties:
  485. id:
  486. type: integer
  487. format: int64
  488. phapharmacy:
  489. $ref: '#/definitions/PharmacyModel'
  490. name:
  491. type: string
  492. dateOfBirth:
  493. type: string
  494. address:
  495. $ref: '#/definitions/AddressModel'
  496. phone:
  497. type: string
  498. email:
  499. type: string
  500. insuranceCardNumber:
  501. type: integer
  502. format: int64
  503. xml:
  504. name: User
  505. ErrorModel:
  506. type: object
  507. properties:
  508. code:
  509. type: integer
  510. enum:
  511. - 400
  512. - 401
  513. - 403
  514. - 404
  515. messageKey:
  516. type: string
  517. messageValue:
  518. type: string
  519. externalDocs:
  520. description: Find out more about Swagger
  521. url: 'http://swagger.io'
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement