@seven.io/client
Version:
Official API client for seven
1,075 lines (922 loc) • 29.3 kB
TypeScript
declare abstract class AbstractResource {
protected readonly client: Client;
constructor(client: Client);
}
export declare type ActiveNumber = {
billing: {
fees: {
basic_charge: number;
setup: number;
sms_mo: number;
voice_mo: number;
};
payment_interval: PaymentInterval;
};
country: string;
created: string;
expires: string | null;
features: {
a2p_sms: boolean;
sms: boolean;
voice: boolean;
};
forward_sms_mo: {
email: {
address: string[];
enabled: boolean;
};
sms: {
enabled: boolean;
number: string[];
};
};
friendly_name: string;
number: string;
};
export declare type ActiveNumbersResponse = {
activeNumbers: ActiveNumber[];
};
export declare type AnalyticBase = {
hlr: number;
inbound: number;
mnp: number;
rcs: number;
sms: number;
usage_eur: number;
voice: number;
};
export declare type AnalyticGroupByCountry = AnalyticBase & {
country: string;
};
export declare type AnalyticGroupByDate = AnalyticBase & {
date: string;
};
export declare type AnalyticGroupByLabel = AnalyticBase & {
label: string;
};
export declare type AnalyticGroupBySubaccount = AnalyticBase & {
account: string;
};
export declare const ANALYTICS_LABELS: readonly ["all"];
export declare const ANALYTICS_SUBACCOUNTS: readonly ["only_main", "all"];
export declare type AnalyticsParams = {
end?: Date;
label?: typeof ANALYTICS_LABELS[number] | string;
start?: Date;
subaccounts?: typeof ANALYTICS_SUBACCOUNTS[number] | number;
};
export declare class AnalyticsResource extends AbstractResource {
byCountry(p?: AnalyticsParams): Promise<AnalyticGroupByCountry[]>;
byDate(p?: AnalyticsParams): Promise<AnalyticGroupByDate[]>;
byLabel(p?: AnalyticsParams): Promise<AnalyticGroupByLabel[]>;
bySubaccount(p?: AnalyticsParams): Promise<AnalyticGroupBySubaccount[]>;
}
export declare const API_RESPONSE_CODES: readonly [100, ErrorCode.InvalidRecipientNumber, ErrorCode.InsufficientCredits, ErrorCode.CarrierFailed];
export declare type ApiResponseCode = typeof API_RESPONSE_CODES[number];
export declare type AvailableNumber = {
country: string;
features: {
a2p_sms: boolean;
sms: boolean;
voice: boolean;
};
fees: {
monthly: {
basic_charge: number;
setup: number;
};
annually: {
basic_charge: number;
setup: number;
};
sms_mo: number;
voice_mo: number;
};
number: string;
number_parsed: string;
};
export declare type AvailableNumbersParams = {
country?: string;
features_a2p_sms?: boolean;
features_sms?: boolean;
features_voice?: boolean;
};
export declare type AvailableNumbersResponse = {
availableNumbers: AvailableNumber[];
};
export declare type Balance = {
amount: number;
currency: string;
};
export declare class BalanceResource extends AbstractResource {
get: () => Promise<Balance>;
}
export declare type Carrier = {
country: string;
name: string | null;
network_code: string;
network_type: NetworkType | null;
};
export declare class Client {
protected options: ClientOptions;
static readonly BASE_URL = "https://gateway.seven.io/api";
static readonly CONTENT_TYPE_URLENCODED = "application/x-www-form-urlencoded";
constructor(options: ClientOptions);
request: <R extends any, P extends {
[p: string]: any;
} = {}>(method: "delete" | "get" | "post" | "patch", endpoint: string, payload: P, contentType?: string) => Promise<R>;
}
export declare type ClientOptions = {
apiKey: string;
debug?: boolean;
sentWith?: string;
signingSecret?: string;
};
export declare const CNAM_API_CODES: readonly [ErrorCode.InvalidRecipientNumber, ErrorCode.CarrierFailed];
export declare type CnamResponse = {
code: number | string;
name?: string;
number?: string;
success?: 'false' | 'true';
};
export declare type Contact = {
avatar: string;
created: string;
groups: number[];
id: number;
initials: {
color: string;
initials: string;
};
properties: {
[k: string]: any;
} & {
address: string | null;
birthday: string | null;
city: string | null;
email: string | null;
firstname: string | null;
fullname: string | null;
home_number: string | null;
lastname: string | null;
mobile_number: string | null;
notes: string | null;
postal_code: string | null;
};
validation: {
state: 'valid' | 'invalid' | 'absent' | 'unknown' | null;
timestamp: string | null;
};
};
export declare type ContactsCreateParams = Pick<Contact, 'avatar' | 'groups'> & {
properties: Omit<Contact['properties'], 'fullname'>;
};
export declare type ContactsDeleteResponse = {
success: boolean;
};
export declare type ContactsListParams = {
groupId?: number;
limit?: number;
offset?: number;
orderBy?: string;
orderDirection?: string;
search?: string;
};
export declare type ContactsListResponse = {
data: Contact[];
pagingMetadata: {
count: number;
has_more: boolean;
limit: number;
offset: number;
total: number;
};
};
export declare class ContactsResource extends AbstractResource {
create({ avatar, groups, properties }: ContactsCreateParams): Promise<Contact>;
delete(id: number): Promise<ContactsDeleteResponse>;
get(id: number): Promise<Contact>;
list(p?: ContactsListParams): Promise<ContactsListResponse>;
update(p: Contact): Promise<Contact>;
}
export declare type CountryNetwork = {
comment: string;
features: string[];
mcc: string;
mncs: string[];
networkName: string;
price: number;
};
export declare type CountryPricing = {
countryCode: string;
countryName: string;
countryPrefix: string;
networks: CountryNetwork[];
};
export declare type DeleteGroupResponse = {
success: boolean;
};
export declare type DeleteNumberParams = {
delete_immediately?: boolean;
number: string | ActiveNumber;
};
export declare type DeleteNumberResponse = {
success: boolean;
};
export declare type DtmfPayload = {
data: {
callerId: string;
dtmf_digit: number;
duration: number;
id: number;
pricePerMinute: number;
recipient: string;
status: 'completed' | string;
system: string;
timestamp: number;
total_price: number;
};
webhook_event: "voice_dtmf";
webhook_timestamp: string;
};
export declare enum ErrorCode {
InvalidCountryCode = 201,
InvalidRecipientNumber = 202,
MissingAuthentication = 300,
MissingParameterTo = 301,
MissingParameterType = 304,
MissingParameterText = 305,
InvalidSender = 306,
MissingParameterUrl = 307,
InvalidType = 400,
ParameterLongExceedsCharLimit = 401,
PreventedByReloadLock = 402,
DailyLimitReachedForNumber = 403,
InsufficientCredits = 500,
CarrierFailed = 600,
UnknownError = 700,
MissingLogoFile = 801,
NonExistingLogoFile = 802,
MissingRingTone = 803,
InvalidApiKey = 900,
InvalidMessageId = 901,
DeactivatedApi = 902,
DisallowedIp = 903
}
export declare type Format = {
carrier: string | null;
country_code: string | false;
country_iso: string | null;
country_name: string | null;
international: string;
international_formatted: string;
national: string | null;
network_type: NetworkType | null;
success: boolean;
};
export declare type GetNumberParams = {
number: string;
};
export declare type Group = {
created: string;
id: number;
members_count: number;
name: string;
};
export declare class GroupsResource extends AbstractResource {
edit(id: number, group: Pick<Group, 'name'>): Promise<Group>;
create(group: Pick<Group, 'name'>): Promise<Group>;
delete(id: number, deleteContacts?: boolean): Promise<DeleteGroupResponse>;
all(): Promise<Group[]>;
one(id: number): Promise<Group>;
}
export declare type GsmCode = typeof LOOKUP_GSM_CODES[number];
export declare type HLR = {
country_code: string;
country_code_iso3?: string;
country_name: string;
country_prefix: string;
current_carrier: Carrier;
gsm_code: GsmCode;
gsm_message: string;
international_format_number: string;
international_formatted: string;
lookup_outcome: typeof HLR_LOOKUP_OUTCOME_CODES[number] | boolean;
lookup_outcome_message: string;
national_format_number: string;
original_carrier: Carrier;
ported: typeof HLR_PORTED_CODES[number];
reachable: typeof HLR_REACHABLE_CODES[number];
roaming: typeof HLR_ROAMING_CODES[number] | Roaming;
status: boolean;
status_message: typeof HLR_STATUS_MESSAGE_CODES[number];
valid_number: typeof HLR_VALID_NUMBER_CODES[number];
};
export declare const HLR_LOOKUP_OUTCOME_CODES: readonly [1, 2, 0];
export declare const HLR_PORTED_CODES: readonly ["assumed_not_ported", "assumed_ported", "not_ported", "ported", "unknown"];
export declare const HLR_REACHABLE_CODES: readonly ["absent", "bad_number", "blacklisted", "reachable", "undeliverable", "unknown"];
export declare const HLR_ROAMING_CODES: readonly ["not_roaming"];
export declare const HLR_STATUS_MESSAGE_CODES: readonly ["error", "success"];
export declare const HLR_VALID_NUMBER_CODES: readonly ["not_valid", "unknown", "valid"];
export declare type Hook = {
enabled: boolean;
created: Date;
event_filter: null | string;
event_type: HookEventType;
headers: string;
id: string;
request_method: HookRequestMethod;
target_url: string;
};
export declare const HOOK_EVENT_TYPES: readonly ["all", "dlr", "sms_mo", "rcs", "tracking", "voice_call", "voice_status"];
export declare const HOOK_REQUEST_METHODS: readonly ["GET", "JSON", "POST"];
export declare type HookEventType = (typeof HOOK_EVENT_TYPES)[number];
export declare type HookRcsLocationPayload = {
agent_id: string;
content_type: 'location';
id: number;
location: {
latitude: number;
longitude: number;
};
message_type: 'RCS';
sender: string;
time: number;
};
export declare type HookRcsPayload = HookRcsStatusPayload | HookRcsTextPayload | HookRcsSuggestionResponsePayload | HookRcsUserFilePayload | HookRcsUserFileImagePayload | HookRcsLocationPayload;
export declare type HookRcsStatusPayload = {
agent_id: string;
sender: string;
status: 'IS_TYPING' | 'READ' | 'DELIVERED';
foreign_id: string | null;
msg_id: string;
timestamp: string;
};
export declare type HookRcsSuggestionResponsePayload = {
agent_id: string;
content_type: 'suggestion_response';
id: number;
message_type: 'RCS';
sender: string;
suggestion_response: {
postbackData: string;
text: string;
type: 'REPLY';
};
time: number;
};
export declare type HookRcsTextPayload = {
agent_id: string;
content_type: 'text';
foreign_id?: string;
id: number;
message_type: 'RCS';
sender: string;
text: string;
time: number;
};
export declare type HookRcsUserFileImagePayload = {
agent_id: string;
content_type: 'user_file';
id: number;
message_type: 'RCS';
sender: string;
time: number;
user_file: {
payload: {
fileName: string;
fileSizeBytes: number;
fileUri: string;
mimeType: string;
};
thumbnail: {
fileSizeBytes: number;
fileUri: string;
mimeType: string;
};
};
};
export declare type HookRcsUserFilePayload = {
agent_id: string;
content_type: 'user_file';
id: number;
message_type: 'RCS';
sender: string;
time: number;
user_file: {
payload: {
fileName: string;
fileSizeBytes: number;
fileUri: string;
mimeType: string;
};
};
};
export declare type HookRequestMethod = (typeof HOOK_REQUEST_METHODS)[number];
export declare type HooksReadResponse = {
hooks?: Hook[];
success: boolean;
};
export declare class HooksResource extends AbstractResource {
read(): Promise<HooksReadResponse>;
subscribe(p: HooksSubscribeParams): Promise<HooksSubscribeResponse>;
unsubscribe(id: number): Promise<HooksUnsubscribeResponse>;
}
export declare type HooksSubscribeParams = {
eventFilter?: string;
eventType: HookEventType;
headers?: string;
requestMethod?: HookRequestMethod;
targetUrl: string;
};
export declare type HooksSubscribeResponse = {
error_message?: string;
id?: number;
success: boolean;
};
export declare type HooksUnsubscribeResponse = {
success: boolean;
};
export declare type InboundCallPayload = {
data: {
caller: string;
id: number;
system: string;
time: number;
};
webhook_event: "voice_call";
webhook_timestamp: string;
};
export declare type InboundSmsPayload = {
data: {
id: string;
message_type: 'SMS';
sender: string;
system: string;
text: string;
time: string;
};
webhook_event: 'sms_mo';
webhook_timestamp: '2020-12-02 11:55:44';
};
export declare function isHookRcsFileMessage(hook: HookRcsPayload): hook is HookRcsUserFilePayload;
export declare function isHookRcsImageMessage(hook: HookRcsPayload): hook is HookRcsUserFileImagePayload;
export declare function isHookRcsLocation(hook: HookRcsPayload): hook is HookRcsLocationPayload;
export declare function isHookRcsStatusUpdate(hook: HookRcsPayload): hook is HookRcsStatusPayload;
export declare function isHookRcsTextMessage(hook: HookRcsPayload): hook is HookRcsTextPayload;
export declare type JournalBase = {
from: string;
id: string;
price: string;
text: string;
timestamp: string;
to: string;
};
export declare type JournalInbound = JournalBase & {
reply_to_message_id: string | null;
};
export declare type JournalOutbound = JournalBase & {
connection: string;
dlr: string | null;
dlr_timestamp: string | null;
foreign_id: string | null;
label: string | null;
latency: string | null;
mccmnc: string | null;
type: string;
};
export declare type JournalParams = {
dateFrom?: string;
dateTo?: string;
id?: number;
limit?: number;
offset?: number;
state?: string;
to?: string;
};
export declare class JournalResource extends AbstractResource {
inbound(p?: JournalParams): Promise<JournalInbound[]>;
outbound(p?: JournalParams): Promise<JournalOutbound[]>;
voice: (p?: JournalParams) => Promise<JournalVoice[]>;
}
export declare type JournalVoice = JournalBase & {
duration: string;
error: string;
status: 'completed' | 'no-answer' | string;
xml: boolean;
};
export declare const LOOKUP_GSM_CODES: readonly ["0", "1", "2", "3", "5", "6", "7", "8", "9", "a", "b", "c", "d", "e", "f", "10", "11", "12", "13", "14", "15", "17", "18", "19", "1a", "1b", "1c", "1d", "1e", "1f", "20", "21", "22", "23", "24", "25", "26", "27", "28", "2b", "2c", "2d", "2e", "2f", "30", "31", "32", "33", "34", "35", "36", "3a", "47", "48", "56", "2100", "2101", "2102", "2200", "2201", "2202", "2203", "2204", "2205", "2206", "2207", "2300", "2301", "2302", "2400", "2401", "2402", "2403", "2404", "6000", "6xxx", "6001", "6002", "6003", "6004", "6005", "6006", "8000", "8001", "8002", "8003", "8004", "8008", "800b", "8010", "a001", "a002", "cxxx", "c000", "c001", "c002", "c003", "c004", "c005", "c006", "c007", "c008", "c009", "c00a", "c00b", "c00d", "d000", "d001", "d002", "d004", "d00a", "d00c", "d010", "d020", "e010", "e040", "e082", "fc0a", "fc06", "fc07", "fc08", "ffdd", "ffde", "ffdf", "ffe0", "ffe1", "ffe5", "fff0", "ffff", "4xxx", "81xx", "82xx", "83xx", "84xx", "85xx", "86xx", "87xx", "88xx", "8axx", "89xx", "8cxx", "exxx", "e140"];
export declare type LookupParams = {
numbers: string[];
};
export declare class LookupResource extends AbstractResource {
cnam(p: LookupParams): Promise<CnamResponse[]>;
format(p: LookupParams): Promise<Format[]>;
hlr(p: LookupParams): Promise<HLR[]>;
mnp(p: LookupParams): Promise<MnpResponse[]>;
rcs(p: LookupParams): Promise<RcsCapabilities[]>;
}
export declare type MNP = {
country: string;
international_formatted: string;
isPorted: boolean | null;
mccmnc: string;
national_format: string;
network: string | null;
networkType: string | null;
number: string;
};
export declare type MnpResponse = {
code: ApiResponseCode;
mnp: MNP;
price: number;
success: boolean;
};
export declare enum NetworkType {
FixedLine = "fixed_line",
FixedLineOrMobile = "fixed_line_or_mobile",
Mobile = "mobile",
Pager = "pager",
PersonalNumber = "personal_number",
PremiumRate = "premium_rate",
SharedCost = "shared_cost",
TollFree = "toll_free",
Uan = "uan",
Unknown = "unknown",
Voicemail = "voicemail",
Voip = "voip"
}
export declare class NumbersResource extends AbstractResource {
getActive: (p: GetNumberParams) => Promise<ActiveNumber>;
listActive: () => Promise<ActiveNumbersResponse>;
listAvailable: (p: AvailableNumbersParams) => Promise<AvailableNumbersResponse>;
order: (p: OrderNumberParams) => Promise<OrderNumberResponse>;
update: ({ number, ...p }: UpdateNumberParams) => Promise<ActiveNumber>;
delete: ({ number, ...p }: DeleteNumberParams) => Promise<DeleteNumberResponse>;
}
export declare type OauthScope = 'analytics' | 'balance' | 'contacts' | 'hooks' | 'journal' | 'lookup' | 'pricing' | 'sms' | 'status' | 'subaccounts' | 'validate_for_voice' | 'voice';
export declare type OrderNumberParams = {
number: string | AvailableNumber;
payment_interval?: PaymentInterval;
};
export declare type OrderNumberResponse = {
error: string | null;
success: boolean;
};
export declare type PaymentInterval = 'annually' | 'monthly';
export declare type PerformanceTrackingPayload = {
data: {
final_url: string;
sms_id: string;
sms_label: null | string;
total_clicks: number;
total_views: number;
tracking_url: string;
type: 'click' | string;
};
'webhook_event': 'tracking';
'webhook_timestamp': string;
};
export declare type PricingParams = {
country?: string;
};
export declare class PricingResource extends AbstractResource {
get: (p?: PricingParams) => Promise<PricingResponse>;
}
export declare type PricingResponse = {
countCountries: number;
countNetworks: number;
countries: CountryPricing[];
};
export declare type Profile = {
alias: string;
balance: string;
company: string;
email: string;
success: boolean;
user_id: number;
};
export declare enum ProviderName {
D1 = "d1",
D2 = "d2",
O2 = "o2",
Eplus = "eplus",
NotAvailable = "N/A",
International = "int"
}
export declare type RcsCapabilities = Format & {
rcs_capabilities: RcsCapability[];
};
export declare type RcsCapability = 'FEATURE_UNSPECIFIED' | 'REVOCATION' | 'RICHCARD_STANDALONE' | 'RICHCARD_CAROUSEL' | 'ACTION_CREATE_CALENDAR_EVENT' | 'ACTION_DIAL' | 'ACTION_OPEN_URL' | 'ACTION_SHARE_LOCATION' | 'ACTION_VIEW_LOCATION';
export declare type RcsDeleteParams = {
id: string;
};
export declare type RcsDeleteResponse = {
success: boolean;
};
export declare type RcsDispatchParams = {
delay?: string;
foreign_id?: string;
from?: string;
label?: string;
performance_tracking?: boolean;
text: string;
to: string;
ttl?: number;
};
export declare type RcsDispatchResponse = {
debug: 'false' | 'true';
balance: number;
messages: RcsMessage[];
sms_type: SmsType;
success: string;
total_price: number | null;
};
export declare type RcsEvent = 'IS_TYPING' | 'READ';
export declare type RcsEventParams = RcsEventParamsBase & (RcsEventParamsTo | RcsEventParamsMessageId);
export declare type RcsEventParamsBase = {
event: RcsEvent;
};
export declare type RcsEventParamsMessageId = {
msg_id: string;
};
export declare type RcsEventParamsTo = {
to: string;
};
export declare type RcsEventResponse = {
success: boolean;
};
export declare type RcsMessage = {
channel: 'RCS' | string;
encoding: SmsEncoding;
error: string | null;
error_text: string | null;
fallback: string | null;
id: string | null;
is_binary: boolean;
label: string | null;
messages?: string[];
parts: number;
price: number;
recipient: string;
sender: string;
success: boolean;
text: string;
udh: string | null;
};
export declare class RcsResource extends AbstractResource {
delete(p: RcsDeleteParams): Promise<RcsDeleteResponse>;
dispatch(p: RcsDispatchParams): Promise<RcsDispatchResponse>;
event(p: RcsEventParams): Promise<RcsEventResponse>;
}
export declare type Roaming = {
roaming_country_code: string;
roaming_network_code: string;
roaming_network_name: string;
status: typeof ROAMING_STATUS_CODES[number];
};
export declare const ROAMING_STATUS_CODES: readonly ["not_roaming", "roaming", "unknown"];
export declare const SMS_ENCODINGS: readonly ["gsm", "ucs2"];
export declare const SMS_TYPES: readonly ["direct", "economy"];
export declare type SmsDeleteParams = {
ids: string[];
};
export declare type SmsDeleteResponse = {
deleted: string[] | null;
success: boolean;
};
export declare type SmsEncoding = typeof SMS_ENCODINGS[number];
export declare type SmsFile = {
contents: string;
name: string;
password?: string;
validity?: number;
};
export declare type SmsMessage = {
encoding: SmsEncoding;
error: string | null;
error_text: string | null;
id: string | null;
is_binary: boolean;
label: string | null;
messages?: string[];
parts: number;
price: number;
recipient: string;
sender: string;
success: boolean;
text: string;
udh: string | null;
};
export declare type SmsParams = {
delay?: Date;
files?: SmsFile[];
flash?: boolean;
foreign_id?: string;
from?: string;
label?: string;
performance_tracking?: boolean;
text: string;
to: string[];
udh?: string;
ttl?: number;
};
export declare class SmsResource extends AbstractResource {
delete: (p: SmsDeleteParams) => Promise<SmsDeleteResponse>;
dispatch: (p: SmsParams) => Promise<SmsResponse>;
}
export declare type SmsResponse = {
debug: 'false' | 'true';
balance: number;
messages: SmsMessage[];
sms_type: SmsType;
success: string;
total_price: number;
};
export declare type SmsStatusChangePayload = {
data: {
msg_id: string;
status: string;
timestamp: string;
};
webhook_event: 'dlr';
webhook_timestamp: string;
};
export declare type SmsType = typeof SMS_TYPES[number];
export declare enum StatusReportCode {
Delivered = "DELIVERED",
NotDelivered = "NOTDELIVERED",
Buffered = "BUFFERED",
Transmitted = "TRANSMITTED",
Accepted = "ACCEPTED",
Expired = "EXPIRED",
Rejected = "REJECTED",
Failed = "FAILED",
Unknown = "UNKNOWN"
}
export declare class StatusResource extends AbstractResource {
get: (ids: number[]) => Promise<StatusResponse[]>;
}
export declare type StatusResponse = {
id: number;
status: StatusReportCode;
statusTime: string;
};
export declare const STRING_RESPONSE_CODES: readonly ["100", string, string, string];
export declare type Subaccount = {
auto_topup: {
amount: number;
threshold: number;
};
balance: number;
company: null | string;
contact: {
email: string;
name: string;
};
id: number;
total_usage: number;
username: null | string;
};
export declare type SubaccountsAutoChargeParams = {
amount: number;
id: number;
threshold: number;
};
export declare type SubaccountsAutoChargeResponse = {
error: string | null;
success: boolean;
};
export declare type SubaccountsCreateParams = {
email: string;
name: string;
};
export declare type SubaccountsCreateResponse = {
error: string | null;
subaccount?: Subaccount;
success: boolean;
};
export declare type SubaccountsDeleteParams = {
id: number;
};
export declare type SubaccountsDeleteResponse = {
error: string | null;
success: boolean;
};
export declare class SubaccountsResource extends AbstractResource {
read: (id?: number) => Promise<Subaccount[]>;
create: (p: SubaccountsCreateParams) => Promise<SubaccountsCreateResponse>;
delete: (p: SubaccountsDeleteParams) => Promise<SubaccountsDeleteResponse>;
transferCredits: (p: SubaccountsTransferCreditsParams) => Promise<SubaccountsTransferCreditsResponse>;
autoCharge: (p: SubaccountsAutoChargeParams) => Promise<SubaccountsAutoChargeResponse>;
}
export declare type SubaccountsTransferCreditsParams = {
amount: number;
id: number;
};
export declare type SubaccountsTransferCreditsResponse = {
error: string | null;
success: boolean;
};
export declare type TokenResponse = {
access_token: string;
expires_in: number;
refresh_token: string;
scope: OauthScope[];
token_type: 'Bearer';
};
export declare type UpdateNumberParams = {
email_forward?: string[];
friendly_name?: string;
number: string | ActiveNumber;
sms_forward?: string[];
};
export declare type ValidateParams = {
callback?: string;
number: string;
};
export declare class ValidateResource extends AbstractResource {
start(p: ValidateParams): Promise<ValidateResponse>;
}
export declare type ValidateResponse = {
code?: string;
error: string | null;
formatted_output?: string | null;
id?: number | null;
sender?: string;
success: boolean;
voice?: boolean;
};
export declare type VoiceMessage = {
error: string | null;
error_text: string | null;
id: string | null;
price: number;
recipient: string;
sender: string;
success: boolean;
text: string;
};
export declare type VoiceParams = {
from?: string;
ringtime?: number;
text: string;
to: string | string[];
};
export declare class VoiceResource extends AbstractResource {
dispatch(p: VoiceParams): Promise<VoiceResponse>;
}
export declare type VoiceResponse = {
balance: number;
debug: boolean;
messages: VoiceMessage[];
success: string;
total_price: number;
};
export declare type VoiceStatusChangePayload = {
data: {
callerId: string;
duration: string;
id: string;
pricePerMinute: number;
recipient: string;
status: 'completed' | string;
timestamp: number;
};
webhook_event: 'voice_status';
webhook_timestamp: string;
};
export declare interface WebhookVerificationParams {
headers: Record<string, string | string[] | undefined>;
body: string | Buffer | object;
url: string;
method: string;
}
export declare interface WebhookVerificationResult {
valid: boolean;
error?: string;
timestamp?: number;
nonce?: string;
}
export declare class WebhookVerifier {
private readonly signingSecret;
private readonly maxAgeSeconds;
constructor(options: WebhookVerifierOptions);
/**
* Verify the authenticity of an incoming webhook from seven.io
*/
verify(params: WebhookVerificationParams): Promise<WebhookVerificationResult>;
/**
* Get header value case-insensitively
*/
private getHeader;
/**
* Constant-time string comparison to prevent timing attacks
*/
private constantTimeEqual;
}
export declare interface WebhookVerifierOptions {
signingSecret: string;
maxAgeSeconds?: number;
}
export { }