aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-web/src/main/js/apps/api-documentation/templates/api-documentation-action.hbs
blob: bf2e964eab5775df00ce6d8f1478e29973771c75 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
<header class="page-header">
  <h3 class="page-title big">{{#if post}}POST{{else}}GET{{/if}} {{this.path}}/{{key}}</h3>

  <div class="page-actions">
    {{#if internal}}
      <span class="spacer-right">
        <span class="badge" data-toggle="tooltip" title="{{t 'api_documentation.internal_tooltip'}}">internal</span>
      </span>
    {{/if}}
    {{#if deprecatedSince}}
      <span class="spacer-right">
        <span class="badge badge-danger" data-toggle="tooltip"
              title="{{t 'api_documentation.deprecation_tooltip'}}">Deprecated since {{deprecatedSince}}</span>
      </span>
    {{/if}}
    {{#if since}}
      <span class="spacer-right">
        <span class="note">Since {{since}}</span>
      </span>
    {{/if}}

    <a class="js-permalink icon-link" href="{{link '/api_documentation/' this.path '/' key}}" target="_blank"></a>
  </div>
</header>

<div class="markdown">{{{description}}}</div>

{{#if params}}
  <h4 class="spacer-top little-spacer-bottom">Parameters</h4>
  <table class="width-100 data zebra">
    {{#each params}}
      <tr>
        <td style="width: 10em;">
          <code>{{key}}</code>
          <div class="note">{{#if required}}required{{else}}optional{{/if}}</div>
          {{#if since}}
            <div class="note">since {{since}}</div>
          {{/if}}
          {{#if deprecatedSince}}
            <span class="badge badge-danger little-spacer-top" data-toggle="tooltip"
                  title="{{t 'api_documentation.deprecation_tooltip'}}">deprecated since {{deprecatedSince}}</span>
          {{/if}}
        </td>
        <td>
          <div class="markdown">{{{description}}}</div>

          {{#if possibleValues}}
            <p class="little-spacer-top">
              <strong>Possible values:</strong>
            </p>
            <ul class="list-styled">
              {{#each possibleValues}}
                <li class="little-spacer-top"><code>{{this}}</code></li>
              {{/each}}
            </ul>
          {{/if}}

          {{#if defaultValue}}
            <p class="little-spacer-top">
              <strong>Default value:</strong> <code>{{defaultValue}}</code>
            </p>
          {{/if}}

          {{#if exampleValue}}
            <p class="little-spacer-top">
              <strong>Example value:</strong> <code>{{exampleValue}}</code>
            </p>
          {{/if}}
        </td>
      </tr>
    {{/each}}
  </table>
{{/if}}

{{#if hasResponseExample}}
  <h4 class="spacer-top">
    Example Response
    {{#if responseExample}}
      <a class="js-hide-response-example little-spacer-left" href="#">Hide</a>
    {{else}}
      <a class="js-show-response-example little-spacer-left" href="#">Show</a>
    {{/if}}
  </h4>

  {{#if responseExample}}
    <div class="little-spacer-top">
      <pre style="white-space: pre-wrap;">{{responseExample}}</pre>
    </div>
  {{/if}}
{{/if}}