pepipost
Version:
Official nodejs library for sending email using web API v5
75 lines (68 loc) • 2.86 kB
JavaScript
/**
* PepipostLib
*
* This file was automatically generated by APIMATIC v2.0 ( https://apimatic.io ).
*/
'use strict';
const BaseModel = require('./BaseModel');
/**
* Creates an instance of Send
*/
class Send extends BaseModel {
/**
* @constructor
* @param {Object} obj The object passed to constructor
*/
constructor(obj) {
super(obj);
if (obj === undefined || obj === null) return;
this.replyTo = this.constructor.getValue(obj.replyTo || obj.reply_to);
this.from = this.constructor.getValue(obj.from);
this.subject = this.constructor.getValue(obj.subject);
this.templateId = this.constructor.getValue(obj.templateId || obj.template_id);
this.content = this.constructor.getValue(obj.content);
this.attachments = this.constructor.getValue(obj.attachments);
this.personalizations = this.constructor.getValue(obj.personalizations);
this.settings = this.constructor.getValue(obj.settings);
this.tags = this.constructor.getValue(obj.tags);
this.lintPayload = this.constructor.getValue(obj.lintPayload || obj.lint_payload);
this.schedule = this.constructor.getValue(obj.schedule);
this.bcc = this.constructor.getValue(obj.bcc);
}
/**
* Function containing information about the fields of this model
* @return {array} Array of objects containing information about the fields
*/
static mappingInfo() {
return super.mappingInfo().concat([
{ name: 'replyTo', realName: 'reply_to' },
{ name: 'from', realName: 'from', type: 'From' },
{ name: 'subject', realName: 'subject' },
{ name: 'templateId', realName: 'template_id' },
{ name: 'content', realName: 'content', array: true, type: 'Content' },
{ name: 'attachments', realName: 'attachments', array: true, type: 'Attachments' },
{
name: 'personalizations',
realName: 'personalizations',
array: true,
type: 'Personalizations',
},
{ name: 'settings', realName: 'settings', type: 'Settings' },
{ name: 'tags', realName: 'tags', array: true },
{ name: 'lintPayload', realName: 'lint_payload' },
{ name: 'schedule', realName: 'schedule' },
{ name: 'bcc', realName: 'bcc', array: true, type: 'EmailStruct' },
]);
}
/**
* Function containing information about discriminator values
* mapped with their corresponding model class names
*
* @return {object} Object containing Key-Value pairs mapping discriminator
* values with their corresponding model classes
*/
static discriminatorMap() {
return {};
}
}
module.exports = Send;