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.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217
  1. @model Teknik.Areas.Help.ViewModels.HelpViewModel
  2. @*@using Teknik.Pygments*@
  3. <bundle src="css/help.min.css" append-version="true"></bundle>
  4. <div class="container">
  5. <ol class="breadcrumb">
  6. <li><a href="@Url.SubRouteUrl("help", "Help.Index")">Help Index</a></li>
  7. <li><a href="@Url.SubRouteUrl("help", "Help.API", new { version = string.Empty, service = string.Empty })">API</a></li>
  8. <li>v1</li>
  9. <li class="active"><a href="#">Paste Service</a></li>
  10. </ol>
  11. <div class="row api">
  12. <h2><b>Paste Service</b></h2>
  13. <hr>
  14. <p>This is a description of the API commands available for the Paste service.</p>
  15. <h3>Submit a Paste</h3>
  16. <pre><code>POST @Url.SubRouteUrl("api", "API.v1.Paste")</code></pre>
  17. <h4>Parameters</h4>
  18. <table>
  19. <thead>
  20. <tr>
  21. <th>Name</th>
  22. <th>Type</th>
  23. <th>Default</th>
  24. <th>Description</th>
  25. </tr>
  26. </thead>
  27. <tbody>
  28. <tr>
  29. <td>
  30. <code>code</code>
  31. </td>
  32. <td>
  33. <code>string</code>
  34. </td>
  35. <td>
  36. <var>NULL</var>
  37. </td>
  38. <td>
  39. <strong>Required</strong>
  40. The text that will be submitted as the paste content.
  41. </td>
  42. </tr>
  43. <tr>
  44. <td>
  45. <code>title</code>
  46. </td>
  47. <td>
  48. <code>string</code>
  49. </td>
  50. <td>
  51. <var>NULL</var>
  52. </td>
  53. <td>
  54. The title for the paste.
  55. </td>
  56. </tr>
  57. <tr>
  58. <td>
  59. <code>syntax</code>
  60. </td>
  61. <td>
  62. <code>string</code>
  63. </td>
  64. <td>
  65. text
  66. </td>
  67. <td>
  68. <div class="row">
  69. <div class="col-sm-12">The syntax of the pasted code.</div>
  70. </div>
  71. <br />
  72. <div class="row">
  73. <div class="col-sm-4">This can be one of the following:</div>
  74. <div class="col-sm-8">
  75. <select name="syntax" id="syntax" class="form-control">
  76. @foreach (var format in HighlightHelper.Languages.GroupBy(l => l.Value).ToList())
  77. {
  78. <!option value="@(format?.FirstOrDefault().Key)">@(format?.Key)</!option>
  79. }
  80. </select>
  81. </div>
  82. </div>
  83. </td>
  84. </tr>
  85. <tr>
  86. <td>
  87. <code>expireUnit</code>
  88. </td>
  89. <td>
  90. <code>string</code>
  91. </td>
  92. <td>
  93. <var>never</var>
  94. </td>
  95. <td>
  96. 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>
  97. </td>
  98. </tr>
  99. <tr>
  100. <td>
  101. <code>expireLength</code>
  102. </td>
  103. <td>
  104. <code>int</code>
  105. </td>
  106. <td>
  107. <var>1</var>
  108. </td>
  109. <td>
  110. The length of whatever unit you choose before the paste is deleted.
  111. </td>
  112. </tr>
  113. <tr>
  114. <td>
  115. <code>password</code>
  116. </td>
  117. <td>
  118. <code>string</code>
  119. </td>
  120. <td>
  121. <var>NULL</var>
  122. </td>
  123. <td>
  124. Specify a password to encrypt and lock the paste with.
  125. </td>
  126. </tr>
  127. </tbody>
  128. </table>
  129. <h4>Response</h4>
  130. <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>
  131. <table>
  132. <thead>
  133. <tr>
  134. <th>Name</th>
  135. <th>Type</th>
  136. <th>Description</th>
  137. </tr>
  138. </thead>
  139. <tbody>
  140. <tr>
  141. <td>
  142. <code>id</code>
  143. </td>
  144. <td>
  145. <code>string</code>
  146. </td>
  147. <td>
  148. The id of the paste.
  149. </td>
  150. </tr>
  151. <tr>
  152. <td>
  153. <code>url</code>
  154. </td>
  155. <td>
  156. <code>string</code>
  157. </td>
  158. <td>
  159. The direct url to the paste.
  160. </td>
  161. </tr>
  162. <tr>
  163. <td>
  164. <code>title</code>
  165. </td>
  166. <td>
  167. <code>string</code>
  168. </td>
  169. <td>
  170. The title of the paste.
  171. </td>
  172. </tr>
  173. <tr>
  174. <td>
  175. <code>syntax</code>
  176. </td>
  177. <td>
  178. <code>string</code>
  179. </td>
  180. <td>
  181. The syntax of the pasted code.
  182. </td>
  183. </tr>
  184. <tr>
  185. <td>
  186. <code>expiration</code>
  187. </td>
  188. <td>
  189. <code>datetime</code>
  190. </td>
  191. <td>
  192. The date of expiration of the paste.
  193. </td>
  194. </tr>
  195. <tr>
  196. <td>
  197. <code>password</code>
  198. </td>
  199. <td>
  200. <code>string</code>
  201. </td>
  202. <td>
  203. The password of the paste.
  204. </td>
  205. </tr>
  206. </tbody>
  207. </table>
  208. <h4>Example</h4>
  209. <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>
  210. <p>
  211. This will submit the paste with a title and expiration when the paste has viewed 3 times.
  212. </p>
  213. </div>
  214. </div>