js-widgets-endpoint.js 33 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562
  1. /* jshint -W109 */
  2. /* jshint unused:false */
  3. var jsWidgetsEndpointSchema =
  4. {
  5. "namespace": "js-widgets\/v1",
  6. "routes": {
  7. "\/js-widgets\/v1": {
  8. "namespace": "js-widgets\/v1",
  9. "methods": ["GET"],
  10. "endpoints": [{
  11. "methods": ["GET"],
  12. "args": {
  13. "namespace": { "required": false, "default": "js-widgets\/v1" },
  14. "context": { "required": false, "default": "view" }
  15. }
  16. }],
  17. "_links": { "self": "http:\/\/newtest.localhost\/wp-json\/js-widgets\/v1" }
  18. },
  19. "\/js-widgets\/v1\/widgets\/pages": {
  20. "namespace": "js-widgets\/v1",
  21. "methods": ["GET", "POST"],
  22. "endpoints": [{
  23. "methods": ["GET"],
  24. "args": {
  25. "context": { "required": false, "enum": ["view", "embed", "edit"], "description": "Scope under which the request is made; determines fields present in response.", "type": "string" }
  26. }
  27. }, {
  28. "methods": ["POST"],
  29. "args": {
  30. "title": { "required": false, "description": "The title for the widget.", "type": ["string", "object"] },
  31. "sortby": { "required": false, "default": "menu_order", "enum": ["post_title", "menu_order", "ID"], "description": "How to sort the pages.", "type": "string" },
  32. "exclude": { "required": false, "default": [], "description": "Page IDs to exclude.", "type": ["array", "string"] }
  33. }
  34. }],
  35. "_links": { "self": "http:\/\/newtest.localhost\/wp-json\/js-widgets\/v1\/widgets\/pages" }
  36. },
  37. "\/js-widgets\/v1\/widgets\/pages\/(?P<widget_number>\\d+)": {
  38. "namespace": "js-widgets\/v1",
  39. "methods": ["GET", "POST", "PUT", "PATCH", "DELETE"],
  40. "endpoints": [{
  41. "methods": ["GET"],
  42. "args": {
  43. "context": { "required": false, "default": "view", "enum": ["view", "embed", "edit"], "description": "Scope under which the request is made; determines fields present in response.", "type": "string" }
  44. }
  45. }, {
  46. "methods": ["POST", "PUT", "PATCH"],
  47. "args": {
  48. "title": { "required": false, "description": "The title for the widget.", "type": ["string", "object"] },
  49. "sortby": { "required": false, "default": "menu_order", "enum": ["post_title", "menu_order", "ID"], "description": "How to sort the pages.", "type": "string" },
  50. "exclude": { "required": false, "default": [], "description": "Page IDs to exclude.", "type": ["array", "string"] }
  51. }
  52. }, {
  53. "methods": ["DELETE"],
  54. "args": {
  55. "title": { "required": false, "description": "The title for the widget.", "type": ["string", "object"] },
  56. "sortby": { "required": false, "enum": ["post_title", "menu_order", "ID"], "description": "How to sort the pages.", "type": "string" },
  57. "exclude": { "required": false, "description": "Page IDs to exclude.", "type": ["array", "string"] }
  58. }
  59. }]
  60. },
  61. "\/js-widgets\/v1\/widgets\/calendar": {
  62. "namespace": "js-widgets\/v1",
  63. "methods": ["GET", "POST"],
  64. "endpoints": [{
  65. "methods": ["GET"],
  66. "args": {
  67. "context": { "required": false, "enum": ["view", "embed", "edit"], "description": "Scope under which the request is made; determines fields present in response.", "type": "string" }
  68. }
  69. }, {
  70. "methods": ["POST"],
  71. "args": {
  72. "title": { "required": false, "description": "The title for the widget.", "type": ["string", "object"] }
  73. }
  74. }],
  75. "_links": { "self": "http:\/\/newtest.localhost\/wp-json\/js-widgets\/v1\/widgets\/calendar" }
  76. },
  77. "\/js-widgets\/v1\/widgets\/calendar\/(?P<widget_number>\\d+)": {
  78. "namespace": "js-widgets\/v1",
  79. "methods": ["GET", "POST", "PUT", "PATCH", "DELETE"],
  80. "endpoints": [{
  81. "methods": ["GET"],
  82. "args": {
  83. "context": { "required": false, "default": "view", "enum": ["view", "embed", "edit"], "description": "Scope under which the request is made; determines fields present in response.", "type": "string" }
  84. }
  85. }, {
  86. "methods": ["POST", "PUT", "PATCH"],
  87. "args": {
  88. "title": { "required": false, "description": "The title for the widget.", "type": ["string", "object"] }
  89. }
  90. }, {
  91. "methods": ["DELETE"],
  92. "args": {
  93. "title": { "required": false, "description": "The title for the widget.", "type": ["string", "object"] }
  94. }
  95. }]
  96. },
  97. "\/js-widgets\/v1\/widgets\/archives": {
  98. "namespace": "js-widgets\/v1",
  99. "methods": ["GET", "POST"],
  100. "endpoints": [{
  101. "methods": ["GET"],
  102. "args": {
  103. "context": { "required": false, "enum": ["view", "embed", "edit"], "description": "Scope under which the request is made; determines fields present in response.", "type": "string" }
  104. }
  105. }, {
  106. "methods": ["POST"],
  107. "args": {
  108. "title": { "required": false, "description": "The title for the widget.", "type": ["string", "object"] },
  109. "dropdown": { "required": false, "default": false, "description": "Display as dropdown", "type": "boolean" },
  110. "count": { "required": false, "default": false, "description": "Show post counts", "type": "boolean" }
  111. }
  112. }],
  113. "_links": { "self": "http:\/\/newtest.localhost\/wp-json\/js-widgets\/v1\/widgets\/archives" }
  114. },
  115. "\/js-widgets\/v1\/widgets\/archives\/(?P<widget_number>\\d+)": {
  116. "namespace": "js-widgets\/v1",
  117. "methods": ["GET", "POST", "PUT", "PATCH", "DELETE"],
  118. "endpoints": [{
  119. "methods": ["GET"],
  120. "args": {
  121. "context": { "required": false, "default": "view", "enum": ["view", "embed", "edit"], "description": "Scope under which the request is made; determines fields present in response.", "type": "string" }
  122. }
  123. }, {
  124. "methods": ["POST", "PUT", "PATCH"],
  125. "args": {
  126. "title": { "required": false, "description": "The title for the widget.", "type": ["string", "object"] },
  127. "dropdown": { "required": false, "default": false, "description": "Display as dropdown", "type": "boolean" },
  128. "count": { "required": false, "default": false, "description": "Show post counts", "type": "boolean" }
  129. }
  130. }, {
  131. "methods": ["DELETE"],
  132. "args": {
  133. "title": { "required": false, "description": "The title for the widget.", "type": ["string", "object"] },
  134. "dropdown": { "required": false, "description": "Display as dropdown", "type": "boolean" },
  135. "count": { "required": false, "description": "Show post counts", "type": "boolean" }
  136. }
  137. }]
  138. },
  139. "\/js-widgets\/v1\/widgets\/meta": {
  140. "namespace": "js-widgets\/v1",
  141. "methods": ["GET", "POST"],
  142. "endpoints": [{
  143. "methods": ["GET"],
  144. "args": {
  145. "context": { "required": false, "enum": ["view", "embed", "edit"], "description": "Scope under which the request is made; determines fields present in response.", "type": "string" }
  146. }
  147. }, {
  148. "methods": ["POST"],
  149. "args": {
  150. "title": { "required": false, "description": "The title for the widget.", "type": ["string", "object"] }
  151. }
  152. }],
  153. "_links": { "self": "http:\/\/newtest.localhost\/wp-json\/js-widgets\/v1\/widgets\/meta" }
  154. },
  155. "\/js-widgets\/v1\/widgets\/meta\/(?P<widget_number>\\d+)": {
  156. "namespace": "js-widgets\/v1",
  157. "methods": ["GET", "POST", "PUT", "PATCH", "DELETE"],
  158. "endpoints": [{
  159. "methods": ["GET"],
  160. "args": {
  161. "context": { "required": false, "default": "view", "enum": ["view", "embed", "edit"], "description": "Scope under which the request is made; determines fields present in response.", "type": "string" }
  162. }
  163. }, {
  164. "methods": ["POST", "PUT", "PATCH"],
  165. "args": {
  166. "title": { "required": false, "description": "The title for the widget.", "type": ["string", "object"] }
  167. }
  168. }, {
  169. "methods": ["DELETE"],
  170. "args": {
  171. "title": { "required": false, "description": "The title for the widget.", "type": ["string", "object"] }
  172. }
  173. }]
  174. },
  175. "\/js-widgets\/v1\/widgets\/search": {
  176. "namespace": "js-widgets\/v1",
  177. "methods": ["GET", "POST"],
  178. "endpoints": [{
  179. "methods": ["GET"],
  180. "args": {
  181. "context": { "required": false, "enum": ["view", "embed", "edit"], "description": "Scope under which the request is made; determines fields present in response.", "type": "string" }
  182. }
  183. }, {
  184. "methods": ["POST"],
  185. "args": {
  186. "title": { "required": false, "description": "The title for the widget.", "type": ["string", "object"] }
  187. }
  188. }],
  189. "_links": { "self": "http:\/\/newtest.localhost\/wp-json\/js-widgets\/v1\/widgets\/search" }
  190. },
  191. "\/js-widgets\/v1\/widgets\/search\/(?P<widget_number>\\d+)": {
  192. "namespace": "js-widgets\/v1",
  193. "methods": ["GET", "POST", "PUT", "PATCH", "DELETE"],
  194. "endpoints": [{
  195. "methods": ["GET"],
  196. "args": {
  197. "context": { "required": false, "default": "view", "enum": ["view", "embed", "edit"], "description": "Scope under which the request is made; determines fields present in response.", "type": "string" }
  198. }
  199. }, {
  200. "methods": ["POST", "PUT", "PATCH"],
  201. "args": {
  202. "title": { "required": false, "description": "The title for the widget.", "type": ["string", "object"] }
  203. }
  204. }, {
  205. "methods": ["DELETE"],
  206. "args": {
  207. "title": { "required": false, "description": "The title for the widget.", "type": ["string", "object"] }
  208. }
  209. }]
  210. },
  211. "\/js-widgets\/v1\/widgets\/text": {
  212. "namespace": "js-widgets\/v1",
  213. "methods": ["GET", "POST"],
  214. "endpoints": [{
  215. "methods": ["GET"],
  216. "args": {
  217. "context": { "required": false, "enum": ["view", "embed", "edit"], "description": "Scope under which the request is made; determines fields present in response.", "type": "string" }
  218. }
  219. }, {
  220. "methods": ["POST"],
  221. "args": {
  222. "title": { "required": false, "description": "The title for the widget.", "type": ["string", "object"] },
  223. "text": { "required": false, "description": "The content for the widget.", "type": ["string", "object"] },
  224. "filter": { "required": false, "default": false, "description": "Whether paragraphs will be added for double line breaks (wpautop).", "type": "boolean" }
  225. }
  226. }],
  227. "_links": { "self": "http:\/\/newtest.localhost\/wp-json\/js-widgets\/v1\/widgets\/text" }
  228. },
  229. "\/js-widgets\/v1\/widgets\/text\/(?P<widget_number>\\d+)": {
  230. "namespace": "js-widgets\/v1",
  231. "methods": ["GET", "POST", "PUT", "PATCH", "DELETE"],
  232. "endpoints": [{
  233. "methods": ["GET"],
  234. "args": {
  235. "context": { "required": false, "default": "view", "enum": ["view", "embed", "edit"], "description": "Scope under which the request is made; determines fields present in response.", "type": "string" }
  236. }
  237. }, {
  238. "methods": ["POST", "PUT", "PATCH"],
  239. "args": {
  240. "title": { "required": false, "description": "The title for the widget.", "type": ["string", "object"] },
  241. "text": { "required": false, "description": "The content for the widget.", "type": ["string", "object"] },
  242. "filter": { "required": false, "default": false, "description": "Whether paragraphs will be added for double line breaks (wpautop).", "type": "boolean" }
  243. }
  244. }, {
  245. "methods": ["DELETE"],
  246. "args": {
  247. "title": { "required": false, "description": "The title for the widget.", "type": ["string", "object"] },
  248. "text": { "required": false, "description": "The content for the widget.", "type": ["string", "object"] },
  249. "filter": { "required": false, "description": "Whether paragraphs will be added for double line breaks (wpautop).", "type": "boolean" }
  250. }
  251. }]
  252. },
  253. "\/js-widgets\/v1\/widgets\/categories": {
  254. "namespace": "js-widgets\/v1",
  255. "methods": ["GET", "POST"],
  256. "endpoints": [{
  257. "methods": ["GET"],
  258. "args": {
  259. "context": { "required": false, "enum": ["view", "embed", "edit"], "description": "Scope under which the request is made; determines fields present in response.", "type": "string" }
  260. }
  261. }, {
  262. "methods": ["POST"],
  263. "args": {
  264. "title": { "required": false, "description": "The title for the widget.", "type": ["string", "object"] },
  265. "dropdown": { "required": false, "default": false, "description": "Display as dropdown", "type": "boolean" },
  266. "count": { "required": false, "default": false, "description": "Show post counts", "type": "boolean" },
  267. "hierarchical": { "required": false, "default": false, "description": "Show hierarchy", "type": "boolean" }
  268. }
  269. }],
  270. "_links": { "self": "http:\/\/newtest.localhost\/wp-json\/js-widgets\/v1\/widgets\/categories" }
  271. },
  272. "\/js-widgets\/v1\/widgets\/categories\/(?P<widget_number>\\d+)": {
  273. "namespace": "js-widgets\/v1",
  274. "methods": ["GET", "POST", "PUT", "PATCH", "DELETE"],
  275. "endpoints": [{
  276. "methods": ["GET"],
  277. "args": {
  278. "context": { "required": false, "default": "view", "enum": ["view", "embed", "edit"], "description": "Scope under which the request is made; determines fields present in response.", "type": "string" }
  279. }
  280. }, {
  281. "methods": ["POST", "PUT", "PATCH"],
  282. "args": {
  283. "title": { "required": false, "description": "The title for the widget.", "type": ["string", "object"] },
  284. "dropdown": { "required": false, "default": false, "description": "Display as dropdown", "type": "boolean" },
  285. "count": { "required": false, "default": false, "description": "Show post counts", "type": "boolean" },
  286. "hierarchical": { "required": false, "default": false, "description": "Show hierarchy", "type": "boolean" }
  287. }
  288. }, {
  289. "methods": ["DELETE"],
  290. "args": {
  291. "title": { "required": false, "description": "The title for the widget.", "type": ["string", "object"] },
  292. "dropdown": { "required": false, "description": "Display as dropdown", "type": "boolean" },
  293. "count": { "required": false, "description": "Show post counts", "type": "boolean" },
  294. "hierarchical": { "required": false, "description": "Show hierarchy", "type": "boolean" }
  295. }
  296. }]
  297. },
  298. "\/js-widgets\/v1\/widgets\/recent-posts": {
  299. "namespace": "js-widgets\/v1",
  300. "methods": ["GET", "POST"],
  301. "endpoints": [{
  302. "methods": ["GET"],
  303. "args": {
  304. "context": { "required": false, "enum": ["view", "embed", "edit"], "description": "Scope under which the request is made; determines fields present in response.", "type": "string" }
  305. }
  306. }, {
  307. "methods": ["POST"],
  308. "args": {
  309. "title": { "required": false, "description": "The title for the widget.", "type": ["string", "object"] },
  310. "number": { "required": false, "default": 5, "description": "The number of posts to display.", "type": "integer" },
  311. "show_date": { "required": false, "default": false, "description": "Whether the date should be shown.", "type": "boolean" }
  312. }
  313. }],
  314. "_links": { "self": "http:\/\/newtest.localhost\/wp-json\/js-widgets\/v1\/widgets\/recent-posts" }
  315. },
  316. "\/js-widgets\/v1\/widgets\/recent-posts\/(?P<widget_number>\\d+)": {
  317. "namespace": "js-widgets\/v1",
  318. "methods": ["GET", "POST", "PUT", "PATCH", "DELETE"],
  319. "endpoints": [{
  320. "methods": ["GET"],
  321. "args": {
  322. "context": { "required": false, "default": "view", "enum": ["view", "embed", "edit"], "description": "Scope under which the request is made; determines fields present in response.", "type": "string" }
  323. }
  324. }, {
  325. "methods": ["POST", "PUT", "PATCH"],
  326. "args": {
  327. "title": { "required": false, "description": "The title for the widget.", "type": ["string", "object"] },
  328. "number": { "required": false, "default": 5, "description": "The number of posts to display.", "type": "integer" },
  329. "show_date": { "required": false, "default": false, "description": "Whether the date should be shown.", "type": "boolean" }
  330. }
  331. }, {
  332. "methods": ["DELETE"],
  333. "args": {
  334. "title": { "required": false, "description": "The title for the widget.", "type": ["string", "object"] },
  335. "number": { "required": false, "description": "The number of posts to display.", "type": "integer" },
  336. "show_date": { "required": false, "description": "Whether the date should be shown.", "type": "boolean" }
  337. }
  338. }]
  339. },
  340. "\/js-widgets\/v1\/widgets\/recent-comments": {
  341. "namespace": "js-widgets\/v1",
  342. "methods": ["GET", "POST"],
  343. "endpoints": [{
  344. "methods": ["GET"],
  345. "args": {
  346. "context": { "required": false, "enum": ["view", "embed", "edit"], "description": "Scope under which the request is made; determines fields present in response.", "type": "string" }
  347. }
  348. }, {
  349. "methods": ["POST"],
  350. "args": {
  351. "title": { "required": false, "description": "The title for the widget.", "type": ["string", "object"] },
  352. "number": { "required": false, "default": 5, "description": "The number of comments to display.", "type": "integer" }
  353. }
  354. }],
  355. "_links": { "self": "http:\/\/newtest.localhost\/wp-json\/js-widgets\/v1\/widgets\/recent-comments" }
  356. },
  357. "\/js-widgets\/v1\/widgets\/recent-comments\/(?P<widget_number>\\d+)": {
  358. "namespace": "js-widgets\/v1",
  359. "methods": ["GET", "POST", "PUT", "PATCH", "DELETE"],
  360. "endpoints": [{
  361. "methods": ["GET"],
  362. "args": {
  363. "context": { "required": false, "default": "view", "enum": ["view", "embed", "edit"], "description": "Scope under which the request is made; determines fields present in response.", "type": "string" }
  364. }
  365. }, {
  366. "methods": ["POST", "PUT", "PATCH"],
  367. "args": {
  368. "title": { "required": false, "description": "The title for the widget.", "type": ["string", "object"] },
  369. "number": { "required": false, "default": 5, "description": "The number of comments to display.", "type": "integer" }
  370. }
  371. }, {
  372. "methods": ["DELETE"],
  373. "args": {
  374. "title": { "required": false, "description": "The title for the widget.", "type": ["string", "object"] },
  375. "number": { "required": false, "description": "The number of comments to display.", "type": "integer" }
  376. }
  377. }]
  378. },
  379. "\/js-widgets\/v1\/widgets\/rss": {
  380. "namespace": "js-widgets\/v1",
  381. "methods": ["GET", "POST"],
  382. "endpoints": [{
  383. "methods": ["GET"],
  384. "args": {
  385. "context": { "required": false, "enum": ["view", "embed", "edit"], "description": "Scope under which the request is made; determines fields present in response.", "type": "string" }
  386. }
  387. }, {
  388. "methods": ["POST"],
  389. "args": {
  390. "title": { "required": false, "description": "The title for the widget.", "type": ["string", "object"] },
  391. "url": { "required": false, "default": "", "description": "The RSS feed URL.", "type": "string" },
  392. "items": { "required": false, "default": 10, "description": "The number of RSS items to display.", "type": "integer" },
  393. "show_summary": { "required": false, "default": false, "description": "Whether the summary should be shown.", "type": "boolean" },
  394. "show_author": { "required": false, "default": false, "description": "Whether the author should be shown.", "type": "boolean" },
  395. "show_date": { "required": false, "default": false, "description": "Whether the date should be shown.", "type": "boolean" }
  396. }
  397. }],
  398. "_links": { "self": "http:\/\/newtest.localhost\/wp-json\/js-widgets\/v1\/widgets\/rss" }
  399. },
  400. "\/js-widgets\/v1\/widgets\/rss\/(?P<widget_number>\\d+)": {
  401. "namespace": "js-widgets\/v1",
  402. "methods": ["GET", "POST", "PUT", "PATCH", "DELETE"],
  403. "endpoints": [{
  404. "methods": ["GET"],
  405. "args": {
  406. "context": { "required": false, "default": "view", "enum": ["view", "embed", "edit"], "description": "Scope under which the request is made; determines fields present in response.", "type": "string" }
  407. }
  408. }, {
  409. "methods": ["POST", "PUT", "PATCH"],
  410. "args": {
  411. "title": { "required": false, "description": "The title for the widget.", "type": ["string", "object"] },
  412. "url": { "required": false, "default": "", "description": "The RSS feed URL.", "type": "string" },
  413. "items": { "required": false, "default": 10, "description": "The number of RSS items to display.", "type": "integer" },
  414. "show_summary": { "required": false, "default": false, "description": "Whether the summary should be shown.", "type": "boolean" },
  415. "show_author": { "required": false, "default": false, "description": "Whether the author should be shown.", "type": "boolean" },
  416. "show_date": { "required": false, "default": false, "description": "Whether the date should be shown.", "type": "boolean" }
  417. }
  418. }, {
  419. "methods": ["DELETE"],
  420. "args": {
  421. "title": { "required": false, "description": "The title for the widget.", "type": ["string", "object"] },
  422. "url": { "required": false, "description": "The RSS feed URL.", "type": "string" },
  423. "items": { "required": false, "description": "The number of RSS items to display.", "type": "integer" },
  424. "show_summary": { "required": false, "description": "Whether the summary should be shown.", "type": "boolean" },
  425. "show_author": { "required": false, "description": "Whether the author should be shown.", "type": "boolean" },
  426. "show_date": { "required": false, "description": "Whether the date should be shown.", "type": "boolean" }
  427. }
  428. }]
  429. },
  430. "\/js-widgets\/v1\/widgets\/tag_cloud": {
  431. "namespace": "js-widgets\/v1",
  432. "methods": ["GET", "POST"],
  433. "endpoints": [{
  434. "methods": ["GET"],
  435. "args": {
  436. "context": { "required": false, "enum": ["view", "embed", "edit"], "description": "Scope under which the request is made; determines fields present in response.", "type": "string" }
  437. }
  438. }, {
  439. "methods": ["POST"],
  440. "args": {
  441. "title": { "required": false, "description": "The title for the widget.", "type": ["string", "object"] },
  442. "taxonomy": { "required": false, "default": "post_tag", "enum": ["category", "post_tag"], "description": "Taxonomy", "type": "string" }
  443. }
  444. }],
  445. "_links": { "self": "http:\/\/newtest.localhost\/wp-json\/js-widgets\/v1\/widgets\/tag_cloud" }
  446. },
  447. "\/js-widgets\/v1\/widgets\/tag_cloud\/(?P<widget_number>\\d+)": {
  448. "namespace": "js-widgets\/v1",
  449. "methods": ["GET", "POST", "PUT", "PATCH", "DELETE"],
  450. "endpoints": [{
  451. "methods": ["GET"],
  452. "args": {
  453. "context": { "required": false, "default": "view", "enum": ["view", "embed", "edit"], "description": "Scope under which the request is made; determines fields present in response.", "type": "string" }
  454. }
  455. }, {
  456. "methods": ["POST", "PUT", "PATCH"],
  457. "args": {
  458. "title": { "required": false, "description": "The title for the widget.", "type": ["string", "object"] },
  459. "taxonomy": { "required": false, "default": "post_tag", "enum": ["category", "post_tag"], "description": "Taxonomy", "type": "string" }
  460. }
  461. }, {
  462. "methods": ["DELETE"],
  463. "args": {
  464. "title": { "required": false, "description": "The title for the widget.", "type": ["string", "object"] },
  465. "taxonomy": { "required": false, "enum": ["category", "post_tag"], "description": "Taxonomy", "type": "string" }
  466. }
  467. }]
  468. },
  469. "\/js-widgets\/v1\/widgets\/nav_menu": {
  470. "namespace": "js-widgets\/v1",
  471. "methods": ["GET", "POST"],
  472. "endpoints": [{
  473. "methods": ["GET"],
  474. "args": {
  475. "context": { "required": false, "enum": ["view", "embed", "edit"], "description": "Scope under which the request is made; determines fields present in response.", "type": "string" }
  476. }
  477. }, {
  478. "methods": ["POST"],
  479. "args": {
  480. "title": { "required": false, "description": "The title for the widget.", "type": ["string", "object"] },
  481. "nav_menu": { "required": false, "default": 0, "description": "Selected nav menu", "type": "integer" }
  482. }
  483. }],
  484. "_links": { "self": "http:\/\/newtest.localhost\/wp-json\/js-widgets\/v1\/widgets\/nav_menu" }
  485. },
  486. "\/js-widgets\/v1\/widgets\/nav_menu\/(?P<widget_number>\\d+)": {
  487. "namespace": "js-widgets\/v1",
  488. "methods": ["GET", "POST", "PUT", "PATCH", "DELETE"],
  489. "endpoints": [{
  490. "methods": ["GET"],
  491. "args": {
  492. "context": { "required": false, "default": "view", "enum": ["view", "embed", "edit"], "description": "Scope under which the request is made; determines fields present in response.", "type": "string" }
  493. }
  494. }, {
  495. "methods": ["POST", "PUT", "PATCH"],
  496. "args": {
  497. "title": { "required": false, "description": "The title for the widget.", "type": ["string", "object"] },
  498. "nav_menu": { "required": false, "default": 0, "description": "Selected nav menu", "type": "integer" }
  499. }
  500. }, {
  501. "methods": ["DELETE"],
  502. "args": {
  503. "title": { "required": false, "description": "The title for the widget.", "type": ["string", "object"] },
  504. "nav_menu": { "required": false, "description": "Selected nav menu", "type": "integer" }
  505. }
  506. }]
  507. },
  508. "\/js-widgets\/v1\/widgets\/post-collection": {
  509. "namespace": "js-widgets\/v1",
  510. "methods": ["GET", "POST"],
  511. "endpoints": [{
  512. "methods": ["GET"],
  513. "args": {
  514. "context": { "required": false, "enum": ["view", "embed", "edit"], "description": "Scope under which the request is made; determines fields present in response.", "type": "string" }
  515. }
  516. }, {
  517. "methods": ["POST"],
  518. "args": {
  519. "title": { "required": false, "description": "The title for the widget.", "type": ["string", "object"] },
  520. "show_date": { "required": false, "default": false, "description": "Whether the date should be shown.", "type": "boolean" },
  521. "show_featured_image": { "required": false, "default": false, "description": "Whether the featured image is shown.", "type": "boolean" },
  522. "show_author": { "required": false, "default": false, "description": "Whether the author is shown.", "type": "boolean" },
  523. "posts": { "required": false, "default": [], "description": "The IDs for the collected posts.", "type": "array" }
  524. }
  525. }],
  526. "_links": { "self": "http:\/\/newtest.localhost\/wp-json\/js-widgets\/v1\/widgets\/post-collection" }
  527. },
  528. "\/js-widgets\/v1\/widgets\/post-collection\/(?P<widget_number>\\d+)": {
  529. "namespace": "js-widgets\/v1",
  530. "methods": ["GET", "POST", "PUT", "PATCH", "DELETE"],
  531. "endpoints": [{
  532. "methods": ["GET"],
  533. "args": {
  534. "context": { "required": false, "default": "view", "enum": ["view", "embed", "edit"], "description": "Scope under which the request is made; determines fields present in response.", "type": "string" }
  535. }
  536. }, {
  537. "methods": ["POST", "PUT", "PATCH"],
  538. "args": {
  539. "title": { "required": false, "description": "The title for the widget.", "type": ["string", "object"] },
  540. "show_date": { "required": false, "default": false, "description": "Whether the date should be shown.", "type": "boolean" },
  541. "show_featured_image": { "required": false, "default": false, "description": "Whether the featured image is shown.", "type": "boolean" },
  542. "show_author": { "required": false, "default": false, "description": "Whether the author is shown.", "type": "boolean" },
  543. "posts": { "required": false, "default": [], "description": "The IDs for the collected posts.", "type": "array" }
  544. }
  545. }, {
  546. "methods": ["DELETE"],
  547. "args": {
  548. "title": { "required": false, "description": "The title for the widget.", "type": ["string", "object"] },
  549. "show_date": { "required": false, "description": "Whether the date should be shown.", "type": "boolean" },
  550. "show_featured_image": { "required": false, "description": "Whether the featured image is shown.", "type": "boolean" },
  551. "show_author": { "required": false, "description": "Whether the author is shown.", "type": "boolean" },
  552. "posts": { "required": false, "description": "The IDs for the collected posts.", "type": "array" }
  553. }
  554. }]
  555. }
  556. },
  557. "_links": {
  558. "up": [
  559. { "href": "http:\/\/newtest.localhost\/wp-json\/" }
  560. ]
  561. }
  562. };