-
Notifications
You must be signed in to change notification settings - Fork 2
/
request.tpl
85 lines (75 loc) · 2.72 KB
/
request.tpl
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
{{ $req := . }}
<div class="headling row">
<h4 id="request-{{ slugify $req.Name }}">
{{ $req.Name }}
<a href="#request-{{ slugify $req.Name }}"><i class="glyphicon glyphicon-link"></i></a>
</h4>
</div>
<div class="description">{{ markdown $req.Description }}</div>
<div class="basics">
<div class="url row">
<h5>HTTP Request</h5>
<div class="col-xs-12">
<code><span class="req-{{ $req.Method }} text-lg">{{ $req.Method }}</span> {{ $req.URL }}</code>
</div>
</div>
<div class="headers row">
<h5>Headers</h5>
<dl class="dl-horizontal col-xs-12">
{{ range $req.Headers }}
<dt class="name col-md-3 col-xs-12">{{ .Name }}</dt>
<dd class="value col-md-9 col-xs-12">{{ .Value }}</dd>
{{ end }}
</dl>
</div>
<div class="payload row">
<h5>PayLoad</h5>
<div class="col-xs-12">
{{ with $payload := indentJSON $req.PayloadRaw }}
<pre><code>{{ $payload }}</code></pre>
{{ end }}
</div>
</div>
</div>
<div class="request examples clearfix">
<h5>Example</h5>
<!-- BEGIN example requests -->
<ul class="nav nav-tabs" role="tablist">
<li role="presentation" class="active"><a href="#request-{{ slugify $req.Name }}-example-curl" data-toggle="tab">Curl</a></li>
<li role="presentation"><a href="#request-{{ slugify $req.Name }}-example-http" data-toggle="tab">HTTP</a></li>
</ul>
<div class="tab-content">
<div class="tab-pane active" id="request-{{ slugify $req.Name }}-example-curl">
<pre><code class="hljs curl">{{ curlSnippet $req }}</code></pre>
</div>
<div class="tab-pane" id="request-{{ slugify $req.Name }}-example-http">
<pre><code class="hljs http">{{ httpSnippet $req }}</code></pre>
</div>
</div>
<!-- END example requests -->
<!-- BEGIN example responses -->
{{ with $req.Responses }}
<ul class="nav nav-tabs" role="tablist">
{{ range $index, $res := . }}
<li role="presentation" {{ if eq $index 0 }} class="active" {{ end }}>
<a href="#request-{{ slugify $req.Name }}-responses-{{ $res.ID }}" data-toggle="tab">
{{ if eq (len $req.Responses) 1 }} Response {{ else}} {{ $res.Name }} {{ end }}
</a>
</li>
{{ end }}
</ul>
<div class="tab-content">
{{ range $index, $res := . }}
<div class="tab-pane{{ if eq $index 0 }} active{{ end }}" id="request-{{ slugify $req.Name }}-responses-{{ $res.ID }}">
<span class="status status-{{ $res.StatusCode }}">Status {{ $res.StatusCode }}</span> {{ $res.Status }}
{{ if hasContent $res.Body }}
{{ with $example := indentJSON $res.Body }}
<pre><code>{{ $example }}</code></pre>
{{ end }}
{{ end }}
</div>
{{ end }}
</div>
{{ end }}
<!-- END example responses -->
</div>