Manual Reference Source Test
import ProjectContentService from 'clinical6/src/services/ProjectContentService.js'
public class | source

ProjectContentService

Service that includes generic functions to pull, update, and create data.

This will only work with v2 content such as: Api | V2 | Agreements Api | V2 | Reminder | Rules Api | V2 | SiteStart | Addresses Api | V2 | SiteStart | LabAccreditations Api | V2 | SiteStart | LabDirectors Api | V2 | SiteStart | Labs Api | V2 | SiteStart | PrimaryLicenses Api | V2 | SiteStart | PrimaryMedicalBoards Api | V2 | SiteStart | SiteLabs Api | V2 | SiteStart | Sites Api | V2 | SiteStart | Studies Api | V2 | SiteStart | StudyAddress Api | V2 | SiteStart | StudyIrb Api | V2 | SiteStart | StudyLab

Method Summary

Public Methods
public

delete(version: String, ownerType: String, owner: Number, type: String, id: Number): Promise

Generic function that deletes data on the server.

public

deleteProject(project: Object, type: String, id: Number): Promise

Delete a sibling or child based on the ProjectContent type and/or child type

public

get(version: String, ownerType: String, owner: Number, contentType: String, contentId: Number): Promise

Generic function that retrieves data.

public

getProject(project: Object, contentType: String, contentId: Number): Promise

Get Data via ProjectContent helper class

public

insert(version: String, ownerType: String, owner: Number, contentType: String, data: Object): Promise

Generic function that updates data on the server.

public

insertProject(project: Object, type: String, data: Object): Promise

Insert a new sibling or child based on the ProjectContent type and/or child type

public

update(version: String, ownerType: String, owner: Number, contentType: String, contentId: Number, data: Object): Promise

Generic function that updates data on the server.

public

updateProject(project: Object, type: String, id: Number, data: Object): Promise

Update ProjectContent information based on the ProjectContent Helper class.

Public Methods

public delete(version: String, ownerType: String, owner: Number, type: String, id: Number): Promise source

Generic function that deletes data on the server.

This should not be called directly but rather be called using the ProjectContentService#deleteProject method. For this reason, no example is provided.

Params:

NameTypeAttributeDescription
version String

Version of the API of the API call to make

ownerType String

The owner type

owner Number
  • optional
  • default: null

The owner

type String
  • optional
  • default: ''

The content type

id Number
  • optional

The id of the object to delete

Return:

Promise

Promise object that returns success or failure

Throw:

Clinical6Error

If missing token or missing required parameters

public deleteProject(project: Object, type: String, id: Number): Promise source

Delete a sibling or child based on the ProjectContent type and/or child type

Params:

NameTypeAttributeDescription
project Object

ProjectContent options

project.version Object
  • nullable: false

ProjectContent version

project.ownerType Object
  • nullable: false

ProjectContent owner type

project.owner Object

ProjectContent owner

type String
  • optional
  • default: ''

Child type

id Number

id to delete

Return:

Promise

public get(version: String, ownerType: String, owner: Number, contentType: String, contentId: Number): Promise source

Generic function that retrieves data.

Handles the following URL patterns:

List: -api/version/ownerType -api/version/ownerType/owner/contentType

Show: -api/version/ownerType/owner -api/version/ownerType/owner/contentType/objectId

This should not be called directly but rather be called using the ProjectContentService#getProject method. For this reason, no example is provided.

Params:

NameTypeAttributeDescription
version String

Version of the API of the API call to make

ownerType String

The owner type

owner Number
  • optional
  • default: null

The owner

contentType String
  • optional
  • default: ''

The content type

contentId Number
  • optional
  • default: null

The ID value of object to show

Return:

Promise

Promise object that returns success or failure

Throw:

Clinical6Error

If missing token or missing required parameters

Test:

public getProject(project: Object, contentType: String, contentId: Number): Promise source

Get Data via ProjectContent helper class

This should not be called directly but rather be called using the ProjectContent#getAll, ProjectContent#getChild, ProjectContent#getChildren, ProjectContent#get, and ProjectContent#getSibling method. For this reason, no examples are provided.

Params:

NameTypeAttributeDescription
project Object

ProjectContent options

project.version Object
  • nullable: false

ProjectContent version

project.ownerType Object
  • nullable: false

ProjectContent owner type

project.owner Object

ProjectContent owner

contentType String
  • optional
  • default: ''

Content type

contentId Number
  • optional
  • default: null

Content id

Return:

Promise

Promise object that returns success or failure

public insert(version: String, ownerType: String, owner: Number, contentType: String, data: Object): Promise source

Generic function that updates data on the server.

This should not be called directly but rather be called using the ProjectContentService#insertProject method. For this reason, no example is provided.

Params:

NameTypeAttributeDescription
version String

Version of the API of the API call to make

ownerType String

The owner type

owner Number
  • optional
  • default: null

The owner

contentType String
  • optional
  • default: ''

The content type

data Object

The object to create on the server

Return:

Promise

Promise object that returns success or failure

Throw:

Clinical6Error

If missing token or missing required parameters

Test:

public insertProject(project: Object, type: String, data: Object): Promise source

Insert a new sibling or child based on the ProjectContent type and/or child type

This should not be called directly but rather be called using the ProjectContent#save method and ProjectContent#addChild. For this reason, no examples are provided.

Params:

NameTypeAttributeDescription
project Object

ProjectContent options

project.version Object
  • nullable: false

ProjectContent version

project.ownerType Object
  • nullable: false

ProjectContent owner type

project.owner Object

ProjectContent owner

type String
  • optional
  • default: ''

Child type

data Object

data to insert

Return:

Promise

Promise object that returns success or failure

public update(version: String, ownerType: String, owner: Number, contentType: String, contentId: Number, data: Object): Promise source

Generic function that updates data on the server.

This should not be called directly but rather be called using the ProjectContentService#updateProject method. For this reason, no example is provided.

Params:

NameTypeAttributeDescription
version String

Version of the API of the API call to make

ownerType String

The owner type

owner Number

The owner

contentType String
  • optional
  • default: ''

The content type

contentId Number
  • optional
  • default: null

The ID value of the object to update

data Object

The updated object to pass to the server

Return:

Promise

Promise object that returns success or failure

Throw:

Clinical6Error

If missing token or missing required parameters

Test:

public updateProject(project: Object, type: String, id: Number, data: Object): Promise source

Update ProjectContent information based on the ProjectContent Helper class.

This should not be called directly but rather be called using the ProjectContent#save method and ProjectContent#updateChild. For this reason, no examples are provided.

Params:

NameTypeAttributeDescription
project Object

The ProjectContent.options object

type String
  • optional
  • default: ''

The child type to update

id Number
  • optional
  • default: null

The child id to update

data Object

The data being used for the update

Return:

Promise

Promise object that returns success or failure