Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
M
Motion Bank API
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
5
Issues
5
List
Boards
Labels
Service Desk
Milestones
Iterations
Merge Requests
0
Merge Requests
0
Requirements
Requirements
List
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Test Cases
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issue
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Motion Bank
Services
Motion Bank API
Commits
1ac7c40a
Commit
1ac7c40a
authored
May 10, 2019
by
Anton
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add PBA endpoints, update changelog
parent
5d6334ee
Pipeline
#10780
passed with stage
in 12 minutes and 7 seconds
Changes
6
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
79 additions
and
0 deletions
+79
-0
CHANGELOG.md
CHANGELOG.md
+4
-0
config/custom-environment-variables.json
config/custom-environment-variables.json
+7
-0
config/default.json
config/default.json
+7
-0
config/dev.json
config/dev.json
+7
-0
src/index.js
src/index.js
+8
-0
src/lib/pba.js
src/lib/pba.js
+46
-0
No files found.
CHANGELOG.md
View file @
1ac7c40a
...
@@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
...
@@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]
## [Unreleased]
### Added
-
Basic
[
Pina Bausch Archive (PBA)
](
http://www.pinabausch.org
)
proxy endpoints for pieces and titles
### Updated
### Updated
-
Updated
[
mbjs-data-models
](
https://gitlab.rlp.net/motionbank/mbjs/data-models
)
-
Updated
[
mbjs-data-models
](
https://gitlab.rlp.net/motionbank/mbjs/data-models
)
...
...
config/custom-environment-variables.json
View file @
1ac7c40a
...
@@ -55,5 +55,12 @@
...
@@ -55,5 +55,12 @@
"jwt"
:
{
"jwt"
:
{
"audience"
:
"AUTH0_AUDIENCE"
"audience"
:
"AUTH0_AUDIENCE"
}
}
},
"pba"
:
{
"baseUrl"
:
"PBA_BASE_URL"
,
"credentials"
:
{
"username"
:
"PBA_USERNAME"
,
"password"
:
"PBA_PASSWORD"
}
}
}
}
}
config/default.json
View file @
1ac7c40a
...
@@ -66,5 +66,12 @@
...
@@ -66,5 +66,12 @@
"apiKeys"
:
{
"apiKeys"
:
{
"youtube"
:
null
,
"youtube"
:
null
,
"vimeo"
:
null
"vimeo"
:
null
},
"pba"
:
{
"baseUrl"
:
null
,
"credentials"
:
{
"username"
:
null
,
"password"
:
null
}
}
}
}
}
config/dev.json
View file @
1ac7c40a
...
@@ -64,5 +64,12 @@
...
@@ -64,5 +64,12 @@
"apiKeys"
:
{
"apiKeys"
:
{
"youtube"
:
null
,
"youtube"
:
null
,
"vimeo"
:
null
"vimeo"
:
null
},
"pba"
:
{
"baseUrl"
:
null
,
"credentials"
:
{
"username"
:
null
,
"password"
:
null
}
}
}
}
}
src/index.js
View file @
1ac7c40a
...
@@ -52,6 +52,14 @@ const setup = async function () {
...
@@ -52,6 +52,14 @@ const setup = async function () {
const
archives
=
require
(
'
./lib/archives
'
)
const
archives
=
require
(
'
./lib/archives
'
)
archives
.
setupArchives
(
api
,
maps
,
annotations
,
cells
)
archives
.
setupArchives
(
api
,
maps
,
annotations
,
cells
)
/**
* Configure PBA
*/
const
PBA
=
require
(
'
./lib/pba
'
),
pba
=
new
PBA
(
api
)
await
api
.
start
()
await
api
.
start
()
}
}
...
...
src/lib/pba.js
0 → 100644
View file @
1ac7c40a
const
config
=
require
(
'
config
'
),
send
=
require
(
'
@polka/send-type
'
),
TinyEmitter
=
require
(
'
tiny-emitter
'
),
axios
=
require
(
'
axios
'
)
class
PBA
extends
TinyEmitter
{
constructor
(
api
)
{
super
()
const
_this
=
this
api
.
app
.
get
(
'
/pba/pieces
'
,
(
req
,
res
)
=>
_this
.
getPiecesHandler
(
req
,
res
))
api
.
app
.
get
(
'
/pba/pieces/:piece_id/titles
'
,
(
req
,
res
)
=>
_this
.
getTitlesForPieceHandler
(
req
,
res
))
}
async
_performRequest
(
path
)
{
const
result
=
await
axios
.
get
(
`
${
config
.
pba
.
baseUrl
}
/
${
path
}
`
,
{
auth
:
config
.
pba
.
credentials
})
return
result
.
data
}
async
getPiecesHandler
(
req
,
res
)
{
const
result
=
await
this
.
_performRequest
(
'
pieces
'
)
this
.
_response
(
req
,
res
,
result
.
pieces
)
}
async
getTitlesForPieceHandler
(
req
,
res
)
{
const
result
=
await
this
.
_performRequest
(
`titles/
${
req
.
params
.
piece_id
}
`
)
this
.
_response
(
req
,
res
,
result
.
titles
)
}
_response
(
req
,
res
,
data
=
{})
{
this
.
emit
(
'
message
'
,
{
method
:
req
.
method
,
id
:
data
.
id
})
if
(
typeof
res
===
'
function
'
)
res
({
data
})
else
if
(
typeof
res
===
'
undefined
'
)
return
Promise
.
resolve
({
data
})
else
send
(
res
,
200
,
data
)
}
_errorResponse
(
res
,
code
,
message
=
undefined
)
{
if
(
typeof
res
===
'
function
'
)
res
({
error
:
true
,
code
})
else
if
(
typeof
res
===
'
undefined
'
)
return
Promise
.
resolve
({
error
:
true
,
code
})
else
send
(
res
,
code
,
message
)
}
}
module
.
exports
=
PBA
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment