new RESTClient()
The RESTClient is a singleton class that handles the connection and data exchange from the back-end REST API.
- Source:
Methods
-
auth_headers(jwt)
-
Method to add authorisation to the headers.
Parameters:
Name Type Description jwtthe user's json web token
- Source:
Returns:
- headers with authorisation field added
- Type
- JSON
-
<async> canClaim(recordID, userToken)
-
Determine if a user has permission to create a MaintenanceRequest for a FairsharingRecord.
Parameters:
Name Type Description recordIDInteger ID for the relevant FairsharingRecord.
userTokenString JWT of the logged in user
- Source:
Returns:
- Type
- Promise
-
<async> canEdit(recordID, userToken)
-
Determine if a user has permission to edit this record.
Parameters:
Name Type Description recordIDInteger ID for the relevant FairsharingRecord.
userTokenString JWT of the logged in user
- Source:
Returns:
- Type
- Promise
-
<async> claimRecord(recordID, userToken)
-
Attempt to create a MaintenanceRequest for a user for a FairsharingRecord.
Parameters:
Name Type Description recordIDInteger ID for the relevant FairsharingRecord.
userTokenString JWT of the logged in user
- Source:
Returns:
- Type
- Promise
-
<async> confirmAccount(token)
-
Validate the account given the corresponding token
Parameters:
Name Type Description tokenString the account token to validate
- Source:
Returns:
- Type
- Promise
-
<async> createAccount(userLogin)
-
Method to create a new user
Parameters:
Name Type Description userLoginObject the user account to create
- Source:
Returns:
response - server response
- Type
- Promise
-
<async> createGrant(grant, userToken)
-
Create a given grant
Parameters:
Name Type Description grantObject userTokenString the user jwt
- Source:
Returns:
- Type
- Promise
-
<async> createLicenceLink(licenceLink, token)
-
Create new a licence link
Parameters:
Name Type Description licenceLinkObject the licence link to create
tokenString the user token
- Source:
Returns:
- Type
- Promise
-
<async> createMessage(message, userToken)
-
Update the given message
Parameters:
Name Type Description messageObject the message to create
userTokenString the user jwt
- Source:
Returns:
- Type
- Promise
-
<async> createNewUserDefinedTag(term, token)
-
Create a new user defined tag in the database for users to tag their records.
Parameters:
Name Type Description termString the string value of the term
tokenString the user JWT
- Source:
Returns:
- Type
- Promise
-
<async> createOrganisation(organisation, userToken)
-
Create a given organisation
Parameters:
Name Type Description organisationObject userTokenString the user jwt
- Source:
Returns:
- Type
- Promise
-
<async> createOrganisationLink(organisationLink, userToken)
-
Create a new link between an organisation, a record and an optional grant.
Parameters:
Name Type Description organisationLinkObject the organisation link to create
userTokenString the user jwt
- Source:
Returns:
- Type
- Promise
-
<async> createRecord(record, jwt)
-
Post the given object to the API to create the corresponding record.
Parameters:
Name Type Description recordjwtString JWT of the logged in user
- Source:
Returns:
- Type
- Promise
-
<async> delete(jwt)
-
Delete the user's account (they must be logged in).
Parameters:
Name Type Description jwtString the user token to expire.
- Source:
Returns:
- Type
- Promise
-
<async> deleteLicenceLink(id, token)
-
Delete the given licence
Parameters:
Name Type Description idNumber id of the licence link to delete
tokenString the user token
- Source:
Returns:
- Type
- Promise
-
<async> deleteMessage(messageId, userToken)
-
Update the given message
Parameters:
Name Type Description messageIdString the ID of the message to delete
userTokenString the user jwt
- Source:
Returns:
- Type
- Promise
-
<async> deleteOrganisation(organisationId, userToken)
-
Delete the given organisation link
Parameters:
Name Type Description organisationIdNumber the id of the link to remove
userTokenString the user jwt
- Source:
Returns:
- Type
- Promise
-
<async> deleteOrganisationLink(linkID, userToken)
-
Delete the given organisation link
Parameters:
Name Type Description linkIDNumber the id of the link to remove
userTokenString the user jwt
- Source:
Returns:
- Type
- Promise
-
<async> deletePublicUser(userID, jwt)
-
Delete the user
Parameters:
Name Type Description userIDjwtString JWT of the logged in user
- Source:
Returns:
- Type
- Promise
-
<async> deleteRecord(id, token)
-
Delete Record
Parameters:
Name Type Description idNumber id of the record link to delete
tokenString the user token
- Source:
Returns:
- Type
- Promise
-
<async> deleteRelations(options)
-
Deletes the relationships as an array of items containing a targetID, a sourceID and a labelID
Parameters:
Name Type Description optionsObject the options to pass as {token: String, relations: Array}
- Source:
Returns:
- Type
- Promise
-
<async> editOrganisation(organisation, id, userToken)
-
Edit a given organisation
Parameters:
Name Type Description organisationObject idNumber userTokenString the user jwt
- Source:
Returns:
- Type
- Promise
-
<async> editPublicUser(newUser, jwt)
-
Edit the current logged in user profile
Parameters:
Name Type Description newUserObject the new values for the logged in user
jwtString JWT of the logged in user
- Source:
Returns:
- Type
- Promise
-
<async> editUser(newUser, jwt)
-
Edit the current logged in user profile
Parameters:
Name Type Description newUserObject the new values for the logged in user
jwtString JWT of the logged in user
- Source:
Returns:
- Type
- Promise
-
<async> executeQuery(query)
-
Trigger the given query with Axios
Parameters:
Name Type Description query- Source:
Returns:
- Type
- Promise.<*>
-
<async> extraMetadataFields(type, userToken)
-
Get the extra metadata fields for a RecordType
Parameters:
Name Type Description typeString name of the record type.
userTokenString the user jwt
- Source:
Returns:
- Type
- Promise
-
<async> getEditByMonth(token)
-
Get count of edits by month
Parameters:
Name Type Description tokenString the user token that needs to be a curator
- Source:
Returns:
- Type
- Promise
-
<async> getHomepageJsonld()
-
Get JSON+LD for homepage.
- Source:
Returns:
- Type
- Promise
-
<async> getProfileTypes()
-
Get the list of available profile types for a user.
- Source:
Returns:
- Type
- Promise
-
<async> getPublicUser(jwt, id)
-
Get the current user data
Parameters:
Name Type Description jwtid- Source:
Returns:
- Type
- Promise
-
<async> getRecordCreatedByMonth(token)
-
Get count of records created by month
Parameters:
Name Type Description tokenString the user token that needs to be a curator
- Source:
Returns:
- Type
- Promise
-
<async> getRecordsWoDOIs(token)
-
Get records without DOIS
Parameters:
Name Type Description tokenString the user token that needs to be a curator
- Source:
Returns:
- Type
- Promise
-
<async> getStatisticsData()
-
Get statistics data without users
- Source:
Returns:
- Type
- Promise
-
<async> getUser(jwt)
-
Get the current user data
Parameters:
Name Type Description jwt- Source:
Returns:
- Type
- Promise
-
<async> getUsersList(jwt)
-
Get all users list
Parameters:
Name Type Description jwt- Source:
Returns:
- Type
- Promise
-
<async> getZenodoSearch(call, userToken)
-
Get Zenodo call
Parameters:
Name Type Description callString userTokenString the user jwt
- Source:
Returns:
- Type
- Promise
-
<async> login(username, password)
-
Method to log in the user
Parameters:
Name Type Description usernamename of the user
passwordpassword of the user
- Source:
Returns:
- the response of the server
- Type
- Promise
-
<async> logout(jwt)
-
Logout the user from the back, expiring the current jwt.
Parameters:
Name Type Description jwtString the user token to expire.
- Source:
Returns:
- Type
- Promise
-
<async> requestResetPwd(email)
-
Method to send a reset password link to the given email address
Parameters:
Name Type Description emailString to send the link to
- Source:
Returns:
- Type
- Promise
-
<async> resendConfirmation(user)
-
Resend the validation link for a given user
Parameters:
Name Type Description userObject contains the email of the user.
- Source:
Returns:
- Type
- Promise
-
<async> resetPassword(user)
-
Reset the password of the given user
Parameters:
Name Type Description userObject contains the new pwd, repeated pwd and token.
- Source:
Returns:
- Type
- Promise
-
<async> resetPasswordWithoutToken(jwt, user)
-
Changes the password of the logged in user
Parameters:
Name Type Description jwtString the user token
userObject contains the current, new and repeated new password
- Source:
Returns:
- Type
- Promise
-
<async> reviewRecord(recordID, userToken)
-
Attempt to create a RecordReview for a user for a FairsharingRecord.
Parameters:
Name Type Description recordIDInteger ID for the relevant FairsharingRecord.
userTokenString JWT of the logged in user
- Source:
Returns:
- Type
- Promise
-
<async> saveRelations(options)
-
Saves the relationships as an array of items containing a targetID, a sourceID and a labelID
Parameters:
Name Type Description optionsObject the options to pass as {token: String, relations: Array}
- Source:
Returns:
- Type
- Promise
-
<async> sendOrcidVerification(user)
-
Send the verification link for a given user
Parameters:
Name Type Description userObject contains the email, uid, identifier of the user.
- Source:
Returns:
- Type
- Promise
-
<async> updateLicenceLink(licenceLink, token)
-
Update the licenceLink
Parameters:
Name Type Description licenceLinkObject the new values for the licence link
tokenString the user token
- Source:
Returns:
- Type
- Promise
-
<async> updateMessage(message, userToken)
-
Update the given message
Parameters:
Name Type Description messageObject the message to update containing the ID to target and the new values
userTokenString the user jwt
- Source:
Returns:
- Type
- Promise
-
<async> updateOrganisationLink(organisationLink, linkID, userToken)
-
Update the organisationLink given from linkID input with the given organisationLink
Parameters:
Name Type Description organisationLinkObject the new organisation link value
linkIDNumber ID of the organisationLink to update
userTokenString the user jwt
- Source:
Returns:
- Type
- Promise
-
<async> updateRecord(record)
-
Update the given record
Parameters:
Name Type Description recordObject the record to update containing the ID to target, the new values and the user token
- Source:
Returns:
- Type
- Promise
-
<async> updateStatusMaintenanceRequest(maintenanceRequest, newStatus, userToken)
-
Update the maintenanceRequest given the new status value
Parameters:
Name Type Description maintenanceRequestNumber ID of the maintenanceRequest to update
newStatusstring new status to update
userTokenString the user jwt
- Source:
Returns:
- Type
- Promise
-
<async> validateToken(jwt)
-
Verify that the given JWT is still valid
Parameters:
Name Type Description jwtString the token to validate
- Source:
Returns:
- Type
- Promise
-
<async> verifyPassword(password)
-
Verify the validity of the given password
Parameters:
Name Type Description passwordString the password to test
- Source:
Returns:
- Type
- Promise