Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: 081c2bc55f
Fetching contributors…

Cannot retrieve contributors at this time

file 176 lines (168 sloc) 10.325 kb
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 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176
h1=apiInfo.name
- if (session.authed && apiInfo.oauth && apiInfo.oauth.type =='three-legged')
    - var authed ='authed'
- else
    - var authed =''


form#credentials
    input(type='hidden', name='apiName', value=apiName)
    - if (apiInfo.auth)
        section(class='credentials ' + authed)
         - if (authed && apiInfo.oauth)
             span Authenticated with OAuth
             img(src='/images/accept.png')
         - else
             h2 API Credentials
               img(src='/images/key.png')

             - if (apiInfo.oauth)
                 input(type='hidden', name='oauth', value='authrequired')

             - if (apiInfo.auth.defaultKey)
                 - var defaultKey =apiInfo.auth.defaultKey
             - else
                 - var defaultKey =''

             - if (apiInfo.auth.defaultSecret)
                 - var defaultSecret =apiInfo.auth.defaultSecret
             - else
                 - var defaultSecret =''
             div
                 label(for='key') API Key
                 input(id='key', name='key', value=defaultKey, style='color=#EEEEEE')
             div
                 - if (apiInfo.oauth || apiInfo.signature)
                     label(for='secret') Shared Secret
                     input(id='secret', name='secret', value=defaultSecret, style='color=#EEEEEE')
             - if (apiInfo.oauth && apiInfo.oauth.type !='two-legged')
                 div
                    input(name='oauth', value='Authenticate with OAuth', type='submit', id='oauth-auth')

div(id='controls')
    ul
        li
            a#toggle-endpoints(href='#') Toggle All Endpoints
        li
            a#toggle-methods(href='#') Toggle All Methods

ul
    - each endpoint in apiDefinition.endpoints
        li.endpoint
            h3.title
                span.name=endpoint.name
                ul.actions
                    li.list-methods
                        a(href='#') List Methods
                    li.expand-methods
                        a(href='#') Expand Methods
            - if (endpoint.methods.length)
            ul.methods.hidden
                - each method in endpoint.methods
                    - var httpmethod =method.HTTPMethod.toLowerCase()
                    - if (method.RequiresOAuth ==='Y' || method.RequiresOAuth ===true)
                        - var secure ='authrequired'
                    - else
                        - var secure =''
                    li(class='method ' + httpmethod + ' ' + secure)
                        div.title
                            span.http-method #{method.HTTPMethod}
                            span.name #{method.MethodName}
                            span.uri #{method.URI}
                        form.hidden
                            input(type='hidden', name='httpMethod', value=method.HTTPMethod)
                            input(type='hidden', name='oauth', value=secure)
                            input(type='hidden', name='methodUri', value=method.URI)

                            span.description #{method.Synopsis}
                            br
                            br
                            - if (method.parameters.length > 0)
                                table.parameters
                                    thead
                                        tr
                                            th Parameter
                                            th Value
                                            th Type
                                            th Description
                                    tbody
                                        - var paramCount =0
                                        - each parameter in method.parameters
                                            - paramCount++
                                            div(id='param' + paramCount)
                                              - if (parameter.Required =='Y')
                                                  - var required =true
                                                  - var className ='required'
                                              - else
                                                  - var required =false
                                                  - var className =''
                                              tr(class=className)
                                                  td.name=parameter.Name
                                                  td.parameter
                                                      - if (parameter.Type =='enumerated')
                                                          select(name='params[' + parameter.Name + ']', placeholder=className)
                                                            - if (parameter.Default =='')
                                                                option(value='')
                                                            - each choice in parameter.EnumeratedList
                                                                - if (parameter.Default ==choice)
                                                                        option(value=choice, selected=true) #{choice}
                                                                - else
                                                                        option(value=choice) #{choice}
                                                      - else if (parameter.Type =='boolean')
                                                           select(name='params[' + parameter.Name + ']', placeholder=className)
                                                                - if (parameter.Default =='')
                                                                        option(value='')
                                                                - each choice in [apiInfo.booleanTrueVal,apiInfo.booleanFalseVal]
                                                                   - if (parameter.Default ==choice)
                                                                           option(value=choice, selected=true) #{choice}
                                                                   - else
                                                                           option(value=choice) #{choice}
                                                      - else
                                                          input(name='params[' + parameter.Name + ']', value=parameter.Default, placeholder=className)
                                                  td.type=parameter.Type
                                                  td.description
                                                      p=parameter.Description || 'No description'
                                                      - if (parameter.Type =='enumerated' && parameter.EnumeratedDescription)
                                                          dl.clearfix
                                                              - each description, choice in parameter.EnumeratedDescription
                                                                  dt #{choice}
                                                                  dd #{description}
                            - if (method.headers && method.headers.length > 0)
                                div.headers
                                    h4.title
                                        div.indicator
                                        span Headers
                                    div.fields
                                        table
                                            colgroup
                                                col(class='name')
                                                col(class='value')
                                                col(class='remove')
                                            thead
                                                tr
                                                    th Name
                                                    th(colspan='2') Value
                                            tbody
                                                tr
                                                    td
                                                        input(name='headerNames[]', placeholder='Name')
                                                    td
                                                        input(name='headerValues[]', placeholder='Value')
                                                    td
                                                        a(href='#', class='remove') Remove
                                        a(href='#', class='add-headers') Add Header
                                    // Create header fields and button to add/remove headers.
                            - if (method.ExpectResponses && method.ExpectResponses.length > 0)
                                div.expect-responses
                                    h4.title
                                        div.indicator
                                        span Expect Responses
                                    div.fields
                                        table
                                            thead
                                                tr
                                                    th Format
                                                    th Schema
                                            tbody
                                                - var responseCount =0
                                                - each response in method.ExpectResponses
                                                    - responseCount++
                                                    div(id='response' + responseCount)
                                                        tr
                                                            td.format=response.Format
                                                            td.schema
                                                                pre(class='prettyprint')!=JSON.stringify(response.Schema, null, 2)
                            - if (!method['read-only'])
                                input(type='submit', id=method.MethodName, value='Try it!')
Something went wrong with that request. Please try again.