GET | /messages |
---|
"use strict";
/** @typedef {'Ascend'|'Descend'} */
export var SortOrders;
(function (SortOrders) {
SortOrders["Ascend"] = "Ascend"
SortOrders["Descend"] = "Descend"
})(SortOrders || (SortOrders = {}));
/** @typedef T {any} */
export class ListRequest {
/** @param {{page?:number,all?:boolean,countPerPage?:number,specificIds?:string[],sortField?:string,sortOrder?:SortOrders,simplifiedPaging?:boolean}} [init] */
constructor(init) { Object.assign(this, init) }
/**
* @type {number}
* @description The page of data to retrieve */
page;
/**
* @type {boolean}
* @description If you want all objects to be returned. This should be used with care */
all;
/**
* @type {number}
* @description The number per page to retrieve */
countPerPage;
/**
* @type {string[]}
* @description Specific IDs */
specificIds;
/**
* @type {string}
* @description Specify a sort field */
sortField;
/**
* @type {SortOrders}
* @description Specify a sort order */
sortOrder;
/**
* @type {boolean}
* @description Disables total / page counts - improves performance. Returns only data. If there is no more data, Items will be empty array */
simplifiedPaging;
}
/** @typedef {'Incoming'|'Outgoing'} */
export var MessageDirections;
(function (MessageDirections) {
MessageDirections["Incoming"] = "Incoming"
MessageDirections["Outgoing"] = "Outgoing"
})(MessageDirections || (MessageDirections = {}));
export class MessageInfo {
/** @param {{id?:string,accountId?:string,customerId?:string,endpointId?:string,endpointDisplayName?:string,date?:string,direction?:MessageDirections,otherAddress?:string,sender?:string,text?:string,isUnread?:boolean}} [init] */
constructor(init) { Object.assign(this, init) }
/** @type {string} */
id;
/** @type {string} */
accountId;
/** @type {string} */
customerId;
/** @type {string} */
endpointId;
/** @type {string} */
endpointDisplayName;
/** @type {string} */
date;
/** @type {MessageDirections} */
direction;
/** @type {string} */
otherAddress;
/** @type {string} */
sender;
/** @type {string} */
text;
/** @type {boolean} */
isUnread;
}
export class ListMessages extends ListRequest {
/** @param {{accountIds?:string[],customerIds?:string[],endpointIds?:string[],conversationIds?:string[],afterDate?:string,page?:number,all?:boolean,countPerPage?:number,specificIds?:string[],sortField?:string,sortOrder?:SortOrders,simplifiedPaging?:boolean}} [init] */
constructor(init) { super(init); Object.assign(this, init) }
/**
* @type {string[]}
* @description The IDs of the account whose messages you want to retrieve */
accountIds;
/**
* @type {string[]}
* @description The IDs of the customers whose messages you want to retrieve */
customerIds;
/**
* @type {string[]}
* @description The IDs of the endpoints whose messages you want to retrieve */
endpointIds;
/**
* @type {string[]}
* @description The ID of the conversations whose messages you want to retrieve */
conversationIds;
/**
* @type {string}
* @description The date after which messages should be retrieved */
afterDate;
}
export class EntityInfo {
/** @param {{id?:string,dateCreated?:string,dateLastModified?:string,createdBy?:string,lastModifiedBy?:string}} [init] */
constructor(init) { Object.assign(this, init) }
/**
* @type {string}
* @description The ID of the object */
id;
/**
* @type {string}
* @description The date the object was created */
dateCreated;
/**
* @type {string}
* @description The date the object was last modified */
dateLastModified;
/**
* @type {string}
* @description The user that created this object */
createdBy;
/**
* @type {string}
* @description The user that last modified this object */
lastModifiedBy;
}
export class BillingItem {
/** @param {{baseCost?:number,rawUnitMultiplier?:number,unitCost?:number,allowance?:number}} [init] */
constructor(init) { Object.assign(this, init) }
/** @type {number} */
baseCost;
/** @type {number} */
rawUnitMultiplier;
/** @type {number} */
unitCost;
/** @type {number} */
allowance;
}
export class BillingSettings {
/** @param {{base?:BillingItem,localNumbers?:BillingItem,tollFreeNumbers?:BillingItem,inboundVoiceCalls?:BillingItem,outboundVoiceCalls?:BillingItem,inboundFaxes?:BillingItem,outboundFaxes?:BillingItem,inboundSmsMessages?:BillingItem,outboundSmsMessages?:BillingItem,aiInsights?:BillingItem,aiLiveMinutes?:BillingItem}} [init] */
constructor(init) { Object.assign(this, init) }
/** @type {BillingItem} */
base;
/** @type {BillingItem} */
localNumbers;
/** @type {BillingItem} */
tollFreeNumbers;
/** @type {BillingItem} */
inboundVoiceCalls;
/** @type {BillingItem} */
outboundVoiceCalls;
/** @type {BillingItem} */
inboundFaxes;
/** @type {BillingItem} */
outboundFaxes;
/** @type {BillingItem} */
inboundSmsMessages;
/** @type {BillingItem} */
outboundSmsMessages;
/** @type {BillingItem} */
aiInsights;
/** @type {BillingItem} */
aiLiveMinutes;
}
export class AccountInfo extends EntityInfo {
/** @param {{name?:string,parentAccountId?:string,twilioAccountSid?:string,ancestorIds?:string[],maxPhoneNumbers?:number,isBYOA?:boolean,trustHubProfileSid?:string,logoId?:string,logoUri?:string,billingSettings?:BillingSettings,id?:string,dateCreated?:string,dateLastModified?:string,createdBy?:string,lastModifiedBy?:string}} [init] */
constructor(init) { super(init); Object.assign(this, init) }
/**
* @type {string}
* @description The name of this account */
name;
/**
* @type {string}
* @description The ID of this account's parent */
parentAccountId;
/**
* @type {string}
* @description The twilio account SID */
twilioAccountSid;
/**
* @type {string[]}
* @description The ancestors of this account. Useful for breadcrumbs */
ancestorIds;
/**
* @type {number}
* @description The max number of phone numbers this account can have */
maxPhoneNumbers;
/**
* @type {boolean}
* @description This account is BYOA */
isBYOA;
/**
* @type {string}
* @description TrustHub Profile Sid */
trustHubProfileSid;
/**
* @type {string}
* @description The ID of the logo file */
logoId;
/**
* @type {string}
* @description The URI of the logo file */
logoUri;
/**
* @type {BillingSettings}
* @description The billing settings for this account */
billingSettings;
}
/** @typedef T {any} */
export class ListResponse {
/** @param {{items?:AccountInfo[],totalCount?:number,totalPages?:number,hasMorePages?:boolean}} [init] */
constructor(init) { Object.assign(this, init) }
/**
* @type {AccountInfo[]}
* @description The items */
items;
/**
* @type {number}
* @description The total number of items */
totalCount;
/**
* @type {number}
* @description The total number of pages */
totalPages;
/**
* @type {boolean}
* @description Are there more pages of items? Used with simplified paging */
hasMorePages;
}
To override the Content-type in your clients, use the HTTP Accept Header, append the .other suffix or ?format=other
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
GET /messages HTTP/1.1 Host: team.evovoice.io Accept: text/jsonl
HTTP/1.1 200 OK Content-Type: text/jsonl Content-Length: length {"items":[{"id":"String","accountId":"String","customerId":"String","endpointId":"String","endpointDisplayName":"String","date":"String","direction":"Incoming","otherAddress":"String","sender":"String","text":"String","isUnread":false}],"totalCount":0,"totalPages":0,"hasMorePages":false}