@bernierllc/nevarmail 0.28.0 → 0.29.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 +1 -0
- package/dist/index.d.ts +22 -0
- package/dist/index.js +12 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -164,6 +164,7 @@ the two, not both). The slug must exist in exactly one project the key can open:
|
|
|
164
164
|
| `listCampaigns({ projectId?, page?, perPage? })` / `getCampaign(id, { projectId? })` — read-only | `GET /api/v1/campaigns`, `GET /api/v1/campaigns/{id}` | `campaigns:read` |
|
|
165
165
|
| `getCampaignAnalytics(id, { projectId? })` — counts plus delivery/open/click/bounce/unsubscribe rates (0 to 1) | `GET /api/v1/campaigns/{id}/analytics` | `analytics:read` |
|
|
166
166
|
| `getAnalyticsSummary({ period? } \| { start, end })` — org-wide counts and rates for a trailing `7d`/`30d`/`90d` (default `30d`) or an inclusive UTC `YYYY-MM-DD` range | `GET /api/v1/analytics/summary` | `analytics:read` |
|
|
167
|
+
| `getUsage({ start, end })` — metered outbound email counts (billable and test-mode apart) for an inclusive UTC `YYYY-MM-DD` range of at most 366 days, current hour included; counts only, no cost | `GET /api/v1/usage` | `usage:read` |
|
|
167
168
|
| `listLists` / `createList` / `getList` | `/api/v1/lists` | `contacts:read` / `contacts:write` |
|
|
168
169
|
| `addListContacts` | `POST /api/v1/lists/{id}/contacts` | `contacts:write` |
|
|
169
170
|
| `removeListContact` | `DELETE /api/v1/lists/{id}/contacts?email=` (one list only; the contact is kept) | `contacts:write` |
|
package/dist/index.d.ts
CHANGED
|
@@ -269,6 +269,17 @@ export interface AnalyticsSummary {
|
|
|
269
269
|
/** True when part of `totalSent` is a campaign's provider-reported recipient estimate. */
|
|
270
270
|
sentIncludesCampaignEstimates: boolean;
|
|
271
271
|
}
|
|
272
|
+
/** Metered outbound email counts for an inclusive UTC date range. */
|
|
273
|
+
export interface Usage {
|
|
274
|
+
/** First day of the range (YYYY-MM-DD, UTC). */
|
|
275
|
+
start: string;
|
|
276
|
+
/** Last day of the range (YYYY-MM-DD, UTC, inclusive). */
|
|
277
|
+
end: string;
|
|
278
|
+
/** Billable outbound emails sent in the range, including the current hour. */
|
|
279
|
+
outboundEmails: number;
|
|
280
|
+
/** Test-mode outbound emails sent in the range; never billed. */
|
|
281
|
+
outboundEmailsTest: number;
|
|
282
|
+
}
|
|
272
283
|
export interface TemplateVariable {
|
|
273
284
|
name: string;
|
|
274
285
|
type: string;
|
|
@@ -926,6 +937,17 @@ export declare class NevarMail {
|
|
|
926
937
|
* on its project only.
|
|
927
938
|
*/
|
|
928
939
|
getAnalyticsSummary(window?: AnalyticsSummaryWindow): Promise<AnalyticsSummary>;
|
|
940
|
+
/**
|
|
941
|
+
* GET /api/v1/usage — scope `usage:read`. `start` and `end` are YYYY-MM-DD
|
|
942
|
+
* UTC dates, `end` inclusive, at most 366 days apart. Counts only: billing
|
|
943
|
+
* prices per month and tier, so no cost is returned. 400
|
|
944
|
+
* `VALIDATION_ERROR` for an invalid range; 403 `PROJECT_PINNED_CREDENTIAL` for a key
|
|
945
|
+
* pinned to a project, since usage is metered per organization.
|
|
946
|
+
*/
|
|
947
|
+
getUsage(range: {
|
|
948
|
+
start: string;
|
|
949
|
+
end: string;
|
|
950
|
+
}): Promise<Usage>;
|
|
929
951
|
/** GET /api/v1/lists — paged. */
|
|
930
952
|
listLists(options?: PageOptions): Promise<Paginated<SubscriberList>>;
|
|
931
953
|
/** POST /api/v1/lists — 409 DUPLICATE_NAME on a name the org already uses. */
|
package/dist/index.js
CHANGED
|
@@ -375,6 +375,18 @@ export class NevarMail {
|
|
|
375
375
|
query: { period: window.period, start: window.start, end: window.end },
|
|
376
376
|
});
|
|
377
377
|
}
|
|
378
|
+
/**
|
|
379
|
+
* GET /api/v1/usage — scope `usage:read`. `start` and `end` are YYYY-MM-DD
|
|
380
|
+
* UTC dates, `end` inclusive, at most 366 days apart. Counts only: billing
|
|
381
|
+
* prices per month and tier, so no cost is returned. 400
|
|
382
|
+
* `VALIDATION_ERROR` for an invalid range; 403 `PROJECT_PINNED_CREDENTIAL` for a key
|
|
383
|
+
* pinned to a project, since usage is metered per organization.
|
|
384
|
+
*/
|
|
385
|
+
getUsage(range) {
|
|
386
|
+
return this.request("GET", "/api/v1/usage", {
|
|
387
|
+
query: { start: range.start, end: range.end },
|
|
388
|
+
});
|
|
389
|
+
}
|
|
378
390
|
// ── Lists & contacts ───────────────────────────────────────────────────
|
|
379
391
|
/** GET /api/v1/lists — paged. */
|
|
380
392
|
async listLists(options = {}) {
|
package/package.json
CHANGED