delete-domain route added (#267)

This commit is contained in:
Kuntal Majee
2025-10-11 00:26:45 +05:30
committed by GitHub
parent 3388426929
commit 3f6a02ac56
8 changed files with 408 additions and 7 deletions
+5 -3
View File
@@ -1,6 +1,7 @@
import { ErrorResponse } from "../types";
import { Contacts } from "./contact";
import { Emails } from "./email";
import { Domains } from "./domain";
const defaultBaseUrl = "https://app.usesend.com";
// eslint-disable-next-line turbo/no-undeclared-env-vars
@@ -15,12 +16,13 @@ export class UseSend {
// readonly domains = new Domains(this);
readonly emails = new Emails(this);
readonly domains = new Domains(this);
readonly contacts = new Contacts(this);
url = baseUrl;
constructor(
readonly key?: string,
url?: string
url?: string,
) {
if (!key) {
if (typeof process !== "undefined" && process.env) {
@@ -29,7 +31,7 @@ export class UseSend {
if (!this.key) {
throw new Error(
'Missing API key. Pass it to the constructor `new UseSend("us_123")`'
'Missing API key. Pass it to the constructor `new UseSend("us_123")`',
);
}
}
@@ -46,7 +48,7 @@ export class UseSend {
async fetchRequest<T>(
path: string,
options = {}
options = {},
): Promise<{ data: T | null; error: ErrorResponse | null }> {
const response = await fetch(`${this.url}${path}`, options);
const defaultError = {