Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

164 lines (155 sloc) 9.768 kb
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 Location
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 =='array')
input.array-entry(name='params[' + parameter.Name + ']', value=parameter.Default, placeholder=className, style="float: left; clear: both;")
input.add-array-entry(type='button', value='Add entry', name=parameter.Name)
- 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)
input(type='hidden', name='locations['+parameter.Name+']', value=parameter.Location || 'query')
td.type=parameter.Type
td.location
p=parameter.Location || 'query'
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['read-only'])
input(type='submit', id=method.MethodName, value='Try it!')
Jump to Line
Something went wrong with that request. Please try again.