Skip to content

TheM.attachments Reference

Constructor

The parent TheM class contains functionality enabling the initialization of any TheM subclass or submodule instance by simply calling TheM.doInit('subclassName'), where the input string is a case sensitive space-delimited string containing the names of all submodules that may be required in the current session. Most TheM subclasses also require the 'common' submodule. It is common to initialize the target submodule and any other submodule dependencies concurrently. The following example will initialize a new instance of the necessary submodules using a proxy constructor in TheM parent class.

TheM.doInit('subclassName1 subclassName2 subclassName3 etc');

Example

TheM.doInit('common user accounts attachments');

Properties

Property table for TheM.attachments

Property Description Required Schema
length Gets (returns) the length of the attachments array. Yes {
  "title": "TheM.attachments.length",
  "type": "number",
  "description": "Gets (returns) the length of the
attachments array.",
  "examples": [
    1
  ],
  "default": 0,
  "nullable": false
}
isReady Gets (returns) or sets true if TheM.attachments is fully ready. When setting isReady true for the first time, a(n) 'TheM.attachments ready' event is also triggered. Yes {
  "title": "TheM.attachments.isReady",
  "type": "boolean",
  "description": "Gets (returns) or sets true if
TheM.attachments is fully ready. When setting
isReady true for the first time, a(n)
'TheM.attachments ready' event is also
triggered.",
  "$comment": "getter setter",
  "examples": [
    true,
    false
  ],
  "default": false,
  "nullable": false
}

Methods

Method Name Parameter Descriptions Description Example
doSave
[]
Saves attachments data in local storage. Normally, there is no need to use this method as the framework knows automatically when to save and when to load the data to and from local storage. Returns true. TheM.attachments.doSave();
doLoad
[]
Loads attachments data from local storage and returns a boolean value to indicate success. Normally, there is no need to use this method as the framework knows automatically when to save and when to load the data to and from local storage. TheM.attachments.doLoad();
doAttach
[
{
"title": "given",
"type": "object",
"nullable": false,
"properties": {
"transactionId": {
"title": "transactionId",
"type": "string",
"nullable": false,
"example":
"lxx8zmwacanlrjzkyhrqldffmhxth
fvn"
},
"AFiAccountId": {
"title": "AFiAccountId",
"type": "string",
"nullable": false,
"example":
"testgalx8wfq4sqfgb"
},
"imageB64": {
"title": "imageB64",
"type": "string",
"nullable": false,
"example":
"Very_Long_Base64_Image_String
"
},
"thumbnailB64": {
"title": "thumbnailB64",
"type": "string",
"nullable": false,
"example":
"Very_Long_Base64_Image_String
"
},
"transaction": {
"title": "transaction",
"type": "object",
"nullable": true,
"example": {
"transactionId":
"lxx8zmwacanlrjzkyhrqldffmhxth
fvn",
"AFiAccountId":
"testgalx8wfq4sqfgb"
}
}
},
"example": {
"transactionId":
"lxx8zmwacanlrjzkyhrqldffmhxth
fvn",
"AFiAccountId":
"testgalx8wfq4sqfgb",
"imageB64":
"Very_Long_Base64_Image_String
",
"thumbnailB64":
"Very_Long_Base64_Image_String
"
}
}
]
Returns a promise that will create an attachment object containing the given imageB64 and thumbnailB64 images, push the attachment object onto the attachmentsArray of the transaction specified by the transactionId, define TheM.accounts[given.AFiAccountId].transactions[given.transactionId].attachments[AFiAttachmentId] as the attachment, store the attachment locally in the TheM.attachments array, and send the attachment to the server. Either given.transactionId or given.transaction.transactionId is required. Likewise, either given.AFiAccountId or given.transaction.AFiAccountId is required. TheM.attachments.doAttach(
  {
   "transactionId": "lxx8zmwacanlrjzkyhrqldffmhxthfvn",
   "AFiAccountId": "testgalx8wfq4sqfgb",
   "imageB64": "Very_Long_Base64_Image_String",
   "thumbnailB64": "Very_Long_Base64_Image_String"
  }
);
doFetch
[
{
"title": "given",
"type": "object",
"nullable": false,
"properties": {
"AFiAttachmentId": {
"title": "AFiAttachmentId",
"type": "string",
"nullable": false,
"example":
"lypzlm3tbj4i4p93rolhgupaeb0tn
kp0"
},
"transactionId": {
"title": "transactionId",
"type": "string",
"nullable": false,
"example":
"lxx8zmwacanlrjzkyhrqldffmhxth
fvn"
},
"AFiAccountId": {
"title": "AFiAccountId",
"type": "string",
"nullable": false,
"example":
"testgalx8wfq4sqfgb"
},
"transaction": {
"title": "transaction",
"type": "object",
"nullable": true,
"example": {
"transactionId":
"lxx8zmwacanlrjzkyhrqldffmhxth
fvn",
"AFiAccountId":
"testgalx8wfq4sqfgb"
}
}
},
"example": {
"AFiAttachmentId":
"lypzlm3tbj4i4p93rolhgupaeb0tn
kp0",
"transactionId":
"lxx8zmwacanlrjzkyhrqldffmhxth
fvn",
"AFiAccountId":
"testgalx8wfq4sqfgb"
}
}
]
Returns a promise that will resolve to the attachment associated with the user specified by the given object, if a match exists. Either given.transactionId or given.transaction.transactionId is required. Likewise, either given.AFiAccountId or given.transaction.AFiAccountId is required. If the requested attachment is not found locally, the attachment will be fetched from the server if a match is found. TheM.attachments.doFetch(
  {
   "AFiAttachmentId": "lypzlm3tbj4i4p93rolhgupaeb0tnkp0",
   "transactionId": "lxx8zmwacanlrjzkyhrqldffmhxthfvn",
   "AFiAccountId": "testgalx8wfq4sqfgb"
  }
);
doDelete
[
{
"title": "given",
"type": "object",
"nullable": false,
"properties": {
"AFiAttachmentId": {
"title": "AFiAttachmentId",
"type": "string",
"nullable": false,
"example":
"lypzlm3tbj4i4p93rolhgupaeb0tn
kp0"
},
"transactionId": {
"title": "transactionId",
"type": "string",
"nullable": false,
"example":
"lxx8zmwacanlrjzkyhrqldffmhxth
fvn"
},
"AFiAccountId": {
"title": "AFiAccountId",
"type": "string",
"nullable": false,
"example":
"testgalx8wfq4sqfgb"
},
"transaction": {
"title": "transaction",
"type": "object",
"nullable": true,
"example": {
"transactionId":
"lxx8zmwacanlrjzkyhrqldffmhxth
fvn",
"AFiAccountId":
"testgalx8wfq4sqfgb"
}
}
},
"example": {
"AFiAttachmentId":
"lypzlm3tbj4i4p93rolhgupaeb0tn
kp0",
"transactionId":
"lxx8zmwacanlrjzkyhrqldffmhxth
fvn",
"AFiAccountId":
"testgalx8wfq4sqfgb"
}
}
]
Returns a promise that will delete the attachment locally and then send a request to delete the attachment from the server as well. Either given.transactionId or given.transaction.transactionId is required. Likewise, either given.AFiAccountId or given.transaction.AFiAccountId is required. TheM.attachments.doDelete(
  {
   "AFiAttachmentId": "lypzlm3tbj4i4p93rolhgupaeb0tnkp0",
   "transactionId": "lxx8zmwacanlrjzkyhrqldffmhxthfvn",
   "AFiAccountId": "testgalx8wfq4sqfgb"
  }
);
attachment
[
{
"title": "given",
"type": "object",
"nullable": false,
"properties": {
"AFiAttachmentId": {
"title": "AFiAttachmentId",
"type": "string",
"nullable": false,
"example":
"lypzlm3tbj4i4p93rolhgupaeb0tn
kp0"
},
"transactionId": {
"title": "transactionId",
"type": "string",
"nullable": false,
"example":
"lxx8zmwacanlrjzkyhrqldffmhxth
fvn"
},
"AFiAccountId": {
"title": "AFiAccountId",
"type": "string",
"nullable": false,
"example":
"testgalx8wfq4sqfgb"
}
},
"example": {
"AFiAttachmentId":
"lypzlm3tbj4i4p93rolhgupaeb0tn
kp0",
"transactionId":
"lxx8zmwacanlrjzkyhrqldffmhxth
fvn",
"AFiAccountId":
"testgalx8wfq4sqfgb"
}
}
]
Returns the attachment associated with the user specified by the given object, if a match exists. TheM.attachments.attachment(
  {
   "AFiAttachmentId": "lypzlm3tbj4i4p93rolhgupaeb0tnkp0",
   "transactionId": "lxx8zmwacanlrjzkyhrqldffmhxthfvn",
   "AFiAccountId": "testgalx8wfq4sqfgb"
  }
);