better support for rendering the public api endpoints. will be moving core.blockstack.org over to this now

This commit is contained in:
Aaron Blankstein
2017-07-31 11:46:31 -04:00
parent b574defe95
commit 3d988dd4b2
3 changed files with 114 additions and 7 deletions

View File

@@ -49,7 +49,7 @@ mixin Nav(onlyPublic)
- if (onlyPublic){
- myGroups = self.api.resourceGroups.filter( filter_public_resourcegroups )
- }else{
- myGroups = self.api.resourceGroups
- myGroups = self.api.resourceGroups.filter( filter_core_resourcegroups )
- }
each resourceGroup in myGroups || []
.resource-group
@@ -65,14 +65,14 @@ mixin Nav(onlyPublic)
- if (onlyPublic){
- myResources = resourceGroup.resources.filter( filter_public_resources )
- }else{
- myResources = resourceGroup.resources
- myResources = resourceGroup.resources.filter( filter_core_resources )
- }
each resource in myResources || []
li
- if (onlyPublic){
- myActions = resource.actions.filter( filter_public_actions )
- }else{
- myActions = resource.actions
- myActions = resource.actions.filter( filter_core_actions )
- }
if !self.condenseNav || (myActions.length != 1)
a(href=resource.elementLink)!= resource.name || 'Resource'
@@ -229,7 +229,7 @@ mixin Content()
+Examples(resourceGroup, resource, action)
- function filter_public_actions(x){
- return x.description.includes('+ Public Endpoint')
- return (x.description.includes('+ Public Endpoint') || x.description.includes('+ Public Only Endpoint'))
- }
- function filter_public_resources(x){
- return (x.actions.filter( filter_public_actions ).length > 0)
@@ -237,6 +237,15 @@ mixin Content()
- function filter_public_resourcegroups(x){
- return (x.resources.filter( filter_public_resources ).length > 0)
- }
- function filter_core_actions(x){
- return !(x.description.includes('+ Public Only Endpoint'))
- }
- function filter_core_resources(x){
- return (x.actions.filter( filter_core_actions ).length > 0)
- }
- function filter_core_resourcegroups(x){
- return (x.resources.filter( filter_core_resources ).length > 0)
- }
mixin ContentTriple(onlyPublic)
.middle
@@ -256,7 +265,7 @@ mixin ContentTriple(onlyPublic)
- if (onlyPublic){
- myGroups = self.api.resourceGroups.filter( filter_public_resourcegroups )
- }else{
- myGroups = self.api.resourceGroups
- myGroups = self.api.resourceGroups.filter( filter_core_resourcegroups )
- }
each resourceGroup in myGroups || []
.middle
@@ -271,7 +280,7 @@ mixin ContentTriple(onlyPublic)
- if (onlyPublic){
- myResources = resourceGroup.resources.filter( filter_public_resources )
- }else{
- myResources = resourceGroup.resources
- myResources = resourceGroup.resources.filter( filter_core_resources )
- }
each resource in myResources || []
if resource.public != null
@@ -288,7 +297,7 @@ mixin ContentTriple(onlyPublic)
- if (onlyPublic){
- myActions = resource.actions.filter( filter_public_actions )
- }else{
- myActions = resource.actions
- myActions = resource.actions.filter( filter_core_actions )
- }
each action in myActions || []
if action.examples

View File

@@ -1,5 +1,6 @@
doctype
include mixins.jade
html

View File

@@ -779,3 +779,100 @@ Not implemented.
Not implemented.
## Launch namespace [PUT /v1/namespaces/{tld}]
Not implemented.
# Group Resolver Endpoints
## Lookup User [GET /v2/users/{username}]
Lookup and resolver a user's profile. Defaults to the `id` namespace.
+ Public Only Endpoint
+ Legacy Endpoint
+ Parameters
+ username: fredwilson (string) - username to lookup
+ Response 200 (application/json)
{
"fredwilson": {
"profile": {
"avatar": {
"url": "https://s3.amazonaws.com/kd4/fredwilson1"
},
"bio": "I am a VC",
"bitcoin": {
"address": "1Fbi3WDPEK6FxKppCXReCPFTgr9KhWhNB7"
},
"cover": {
"url": "https://s3.amazonaws.com/dx3/fredwilson"
},
"facebook": {
"proof": {
"url": "https://facebook.com/fred.wilson.963871/posts/10100401430876108"
},
"username": "fred.wilson.963871"
},
"graph": {
"url": "https://s3.amazonaws.com/grph/fredwilson"
},
"location": {
"formatted": "New York City"
},
"name": {
"formatted": "Fred Wilson"
},
"twitter": {
"proof": {
"url": "https://twitter.com/fredwilson/status/533040726146162689"
},
"username": "fredwilson"
},
"v": "0.2",
"website": "http://avc.com"
}
}
}
## Profile Search [GET /v1/search?query={query}]
Searches for a profile using a search string.
+ Public Only Endpoint
+ Parameters
+ query: wenger (string) - the search query
+ Response 200 (application/json)
+ Body
{
"results": [
{
"profile": {
"@type": "Person",
"account": [
{
"@type": "Account",
"identifier": "albertwenger",
"proofType": "http",
"service": "twitter"
},
{
"@type": "Account",
"identifier": "albertwenger",
"proofType": "http",
"service": "facebook"
},
{
"@type": "Account",
"identifier": "albertwenger",
"proofType": "http",
"service": "github"
},
{
"@type": "Account",
"identifier": "1QHDGGLEKK7FZWsBEL78acV9edGCTarqXt",
"role": "payment",
"service": "bitcoin"
}
],
"address": {
"@type": "PostalAddress",
"addressLocality": "New York"
},
"description": "VC at USV.com",
...
}