Manual Reference Source Test
public class | source

ConsentForm

Mixin Extends:

ConsentFormModel, Helper

Helper class representing a Consent Form.

Example:

// To get a list of ConsentForms use clinical6.get
import { clinical6, ConsentForm } from 'clinical6';
clinical6.get(ConsentForm).then(c => console.log(c));

// To get a single ConsentForm, you can also use clinical6
clinical6.get({ id: 5, type: 'consent__forms'});

// To save or insert, you can either use the .save() capability or clinical6
myConsentForm.save(); // insert if no id, save if id
clinical6.insert(new ConsentForm({...}));
clinical6.update(myConsentForm);

Test:

Static Member Summary

Static Public Members
public static get

Constructor Summary

Public Constructor
public

Constructor for helper class representing a Consent Form

Member Summary

Public Members
public get
public set
public get
public set

Method Summary

Public Methods
public

async getVersions(options: String): Promise

Gets the ConsentFormVersions associated to this ConsentForm.

public

Saves a consent form (insert if id doesn't exist, update if it does)

Inherited Summary

From class ConsentFormModel
public
public
public
public
public

Static Public Members

public static get type: String source

Public Constructors

public constructor(json: Object) source

Constructor for helper class representing a Consent Form

Override:

ConsentFormModel#constructor

Params:

NameTypeAttributeDescription
json Object

json api response from server

Public Members

public get consentFormVersions: ConsentFormVersion[] source

public set consentFormVersions: ConsentFormVersion[] source

public get consentStrategy: ConsentStrategy source

public set consentStrategy: ConsentStrategy source

Public Methods

public async getVersions(options: String): Promise source

Gets the ConsentFormVersions associated to this ConsentForm.

Params:

NameTypeAttributeDescription
options String
  • optional

Modify the nature of the call and response

options.url String
  • optional

Override the url for this call

options.cacheMode String
  • optional

Override the caching method for this call

Return:

Promise

Promise with data (array or object)

Example:

import { ConsentForm, clinical6 } from 'clinical6';
const consentForm = new ConsentForm({ id: 23 });
consentForm.getVersions({ id: 5 });

// Combined with clinical6.get
clinical6.get(ConsentForm).then(consentForms => { consentForms[0].getVersions() });

Test:

public async save(): Promise<ConsentForm> source

Saves a consent form (insert if id doesn't exist, update if it does)

Return:

Promise<ConsentForm>

Returns a promise via ajax call.

Example:

import { ConsentForm, clinical6 } from 'clinical6';

// Inserts new consentForm (no existing id)
const consentForm = new ConsentForm(
  "type": "consent__forms",
  "attributes": {
    "name": "a consent form name",
    "enabled": true
  });

consentForm.save();

// Updates existing consentForm(has existing id)
clinical6.get(ConsentForm).then(consentForms => consentForms[0].save());

Test: