1
0

openapi.json 33 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800
  1. {
  2. "openapi": "3.0.3",
  3. "info": {
  4. "title": "weather_status",
  5. "version": "0.0.1",
  6. "description": "Weather status in your dashboard",
  7. "license": {
  8. "name": "agpl"
  9. }
  10. },
  11. "components": {
  12. "securitySchemes": {
  13. "basic_auth": {
  14. "type": "http",
  15. "scheme": "basic"
  16. },
  17. "bearer_auth": {
  18. "type": "http",
  19. "scheme": "bearer"
  20. }
  21. },
  22. "schemas": {
  23. "Capabilities": {
  24. "type": "object",
  25. "required": [
  26. "weather_status"
  27. ],
  28. "properties": {
  29. "weather_status": {
  30. "type": "object",
  31. "required": [
  32. "enabled"
  33. ],
  34. "properties": {
  35. "enabled": {
  36. "type": "boolean"
  37. }
  38. }
  39. }
  40. }
  41. },
  42. "Forecast": {
  43. "type": "object",
  44. "required": [
  45. "time",
  46. "data"
  47. ],
  48. "properties": {
  49. "time": {
  50. "type": "string"
  51. },
  52. "data": {
  53. "type": "object",
  54. "required": [
  55. "instant",
  56. "next_12_hours",
  57. "next_1_hours",
  58. "next_6_hours"
  59. ],
  60. "properties": {
  61. "instant": {
  62. "type": "object",
  63. "required": [
  64. "details"
  65. ],
  66. "properties": {
  67. "details": {
  68. "type": "object",
  69. "required": [
  70. "air_pressure_at_sea_level",
  71. "air_temperature",
  72. "cloud_area_fraction",
  73. "relative_humidity",
  74. "wind_from_direction",
  75. "wind_speed"
  76. ],
  77. "properties": {
  78. "air_pressure_at_sea_level": {
  79. "type": "number"
  80. },
  81. "air_temperature": {
  82. "type": "number"
  83. },
  84. "cloud_area_fraction": {
  85. "type": "number"
  86. },
  87. "relative_humidity": {
  88. "type": "number"
  89. },
  90. "wind_from_direction": {
  91. "type": "number"
  92. },
  93. "wind_speed": {
  94. "type": "number"
  95. }
  96. }
  97. }
  98. }
  99. },
  100. "next_12_hours": {
  101. "type": "object",
  102. "required": [
  103. "summary",
  104. "details"
  105. ],
  106. "properties": {
  107. "summary": {
  108. "type": "object",
  109. "required": [
  110. "symbol_code"
  111. ],
  112. "properties": {
  113. "symbol_code": {
  114. "type": "string"
  115. }
  116. }
  117. },
  118. "details": {
  119. "type": "object",
  120. "properties": {
  121. "precipitation_amount": {
  122. "type": "number"
  123. }
  124. }
  125. }
  126. }
  127. },
  128. "next_1_hours": {
  129. "type": "object",
  130. "required": [
  131. "summary",
  132. "details"
  133. ],
  134. "properties": {
  135. "summary": {
  136. "type": "object",
  137. "required": [
  138. "symbol_code"
  139. ],
  140. "properties": {
  141. "symbol_code": {
  142. "type": "string"
  143. }
  144. }
  145. },
  146. "details": {
  147. "type": "object",
  148. "properties": {
  149. "precipitation_amount": {
  150. "type": "number"
  151. }
  152. }
  153. }
  154. }
  155. },
  156. "next_6_hours": {
  157. "type": "object",
  158. "required": [
  159. "summary",
  160. "details"
  161. ],
  162. "properties": {
  163. "summary": {
  164. "type": "object",
  165. "required": [
  166. "symbol_code"
  167. ],
  168. "properties": {
  169. "symbol_code": {
  170. "type": "string"
  171. }
  172. }
  173. },
  174. "details": {
  175. "type": "object",
  176. "properties": {
  177. "precipitation_amount": {
  178. "type": "number"
  179. }
  180. }
  181. }
  182. }
  183. }
  184. }
  185. }
  186. }
  187. },
  188. "Location": {
  189. "type": "object",
  190. "properties": {
  191. "lat": {
  192. "type": "string"
  193. },
  194. "lon": {
  195. "type": "string"
  196. },
  197. "address": {
  198. "type": "string",
  199. "nullable": true
  200. }
  201. }
  202. },
  203. "LocationWithMode": {
  204. "allOf": [
  205. {
  206. "$ref": "#/components/schemas/Location"
  207. },
  208. {
  209. "$ref": "#/components/schemas/Mode"
  210. }
  211. ]
  212. },
  213. "LocationWithSuccess": {
  214. "allOf": [
  215. {
  216. "$ref": "#/components/schemas/Location"
  217. },
  218. {
  219. "$ref": "#/components/schemas/Success"
  220. }
  221. ]
  222. },
  223. "Mode": {
  224. "type": "object",
  225. "required": [
  226. "mode"
  227. ],
  228. "properties": {
  229. "mode": {
  230. "type": "integer",
  231. "format": "int64"
  232. }
  233. }
  234. },
  235. "OCSMeta": {
  236. "type": "object",
  237. "required": [
  238. "status",
  239. "statuscode"
  240. ],
  241. "properties": {
  242. "status": {
  243. "type": "string"
  244. },
  245. "statuscode": {
  246. "type": "integer"
  247. },
  248. "message": {
  249. "type": "string"
  250. },
  251. "totalitems": {
  252. "type": "string"
  253. },
  254. "itemsperpage": {
  255. "type": "string"
  256. }
  257. }
  258. },
  259. "Success": {
  260. "type": "object",
  261. "required": [
  262. "success"
  263. ],
  264. "properties": {
  265. "success": {
  266. "type": "boolean"
  267. }
  268. }
  269. }
  270. }
  271. },
  272. "paths": {
  273. "/ocs/v2.php/apps/weather_status/api/v1/mode": {
  274. "put": {
  275. "operationId": "weather_status-set-mode",
  276. "summary": "Change the weather status mode. There are currently 2 modes: - ask the browser - use the user defined address",
  277. "tags": [
  278. "weather_status"
  279. ],
  280. "security": [
  281. {
  282. "bearer_auth": []
  283. },
  284. {
  285. "basic_auth": []
  286. }
  287. ],
  288. "parameters": [
  289. {
  290. "name": "mode",
  291. "in": "query",
  292. "description": "New mode",
  293. "required": true,
  294. "schema": {
  295. "type": "integer",
  296. "format": "int64"
  297. }
  298. },
  299. {
  300. "name": "OCS-APIRequest",
  301. "in": "header",
  302. "description": "Required to be true for the API request to pass",
  303. "required": true,
  304. "schema": {
  305. "type": "boolean",
  306. "default": true
  307. }
  308. }
  309. ],
  310. "responses": {
  311. "200": {
  312. "description": "Weather status mode updated",
  313. "content": {
  314. "application/json": {
  315. "schema": {
  316. "type": "object",
  317. "required": [
  318. "ocs"
  319. ],
  320. "properties": {
  321. "ocs": {
  322. "type": "object",
  323. "required": [
  324. "meta",
  325. "data"
  326. ],
  327. "properties": {
  328. "meta": {
  329. "$ref": "#/components/schemas/OCSMeta"
  330. },
  331. "data": {
  332. "$ref": "#/components/schemas/Success"
  333. }
  334. }
  335. }
  336. }
  337. }
  338. }
  339. }
  340. }
  341. }
  342. }
  343. },
  344. "/ocs/v2.php/apps/weather_status/api/v1/use-personal": {
  345. "put": {
  346. "operationId": "weather_status-use-personal-address",
  347. "summary": "Try to use the address set in user personal settings as weather location",
  348. "tags": [
  349. "weather_status"
  350. ],
  351. "security": [
  352. {
  353. "bearer_auth": []
  354. },
  355. {
  356. "basic_auth": []
  357. }
  358. ],
  359. "parameters": [
  360. {
  361. "name": "OCS-APIRequest",
  362. "in": "header",
  363. "description": "Required to be true for the API request to pass",
  364. "required": true,
  365. "schema": {
  366. "type": "boolean",
  367. "default": true
  368. }
  369. }
  370. ],
  371. "responses": {
  372. "200": {
  373. "description": "Address updated",
  374. "content": {
  375. "application/json": {
  376. "schema": {
  377. "type": "object",
  378. "required": [
  379. "ocs"
  380. ],
  381. "properties": {
  382. "ocs": {
  383. "type": "object",
  384. "required": [
  385. "meta",
  386. "data"
  387. ],
  388. "properties": {
  389. "meta": {
  390. "$ref": "#/components/schemas/OCSMeta"
  391. },
  392. "data": {
  393. "$ref": "#/components/schemas/LocationWithSuccess"
  394. }
  395. }
  396. }
  397. }
  398. }
  399. }
  400. }
  401. }
  402. }
  403. }
  404. },
  405. "/ocs/v2.php/apps/weather_status/api/v1/location": {
  406. "get": {
  407. "operationId": "weather_status-get-location",
  408. "summary": "Get stored user location",
  409. "tags": [
  410. "weather_status"
  411. ],
  412. "security": [
  413. {
  414. "bearer_auth": []
  415. },
  416. {
  417. "basic_auth": []
  418. }
  419. ],
  420. "parameters": [
  421. {
  422. "name": "OCS-APIRequest",
  423. "in": "header",
  424. "description": "Required to be true for the API request to pass",
  425. "required": true,
  426. "schema": {
  427. "type": "boolean",
  428. "default": true
  429. }
  430. }
  431. ],
  432. "responses": {
  433. "200": {
  434. "description": "Location returned",
  435. "content": {
  436. "application/json": {
  437. "schema": {
  438. "type": "object",
  439. "required": [
  440. "ocs"
  441. ],
  442. "properties": {
  443. "ocs": {
  444. "type": "object",
  445. "required": [
  446. "meta",
  447. "data"
  448. ],
  449. "properties": {
  450. "meta": {
  451. "$ref": "#/components/schemas/OCSMeta"
  452. },
  453. "data": {
  454. "$ref": "#/components/schemas/LocationWithMode"
  455. }
  456. }
  457. }
  458. }
  459. }
  460. }
  461. }
  462. }
  463. }
  464. },
  465. "put": {
  466. "operationId": "weather_status-set-location",
  467. "summary": "Set address and resolve it to get coordinates or directly set coordinates and get address with reverse geocoding",
  468. "tags": [
  469. "weather_status"
  470. ],
  471. "security": [
  472. {
  473. "bearer_auth": []
  474. },
  475. {
  476. "basic_auth": []
  477. }
  478. ],
  479. "parameters": [
  480. {
  481. "name": "address",
  482. "in": "query",
  483. "description": "Any approximative or exact address",
  484. "schema": {
  485. "type": "string",
  486. "nullable": true
  487. }
  488. },
  489. {
  490. "name": "lat",
  491. "in": "query",
  492. "description": "Latitude in decimal degree format",
  493. "schema": {
  494. "type": "number",
  495. "format": "double",
  496. "nullable": true
  497. }
  498. },
  499. {
  500. "name": "lon",
  501. "in": "query",
  502. "description": "Longitude in decimal degree format",
  503. "schema": {
  504. "type": "number",
  505. "format": "double",
  506. "nullable": true
  507. }
  508. },
  509. {
  510. "name": "OCS-APIRequest",
  511. "in": "header",
  512. "description": "Required to be true for the API request to pass",
  513. "required": true,
  514. "schema": {
  515. "type": "boolean",
  516. "default": true
  517. }
  518. }
  519. ],
  520. "responses": {
  521. "200": {
  522. "description": "Location updated",
  523. "content": {
  524. "application/json": {
  525. "schema": {
  526. "type": "object",
  527. "required": [
  528. "ocs"
  529. ],
  530. "properties": {
  531. "ocs": {
  532. "type": "object",
  533. "required": [
  534. "meta",
  535. "data"
  536. ],
  537. "properties": {
  538. "meta": {
  539. "$ref": "#/components/schemas/OCSMeta"
  540. },
  541. "data": {
  542. "$ref": "#/components/schemas/LocationWithSuccess"
  543. }
  544. }
  545. }
  546. }
  547. }
  548. }
  549. }
  550. }
  551. }
  552. }
  553. },
  554. "/ocs/v2.php/apps/weather_status/api/v1/forecast": {
  555. "get": {
  556. "operationId": "weather_status-get-forecast",
  557. "summary": "Get forecast for current location",
  558. "tags": [
  559. "weather_status"
  560. ],
  561. "security": [
  562. {
  563. "bearer_auth": []
  564. },
  565. {
  566. "basic_auth": []
  567. }
  568. ],
  569. "parameters": [
  570. {
  571. "name": "OCS-APIRequest",
  572. "in": "header",
  573. "description": "Required to be true for the API request to pass",
  574. "required": true,
  575. "schema": {
  576. "type": "boolean",
  577. "default": true
  578. }
  579. }
  580. ],
  581. "responses": {
  582. "200": {
  583. "description": "Forecast returned",
  584. "content": {
  585. "application/json": {
  586. "schema": {
  587. "type": "object",
  588. "required": [
  589. "ocs"
  590. ],
  591. "properties": {
  592. "ocs": {
  593. "type": "object",
  594. "required": [
  595. "meta",
  596. "data"
  597. ],
  598. "properties": {
  599. "meta": {
  600. "$ref": "#/components/schemas/OCSMeta"
  601. },
  602. "data": {
  603. "oneOf": [
  604. {
  605. "type": "array",
  606. "items": {
  607. "$ref": "#/components/schemas/Forecast"
  608. }
  609. },
  610. {
  611. "type": "object",
  612. "required": [
  613. "error"
  614. ],
  615. "properties": {
  616. "error": {
  617. "type": "string"
  618. }
  619. }
  620. }
  621. ]
  622. }
  623. }
  624. }
  625. }
  626. }
  627. }
  628. }
  629. },
  630. "404": {
  631. "description": "Forecast not found",
  632. "content": {
  633. "application/json": {
  634. "schema": {
  635. "type": "object",
  636. "required": [
  637. "ocs"
  638. ],
  639. "properties": {
  640. "ocs": {
  641. "type": "object",
  642. "required": [
  643. "meta",
  644. "data"
  645. ],
  646. "properties": {
  647. "meta": {
  648. "$ref": "#/components/schemas/OCSMeta"
  649. },
  650. "data": {
  651. "$ref": "#/components/schemas/Success"
  652. }
  653. }
  654. }
  655. }
  656. }
  657. }
  658. }
  659. }
  660. }
  661. }
  662. },
  663. "/ocs/v2.php/apps/weather_status/api/v1/favorites": {
  664. "get": {
  665. "operationId": "weather_status-get-favorites",
  666. "summary": "Get favorites list",
  667. "tags": [
  668. "weather_status"
  669. ],
  670. "security": [
  671. {
  672. "bearer_auth": []
  673. },
  674. {
  675. "basic_auth": []
  676. }
  677. ],
  678. "parameters": [
  679. {
  680. "name": "OCS-APIRequest",
  681. "in": "header",
  682. "description": "Required to be true for the API request to pass",
  683. "required": true,
  684. "schema": {
  685. "type": "boolean",
  686. "default": true
  687. }
  688. }
  689. ],
  690. "responses": {
  691. "200": {
  692. "description": "Favorites returned",
  693. "content": {
  694. "application/json": {
  695. "schema": {
  696. "type": "object",
  697. "required": [
  698. "ocs"
  699. ],
  700. "properties": {
  701. "ocs": {
  702. "type": "object",
  703. "required": [
  704. "meta",
  705. "data"
  706. ],
  707. "properties": {
  708. "meta": {
  709. "$ref": "#/components/schemas/OCSMeta"
  710. },
  711. "data": {
  712. "type": "array",
  713. "items": {
  714. "type": "string"
  715. }
  716. }
  717. }
  718. }
  719. }
  720. }
  721. }
  722. }
  723. }
  724. }
  725. },
  726. "put": {
  727. "operationId": "weather_status-set-favorites",
  728. "summary": "Set favorites list",
  729. "tags": [
  730. "weather_status"
  731. ],
  732. "security": [
  733. {
  734. "bearer_auth": []
  735. },
  736. {
  737. "basic_auth": []
  738. }
  739. ],
  740. "parameters": [
  741. {
  742. "name": "favorites[]",
  743. "in": "query",
  744. "description": "Favorite addresses",
  745. "required": true,
  746. "schema": {
  747. "type": "array",
  748. "items": {
  749. "type": "string"
  750. }
  751. }
  752. },
  753. {
  754. "name": "OCS-APIRequest",
  755. "in": "header",
  756. "description": "Required to be true for the API request to pass",
  757. "required": true,
  758. "schema": {
  759. "type": "boolean",
  760. "default": true
  761. }
  762. }
  763. ],
  764. "responses": {
  765. "200": {
  766. "description": "Favorites updated",
  767. "content": {
  768. "application/json": {
  769. "schema": {
  770. "type": "object",
  771. "required": [
  772. "ocs"
  773. ],
  774. "properties": {
  775. "ocs": {
  776. "type": "object",
  777. "required": [
  778. "meta",
  779. "data"
  780. ],
  781. "properties": {
  782. "meta": {
  783. "$ref": "#/components/schemas/OCSMeta"
  784. },
  785. "data": {
  786. "$ref": "#/components/schemas/Success"
  787. }
  788. }
  789. }
  790. }
  791. }
  792. }
  793. }
  794. }
  795. }
  796. }
  797. }
  798. },
  799. "tags": []
  800. }