feat: Ajout d'un système d'alert
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2024-09-05 22:48:06 +02:00
parent 9b039a3fb1
commit 346399d757
217 changed files with 56413 additions and 0 deletions

View File

@ -0,0 +1,8 @@
import { RequestOptions, RequestConfig } from '../request/Request';
export interface ClientParams {
apiKey?: string;
apiSecret?: string;
apiToken?: string;
options?: null | RequestOptions;
config?: null | Partial<RequestConfig>;
}

View File

@ -0,0 +1,149 @@
import { ClientParams } from './Client';
import { RequestConfig, RequestOptions, RequestConstructorConfig } from '../request/Request';
import Request from '../request';
export declare type ClientConnectParams = Pick<ClientParams, 'config' | 'options'>;
declare class Client {
private version;
private config;
private options;
private apiKey?;
private apiSecret?;
private apiToken?;
constructor(params: ClientParams);
getPackageVersion(): string;
getAPIKey(): string | undefined;
getAPISecret(): string | undefined;
getAPIToken(): string | undefined;
getConfig(): {
host: string;
version: string;
output: import("axios").ResponseType;
};
getOptions(): RequestOptions;
get(resource: string, config?: RequestConstructorConfig): Request;
post(resource: string, config?: RequestConstructorConfig): Request;
put(resource: string, config?: RequestConstructorConfig): Request;
delete(resource: string, config?: RequestConstructorConfig): Request;
private init;
private cloneParams;
private setConfig;
private setOptions;
private tokenConnectStrategy;
private basicConnectStrategy;
static apiConnect(apiKey: string, apiSecret: string, params?: ClientConnectParams): Client;
static smsConnect(apiToken: string, params?: ClientConnectParams): Client;
static config: Readonly<RequestConfig>;
static packageJSON: Readonly<{
readonly name: string;
readonly version: string;
readonly main: string;
readonly browser: string;
readonly types: string;
readonly description: string;
readonly author: string;
readonly license: string;
readonly private: boolean;
readonly keywords: string[];
readonly engines: {
node: string;
npm: string;
};
readonly files: string[];
readonly directories: {
lib: string;
docs: string;
};
readonly typescript: {
definition: string;
};
readonly scripts: {
test: string;
"test:int": string;
"test:unit": string;
"test:watch": string;
cover: string;
"cover:int": string;
"cover:unit": string;
"cover:expandable": string;
build: string;
"build:dev": string;
"build:release": string;
"build:prepublish": string;
"build:watch": string;
lint: string;
"lint:fix": string;
"lint:errors": string;
"ts:run": string;
"ts:watch": string;
"ts:mocha": string;
"ts:patch": string;
init: string;
"pkg:link": string;
"pkg:prepare": string;
"pkg:precommit": string;
release: string;
"release:dry": string;
"release:quiet": string;
"release:minor": string;
"release:patch": string;
"release:major": string;
docs: string;
};
readonly dependencies: {
axios: string;
"json-bigint": string;
"url-join": string;
};
readonly devDependencies: {
"@babel/core": string;
"@babel/preset-env": string;
"@commitlint/cli": string;
"@commitlint/config-conventional": string;
"@types/chai": string;
"@types/json-bigint": string;
"@types/mocha": string;
"@types/node": string;
"@types/qs": string;
"@types/superagent": string;
"@types/url-join": string;
"@typescript-eslint/eslint-plugin": string;
"@typescript-eslint/parser": string;
"babel-loader": string;
chai: string;
eslint: string;
"eslint-config-airbnb-base": string;
"eslint-import-resolver-typescript": string;
"eslint-plugin-import": string;
"eslint-plugin-tsdoc": string;
husky: string;
mocha: string;
nock: string;
nyc: string;
qs: string;
"standard-version": string;
"terser-webpack-plugin": string;
"ts-loader": string;
"ts-node": string;
"ts-node-dev": string;
"ts-patch": string;
"tsconfig-paths": string;
"tsconfig-paths-webpack-plugin": string;
typedoc: string;
typescript: string;
"typescript-transform-paths": string;
webpack: string;
"webpack-cli": string;
"webpack-merge": string;
};
readonly homepage: string;
readonly repository: {
type: string;
url: string;
};
readonly bugs: {
url: string;
};
readonly contributors: string[];
}>;
}
export default Client;

View File

@ -0,0 +1,11 @@
import HttpMethods from './request/HttpMethods';
import Request from './request/index';
import Client from './client/index';
declare class Mailjet extends Client {
static Request: typeof Request;
static HttpMethods: typeof HttpMethods;
static Client: typeof Client;
}
export * from './types/api';
export { Client, Request, HttpMethods };
export default Mailjet;

View File

@ -0,0 +1,7 @@
declare enum HttpMethods {
Get = "get",
Post = "post",
Put = "put",
Delete = "delete"
}
export default HttpMethods;

View File

@ -0,0 +1,19 @@
import { AxiosProxyConfig, AxiosRequestConfig, RawAxiosRequestHeaders, ResponseType } from 'axios';
import { TObject } from '../types';
export interface RequestConfig {
host: string;
version: string;
output: ResponseType;
}
export interface RequestOptions {
timeout?: number;
proxy?: AxiosProxyConfig;
headers?: RawAxiosRequestHeaders;
maxBodyLength?: number;
maxContentLength?: number;
}
export declare type SubPath = 'REST' | 'DATA' | '';
export declare type RequestData = string | TObject.UnknownRec;
export declare type RequestParams = TObject.UnknownRec;
export declare type RequestConstructorConfig = null | Partial<RequestConfig>;
export declare type RequestAxiosConfig = Required<Pick<AxiosRequestConfig, 'url' | 'data' | 'params' | 'method' | 'headers' | 'responseType' | 'transformResponse'>> & Pick<AxiosRequestConfig, 'auth' | 'timeout' | 'proxy' | 'maxBodyLength' | 'maxContentLength'>;

View File

@ -0,0 +1,36 @@
import { TObject } from '../types';
import { LibraryResponse, LibraryLocalResponse } from '../types/api';
import HttpMethods from './HttpMethods';
import { RequestData, RequestParams, RequestConstructorConfig } from './Request';
import Client from '../client';
declare type UnknownRec = TObject.UnknownRec;
declare class Request {
private readonly client;
private readonly method;
private readonly config;
private readonly resource;
private url;
private subPath;
private actionPath;
constructor(client: Client, method: HttpMethods, resource: string, config?: RequestConstructorConfig);
getUserAgent(): string;
getCredentials(): {
apiToken: string | undefined;
apiKey: string | undefined;
apiSecret: string | undefined;
};
private getContentType;
private getRequestBody;
private buildFullUrl;
private buildSubPath;
private makeRequest;
private setBaseURL;
id(value: string | number): this;
action(name: string): this;
request<Body extends RequestData>(data?: RequestData, params?: RequestParams, performAPICall?: true): Promise<LibraryResponse<Body>>;
request<Body extends RequestData, Params extends UnknownRec>(data?: Body, params?: Params, performAPICall?: false): Promise<LibraryLocalResponse<Body, Params>>;
static protocol: "https://";
static parseToJSONb(text: string): any;
static isBrowser(): boolean;
}
export default Request;

View File

@ -0,0 +1,188 @@
import { Common } from './Common';
export declare namespace DraftCampaign {
export enum EditMode {
Tool2 = "tool2",
HTML2 = "html2",
MJML = "mjml"
}
export enum CampaignDraftStatus {
AXCanceled = -3,
Deleted = -2,
Archived = -1,
Draft = 0,
Programmed = 1,
Sent = 2,
AXTested = 3,
AXSelected = 4
}
export enum CampaignDraftSendingStatus {
AXCancelled = "AXCancelled",
Deleted = "Deleted",
Archived = "Archived",
Draft = "Draft",
Programmed = "Programmed",
Sent = "Sent",
AXTested = "AXTested",
AXSelected = "AXSelected"
}
export interface Recipient {
Email: string;
Name?: string;
}
export interface CampaignDraft<AXTesting = Common.UnknownRec> {
ID: number;
AXFraction: number;
AXFractionName: string;
AXTesting: AXTesting;
Current: number;
EditMode: EditMode;
IsStarred: boolean;
IsTextPartIncluded: boolean;
ReplyEmail: string;
SenderName: string;
TemplateID: number;
Title: string;
CampaignID: number;
ContactsListID: number;
CreatedAt: string;
DeliveredAt: string;
Locale: string;
ModifiedAt: string;
Preset: string;
SegmentationID: number;
Sender: string;
SenderEmail: string;
Status: CampaignDraftStatus;
Subject: string;
Url: string;
Used: boolean;
}
export interface CampaignDraftDetailContent<Headers = Common.UnknownRec> {
Headers: Headers;
'Html-part': string;
'Text-part': string;
MJMLContent: string;
}
export interface CampaignDraftSchedule {
Date: string;
Status: string;
}
export type PostCampaignDraftBody<AXTesting = Common.UnknownRec> = {
Locale: string;
Subject: string;
AXFraction?: number;
AXFractionName?: string;
AXTesting?: AXTesting;
Current?: number;
EditMode?: EditMode;
IsStarred?: boolean;
IsTextPartIncluded?: boolean;
ReplyEmail?: string;
SenderName?: string;
TemplateID?: number;
Title?: string;
ContactsListID?: number;
ContactsListAlt?: string;
SegmentationID?: number;
SegmentationAlt?: string;
Sender?: string;
SenderEmail?: string;
};
export type PutCampaignDraftBody<AXTesting = Common.UnknownRec> = Omit<Partial<PostCampaignDraftBody<AXTesting>>, 'ContactsListAlt'> & {
Status?: CampaignDraftStatus;
};
export type GetCampaignDraftQueryParams = Partial<Common.Pagination> & {
AXTesting?: number;
Campaign?: number;
ContactsList?: number;
DeliveredAt?: string;
EditMode?: EditMode;
IsArchived?: boolean;
IsCampaign?: boolean;
IsDeleted?: boolean;
IsHandled?: boolean;
IsStarred?: boolean;
Modified?: boolean;
NewsLetterTemplate?: number;
Status?: CampaignDraftStatus;
Subject?: string;
Template?: number;
};
export type PostCampaignDraftDetailContentBody<Headers = Common.UnknownRec> = Partial<CampaignDraftDetailContent<Headers>>;
export type PostCampaignDraftScheduleBody = {
Date: string;
};
export type PutCampaignDraftScheduleBody = Partial<PostCampaignDraftScheduleBody>;
export type PostCampaignDraftTestBody = {
Recipients: Recipient[];
};
type CampaignDraftResponse = Common.Response<CampaignDraft[]>;
type CampaignDraftScheduleResponse = Common.Response<CampaignDraftSchedule[]>;
type CampaignDraftDetailContentResponse<Headers = Common.UnknownRec> = Common.Response<Array<CampaignDraftDetailContent<Headers>>>;
type CampaignDraftStatusResponse = Common.Response<Array<{
Status: CampaignDraftSendingStatus;
}>>;
export type PostCampaignDraftResponse = CampaignDraftResponse;
export type PutCampaignDraftResponse = CampaignDraftResponse;
export type GetCampaignDraftResponse = CampaignDraftResponse;
export type PostCampaignDraftScheduleResponse = CampaignDraftScheduleResponse;
export type PutCampaignDraftScheduleResponse = CampaignDraftScheduleResponse;
export type GetCampaignDraftScheduleResponse = CampaignDraftScheduleResponse;
export type PostCampaignDraftDetailContentResponse<Headers = Common.UnknownRec> = CampaignDraftDetailContentResponse<Headers>;
export type GetCampaignDraftDetailContentResponse<Headers = Common.UnknownRec> = CampaignDraftDetailContentResponse<Headers>;
export type PostCampaignDraftSend = CampaignDraftStatusResponse;
export type PostCampaignDraftTest = CampaignDraftStatusResponse;
export type GetCampaignDraftStatus = CampaignDraftStatusResponse;
export {};
}
export declare namespace SentCampaign {
export enum CampaignType {
Transactional = 1,
Marketing = 2,
Unknown = 3
}
export interface Campaign {
ID: number;
IsDeleted: boolean;
IsStarred: boolean;
CampaignType: CampaignType;
CreatedAt: string;
CustomValue: string;
FirstMessageID: number;
FromEmail: string;
FromID: number;
FromName: string;
HasHtmlCount: number;
HasTxtCount: number;
ListID: number;
NewsLetterID: number;
SegmentationID: number;
SendEndAt: string;
SendStartAt: string;
SpamassScore: number;
Subject: string;
WorkflowID: number;
}
export type PutCampaignBody = {
IsDeleted?: boolean;
IsStarred?: boolean;
};
export type GetCampaignQueryParams = Partial<Common.TimestampPeriod> & Partial<Common.Pagination> & {
CampaignID?: number;
ContactsListID?: number;
CustomCampaign?: string;
From?: string;
FromDomain?: string;
FromID?: number;
FromType?: CampaignType;
IsDeleted?: boolean;
IsNewsletterTool?: boolean;
IsStarred?: boolean;
Period?: Common.Period;
WorkflowID?: number;
};
type CampaignResponse = Common.Response<Campaign[]>;
export type PutCampaignResponse = CampaignResponse;
export type GetCampaignResponse = CampaignResponse;
export {};
}

View File

@ -0,0 +1,24 @@
export declare namespace Common {
type UnknownRec = Record<string, unknown>;
interface Pagination {
countOnly: boolean;
Limit: number;
Offset: number;
Sort: string;
}
interface TimestampPeriod {
FromTS: string | number;
ToTS: string | number;
}
type Response<Entity> = {
Count: number;
Total: number;
Data: Entity;
};
enum Period {
Day = "Day",
Week = "Week",
Month = "Month",
Year = "Year"
}
}

View File

@ -0,0 +1,344 @@
import { Common } from './Common';
export declare namespace Contact {
export interface Contact {
ID: number;
IsExcludedFromCampaigns: boolean;
Name: string;
CreatedAt: string;
DeliveredCount: number;
Email: string;
ExclusionFromCampaignsUpdatedAt: string;
IsOptInPending: boolean;
IsSpamComplaining: boolean;
LastActivityAt: string;
LastUpdateAt: string;
}
export type PostContactBody = {
Email: string;
IsExcludedFromCampaigns?: boolean;
Name?: string;
};
export type PutContactBody = Omit<PostContactBody, 'Email'>;
export type GetContactQueryParams = Partial<Common.Pagination> & {
Campaign?: number;
ContactsList?: number;
IsExcludedFromCampaigns?: boolean;
};
type ContactResponse = {
Count: number;
Total: number;
Data: Contact[];
};
export type PostContactResponse = ContactResponse;
export type PutContactResponse = ContactResponse;
export type GetContactResponse = ContactResponse;
export {};
}
export declare namespace ContactList {
export interface ContactList {
ID: number;
IsDeleted: boolean;
Name: string;
Address: string;
CreatedAt: string;
SubscriberCount: number;
}
export type PostContactListBody = {
Name: string;
IsDeleted?: boolean;
};
export type PutContactListBody = Partial<PostContactListBody>;
export type GetContactListQueryParams = Partial<Common.Pagination> & {
Address?: string;
ExcludeID?: number;
IsDeleted?: boolean;
Name?: string;
};
type ContactListResponse = Common.Response<ContactList[]>;
export type PostContactListResponse = ContactListResponse;
export type PutContactListResponse = ContactListResponse;
export type GetContactListResponse = ContactListResponse;
export {};
}
export declare namespace BulkContactManagement {
export enum ManageContactsAction {
AddForce = "addforce",
AddNoForce = "addnoforce",
Remove = "remove",
UnSub = "unsub"
}
export enum ImportListAction {
AddForce = "addforce",
AddNoForce = "addnoforce",
UnSub = "unsub",
DuplicateOverride = "duplicate-override",
DuplicateNoOverride = "duplicate-no-override"
}
export enum ImportCSVMethod {
AddForce = "addforce",
AddNoForce = "addnoforce",
Remove = "remove",
UnSub = "unsub",
ExcludeMarketing = "excludemarketing",
IncludeMarketing = "includemarketing"
}
export enum CSVImportStatus {
Upload = "Upload",
Completed = "Completed",
Abort = "Abort"
}
export enum JobStatus {
Completed = "Completed",
InProgress = "In Progress",
Error = "Error"
}
export interface Job {
JobID: number;
}
export interface CSVImport {
ID: number;
ErrTreshold: number;
ImportOptions: string;
Method: ImportCSVMethod;
AliveAt: string;
ContactsListID: number;
Count: number;
Current: number;
DataID: number;
Errcount: number;
JobEnd: string;
JobStart: string;
RequestAt: string;
Status: CSVImportStatus;
}
export interface ContactList {
ListID: number;
Action: ManageContactsAction;
}
export interface ContactManageManyContacts {
ContactsLists: ContactList[];
Count: number;
Error: string;
ErrorFile: string;
JobEnd: string;
JobStart: string;
Status: JobStatus;
}
export interface ContactsListImportList {
JobID: number;
Action: ImportListAction;
ListID: number;
}
export type ContactBody<Properties = Common.UnknownRec> = {
Email: string;
Name?: string;
IsExcludedFromCampaigns?: boolean;
Properties?: Properties;
};
export type PostContactManageManyContactsBody<Properties = Common.UnknownRec> = {
Contacts: Array<ContactBody<Properties>>;
ContactsLists?: ContactList[];
};
export type PostContactsListImportListBody = {
Action: ImportListAction;
ListID: number;
};
export type PostContactsListManageManyContactsBody<Properties = Common.UnknownRec> = {
Action: ManageContactsAction;
Contacts: Array<ContactBody<Properties>>;
};
export type PostCSVImportBody = {
ContactsListID: number;
DataID: number;
ErrTreshold?: number;
ImportOptions?: string;
Method?: ImportCSVMethod;
};
export type PutCSVImportBody = Partial<PostCSVImportBody> & {
Status?: CSVImportStatus;
};
export type GetCSVImportQueryParams = Partial<Common.Pagination>;
type JobResponse = Common.Response<Job[]>;
type CSVImportResponse = Common.Response<CSVImport[]>;
type ContactManageManyContactsResponse = Common.Response<ContactManageManyContacts[]>;
export type PostContactManageManyContactsResponse = JobResponse;
export type GetContactManageManyContactsResponse = ContactManageManyContactsResponse;
export type PostContactsListImportListResponse = JobResponse;
export type GetContactsListImportListResponse = Common.Response<ContactsListImportList[]>;
export type PostContactsListManageManyContactsResponse = JobResponse;
export type GetContactsListManageManyContactsResponse = ContactManageManyContactsResponse;
export type PostCSVImportResponse = CSVImportResponse;
export type PutCSVImportResponse = CSVImportResponse;
export type GetCSVImportResponse = CSVImportResponse;
export {};
}
export declare namespace ContactProperties {
export enum DataType {
Str = "str",
Int = "int",
Float = "float",
Bool = "bool",
DateTime = "datetime"
}
export enum NameSpace {
Static = "static",
Historic = "historic"
}
export interface ContactProperty {
Name: string;
Value: string;
}
export interface ContactData {
ID: number;
ContactID: number;
Data: ContactProperty[];
}
export interface ContactMetaData {
ID: number;
Datatype: DataType;
Name: string;
NameSpace: NameSpace;
}
export type PostContactMetaDataBody = {
Name: string;
Datatype?: DataType;
NameSpace?: NameSpace;
};
export type PutContactMetaDataBody = {
Name?: string;
Datatype?: DataType;
};
export type GetContactMetaDataQueryParams = Partial<Common.Pagination> & {
DataType?: DataType;
Namespace?: NameSpace;
};
export type PutContactDataBody = {
Data: ContactProperty[];
};
export type GetContactDataQueryParams = Partial<Common.Pagination> & {
Campaign?: number;
ContactEmail?: string;
ContactsList?: number;
Fields?: string;
LastActivityAt?: string;
};
type ContactDataResponse = Common.Response<ContactData[]>;
type ContactMetaDataResponse = Common.Response<ContactMetaData[]>;
export type PostContactMetaDataResponse = ContactMetaDataResponse;
export type PutContactMetaDataResponse = ContactMetaDataResponse;
export type GetContactMetaDataResponse = ContactMetaDataResponse;
export type PutContactDataResponse = ContactDataResponse;
export type GetContactDataResponse = ContactDataResponse;
export {};
}
export declare namespace ContactSubscription {
export interface ManageContacts<Properties = Common.UnknownRec> {
Email: string;
Action: BulkContactManagement.ManageContactsAction;
Name: string;
Properties: Properties;
}
export interface ListRecipient {
ID: number;
IsUnsubscribed: boolean;
ContactID: number;
ListID: number;
ListName: string;
SubscribedAt: string;
UnsubscribedAt: string;
}
export interface ContactsList {
ListID: number;
IsUnsub: boolean;
SubscribedAt: string;
}
export interface ContactsListSignup {
ID: number;
ConfirmAt: number;
ConfirmIp: string;
ContactID: number;
Email: string;
ListID: number;
SignupAt: number;
SignupIp: string;
SignupKey: string;
SourceId: number;
Source: string;
}
export type PostContactManageContactsListsBody = {
ContactsLists: BulkContactManagement.ContactList[];
};
export type PostContactsListManageContactBody<Properties = Common.UnknownRec> = {
Email: string;
Action: BulkContactManagement.ManageContactsAction;
Name?: string;
Properties?: Properties;
};
export type PostListRecipientBody = {
IsUnsubscribed?: boolean;
ContactID: number;
ContactAlt?: string;
ListID: number;
ListAlt?: string;
};
export type PutListRecipientBody = {
IsUnsubscribed?: boolean;
};
export type GetListRecipientQueryParams = Partial<Common.Pagination> & {
Blocked?: boolean;
Contact?: number;
ContactEmail?: string;
ContactsList?: number;
IgnoreDeleted?: boolean;
IsExcludedFromCampaigns?: boolean;
LastActivityAt?: string;
ListName?: string;
Opened?: boolean;
Unsub?: boolean;
};
export type GetContactsListSignupQueryParams = Partial<Common.Pagination> & {
Contact?: number;
ContactsList?: number;
Domain?: string;
Email?: string;
LocalPart?: string;
MaxConfirmAt?: number;
MinConfirmAt?: number;
MaxSignupAt?: number;
MinSignupAt?: number;
SignupIp?: string;
Source?: string;
SourceID?: number;
};
type ListRecipientResponse = Common.Response<ListRecipient[]>;
export type PostContactManageContactsListsResponse = Common.Response<Array<{
ContactsLists: BulkContactManagement.ContactList[];
}>>;
export type PostContactsListManageContactResponse<Properties = Common.UnknownRec> = Common.Response<Array<ManageContacts<Properties>>>;
export type PostListRecipientResponse = ListRecipientResponse;
export type PutListRecipientResponse = ListRecipientResponse;
export type GetListRecipientResponse = ListRecipientResponse;
export type GetContactGetContactsListsResponse = Common.Response<ContactsList[]>;
export type GetContactsListSignupResponse = Common.Response<ContactsListSignup[]>;
export {};
}
export declare namespace ContactVerification {
interface VerificationSummary<Result = Common.UnknownRec, Risk = Common.UnknownRec> {
result: Result;
risk: Risk;
}
interface ContactsListVerification<Result = Common.UnknownRec, Risk = Common.UnknownRec> {
Akid: number;
ContactListID: number;
Count: number;
Error: string;
ID: number;
JobEnd: string;
JobStart: string;
Method: string;
ResponseURL: string;
Status: string;
Summary: VerificationSummary<Result, Risk>;
}
type GetContactsListVerifyResponse<Result = Common.UnknownRec, Risk = Common.UnknownRec> = Common.Response<Array<ContactsListVerification<Result, Risk>>>;
}

View File

@ -0,0 +1,10 @@
import { AxiosResponse } from 'axios';
export interface LibraryResponse<Body> {
response: AxiosResponse<Body>;
body: Body;
}
export interface LibraryLocalResponse<Data, Params> {
body: Data;
params: Params;
url: string;
}

View File

@ -0,0 +1,149 @@
import { Common } from './Common';
export declare namespace Message {
enum MessageState {
UserUnknown = 1,
MailboxInactive = 2,
QuotaExceeded = 3,
InvalidDomain = 4,
NoMailHost = 5,
RelayOrAccessDenied = 6,
SenderBlocked = 7,
ContentBlocked = 8,
PolicyIssue = 9,
SystemIssue = 10,
ProtocolIssue = 11,
ConnectionIssue = 12,
GreyListed = 13,
PreBlocked = 14,
DuplicateInCampaign = 15,
SpamPreBlocked = 16,
BadOrEmptyTemplate = 17,
ErrorInTemplateLanguage = 18,
TypoFix = 19,
BlackListed = 20,
SpamReporter = 21
}
enum FromType {
Transactional = 1,
Marketing = 2,
Unknown = 3
}
enum MessageStatus {
Processed = 0,
Queued = 1,
Sent = 2,
Opened = 3,
Clicked = 4,
Bounce = 5,
Spam = 6,
Unsub = 7,
Blocked = 8,
SoftBounce = 9,
HardBounce = 10,
Deferred = 11
}
enum CurrentMessageStatus {
Unknown = "unknown",
Queued = "queued",
Sent = "sent",
Opened = "opened",
Clicked = "clicked",
Bounce = "bounce",
Spam = "spam",
Unsub = "unsub",
Blocked = "blocked",
HardBounced = "hardbounced",
SoftBounced = "softbounced",
Deferred = "deferred"
}
enum EventType {
Sent = "sent",
Opened = "opened",
Clicked = "clicked",
Bounced = "bounced",
Blocked = "blocked",
Unsub = "unsub",
Spam = "spam"
}
interface MessageTracked {
IsClickTracked: boolean;
IsHTMLPartIncluded: boolean;
IsOpenTracked: boolean;
IsTextPartIncluded: boolean;
IsUnsubTracked: boolean;
}
interface Message extends MessageTracked {
ID: number;
ArrivedAt: string;
AttachmentCount: number;
AttemptCount: number;
CampaignID: number;
ContactAlt: string;
ContactID: number;
Delay: number;
DestinationID: number;
FilterTime: number;
MessageSize: number;
SenderID: number;
SpamassassinScore: number;
SpamassRules: string;
StateID: MessageState;
StatePermanent: boolean;
Status: CurrentMessageStatus;
Subject: string;
UUID: string;
}
interface MessageHistory {
Comment: string;
EventAt: number;
EventType: EventType;
State: string;
Useragent: string;
UseragentID: number;
}
interface MessageInformation<Rules = Common.UnknownRec> {
ID: number;
CampaignID: number;
ClickTrackedCount: number;
ContactID: number;
CreatedAt: string;
MessageSize: number;
OpenTrackedCount: number;
QueuedCount: number;
SendEndAt: string;
SentCount: number;
SpamAssassinRules: Rules;
SpamAssassinScore: number;
}
type GetMessageQueryParams = Partial<Common.TimestampPeriod> & Partial<Common.Pagination> & {
Campaign?: number;
Contact?: number;
CustomID?: string;
Destination?: number;
FromType?: FromType;
MessageState?: MessageState;
MessageStatus?: MessageStatus;
PlanSubscription?: number;
SenderID?: number;
ShowContactAlt?: boolean;
ShowCustomID?: boolean;
ShowSubject?: boolean;
};
type GetMessageInformationQueryParams = Partial<Common.TimestampPeriod> & Partial<Common.Pagination> & {
CampaignID?: number;
ContactsList?: number;
CustomCampaign?: string;
From?: string;
FromDomain?: string;
FromID?: number;
FromType?: FromType;
IsDeleted?: boolean;
IsNewsletterTool?: boolean;
IsStarred?: boolean;
MessageStatus?: MessageStatus;
Period?: Common.Period;
};
type GetMessagesResponse = Common.Response<Message[]>;
type GetMessageHistoryResponse = Common.Response<MessageHistory[]>;
type GetMessageInformationResponse<Rules = Common.UnknownRec> = Common.Response<Array<MessageInformation<Rules>>>;
}

View File

@ -0,0 +1,71 @@
import { Message } from './Message';
import { Common } from './Common';
export declare namespace MessageEvent {
interface BounceStatistic {
ID: number;
BouncedAt: string;
CampaignID: number;
ContactID: number;
IsBlocked: boolean;
IsStatePermanent: boolean;
StateID: Message.MessageState;
}
interface ClickStatistic {
ID: number;
ClickedAt: string;
ClickedDelay: number;
ContactID: number;
MessageID: number;
Url: string;
UserAgentID: number;
}
interface OpenInformation {
ArrivedAt: string;
CampaignID: number;
ContactID: number;
MessageID: number;
OpenedAt: string;
UserAgentFull: string;
UserAgentID: number;
}
type GetBounceStatisticsQueryParams = Partial<Common.TimestampPeriod> & Partial<Common.Pagination> & {
CampaignID?: number;
ContactsList?: number;
EventFromTs?: string;
EventToTs?: string;
Period?: Common.Period;
};
type GetClickStatisticsQueryParams = Partial<Common.TimestampPeriod> & Partial<Common.Pagination> & {
CampaignID?: number;
ContactsList?: number;
CustomCampaign?: string;
EventFromTs?: string;
EventToTs?: string;
From?: string;
FromDomain?: string;
FromID?: number;
FromType?: Message.FromType;
IsDeleted?: boolean;
IsNewsletterTool?: boolean;
MessageID?: number;
MessageStatus?: Message.MessageStatus;
Period?: Common.Period;
};
type GetOpenInformationQueryParams = Partial<Common.TimestampPeriod> & Partial<Common.Pagination> & {
CampaignID?: number;
ContactsList?: number;
CustomCampaign?: string;
EventFromTs?: string;
EventToTs?: string;
From?: string;
FromDomain?: string;
FromID?: number;
FromType?: Message.FromType;
IsDeleted?: boolean;
MessageStatus?: Message.MessageStatus;
Period?: Common.Period;
};
type GetBounceStatisticsResponse = Common.Response<BounceStatistic[]>;
type GetClickStatisticsResponse = Common.Response<ClickStatistic[]>;
type GetOpenInformationResponse = Common.Response<OpenInformation[]>;
}

View File

@ -0,0 +1,21 @@
import { Common } from './Common';
export declare namespace Parse {
export interface ParseRoute {
ID: number;
APIKeyID: number;
Email: string;
Url: string;
}
export type PostParseRouteBody = {
Url: string;
APIKeyID?: number;
Email?: string;
};
export type PutParseRouteBody = Partial<PostParseRouteBody>;
export type GetParseRouteQueryParams = Partial<Common.Pagination>;
type ParseRouteResponse = Common.Response<ParseRoute[]>;
export type PostParseRouteResponse = ParseRouteResponse;
export type PutParseRouteResponse = ParseRouteResponse;
export type GetParseRouteResponse = ParseRouteResponse;
export {};
}

View File

@ -0,0 +1,39 @@
import { SendMessage } from './SendMessage';
import { Common } from './Common';
export declare namespace SMSMessage {
type SMS = {
From: string;
To: string;
MessageID: string | number;
SMSCount: number;
CreationTS: number;
SentTS: number;
Cost: SendMessage.Cost;
Status: SendMessage.SendStatus;
};
type SMSExport = {
ID: number;
URL: string;
Status: SendMessage.SendStatus;
CreationTS: number;
ExpirationTS: number;
};
type PostSMSExportBody = Common.TimestampPeriod;
type GetSMSQueryParams = Partial<Common.TimestampPeriod> & Partial<Pick<Common.Pagination, 'Limit' | 'Offset'>> & {
StatusCode?: Array<string>;
To?: string;
IDs?: string;
};
type GetSMSCountQueryParams = Partial<Common.TimestampPeriod> & {
StatusCode?: Array<string>;
To?: string;
};
type PostSMSExportResponse = SMSExport;
type GetSMSExportResponse = SMSExport;
type GetSMSResponse = {
Data: SMS[];
};
type GetSMSCountResponse = {
Count: number;
};
}

View File

@ -0,0 +1,32 @@
import { Common } from './Common';
export declare namespace Segmentation {
export enum SegmentStatus {
Used = "used",
UnUsed = "unused",
Deleted = "deleted"
}
export interface ContactFilter {
ID: number;
Description: string;
Expression: string;
Name: string;
Status: SegmentStatus;
}
export type PostContactFilterBody = {
Name: string;
Expression: string;
Description?: string;
};
export type PutContactFilterBody = Partial<PostContactFilterBody> & {
Status?: SegmentStatus;
};
export type GetContactFilterQueryParams = Partial<Common.Pagination> & {
ShowDeleted?: boolean;
Status?: SegmentStatus;
};
type ContactFilterResponse = Common.Response<ContactFilter[]>;
export type PostContactFilterResponse = ContactFilterResponse;
export type PutContactFilterResponse = ContactFilterResponse;
export type GetContactFilterResponse = ContactFilterResponse;
export {};
}

View File

@ -0,0 +1,147 @@
import { Common } from './Common';
export declare namespace SendEmailV3 {
type MjTemplateErrorDeliver = '0' | 'deliver';
type MjDeduplicateCampaign = 0 | 1;
type MjTrackOpen = 0 | 1 | 2;
interface Recipient {
Email: string;
Name?: string;
Vars?: string;
}
interface Attachment {
Filename: string;
Content: string;
'Content-type': string;
}
type BodyMj = {
'Mj-TemplateID'?: number;
'Mj-TemplateLanguage'?: boolean;
'Mj-TemplateErrorReporting'?: string;
'Mj-TemplateErrorDeliver'?: MjTemplateErrorDeliver;
'Mj-prio'?: number;
'Mj-campaign'?: string;
'Mj-deduplicatecampaign'?: MjDeduplicateCampaign;
'Mj-trackopen'?: MjTrackOpen;
'Mj-CustomID'?: string;
'Mj-EventPayload'?: string;
};
type Body<Headers = Common.UnknownRec, Vars = Common.UnknownRec> = BodyMj & {
FromEmail?: string;
FromName?: string;
Recipients?: Recipient[];
Sender?: boolean;
Subject?: string;
'Text-part'?: string;
'Html-part'?: string;
To?: string;
Cc?: string;
Bcc?: string;
Attachments?: Attachment[];
Inline_attachments?: Attachment[];
Headers?: Headers;
Vars?: Vars;
};
interface ResponseSent {
Email: string;
MessageID: number;
MessageUUID: string;
}
type Response = {
Sent: ResponseSent[];
};
}
export declare namespace SendEmailV3_1 {
enum TrackOpens {
AccountDefault = "account_default",
Disabled = "disabled",
Enabled = "enabled"
}
enum TrackClicks {
AccountDefault = "account_default",
Disabled = "disabled",
Enabled = "enabled"
}
interface EmailAddressTo {
Email: string;
Name?: string;
}
interface Attachment {
Filename: string;
ContentType: string;
Base64Content: string;
}
interface InlinedAttachment extends Attachment {
ContentID?: string;
}
interface Message<Headers = Common.UnknownRec, Variables = Common.UnknownRec> {
From: EmailAddressTo;
Sender?: EmailAddressTo;
To: EmailAddressTo[];
Cc?: EmailAddressTo[];
Bcc?: EmailAddressTo[];
ReplyTo?: EmailAddressTo;
Subject?: string;
TextPart?: string;
HTMLPart?: string;
TemplateID?: number;
TemplateLanguage?: boolean;
TemplateErrorReporting?: EmailAddressTo;
TemplateErrorDeliver?: boolean;
Attachments?: Attachment[];
InlinedAttachments?: InlinedAttachment[];
Priority?: number;
CustomCampaign?: string;
DeduplicateCampaign?: boolean;
TrackOpens?: TrackOpens;
TrackClicks?: TrackClicks;
CustomID?: string;
EventPayload?: string;
URLTags?: string;
Headers?: Headers;
Variables?: Variables;
}
enum ResponseStatus {
Success = "success",
Error = "error"
}
interface ResponseError {
ErrorIdentifier: string;
ErrorCode: string;
StatusCode: number;
ErrorMessage: string;
ErrorRelatedTo: Array<string>;
}
interface ResponseEmailAddressTo {
Email: string;
MessageUUID: string;
MessageID: number;
MessageHref: string;
}
type Body<Headers = Common.UnknownRec, Variables = Common.UnknownRec, Globals = Common.UnknownRec> = {
Messages: Array<Message<Headers, Variables>>;
SandboxMode?: boolean;
AdvanceErrorHandling?: boolean;
Globals?: Globals;
} | {
Messages: Array<Omit<Message<Headers, Variables>, 'From'> & {
From?: string;
}>;
SandboxMode?: boolean;
AdvanceErrorHandling?: boolean;
Globals: {
From: EmailAddressTo;
[key: string]: unknown;
};
};
interface ResponseMessage {
Status: ResponseStatus;
Errors: ResponseError[];
CustomID: string;
To: ResponseEmailAddressTo[];
Cc: ResponseEmailAddressTo[];
Bcc: ResponseEmailAddressTo[];
}
type Response = {
Messages: ResponseMessage[];
};
}

View File

@ -0,0 +1,27 @@
export declare namespace SendMessage {
interface Cost {
Value: number;
Currency: string;
}
interface SendStatus {
Code: number;
Name: string;
Description: string;
}
type Body = {
From: string;
To: string;
Text: string;
};
type Response = {
From: string;
To: string;
Text: string;
MessageID: string | number;
SMSCount: number;
CreationTS: number;
SentTS: number;
Cost: Cost;
Status: SendStatus;
};
}

View File

@ -0,0 +1,126 @@
import { Common } from './Common';
export declare namespace Sender {
export enum EmailType {
Transactional = "transactional",
Bulk = "bulk",
Unknown = "unknown"
}
export enum SenderStatus {
Inactive = "Inactive",
Active = "Active",
Deleted = "Deleted"
}
export interface Sender {
ID: number;
EmailType: EmailType;
IsDefaultSender: boolean;
Name: string;
CreatedAt: string;
DNSID: number;
Email: string;
Filename: string;
Status: SenderStatus;
}
export interface SenderValidate {
ValidationMethod: string;
Errors: string;
GlobalError: string;
}
export type PostSenderBody = {
Email: string;
EmailType?: EmailType;
IsDefaultSender?: boolean;
Name?: string;
};
export type PutSenderBody = Omit<PostSenderBody, 'Email'>;
export type GetSenderQueryParams = Partial<Common.Pagination> & {
DnsID?: number;
Domain?: string;
Email?: string;
IsDomainSender?: boolean;
LocalPart?: string;
ShowDeleted?: boolean;
Status?: SenderStatus;
};
type SenderResponse = Common.Response<Sender[]>;
export type PostSenderResponse = SenderResponse;
export type PutSenderResponse = SenderResponse;
export type GetSenderResponse = SenderResponse;
export type PostSenderValidateResponse = Common.Response<SenderValidate[]>;
export {};
}
export declare namespace Metasender {
export interface MetaSender {
ID: number;
Description: string;
CreatedAt: string;
Email: string;
Filename: string;
IsEnabled: boolean;
}
export type PostMetaSenderBody = {
Email: string;
Description?: string;
};
export type PutMetaSenderBody = Omit<PostMetaSenderBody, 'Email'>;
export type GetMetaSenderQueryParams = Partial<Common.Pagination> & {
DNS?: number;
};
type MetaSenderResponse = Common.Response<MetaSender[]>;
export type PostMetaSenderResponse = MetaSenderResponse;
export type PutMetaSenderResponse = MetaSenderResponse;
export type GetMetaSenderResponse = MetaSenderResponse;
export {};
}
export declare namespace DNS {
enum DKIMConfigurationCheckStatus {
OK = "OK",
Error = "Error",
NotChecked = "Not checked"
}
enum DKIMConfigurationStatus {
OK = "OK",
Error = "Error"
}
enum SPFConfigurationCheckStatus {
OK = "OK",
Error = "Error",
NotChecked = "Not checked",
NotFound = "Not found"
}
enum SPFConfigurationStatus {
OK = "OK",
Error = "Error"
}
interface DNS {
ID: number;
DKIMRecordName: string;
DKIMRecordValue: string;
DKIMStatus: DKIMConfigurationCheckStatus;
Domain: string;
IsCheckInProgress: boolean;
LastCheckAt: string;
OwnerShipToken: string;
OwnerShipTokenRecordName: string;
SPFRecordValue: string;
SPFStatus: SPFConfigurationCheckStatus;
}
interface DNSCheck {
DKIMErrors: string;
DKIMRecordCurrentValue: string;
DKIMStatus: DKIMConfigurationStatus;
SPFErrors: string;
SPFRecordCurrentValue: string;
SPFStatus: SPFConfigurationStatus;
}
type GetDNSQueryParams = Partial<Common.Pagination> & {
IsCheckInProgress?: boolean;
IsSenderIdentified?: boolean;
IsYahooFBL?: boolean;
MaxLastCheckAt?: string;
MinLastCheckAt?: string;
SPFStatus?: SPFConfigurationCheckStatus;
};
type GetDNSResponse = Common.Response<DNS[]>;
type PostDNSCheckResponse = Common.Response<DNSCheck[]>;
}

View File

@ -0,0 +1,87 @@
import { Common } from './Common';
export declare namespace APIKeyConfiguration {
export enum RunLevel {
Normal = "Normal",
SoftLock = "Softlock",
HardLock = "Hardlock"
}
export interface ApiKey {
ID: number;
ACL: string;
IsActive: boolean;
APIKey: string;
CreatedAt: string;
IsMaster: boolean;
Name: string;
QuarantineValue: number;
Runlevel: RunLevel;
SecretKey: string;
TrackHost: string;
UserID: number;
}
export type PostApiKeyBody = {
Name: string;
ACL?: string;
IsActive?: boolean;
};
export type PutApiKeyBody = Partial<PostApiKeyBody>;
export type GetApiKeyQueryParams = Partial<Common.Pagination> & {
APIKey?: string;
IsActive?: boolean;
IsMaster?: boolean;
Name?: string;
};
type ApiKeyResponse = Common.Response<ApiKey[]>;
export type PostApiKeyResponse = ApiKeyResponse;
export type PutApiKeyResponse = ApiKeyResponse;
export type GetApiKeyResponse = ApiKeyResponse;
export {};
}
export declare namespace AccountSetting {
export interface MyProfile {
ID: number;
AddressCity: string;
AddressCountry: string;
AddressPostalCode: string;
AddressState: string;
AddressStreet: string;
BillingEmail: string;
BirthdayAt: string;
CompanyName: string;
CompanyNumOfEmployees: string;
ContactPhone: string;
EstimatedVolume: number;
Features: string;
Firstname: string;
Industry: number;
JobTitle: string;
Lastname: string;
VATNumber: string;
Website: string;
VAT: number;
UserID: number;
}
export interface User {
ID: number;
ACL: string;
Email: string;
LastLoginAt: string;
Locale: string;
Timezone: string;
CreatedAt: string;
FirstIp: string;
LastIp: string;
MaxAllowedAPIKeys: number;
Username: string;
WarnedRatelimitAt: string;
}
export type PutMyProfileBody = Partial<Omit<MyProfile, 'ID' | 'VAT' | 'UserID'>>;
export type PutUserBody = Partial<Omit<User, 'ID' | 'CreatedAt' | 'FirstIp' | 'MaxAllowedAPIKeys' | 'WarnedRatelimitAt'>>;
type MyProfileResponse = Common.Response<MyProfile[]>;
type UserResponse = Common.Response<User[]>;
export type PutMyProfileResponse = MyProfileResponse;
export type GetMyProfileResponse = MyProfileResponse;
export type PutUserResponse = UserResponse;
export type GetUserResponse = UserResponse;
export {};
}

View File

@ -0,0 +1,272 @@
import { Common } from './Common';
import { Message } from './Message';
export declare namespace Statistic {
enum CampaignOverviewIDType {
SentCampaign = "Campaign",
ABTesting = "AX",
Draft = "NL"
}
enum CampaignOverviewEditMode {
Tool = "tool",
HTML = "html",
Tool2 = "tool2",
HTML2 = "html2",
MJML = "mjml"
}
enum CampaignOverviewEditType {
Full = "full",
Unknown = "unknown"
}
enum CounterSource {
Campaign = "Campaign",
APIKey = "APIKey",
List = "List",
Sender = "Sender"
}
enum CounterResolution {
Highest = "Highest",
Hour = "Hour",
Day = "Day",
Lifetime = "Lifetime"
}
enum CounterTiming {
Message = "Message",
Event = "Event"
}
enum EmailEvent {
Open = "open",
Click = "click"
}
interface CampaignOverview {
ClickedCount: number;
DeliveredCount: number;
EditMode: CampaignOverviewEditMode;
EditType: CampaignOverviewEditType;
ID: number;
IDType: CampaignOverviewIDType;
OpenedCount: number;
ProcessedCount: number;
SendTimeStart: number;
Starred: boolean;
Subject: string;
Title: string;
}
interface ContactStatistic {
BlockedCount: number;
BouncedCount: number;
ClickedCount: number;
ContactID: number;
DeferredCount: number;
DeliveredCount: number;
HardbouncedCount: number;
LastActivityAt: string;
MarketingContacts: number;
OpenedCount: number;
ProcessedCount: number;
QueuedCount: number;
SoftbouncedCount: number;
SpamComplaintCount: number;
UnsubscribedCount: number;
UserMarketingContacts: number;
WorkFlowExitedCount: number;
}
interface GEOStatistic {
ClickedCount: number;
OpenedCount: number;
Country: string;
}
interface ListRecipientStatistic<Data = Array<unknown>> {
BlockedCount: number;
BouncedCount: number;
ClickedCount: number;
Data: Data;
DeferredCount: number;
DeliveredCount: number;
HardbouncedCount: number;
LastActivityAt: string;
ListRecipientID: number;
OpenedCount: number;
PreQueuedCount: number;
ProcessedCount: number;
QueuedCount: number;
SoftbouncedCount: number;
SpamComplaintCount: number;
UnsubscribedCount: number;
WorkFlowExitedCount: number;
}
interface StatCounter {
APIKeyID: number;
EventClickDelay: number;
EventClickedCount: number;
EventOpenDelay: number;
EventOpenedCount: number;
EventSpamCount: number;
EventUnsubscribedCount: number;
EventWorkflowExitedCount: number;
MessageBlockedCount: number;
MessageClickedCount: number;
MessageDeferredCount: number;
MessageHardBouncedCount: number;
MessageOpenedCount: number;
MessageQueuedCount: number;
MessageSentCount: number;
MessageSoftBouncedCount: number;
MessageSpamCount: number;
MessageUnsubscribedCount: number;
MessageWorkFlowExitedCount: number;
SourceID: number;
Timeslice: string;
Total: number;
}
interface LinkClickStatistic {
ClickedEventsCount: number;
ClickedMessagesCount: number;
PositionIndex: number;
URL: string;
}
interface RecipientESPStatistic {
AttemptedMessagesCount?: number;
ClickedMessagesCount?: number;
DeferredMessagesCount?: number;
DeliveredMessagesCount?: number;
HardBouncedMessagesCount?: number;
ESPName?: string;
OpenedMessagesCount?: number;
SoftBouncedMessagesCount?: number;
SpamReportsCount?: number;
UnsubscribedMessagesCount?: number;
OpenRate?: number;
ClickThroughRate?: number;
SoftBouncedRate?: number;
HardBouncedRate?: number;
UnsubscribedRate?: number;
SpamReportsRate?: number;
DeferredRate?: number;
}
interface TopLinkClicked {
ClickedCount: number;
LinkId: number;
Url: string;
}
interface UserAgentStatistic {
Count: number;
DistinctCount: number;
Platform: string;
UserAgent: string;
}
type GetCampaignOverviewQueryParams = Partial<Common.Pagination> & {
All?: boolean;
Archived?: boolean;
Drafts?: boolean;
ID?: number;
IDType?: CampaignOverviewIDType;
Programmed?: boolean;
Sent?: boolean;
Starred?: boolean;
Subject?: string;
};
type GetContactStatisticsQueryParams = Partial<Common.Pagination> & {
Blocked?: boolean;
Bounced?: boolean;
Click?: boolean;
Deferred?: boolean;
Hardbounced?: boolean;
LastActivityAt?: string;
MaxLastActivityAt?: string;
MinLastActivityAt?: string;
Open?: boolean;
Queued?: boolean;
Sent?: boolean;
Spam?: boolean;
Softbounced?: boolean;
Unsubscribed?: boolean;
};
type GetGEOStatisticsQueryParams = Partial<Common.TimestampPeriod> & Partial<Common.Pagination> & {
CampaignID?: number;
ContactsList?: number;
CustomCampaign?: string;
From?: string;
FromDomain?: string;
FromID?: number;
FromType?: Message.FromType;
IsDeleted?: boolean;
IsNewsletterTool?: boolean;
IsStarred?: boolean;
MessageStatus?: Message.MessageStatus;
Period?: Common.Period;
};
type GetListRecipientStatisticsQueryParams = Partial<Common.Pagination> & {
Blocked?: boolean;
Bounced?: boolean;
Click?: boolean;
Contact?: number;
ContactsList?: number;
IsExcludedFromCampaigns?: boolean;
IsUnsubscribed?: boolean;
LastActivityAt?: string;
MaxLastActivityAt?: string;
MinLastActivityAt?: string;
MaxUnsubscribedAt?: string;
MinUnsubscribedAt?: string;
Open?: boolean;
Queued?: boolean;
Sent?: boolean;
ShowExtraData?: boolean;
Spam?: boolean;
TimeZone?: string;
Unsubscribed?: boolean;
};
type GetStatCountersQueryParams = Partial<Common.TimestampPeriod> & Partial<Common.Pagination> & {
CounterSource: CounterSource;
CounterResolution: CounterResolution;
CounterTiming: CounterTiming;
SourceID?: number;
};
type GetLinkClickStatisticsQueryParams = Partial<Common.Pagination> & {
CampaignID: number;
};
type GetRecipientESPStatisticsQueryParams = GetLinkClickStatisticsQueryParams & {
ESP_Name?: number;
};
type GetTopLinkClickedQueryParams = Partial<Common.TimestampPeriod> & Partial<Common.Pagination> & {
ActualClicks?: boolean;
CampaignID?: number;
Contact?: number;
ContactsList?: number;
CustomCampaign?: string;
From?: string;
FromDomain?: string;
FromID?: number;
FromType?: Message.FromType;
IsDeleted?: boolean;
IsNewsletterTool?: boolean;
IsStarred?: boolean;
Message?: number;
Period?: Common.Period;
};
type GetUserAgentStatisticsQueryParams = Partial<Common.TimestampPeriod> & Partial<Common.Pagination> & {
CampaignID?: number;
ContactsList?: number;
CustomCampaign?: string;
Event?: EmailEvent;
ExcludePlatform?: string;
From?: string;
FromDomain?: string;
FromID?: number;
FromType?: Message.FromType;
IsDeleted?: boolean;
IsNewsletterTool?: boolean;
IsStarred?: boolean;
Period?: Common.Period;
Platform?: string;
};
type GetCampaignOverviewResponse = Common.Response<CampaignOverview[]>;
type GetContactStatisticsResponse = Common.Response<ContactStatistic[]>;
type GetGEOStatisticsResponse = Common.Response<GEOStatistic[]>;
type GetListRecipientStatisticsResponse<Data = Array<unknown>> = Common.Response<Array<ListRecipientStatistic<Data>>>;
type GetStatCountersResponse = Common.Response<StatCounter[]>;
type GetLinkClickStatisticsResponse = Common.Response<LinkClickStatistic[]>;
type GetRecipientESPStatisticsResponse = Common.Response<RecipientESPStatistic[]>;
type GetTopLinkClickedResponse = Common.Response<TopLinkClicked[]>;
type GetUserAgentStatisticsResponse = Common.Response<UserAgentStatistic[]>;
}

View File

@ -0,0 +1,101 @@
import { Common } from './Common';
export declare namespace Template {
export enum Categories {
Full = "full",
Basic = "basic",
NewsLetter = "newsletter",
ECommerce = "e-commerce",
Events = "events",
Travel = "travel",
Sports = "sports",
Welcome = "welcome",
ContactPropertyUpdate = "contact-property-update",
Support = "support",
Invoice = "invoice",
Anniversary = "anniversary",
Account = "account",
Activation = "activation"
}
export enum CategoriesSelectionMethod {
ContainsAny = "containsany",
ContainsAll = "containsall",
IsSubSet = "issubset"
}
export enum EditMode {
DragAndDropBuilder = 1,
HTMLBuilder = 2,
SavedSectionBuilder = 3,
MJMLBuilder = 4
}
export enum OwnerType {
ApiKey = "apikey",
User = "user",
Global = "global"
}
export enum Purposes {
Marketing = "marketing",
Transactional = "transactional",
Automation = "automation"
}
export enum PurposesSelectionMethod {
ContainsAny = "containsany",
ContainsAll = "containsall",
IsSubSet = "issubset"
}
export interface Headers {
From: string;
Subject: string;
'Reply-to': string;
}
export interface Template {
Author: string;
Categories: Categories;
Copyright: string;
Description: string;
EditMode: EditMode;
IsStarred: boolean;
IsTextPartGenerationEnabled: boolean;
Locale: string;
Name: string;
OwnerType: OwnerType;
Presets: string;
Purposes: Purposes;
ID: number;
OwnerId: number;
Previews: string;
CreatedAt: string;
LastUpdatedAt: string;
}
export type TemplateDetailContent = {
Headers: Headers;
'Html-part': string;
'Text-part': string;
MJMLContent: string;
};
export type PostTemplateBody = Partial<Omit<Template, 'Name' | 'ID' | 'OwnerId' | 'Previews' | 'CreatedAt' | 'LastUpdatedAt'>> & {
Name: string;
};
export type PutTemplateBody = Partial<PostTemplateBody>;
export type GetTemplateQueryParams = Partial<Common.Pagination> & {
Categories?: string;
CategoriesSelectionMethod?: CategoriesSelectionMethod;
EditMode?: EditMode;
Name?: string;
OwnerType?: OwnerType;
Purposes?: Purposes;
PurposesSelectionMethod?: PurposesSelectionMethod;
};
export type PostTemplateDetailContentBody = Partial<Omit<TemplateDetailContent, 'Headers'>> & {
Headers?: Partial<Headers>;
};
export type PutTemplateDetailContentBody = PostTemplateDetailContentBody;
type TemplateResponse = Common.Response<Template[]>;
type TemplateDetailContentResponse = Common.Response<TemplateDetailContent[]>;
export type PostTemplateResponse = TemplateResponse;
export type PutTemplateResponse = TemplateResponse;
export type GetTemplateResponse = TemplateResponse;
export type PostTemplateDetailContentResponse = TemplateDetailContentResponse;
export type PutTemplateDetailContentResponse = TemplateDetailContentResponse;
export type GetTemplateDetailContentResponse = TemplateDetailContentResponse;
export {};
}

View File

@ -0,0 +1,57 @@
import { Common } from './Common';
export declare namespace Webhook {
export enum EventType {
Open = "open",
Click = "click",
Bounce = "bounce",
Spam = "spam",
Blocked = "blocked",
UnSub = "unsub",
Sent = "sent"
}
export enum EventTypeValue {
Click = 1,
Bounce = 2,
Spam = 3,
Blocked = 4,
Unsubscribe = 5,
Open = 6,
Sent = 7
}
export enum Status {
Dead = "dead",
Alive = "alive"
}
export type Version = 1 | 2;
export interface EventCallbackUrl {
ID: number;
EventType: EventType;
IsBackup: boolean;
Status: Status;
APIKeyID: number;
Version: Version;
Url: string;
}
export type PostEventCallbackUrlBody = {
Url: string;
EventType?: EventType;
IsBackup?: boolean;
Status?: Status;
};
export type PutEventCallbackUrlBody = Partial<PostEventCallbackUrlBody>;
export type GetEventCallbackUrlQueryParams = Partial<Common.Pagination> & {
Backup?: boolean;
EventType?: EventTypeValue;
Status?: string;
Version?: Version;
};
type EventCallbackUrlResponse = {
Count: number;
Total: number;
Data: EventCallbackUrl[];
};
export type PostEventCallbackUrlResponse = EventCallbackUrlResponse;
export type PutEventCallbackUrlResponse = EventCallbackUrlResponse;
export type GetEventCallbackUrlResponse = EventCallbackUrlResponse;
export {};
}

View File

@ -0,0 +1,16 @@
export { LibraryResponse, LibraryLocalResponse } from './LibraryResponse';
export { Common } from './Common';
export { SendEmailV3, SendEmailV3_1, } from './SendEmail';
export { Message } from './Message';
export { Contact, ContactList, BulkContactManagement, ContactProperties, ContactSubscription, ContactVerification, } from './Contact';
export { DraftCampaign, SentCampaign, } from './Campaign';
export { Segmentation } from './Segmentation';
export { Template } from './Template';
export { Statistic } from './Statistic';
export { MessageEvent } from './MessageEvent';
export { Webhook } from './Webhook';
export { Parse } from './Parse';
export { Sender, Metasender, DNS, } from './SenderAddressAndDomain';
export { APIKeyConfiguration, AccountSetting, } from './Setting';
export { SendMessage } from './SendMessage';
export { SMSMessage } from './SMSMessage';

View File

@ -0,0 +1,25 @@
export declare namespace TFunction {
type Args<T> = T extends (...args: infer U) => unknown ? U : never;
type Arg0<T> = T extends (arg1: infer U) => unknown ? U : never;
}
export declare namespace TObject {
type TKeys<T> = Array<keyof T>;
type TValues<TObj> = TObj extends Record<string, infer TKey> ? Array<TKey> : never;
type MakeOptional<T, K extends keyof T> = Omit<T, K> & Partial<T>;
type MakeRequired<T, K extends keyof T> = Omit<T, K> & Required<Pick<T, K>>;
type MakeNil<T extends Record<string, unknown>, TObjKeys extends keyof T> = {
[TKey in TObjKeys]?: T[TKey] | null;
};
type MakeNilAll<T extends Record<string, unknown>> = {
[TKey in keyof T]?: T[TKey] | null;
};
type UnknownRec = Record<string, unknown>;
}
export declare namespace TArray {
type TKeys<T extends Array<unknown>> = Array<Exclude<keyof T, keyof Array<unknown>>>;
type TValues<T extends Array<unknown>> = Array<T[number]>;
type SingleType<TValue> = TValue extends Array<infer TSingle> ? TSingle : TValue;
type PossibleArray<TValue> = TValue | Array<TValue>;
type Pair<T, K> = [T, K];
type Pairs<T, K> = Pair<T, K>[];
}

View File

@ -0,0 +1,6 @@
import isNil from './isNil';
import isNull from './isNull';
import isUndefined from './isUndefined';
import isPureObject from './isPureObject';
import setValueIfNotNil from './setValueIfNotNil';
export { isNil, isNull, isUndefined, isPureObject, setValueIfNotNil, };

View File

@ -0,0 +1,2 @@
declare function isNil(value: unknown): boolean;
export default isNil;

View File

@ -0,0 +1,2 @@
declare function isNull(value: unknown): value is null;
export default isNull;

View File

@ -0,0 +1,2 @@
declare function isPureObject(value: unknown): boolean;
export default isPureObject;

View File

@ -0,0 +1,2 @@
declare function isUndefined(value: unknown): value is undefined;
export default isUndefined;

View File

@ -0,0 +1,3 @@
import { TObject } from '../types';
declare function setValueIfNotNil(targetObject: TObject.UnknownRec, path: string, value: unknown): void;
export default setValueIfNotNil;