UNPKG

mnotify-ts-sdk

Version:

Modern, zero-dependency TypeScript SDK for mNotify BMS API - Type-safe SMS, contacts, and account management with Railway-Oriented Programming

44 lines (43 loc) 1.45 kB
import type { HttpClient } from "../client/HttpClient"; import type { Result } from "../types/Result"; import { MNotifyError } from "../errors/MNotifyError"; export interface Contact { _id: string; phone: string; title?: string; firstname: string; lastname: string; email?: string[]; dbo?: string; } export type CreateContactInput = Omit<Contact, "_id">; /** * Service for managing contacts with mNotify API */ export declare class ContactService { private readonly client; constructor(client: HttpClient); private annotate; /** * Creates a new contact (railway-oriented programming) * @param contact - Contact data * @returns Result containing created contact with ID or error */ createContactSafe(contact: CreateContactInput, groupId?: string): Promise<Result<Contact, MNotifyError>>; /** * Creates a new contact (throws on error - legacy API) * @param contact - Contact data * @returns Created contact with ID */ createContact(contact: CreateContactInput, groupId?: string): Promise<Contact>; /** * Retrieves all contacts (railway-oriented programming) * @returns Result containing array of contacts or error */ getContactsSafe(): Promise<Result<Contact[], MNotifyError>>; /** * Retrieves all contacts (throws on error - legacy API) * @returns Array of contacts */ getContacts(): Promise<Contact[]>; }