Advertisement
Guest User

Untitled

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