-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #619 from HDRUK/Release
Release
- Loading branch information
Showing
122 changed files
with
11,405 additions
and
4,825 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
import auth from './resources/auth.docs'; | ||
import datarequest from './resources/datarequest.docs'; | ||
import publisher from './resources/publisher.docs'; | ||
import person from './resources/person.docs'; | ||
import search from './resources/search.docs'; | ||
import stats from './resources/stats.docs'; | ||
import message from './resources/message.docs'; | ||
import topic from './resources/topic.docs'; | ||
import dataset from './resources/dataset.docs'; | ||
import project from './resources/project.docs'; | ||
import paper from './resources/paper.docs'; | ||
import tool from './resources/tool.docs'; | ||
import course from './resources/course.docs'; | ||
import collection from './resources/collections.docs'; | ||
import activitylog from './resources/activitylog.docs'; | ||
|
||
import collectionsSchema from './schemas/collections.schema'; | ||
|
||
module.exports = { | ||
openapi: '3.0.1', | ||
info: { | ||
title: 'HDR UK API', | ||
description: 'API for Tools and artefacts repository.', | ||
version: '1.0.0', | ||
}, | ||
servers: [ | ||
{ | ||
url: 'https://api.www.healthdatagateway.org/', | ||
}, | ||
{ | ||
url: 'http://localhost:3001/', | ||
}, | ||
{ | ||
url: 'https://api.{environment}.healthdatagateway.org:{port}/', | ||
variables: { | ||
environment: { | ||
default: 'latest', | ||
description: 'The Environment name.', | ||
}, | ||
port: { | ||
enum: ['443'], | ||
default: '443', | ||
}, | ||
}, | ||
}, | ||
], | ||
security: [ | ||
{ | ||
oauth2: [], | ||
}, | ||
], | ||
paths: { | ||
...auth, | ||
...datarequest, | ||
...publisher, | ||
...person, | ||
...search, | ||
...stats, | ||
...message, | ||
...topic, | ||
...dataset, | ||
...project, | ||
...paper, | ||
...tool, | ||
...course, | ||
...collection, | ||
...activitylog, | ||
}, | ||
components: { | ||
securitySchemes: { | ||
oauth2: { | ||
type: 'oauth2', | ||
flows: { | ||
clientCredentials: { | ||
tokenUrl: 'https://api.www.healthdatagateway.org/oauth/token', | ||
scopes: {}, | ||
}, | ||
}, | ||
}, | ||
cookieAuth: { | ||
type: 'http', | ||
scheme: 'bearer', | ||
}, | ||
}, | ||
schemas: { | ||
Collections: { ...collectionsSchema }, | ||
}, | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,160 @@ | ||
module.exports = { | ||
'/api/v2/activitylog': { | ||
post: { | ||
summary: 'Search activity logs for a given dataset or data access request', | ||
security: [ | ||
{ | ||
cookieAuth: [], | ||
}, | ||
], | ||
requestBody: { | ||
required: true, | ||
content: { | ||
'application/json': { | ||
schema: { | ||
type: 'object', | ||
required: ['versionIds', 'type'], | ||
properties: { | ||
versionIds: { | ||
type: 'array', | ||
}, | ||
type: { | ||
type: 'array', | ||
}, | ||
}, | ||
example: { | ||
versionIds: ['618cd6170d111006c0550fa3', '618cd556f19753063504a492'], | ||
type: 'dataset', | ||
}, | ||
}, | ||
}, | ||
}, | ||
}, | ||
description: | ||
'Returns a list of activity logs for a given set of versionIds sorted into thier respective versions. Activity logs can either be for datasets or data access requests. The requesting user must be an admin user or a member of the custodian team to which the version IDs relate.', | ||
tags: ['Activity Logs'], | ||
responses: { | ||
200: { | ||
description: 'Successful response including the JSON payload.', | ||
}, | ||
401: { | ||
description: 'Unauthorised.', | ||
}, | ||
}, | ||
}, | ||
}, | ||
'/api/v2/activitylog/{type}': { | ||
post: { | ||
summary: 'Create a manual activity log for a data access requesr', | ||
security: [ | ||
{ | ||
cookieAuth: [], | ||
}, | ||
], | ||
parameters: [ | ||
{ | ||
in: 'path', | ||
name: 'type', | ||
required: true, | ||
description: 'The type of activity log. Functionality only exists in current API for data access requests.', | ||
schema: { | ||
type: 'string', | ||
example: 'data_request', | ||
}, | ||
}, | ||
], | ||
requestBody: { | ||
required: true, | ||
content: { | ||
'application/json': { | ||
schema: { | ||
type: 'object', | ||
required: ['description', 'timestamp', 'versionId'], | ||
properties: { | ||
description: { | ||
type: 'string', | ||
description: 'The text associated with the manual log.', | ||
}, | ||
timestamp: { | ||
type: 'string', | ||
format: 'date-time', | ||
description: 'Timestamp of when the log was created.', | ||
}, | ||
versionId: { | ||
type: 'string', | ||
description: 'The versionId of the data access request version the activity log relates to.', | ||
}, | ||
}, | ||
example: { description: 'Test', timestamp: '2021-11-11T12:03:49.714Z', versionId: '615b2ba0e33a38453bcf306b' }, | ||
}, | ||
}, | ||
}, | ||
}, | ||
description: | ||
'Creates a manual activity log for a data access request version. The user must be an admin user or a member of the custodian team to which the log relates.', | ||
tags: ['Activity Logs'], | ||
responses: { | ||
200: { | ||
description: 'Successful response including the updated JSON payload for the associated data access request version.', | ||
}, | ||
400: { | ||
description: 'Bad request, including missing information in request body.', | ||
}, | ||
401: { | ||
description: 'Unauthorised.', | ||
}, | ||
401: { | ||
description: 'Data access request for submitted version I', | ||
}, | ||
}, | ||
}, | ||
}, | ||
'/api/v2/activitylog/{type}/{id}': { | ||
delete: { | ||
summary: 'Delete a manually created activity log for a data access request', | ||
security: [ | ||
{ | ||
cookieAuth: [], | ||
}, | ||
], | ||
parameters: [ | ||
{ | ||
in: 'path', | ||
name: 'type', | ||
required: true, | ||
description: 'The type of activity log. Functionality only exists in current API for data access requests.', | ||
schema: { | ||
type: 'string', | ||
example: 'data_request', | ||
}, | ||
}, | ||
{ | ||
in: 'path', | ||
name: 'id', | ||
required: true, | ||
description: 'The id of the manually created activity log.', | ||
schema: { | ||
type: 'string', | ||
}, | ||
}, | ||
], | ||
description: | ||
'Deletes a manually created activity log for a data access request version. The user must be a member of the relevant custodian team or an admin user.', | ||
tags: ['Activity Logs'], | ||
responses: { | ||
200: { | ||
description: 'Successful deletion, including payload for updated version.', | ||
}, | ||
400: { | ||
description: 'Bad request - only manually created logs can be deleted.', | ||
}, | ||
401: { | ||
description: 'Unauthorised.', | ||
}, | ||
404: { | ||
description: 'Log not found for submitted version ID.', | ||
}, | ||
}, | ||
}, | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,122 @@ | ||
module.exports = { | ||
'/oauth/token': { | ||
post: { | ||
tags: ['Authorization'], | ||
description: | ||
'OAuth2.0 token endpoint responsible for issuing short-lived json web tokens (JWT) for access to secure Gateway APIs. For client credentials grant flow, a valid client id and secret must be provided to identify your application and provide the expected permissions. This type of authentication is reserved for team based connectivity through client applications and is not provided for human user access. For more information, contact the HDR-UK team.', | ||
requestBody: { | ||
required: true, | ||
content: { | ||
'application/json': { | ||
schema: { | ||
type: 'object', | ||
properties: { | ||
grant_type: { | ||
type: 'string', | ||
description: 'The OAuth2.0 grant type that will be used to provide authentication.', | ||
}, | ||
client_id: { | ||
type: 'string', | ||
description: | ||
'A unique identifer provided to your team by the HDR-UK team at the time of onboarding to the Gateway. Contact the HDR-UK team for issue of new credentials.', | ||
}, | ||
client_secret: { | ||
type: 'string', | ||
description: | ||
'A long (50 character) string provided by the HDR-UK team at the time of onboarding to the Gateway. Contact the HDR-UK team for issue of new credentials.', | ||
}, | ||
}, | ||
required: ['grant_type', 'client_secret', 'client_id'], | ||
}, | ||
examples: { | ||
'Client Credentials Grant Flow': { | ||
value: { | ||
grant_type: 'client_credentials', | ||
client_id: '2ca1f61a90e3547', | ||
client_secret: '3f80fecbf781b6da280a8d17aa1a22066fb66daa415d8befc1', | ||
}, | ||
}, | ||
}, | ||
}, | ||
}, | ||
}, | ||
responses: { | ||
200: { | ||
description: 'Successful response containing json web token (JWT) that will authorize an HTTP request against secured resources.', | ||
content: { | ||
'application/json': { | ||
schema: { | ||
type: 'object', | ||
properties: { | ||
access_token: { | ||
type: 'string', | ||
description: | ||
'The encoded json web token (JWT) that must be appended to the Authorization of subsequent API HTTP requests in order to access secured resources.', | ||
}, | ||
token_type: { | ||
type: 'string', | ||
description: 'The type of token issued, in this case, a json web token (JWT).', | ||
}, | ||
expires_in: { | ||
type: 'integer', | ||
description: 'The length of time in seconds before the issued JWT expires, defaulted to 900 seconds (15 minutes).', | ||
}, | ||
}, | ||
}, | ||
examples: { | ||
'Client Credentials Grant Flow': { | ||
value: { | ||
access_token: | ||
'Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJkYXRhIjp7Il9pZCI6IjYwMGJmYzk5YzhiZjcwMGYyYzdkNWMzNiIsInRpbWVTdGFtcCI2MTYxMjM4MzkwMzE5Nn0sImlhdCI6MTYxMjM4MzkwMywiZXhwIjoxNjEyMzg0ODAzfQ.-YvUBdjtJvdrRacz6E8-cYPQlum4TrEmiCFl8jO5a-M', | ||
token_type: 'jwt', | ||
expires_in: 900, | ||
}, | ||
}, | ||
}, | ||
}, | ||
}, | ||
}, | ||
400: { | ||
description: 'Failure response caused by incomplete or invalid client credentials being passed to the endpoint.', | ||
content: { | ||
'application/json': { | ||
schema: { | ||
type: 'object', | ||
properties: { | ||
success: { | ||
type: 'boolean', | ||
description: 'A field that indicates the API request failed.', | ||
}, | ||
message: { | ||
type: 'string', | ||
description: 'A message indicating that the request failed for a given reason.', | ||
}, | ||
}, | ||
}, | ||
examples: { | ||
'Invalid Client Credentials': { | ||
value: { | ||
success: false, | ||
message: 'Invalid client credentials were provided for the authorisation attempt', | ||
}, | ||
}, | ||
'Incomplete Client Credentials': { | ||
value: { | ||
success: false, | ||
message: 'Incomplete client credentials were provided for the authorisation attempt', | ||
}, | ||
}, | ||
'Invalid Grant Type': { | ||
value: { | ||
success: false, | ||
message: 'An invalid grant type has been specified', | ||
}, | ||
}, | ||
}, | ||
}, | ||
}, | ||
}, | ||
}, | ||
}, | ||
}, | ||
}; |
Oops, something went wrong.