1
0

openapi.json 34 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820
  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. "requestBody": {
  289. "required": true,
  290. "content": {
  291. "application/json": {
  292. "schema": {
  293. "type": "object",
  294. "required": [
  295. "mode"
  296. ],
  297. "properties": {
  298. "mode": {
  299. "type": "integer",
  300. "format": "int64",
  301. "description": "New mode"
  302. }
  303. }
  304. }
  305. }
  306. }
  307. },
  308. "parameters": [
  309. {
  310. "name": "OCS-APIRequest",
  311. "in": "header",
  312. "description": "Required to be true for the API request to pass",
  313. "required": true,
  314. "schema": {
  315. "type": "boolean",
  316. "default": true
  317. }
  318. }
  319. ],
  320. "responses": {
  321. "200": {
  322. "description": "Weather status mode updated",
  323. "content": {
  324. "application/json": {
  325. "schema": {
  326. "type": "object",
  327. "required": [
  328. "ocs"
  329. ],
  330. "properties": {
  331. "ocs": {
  332. "type": "object",
  333. "required": [
  334. "meta",
  335. "data"
  336. ],
  337. "properties": {
  338. "meta": {
  339. "$ref": "#/components/schemas/OCSMeta"
  340. },
  341. "data": {
  342. "$ref": "#/components/schemas/Success"
  343. }
  344. }
  345. }
  346. }
  347. }
  348. }
  349. }
  350. }
  351. }
  352. }
  353. },
  354. "/ocs/v2.php/apps/weather_status/api/v1/use-personal": {
  355. "put": {
  356. "operationId": "weather_status-use-personal-address",
  357. "summary": "Try to use the address set in user personal settings as weather location",
  358. "tags": [
  359. "weather_status"
  360. ],
  361. "security": [
  362. {
  363. "bearer_auth": []
  364. },
  365. {
  366. "basic_auth": []
  367. }
  368. ],
  369. "parameters": [
  370. {
  371. "name": "OCS-APIRequest",
  372. "in": "header",
  373. "description": "Required to be true for the API request to pass",
  374. "required": true,
  375. "schema": {
  376. "type": "boolean",
  377. "default": true
  378. }
  379. }
  380. ],
  381. "responses": {
  382. "200": {
  383. "description": "Address updated",
  384. "content": {
  385. "application/json": {
  386. "schema": {
  387. "type": "object",
  388. "required": [
  389. "ocs"
  390. ],
  391. "properties": {
  392. "ocs": {
  393. "type": "object",
  394. "required": [
  395. "meta",
  396. "data"
  397. ],
  398. "properties": {
  399. "meta": {
  400. "$ref": "#/components/schemas/OCSMeta"
  401. },
  402. "data": {
  403. "$ref": "#/components/schemas/LocationWithSuccess"
  404. }
  405. }
  406. }
  407. }
  408. }
  409. }
  410. }
  411. }
  412. }
  413. }
  414. },
  415. "/ocs/v2.php/apps/weather_status/api/v1/location": {
  416. "get": {
  417. "operationId": "weather_status-get-location",
  418. "summary": "Get stored user location",
  419. "tags": [
  420. "weather_status"
  421. ],
  422. "security": [
  423. {
  424. "bearer_auth": []
  425. },
  426. {
  427. "basic_auth": []
  428. }
  429. ],
  430. "parameters": [
  431. {
  432. "name": "OCS-APIRequest",
  433. "in": "header",
  434. "description": "Required to be true for the API request to pass",
  435. "required": true,
  436. "schema": {
  437. "type": "boolean",
  438. "default": true
  439. }
  440. }
  441. ],
  442. "responses": {
  443. "200": {
  444. "description": "Location returned",
  445. "content": {
  446. "application/json": {
  447. "schema": {
  448. "type": "object",
  449. "required": [
  450. "ocs"
  451. ],
  452. "properties": {
  453. "ocs": {
  454. "type": "object",
  455. "required": [
  456. "meta",
  457. "data"
  458. ],
  459. "properties": {
  460. "meta": {
  461. "$ref": "#/components/schemas/OCSMeta"
  462. },
  463. "data": {
  464. "$ref": "#/components/schemas/LocationWithMode"
  465. }
  466. }
  467. }
  468. }
  469. }
  470. }
  471. }
  472. }
  473. }
  474. },
  475. "put": {
  476. "operationId": "weather_status-set-location",
  477. "summary": "Set address and resolve it to get coordinates or directly set coordinates and get address with reverse geocoding",
  478. "tags": [
  479. "weather_status"
  480. ],
  481. "security": [
  482. {
  483. "bearer_auth": []
  484. },
  485. {
  486. "basic_auth": []
  487. }
  488. ],
  489. "requestBody": {
  490. "required": false,
  491. "content": {
  492. "application/json": {
  493. "schema": {
  494. "type": "object",
  495. "properties": {
  496. "address": {
  497. "type": "string",
  498. "nullable": true,
  499. "description": "Any approximative or exact address"
  500. },
  501. "lat": {
  502. "type": "number",
  503. "format": "double",
  504. "nullable": true,
  505. "description": "Latitude in decimal degree format"
  506. },
  507. "lon": {
  508. "type": "number",
  509. "format": "double",
  510. "nullable": true,
  511. "description": "Longitude in decimal degree format"
  512. }
  513. }
  514. }
  515. }
  516. }
  517. },
  518. "parameters": [
  519. {
  520. "name": "OCS-APIRequest",
  521. "in": "header",
  522. "description": "Required to be true for the API request to pass",
  523. "required": true,
  524. "schema": {
  525. "type": "boolean",
  526. "default": true
  527. }
  528. }
  529. ],
  530. "responses": {
  531. "200": {
  532. "description": "Location updated",
  533. "content": {
  534. "application/json": {
  535. "schema": {
  536. "type": "object",
  537. "required": [
  538. "ocs"
  539. ],
  540. "properties": {
  541. "ocs": {
  542. "type": "object",
  543. "required": [
  544. "meta",
  545. "data"
  546. ],
  547. "properties": {
  548. "meta": {
  549. "$ref": "#/components/schemas/OCSMeta"
  550. },
  551. "data": {
  552. "$ref": "#/components/schemas/LocationWithSuccess"
  553. }
  554. }
  555. }
  556. }
  557. }
  558. }
  559. }
  560. }
  561. }
  562. }
  563. },
  564. "/ocs/v2.php/apps/weather_status/api/v1/forecast": {
  565. "get": {
  566. "operationId": "weather_status-get-forecast",
  567. "summary": "Get forecast for current location",
  568. "tags": [
  569. "weather_status"
  570. ],
  571. "security": [
  572. {
  573. "bearer_auth": []
  574. },
  575. {
  576. "basic_auth": []
  577. }
  578. ],
  579. "parameters": [
  580. {
  581. "name": "OCS-APIRequest",
  582. "in": "header",
  583. "description": "Required to be true for the API request to pass",
  584. "required": true,
  585. "schema": {
  586. "type": "boolean",
  587. "default": true
  588. }
  589. }
  590. ],
  591. "responses": {
  592. "200": {
  593. "description": "Forecast returned",
  594. "content": {
  595. "application/json": {
  596. "schema": {
  597. "type": "object",
  598. "required": [
  599. "ocs"
  600. ],
  601. "properties": {
  602. "ocs": {
  603. "type": "object",
  604. "required": [
  605. "meta",
  606. "data"
  607. ],
  608. "properties": {
  609. "meta": {
  610. "$ref": "#/components/schemas/OCSMeta"
  611. },
  612. "data": {
  613. "oneOf": [
  614. {
  615. "type": "array",
  616. "items": {
  617. "$ref": "#/components/schemas/Forecast"
  618. }
  619. },
  620. {
  621. "type": "object",
  622. "required": [
  623. "error"
  624. ],
  625. "properties": {
  626. "error": {
  627. "type": "string"
  628. }
  629. }
  630. }
  631. ]
  632. }
  633. }
  634. }
  635. }
  636. }
  637. }
  638. }
  639. },
  640. "404": {
  641. "description": "Forecast not found",
  642. "content": {
  643. "application/json": {
  644. "schema": {
  645. "type": "object",
  646. "required": [
  647. "ocs"
  648. ],
  649. "properties": {
  650. "ocs": {
  651. "type": "object",
  652. "required": [
  653. "meta",
  654. "data"
  655. ],
  656. "properties": {
  657. "meta": {
  658. "$ref": "#/components/schemas/OCSMeta"
  659. },
  660. "data": {
  661. "$ref": "#/components/schemas/Success"
  662. }
  663. }
  664. }
  665. }
  666. }
  667. }
  668. }
  669. }
  670. }
  671. }
  672. },
  673. "/ocs/v2.php/apps/weather_status/api/v1/favorites": {
  674. "get": {
  675. "operationId": "weather_status-get-favorites",
  676. "summary": "Get favorites list",
  677. "tags": [
  678. "weather_status"
  679. ],
  680. "security": [
  681. {
  682. "bearer_auth": []
  683. },
  684. {
  685. "basic_auth": []
  686. }
  687. ],
  688. "parameters": [
  689. {
  690. "name": "OCS-APIRequest",
  691. "in": "header",
  692. "description": "Required to be true for the API request to pass",
  693. "required": true,
  694. "schema": {
  695. "type": "boolean",
  696. "default": true
  697. }
  698. }
  699. ],
  700. "responses": {
  701. "200": {
  702. "description": "Favorites returned",
  703. "content": {
  704. "application/json": {
  705. "schema": {
  706. "type": "object",
  707. "required": [
  708. "ocs"
  709. ],
  710. "properties": {
  711. "ocs": {
  712. "type": "object",
  713. "required": [
  714. "meta",
  715. "data"
  716. ],
  717. "properties": {
  718. "meta": {
  719. "$ref": "#/components/schemas/OCSMeta"
  720. },
  721. "data": {
  722. "type": "array",
  723. "items": {
  724. "type": "string"
  725. }
  726. }
  727. }
  728. }
  729. }
  730. }
  731. }
  732. }
  733. }
  734. }
  735. },
  736. "put": {
  737. "operationId": "weather_status-set-favorites",
  738. "summary": "Set favorites list",
  739. "tags": [
  740. "weather_status"
  741. ],
  742. "security": [
  743. {
  744. "bearer_auth": []
  745. },
  746. {
  747. "basic_auth": []
  748. }
  749. ],
  750. "requestBody": {
  751. "required": true,
  752. "content": {
  753. "application/json": {
  754. "schema": {
  755. "type": "object",
  756. "required": [
  757. "favorites"
  758. ],
  759. "properties": {
  760. "favorites": {
  761. "type": "array",
  762. "description": "Favorite addresses",
  763. "items": {
  764. "type": "string"
  765. }
  766. }
  767. }
  768. }
  769. }
  770. }
  771. },
  772. "parameters": [
  773. {
  774. "name": "OCS-APIRequest",
  775. "in": "header",
  776. "description": "Required to be true for the API request to pass",
  777. "required": true,
  778. "schema": {
  779. "type": "boolean",
  780. "default": true
  781. }
  782. }
  783. ],
  784. "responses": {
  785. "200": {
  786. "description": "Favorites updated",
  787. "content": {
  788. "application/json": {
  789. "schema": {
  790. "type": "object",
  791. "required": [
  792. "ocs"
  793. ],
  794. "properties": {
  795. "ocs": {
  796. "type": "object",
  797. "required": [
  798. "meta",
  799. "data"
  800. ],
  801. "properties": {
  802. "meta": {
  803. "$ref": "#/components/schemas/OCSMeta"
  804. },
  805. "data": {
  806. "$ref": "#/components/schemas/Success"
  807. }
  808. }
  809. }
  810. }
  811. }
  812. }
  813. }
  814. }
  815. }
  816. }
  817. }
  818. },
  819. "tags": []
  820. }