3.0.1 • Published 4 years ago

@sheetbase/mail v3.0.1

Weekly downloads
-
License
MIT
Repository
github
Last release
4 years ago

@sheetbase/mail

Send email using Gmail in Sheetbase backend app.

  • Install: npm install --save @sheetbase/mail

  • Usage:

// 1. import module
import { MailModule } from "@sheetbase/mail";

// 2. create an instance
export class App {
  // the object
  mailModule: MailModule;

  // initiate the instance
  constructor() {
    this.mailModule = new MailModule(/* options */);
  }
}
NameTypeDescription
categories?Record<string, string | Category>
forwarding?undefined | string
templates?Record<string, Template>

The Lib class.

NameTypeDescription
attachmentServiceAttachmentService
helperServiceHelperService
labelServiceLabelService
mailRouteMailRoute
mailServiceMailService
mailThreadRouteMailThreadRoute
mailThreadsRouteMailThreadsRoute
messageServiceMessageService
optionServiceOptionService
threadServiceThreadService
FunctionReturns typeDescription
registerRoutes(routeEnabling?, middlewares?)RouterService<>Expose the module routes

Expose the module routes

Parameters

ParamTypeDescription
routeEnablingtrue | DisabledRoutes
middlewaresMiddlewares | RouteMiddlewares

Returns

RouterService<>


MailModule provides REST API endpoints allowing clients to access server resources. Theses enpoints are not exposed by default, to expose the endpoints:

MailModule.registerRoutes(routeEnabling?);

MailModule returns these routing errors, you may use the error code to customize the message:

  • mail/invalid-input: Invalid input.
  • mail/missing-recipient: Missing required recipient for the action
  • mail/no-access: Current auth user has no access permission for the resource.
RouteMethodDisabledDescription
/mailGETGet mail information
/mailPATCHtrueReply to a thread/message
/mailPUTtrueSend an email
/mail/threadGETtrueGet a single message/thread
/mail/threadsGETtrueGet threads (list by category/single - parent + children/single - children only)

Get mail information

Response

object


DISABLED Reply to a thread/message

Request body

NameTypeDescription
threadId?string
messageId?string
inputMailingInput
replyAll?boolean

Middleware data

NameTypeDescription
authAuthData

Response

GmailMessage | GmailThread


DISABLED Send an email

Request body

NameTypeDescription
recipientstring
subjectstring
inputMailingInput
categoryName?string

Response

object


DISABLED Get a single message/thread

Request query

NameTypeDescription
threadId?string
messageId?string

Middleware data

NameTypeDescription
authAuthData

Response

null | Thread


DISABLED Get threads (list by category/single - parent + children/single - children only)

Request query

NameTypeDescription
threadId?string
categoryName?string
childrenOnly?boolean
full?boolean
grouping?boolean

Middleware data

NameTypeDescription
authAuthData

Response

Thread[] | GroupingThread | GroupingThread[]


License

@sheetbase/mail is released under the MIT license.