您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

openapi.yaml 13 KiB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485
  1. openapi: 3.0.0
  2. info:
  3. title: LessPass Server API
  4. version: 0.1.0
  5. servers:
  6. - url: https://api.lesspass.com/
  7. paths:
  8. /auth/users/:
  9. summary: Create new user
  10. post:
  11. tags:
  12. - Auth
  13. summary: Create new user
  14. description: Create a new user
  15. operationId: authusers
  16. requestBody:
  17. content:
  18. application/json:
  19. schema:
  20. $ref: '#/components/schemas/user_signup_login'
  21. description: New user email and password
  22. required: true
  23. responses:
  24. '201':
  25. description: User creation suscessfully
  26. content:
  27. application/json:
  28. example:
  29. key: null
  30. email: user@example.com
  31. id: 14348
  32. '400':
  33. description: User creation error
  34. content:
  35. application/json:
  36. examples:
  37. email problem:
  38. value:
  39. email: [ "Enter a valid email address." ]
  40. password problem:
  41. value:
  42. password:
  43. - This password is too short. It must contain at least 8 characters.
  44. - This password is too common.
  45. - This password is entirely numeric.
  46. /auth/users/reset_password/:
  47. summary: Recover lost password
  48. post:
  49. tags:
  50. - Auth
  51. summary: Recover lost password
  52. description: Recover lost password of existing user
  53. operationId: authusersresetpassword
  54. requestBody:
  55. content:
  56. application/json:
  57. schema:
  58. $ref: '#/components/schemas/user_reset_password'
  59. description: New user email and password
  60. required: true
  61. responses:
  62. '204':
  63. description: Recover suscessfully
  64. /auth/users/set_password/:
  65. summary: Change user password
  66. post:
  67. tags:
  68. - Auth
  69. summary: Change user password
  70. description: Change password of existing user
  71. operationId: authuserssetpassword
  72. security:
  73. - JWTAuth: []
  74. requestBody:
  75. content:
  76. application/json:
  77. schema:
  78. $ref: '#/components/schemas/user_set_password'
  79. description: New user email and password
  80. required: true
  81. responses:
  82. '204':
  83. description: Password changed suscessfully
  84. '401':
  85. $ref: '#/components/responses/unauthorized_error'
  86. /auth/jwt/create/:
  87. summary: Perform user login
  88. post:
  89. tags:
  90. - Auth
  91. summary: Authenticate an existing user
  92. description: Authenticate an existing user
  93. operationId: authjwtcreate
  94. requestBody:
  95. content:
  96. application/json:
  97. schema:
  98. $ref: '#/components/schemas/user_signup_login'
  99. description: New user email and password
  100. required: true
  101. responses:
  102. '200':
  103. $ref: '#/components/responses/auth_jwt_create'
  104. /auth/jwt/refresh/:
  105. summary: Perform token refresh
  106. post:
  107. tags:
  108. - Auth
  109. summary: Refresh user token
  110. description: Refresh user token
  111. operationId: authjwtrefresh
  112. requestBody:
  113. content:
  114. application/json:
  115. schema:
  116. $ref: '#/components/schemas/jwt_token_refresh'
  117. description: Refresh token
  118. required: true
  119. responses:
  120. '201':
  121. $ref: '#/components/responses/auth_jwt_refresh'
  122. '400':
  123. description: Refresh token is in blank
  124. content:
  125. application/json:
  126. example:
  127. refresh: [ "This field may not be blank." ]
  128. '401':
  129. description: Refresh token has wrong type, is not valid or expired
  130. content:
  131. application/json:
  132. examples:
  133. token is invalid or expired:
  134. value:
  135. detail: Token is invalid or expired
  136. code: token_not_valid
  137. token has wrong type:
  138. value:
  139. detail: Token has wrong type
  140. code: token_not_valid
  141. /passwords/:
  142. summary: Work with stored passwords
  143. get:
  144. tags:
  145. - Passwords
  146. summary: Get passwords list
  147. description: Get passwords list
  148. operationId: passwordsget
  149. security:
  150. - JWTAuth: []
  151. responses:
  152. '200':
  153. $ref: '#/components/responses/passwords'
  154. '401':
  155. $ref: '#/components/responses/unauthorized_error'
  156. post:
  157. tags:
  158. - Passwords
  159. summary: Create new password
  160. description: Create new password
  161. operationId: passwordspost
  162. security:
  163. - JWTAuth: []
  164. requestBody:
  165. content:
  166. application/json:
  167. schema:
  168. $ref: '#/components/schemas/password'
  169. description: Create new password
  170. required: true
  171. responses:
  172. '200':
  173. $ref: '#/components/responses/password'
  174. '401':
  175. $ref: '#/components/responses/unauthorized_error'
  176. /passwords/{password_id}/:
  177. summary: Modify or delete stored password
  178. put:
  179. tags:
  180. - Passwords
  181. summary: Modify existing password
  182. description: Modify existing password
  183. operationId: passwordsidput
  184. security:
  185. - JWTAuth: []
  186. parameters:
  187. - $ref: '#/components/parameters/password_id'
  188. requestBody:
  189. content:
  190. application/json:
  191. schema:
  192. $ref: '#/components/schemas/password'
  193. description: Modify existing password
  194. required: true
  195. responses:
  196. '200':
  197. $ref: '#/components/responses/password'
  198. '400':
  199. description: Parse error
  200. content:
  201. application/json:
  202. examples:
  203. invalid values in fields:
  204. value:
  205. field: [ "A valid value is required." ]
  206. invalid json:
  207. value:
  208. detail: "JSON parse error - Expecting value: line 1 column 1 (char 0)"
  209. '401':
  210. $ref: '#/components/responses/unauthorized_error'
  211. '404':
  212. description: Password ID not found
  213. content:
  214. application/json:
  215. example:
  216. detail: Not found.
  217. delete:
  218. tags:
  219. - Passwords
  220. summary: Modify existing password
  221. description: Modify existing password
  222. operationId: passwordsiddelete
  223. security:
  224. - JWTAuth: []
  225. parameters:
  226. - $ref: '#/components/parameters/password_id'
  227. responses:
  228. '204':
  229. description: Deletion done
  230. '404':
  231. description: Password ID not found
  232. content:
  233. application/json:
  234. example:
  235. detail: Not found.
  236. components:
  237. parameters:
  238. password_id:
  239. in: path
  240. name: password_id
  241. required: true
  242. description: The ID of password
  243. schema:
  244. type: string
  245. responses:
  246. auth_jwt_create:
  247. description: successful operation
  248. content:
  249. application/json:
  250. schema:
  251. $ref: '#/components/schemas/jwt_response'
  252. auth_jwt_refresh:
  253. description: successful operation
  254. content:
  255. application/json:
  256. schema:
  257. $ref: '#/components/schemas/jwt_response'
  258. password:
  259. description: successful operation
  260. content:
  261. application/json:
  262. schema:
  263. $ref: '#/components/schemas/password_response'
  264. passwords:
  265. description: successful operation
  266. content:
  267. application/json:
  268. schema:
  269. $ref: '#/components/schemas/passwords_response'
  270. unauthorized_error:
  271. description: Unauthorized error
  272. content:
  273. application/json:
  274. schema:
  275. $ref: '#/components/schemas/error_response'
  276. example:
  277. detail: Given token not valid for any token type
  278. code: token_not_valid
  279. messages:
  280. - token_class: AccessToken
  281. token_type: access
  282. message: Token is invalid or expired
  283. securitySchemes:
  284. JWTAuth:
  285. type: http
  286. scheme: bearer
  287. bearerFormat: JWT
  288. schemas:
  289. user_signup_login:
  290. required:
  291. - email
  292. - password
  293. type: object
  294. properties:
  295. email:
  296. description: User email
  297. type: string
  298. format: email
  299. password:
  300. description: User password
  301. type: string
  302. minLength: 8
  303. format: password
  304. user_reset_password:
  305. required:
  306. - email
  307. type: object
  308. properties:
  309. email:
  310. description: User email
  311. type: string
  312. format: email
  313. user_set_password:
  314. required:
  315. - current_password
  316. - new_password
  317. - re_new_password
  318. type: object
  319. properties:
  320. current_password:
  321. description: User current password
  322. type: string
  323. minLength: 8
  324. format: password
  325. new_password:
  326. description: User new password
  327. type: string
  328. minLength: 8
  329. format: password
  330. re_new_password:
  331. description: Repeat user new password
  332. type: string
  333. minLength: 8
  334. format: password
  335. jwt_token_refresh:
  336. required:
  337. - refresh
  338. type: object
  339. properties:
  340. refresh:
  341. description: Refresh token
  342. type: string
  343. jwt_response:
  344. type: object
  345. properties:
  346. access:
  347. description: Access token
  348. type: string
  349. refresh:
  350. description: Refresh token
  351. type: string
  352. password:
  353. type: object
  354. required:
  355. - login
  356. - site
  357. - uppercase
  358. - lowercase
  359. - numbers
  360. - symbols
  361. - length
  362. - counter
  363. - version
  364. properties:
  365. login:
  366. description: User login
  367. type: string
  368. example: user@example.com
  369. site:
  370. description: User login
  371. type: string
  372. example: example.com
  373. uppercase:
  374. description: Generated password has uppercase characters
  375. type: boolean
  376. default: true
  377. lowercase:
  378. description: Generated password has lowercase characters
  379. type: boolean
  380. default: true
  381. numbers:
  382. description: Generated password has numbers
  383. type: boolean
  384. default: true
  385. symbols:
  386. description: Generated password has symbol characters
  387. type: boolean
  388. default: true
  389. length:
  390. description: Password length
  391. type: integer
  392. default: 16
  393. counter:
  394. description: Password counter
  395. type: integer
  396. default: 1
  397. version:
  398. description: Password version algorithm
  399. type: integer
  400. default: 2
  401. password_response:
  402. type: object
  403. properties:
  404. id:
  405. description: Password unique id
  406. type: string
  407. format: uuid
  408. login:
  409. description: User login
  410. type: string
  411. example: user@example.com
  412. site:
  413. description: User login
  414. type: string
  415. example: example.com
  416. uppercase:
  417. description: Generated password has uppercase characters
  418. type: boolean
  419. default: true
  420. lowercase:
  421. description: Generated password has lowercase characters
  422. type: boolean
  423. default: true
  424. numbers:
  425. description: Generated password has numbers
  426. type: boolean
  427. default: true
  428. symbols:
  429. description: Generated password has symbol characters
  430. type: boolean
  431. default: true
  432. length:
  433. description: Password length
  434. type: integer
  435. default: 16
  436. counter:
  437. description: Password counter
  438. type: integer
  439. default: 1
  440. version:
  441. description: Password version algorithm
  442. type: integer
  443. default: 2
  444. created:
  445. description: Creation date
  446. type: string
  447. format: date-time
  448. modified:
  449. description: Creation date
  450. type: string
  451. format: date-time
  452. passwords_response:
  453. type: object
  454. properties:
  455. count:
  456. description: Password items count
  457. type: integer
  458. example: 1
  459. previous:
  460. description: Previous page
  461. type: integer
  462. default: null
  463. next:
  464. description: Next page
  465. type: integer
  466. default: null
  467. results:
  468. description: Password items
  469. type: array
  470. items:
  471. $ref: '#/components/schemas/password_response'
  472. error_response:
  473. type: object
  474. properties:
  475. detail:
  476. description: Error detail
  477. type: string
  478. code:
  479. description: Error code
  480. type: string
  481. messages:
  482. description: Error messages
  483. type: array
  484. items:
  485. type: object