@bernierllc/nevarmail 0.3.0 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -150,7 +150,7 @@ yourself can narrow a block; a default the server resolves cannot.
150
150
  | `addListContacts` | `POST /api/v1/lists/{id}/contacts` | `contacts:write` |
151
151
  | `listContacts` / `upsertContacts` / `updateContact` / `deleteContact` | `/api/v1/contacts` | `contacts:read` / `contacts:write` |
152
152
  | `listSenders` / `createSender` / `getSender` / `updateSender` / `deleteSender` | `/api/v1/senders` | `senders:read` / `senders:write` |
153
- | `listDomains` / `createDomain` / `getDomain` / `deleteDomain` | `/api/v1/domains` | `domains:read` / `domains:write` |
153
+ | `listDomains` / `createDomain(domain, { projectId })` / `getDomain` / `deleteDomain` | `/api/v1/domains` | `domains:read` / `domains:write` |
154
154
  | `getDomainDnsRecords` / `verifyDomain` | `/api/v1/domains/{id}/…` | `domains:read` / `domains:write` |
155
155
  | `listSuppressions` / `addSuppressions` | `/api/v1/suppressions` | `org:read` / `org:write` |
156
156
 
package/dist/index.d.ts CHANGED
@@ -275,6 +275,8 @@ export interface ProviderVerification {
275
275
  export interface Domain {
276
276
  id: string;
277
277
  orgId: string;
278
+ /** Project the domain is attributed to — a domain is an org-level asset. */
279
+ projectId: string;
278
280
  domain: string;
279
281
  verificationStatus: string;
280
282
  createdAt: string;
@@ -469,8 +471,15 @@ export declare class NevarMail {
469
471
  }>;
470
472
  /** GET /api/v1/domains — paged; list rows carry extras single reads do not. */
471
473
  listDomains(options?: PageOptions): Promise<Paginated<Domain>>;
472
- /** POST /api/v1/domains — 409 DUPLICATE_DOMAIN if the org already has it. */
473
- createDomain(domain: string): Promise<Domain>;
474
+ /**
475
+ * POST /api/v1/domains — 409 DUPLICATE_DOMAIN if the org already has it.
476
+ * `projectId` is required when the org has more than one project
477
+ * (422 PROJECT_REQUIRED otherwise); 404 PROJECT_NOT_FOUND for a project
478
+ * outside the org.
479
+ */
480
+ createDomain(domain: string, options?: {
481
+ projectId?: string;
482
+ }): Promise<Domain>;
474
483
  /** GET /api/v1/domains/{id} — 404 DOMAIN_NOT_FOUND. */
475
484
  getDomain(id: string): Promise<Domain>;
476
485
  /**
package/dist/index.js CHANGED
@@ -330,9 +330,16 @@ export class NevarMail {
330
330
  listDomains(options = {}) {
331
331
  return this.requestPaginated("GET", "/api/v1/domains", { query: { ...options } });
332
332
  }
333
- /** POST /api/v1/domains — 409 DUPLICATE_DOMAIN if the org already has it. */
334
- createDomain(domain) {
335
- return this.request("POST", "/api/v1/domains", { body: { domain } });
333
+ /**
334
+ * POST /api/v1/domains — 409 DUPLICATE_DOMAIN if the org already has it.
335
+ * `projectId` is required when the org has more than one project
336
+ * (422 PROJECT_REQUIRED otherwise); 404 PROJECT_NOT_FOUND for a project
337
+ * outside the org.
338
+ */
339
+ createDomain(domain, options = {}) {
340
+ return this.request("POST", "/api/v1/domains", {
341
+ body: options.projectId ? { domain, projectId: options.projectId } : { domain },
342
+ });
336
343
  }
337
344
  /** GET /api/v1/domains/{id} — 404 DOMAIN_NOT_FOUND. */
338
345
  getDomain(id) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bernierllc/nevarmail",
3
- "version": "0.3.0",
3
+ "version": "0.4.0",
4
4
  "description": "Official client for the NevarMail v1 API. Typed, retries 429/5xx, throws NevarMailError on every non-2xx.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",