Advertisement
Guest User

Untitled

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