UNPKG

@davidbolaji/termii-node

Version:

Node.js SDK for Termii API – send SMS, voice, OTP, and manage messaging with ease.

60 lines (59 loc) 1.77 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.PhonebookService = void 0; class PhonebookService { constructor(http) { this.http = http; } /** * Fetch all phonebooks (paginated) * * @returns Expanded `FetchPhonebooksResponse` including `data`, `links`, and `meta` */ async fetchPhonebooks() { return this.http.request("/phonebooks", { method: "GET", authLocation: "query" }); } /** * Create a new phonebook * * @param payload - Details of the phonebook to create * @returns Expanded `CreatePhonebookResponse` with status message */ async createPhonebook(payload) { return this.http.request("/phonebooks", { method: "POST", data: payload, authLocation: "body" }); } /** * Update an existing phonebook * * @param phonebookId - The ID of the phonebook to update * @param payload - Updated details for the phonebook * @returns Expanded `UpdatePhonebookResponse` with status message */ async updatePhonebook(phonebookId, payload) { return this.http.request(`/phonebooks/${phonebookId}`, { method: "PATCH", data: payload, authLocation: "body" }); } /** * Delete a phonebook * * @param phonebookId - The ID of the phonebook to delete * @returns Expanded `DeletePhonebookResponse` with confirmation message */ async deletePhonebook(phonebookId) { return this.http.request(`/phonebooks/${phonebookId}`, { method: "DELETE", authLocation: "query" }); } } exports.PhonebookService = PhonebookService;