The next generation of the Teknik Services. Written in ASP.NET. https://www.teknik.io/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

Paste.cshtml 7.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234
  1. @model Teknik.Areas.Help.ViewModels.HelpViewModel
  2. @using Teknik.Helpers
  3. @using Teknik.Pygments
  4. @Styles.Render("~/Content/help");
  5. <div class="container">
  6. <div class="row api">
  7. <h2><b>Paste Service</b></h2>
  8. <hr>
  9. <p>This is a description of the API commands available for the Paste service.</p>
  10. <h3>Submit a Paste</h3>
  11. <pre><code>POST @Url.SubRouteUrl("api", "API.v1.Paste")</code></pre>
  12. <h4>Parameters</h4>
  13. <table>
  14. <thead>
  15. <tr>
  16. <th>Name</th>
  17. <th>Type</th>
  18. <th>Default</th>
  19. <th>Description</th>
  20. </tr>
  21. </thead>
  22. <tbody>
  23. <tr>
  24. <td>
  25. <code>code</code>
  26. </td>
  27. <td>
  28. <code>string</code>
  29. </td>
  30. <td>
  31. <var>NULL</var>
  32. </td>
  33. <td>
  34. <strong>Required</strong>
  35. The text that will be submitted as the paste content.
  36. </td>
  37. </tr>
  38. <tr>
  39. <td>
  40. <code>title</code>
  41. </td>
  42. <td>
  43. <code>string</code>
  44. </td>
  45. <td>
  46. <var>NULL</var>
  47. </td>
  48. <td>
  49. The title for the paste.
  50. </td>
  51. </tr>
  52. <tr>
  53. <td>
  54. <code>syntax</code>
  55. </td>
  56. <td>
  57. <code>string</code>
  58. </td>
  59. <td>
  60. text
  61. </td>
  62. <td>
  63. The syntax of the pasted code.
  64. <br />
  65. This can be one of the following:
  66. <select name="format" class="selectpicker">
  67. @foreach (Highlighter.Lexer format in Highlighter.Lexers.OrderBy(l => l.Name))
  68. {
  69. <option value="@format.Aliases.FirstOrDefault()">@format.Name</option>
  70. }
  71. </select>
  72. </td>
  73. </tr>
  74. <tr>
  75. <td>
  76. <code>expireUnit</code>
  77. </td>
  78. <td>
  79. <code>string</code>
  80. </td>
  81. <td>
  82. <var>never</var>
  83. </td>
  84. <td>
  85. The expiration type for the paste. Possible values are <code>view</code> (Number of Views) or a date value <code>minute</code>, <code>hour</code>, <code>day</code>, <code>month</code>, <code>year</code>
  86. </td>
  87. </tr>
  88. <tr>
  89. <td>
  90. <code>expireLength</code>
  91. </td>
  92. <td>
  93. <code>int</code>
  94. </td>
  95. <td>
  96. <var>1</var>
  97. </td>
  98. <td>
  99. The length of whatever unit you choose before the paste is deleted.
  100. </td>
  101. </tr>
  102. <tr>
  103. <td>
  104. <code>password</code>
  105. </td>
  106. <td>
  107. <code>string</code>
  108. </td>
  109. <td>
  110. <var>NULL</var>
  111. </td>
  112. <td>
  113. Specify a password to encrypt and lock the paste with.
  114. </td>
  115. </tr>
  116. <tr>
  117. <td>
  118. <code>hide</code>
  119. </td>
  120. <td>
  121. <code>bool</code>
  122. </td>
  123. <td>
  124. <var>false</var>
  125. </td>
  126. <td>
  127. If the paste should be visible in the most recent pastes list.
  128. </td>
  129. </tr>
  130. <tr>
  131. <td>
  132. <code>doNotTrack</code>
  133. </td>
  134. <td>
  135. <code>bool</code>
  136. </td>
  137. <td>
  138. <var>false</var>
  139. </td>
  140. <td>
  141. If you do not want the api request to be tracked as defined in the privacy policy.
  142. </td>
  143. </tr>
  144. </tbody>
  145. </table>
  146. <h4>Response</h4>
  147. <pre><code>{"result":{"id":<var>id</var>, "url":"<var>url</var>", "title":"<var>title</var>", "syntax":"<var>text</var>", "expiration":"<var>datetime</var>", "password":"<var>password</var>"}}</code></pre>
  148. <table>
  149. <thead>
  150. <tr>
  151. <th>Name</th>
  152. <th>Type</th>
  153. <th>Description</th>
  154. </tr>
  155. </thead>
  156. <tbody>
  157. <tr>
  158. <td>
  159. <code>id</code>
  160. </td>
  161. <td>
  162. <code>string</code>
  163. </td>
  164. <td>
  165. The id of the paste.
  166. </td>
  167. </tr>
  168. <tr>
  169. <td>
  170. <code>url</code>
  171. </td>
  172. <td>
  173. <code>string</code>
  174. </td>
  175. <td>
  176. The direct url to the paste.
  177. </td>
  178. </tr>
  179. <tr>
  180. <td>
  181. <code>title</code>
  182. </td>
  183. <td>
  184. <code>string</code>
  185. </td>
  186. <td>
  187. The title of the paste.
  188. </td>
  189. </tr>
  190. <tr>
  191. <td>
  192. <code>syntax</code>
  193. </td>
  194. <td>
  195. <code>string</code>
  196. </td>
  197. <td>
  198. The syntax of the pasted code.
  199. </td>
  200. </tr>
  201. <tr>
  202. <td>
  203. <code>expiration</code>
  204. </td>
  205. <td>
  206. <code>datetime</code>
  207. </td>
  208. <td>
  209. The date of expiration of the paste.
  210. </td>
  211. </tr>
  212. <tr>
  213. <td>
  214. <code>password</code>
  215. </td>
  216. <td>
  217. <code>string</code>
  218. </td>
  219. <td>
  220. The password of the paste.
  221. </td>
  222. </tr>
  223. </tbody>
  224. </table>
  225. <h4>Example</h4>
  226. <pre><code>$ curl --data "title=Paste%20Title&expireUnit=view&expireLength=3" --data-urlencode "code=This is my test code." @Url.SubRouteUrl("api", "API.v1.Paste")</code></pre>
  227. <p>
  228. This will submit the paste with a title and expiration when the paste has viewed 3 times.
  229. </p>
  230. </div>
  231. </div>