Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Email

Class containing all hackerapi email functionality

class
extends

{ HackerAPI.Base }

Hierarchy

Index

Constructors

constructor

  • new Email(__namedParameters?: { campaign: undefined | string; context: undefined | object; createdAt: undefined | Date; created_at: undefined | Date; html: undefined | string; id: undefined | number; sendTime: undefined | Date; send_time: undefined | Date; subject: undefined | string; targetEmail: undefined | string; toEmail: undefined | string; to_email: undefined | string; updatedAt: undefined | Date; updated_at: undefined | Date }): Email
  • Creates a new Mail instance

    constructor

    Parameters

    • Default value __namedParameters: { campaign: undefined | string; context: undefined | object; createdAt: undefined | Date; created_at: undefined | Date; html: undefined | string; id: undefined | number; sendTime: undefined | Date; send_time: undefined | Date; subject: undefined | string; targetEmail: undefined | string; toEmail: undefined | string; to_email: undefined | string; updatedAt: undefined | Date; updated_at: undefined | Date } = {}
      • campaign: undefined | string
      • context: undefined | object
      • createdAt: undefined | Date
      • created_at: undefined | Date
      • html: undefined | string
      • id: undefined | number
      • sendTime: undefined | Date
      • send_time: undefined | Date
      • subject: undefined | string
      • targetEmail: undefined | string
      • toEmail: undefined | string
      • to_email: undefined | string
      • updatedAt: undefined | Date
      • updated_at: undefined | Date

    Returns Email

Properties

Optional campaign

campaign: undefined | string

Optional context

context: undefined | object

Optional createdAt

createdAt: Date

Optional html

html: undefined | string

Optional id

id: undefined | number

Optional sendTime

sendTime: Date

specialHandlers

specialHandlers: {}

Type declaration

  • [key: string]: (...args: unknown[]) => [string, undefined | string]
      • (...args: unknown[]): [string, undefined | string]
      • Parameters

        • Rest ...args: unknown[]

        Returns [string, undefined | string]

Optional subject

subject: undefined | string

Optional targetEmail

targetEmail: undefined | string

Optional updatedAt

updatedAt: Date

Accessors

Static Template

Static Trigger

Methods

toHackerAPIFormat

  • toHackerAPIFormat(method?: undefined | string): {}

Static dateHandler

  • dateHandler(key: string, date: string | Date): string[]
  • Converts a Javascript date (where only day, month and year are relevant) to a format understood by hackerapi

    Parameters

    • key: string
    • date: string | Date

      Doesn't do anything if string

    Returns string[]

    key: [0], value: [1]

Static dateTimeHandler

  • dateTimeHandler(key: string, datetime: string | Date): string[]
  • Converts Javascript date to a format understood by hackerapi

    Parameters

    • key: string
    • datetime: string | Date

    Returns string[]

    key: [0], value: [1]

Static doNotSendHandler

  • doNotSendHandler(key: string, _: any): (undefined | string)[]
  • Does not send the field to hackerapi

    Parameters

    • key: string
    • _: any

    Returns (undefined | string)[]

    key: [0], value: [1]

Static renameHandler

  • renameHandler(renamedKey: string): (Anonymous function)
  • HOC for renaming a field before sending it to hackerapi

    Parameters

    • renamedKey: string

      The string to rename the key to

    Returns (Anonymous function)

    key: [0], value: [1]

Static send

  • send(email: Email, token?: undefined | string): Promise<{}>
  • Creates a new email

    Parameters

    • email: Email
    • Optional token: undefined | string

    Returns Promise<{}>

Static sendBatch

  • sendBatch(email: Email, targets: (string | { email: string })[], token?: undefined | string): Promise<{}[]>
  • Creates a batch of emails

    Parameters

    • email: Email

      .targetEmail is ignored

    • targets: (string | { email: string })[]

      Array of emails or array of objects that contain emails

    • Optional token: undefined | string

    Returns Promise<{}[]>

Generated using TypeDoc