Advertisement
Guest User

Untitled

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