Skip to content

Commit 9b542b9

Browse files
committed
Support for new isPublic mailing list attribute
1 parent 43f8ee3 commit 9b542b9

File tree

2 files changed

+23
-4
lines changed

2 files changed

+23
-4
lines changed

README.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -277,19 +277,21 @@ const resp = await loops.getMailingLists();
277277

278278
#### Response
279279

280-
This method will return a list of mailing list objects containing `id` and `name` attributes.
280+
This method will return a list of mailing list objects containing `id`, `name` and `isPublic` attributes.
281281

282282
If your account has no mailing lists, an empty list will be returned.
283283

284284
```json
285285
[
286286
{
287287
"id": "list_123",
288-
"name": "Main list"
288+
"name": "Main list",
289+
"isPublic": true
289290
},
290291
{
291292
"id": "list_456",
292-
"name": "Investors"
293+
"name": "Investors",
294+
"isPublic": false
293295
}
294296
]
295297
```
@@ -490,6 +492,7 @@ If your account has no custom fields, an empty list will be returned.
490492

491493
## Version history
492494

495+
- `v3.1.1` (Aug 16, 2024) - Support for a new `isPublic` attribute in [`getMailingLists()`](#getmailinglists).
493496
- `v3.1.0` (Aug 12, 2024) - The SDK now accepts `null` as a value for contact properties in `createContact()`, `updateContact()` and `sendEvent()`, which allows you to reset/empty properties.
494497
- `v3.0.0` (Jul 2, 2024) - [`sendTransactionalEmail()`](#sendtransactionalemail) now accepts an object instead of separate parameters (breaking change).
495498
- `v2.2.0` (Jul 2, 2024) - Deprecated. Added new `addToAudience` option to [`sendTransactionalEmail()`](#sendtransactionalemail).

src/index.ts

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,22 @@ interface TransactionalAttachment {
113113
data: string;
114114
}
115115

116+
interface MailingList {
117+
/**
118+
* The ID of the list.
119+
*/
120+
id: string;
121+
/**
122+
* The name of the list.
123+
*/
124+
name: string;
125+
/**
126+
* Whether the list is public (true) or private (false).
127+
* @see https://loops.so/docs/contacts/mailing-lists#list-visibility
128+
*/
129+
isPublic: boolean;
130+
}
131+
116132
class LoopsClient {
117133
apiKey: string;
118134
apiRoot = "https://app.loops.so/api/";
@@ -272,7 +288,7 @@ class LoopsClient {
272288
*
273289
* @returns {Object} List of mailing lists (JSON)
274290
*/
275-
async getMailingLists(): Promise<Record<"id" | "name", string>[]> {
291+
async getMailingLists(): Promise<MailingList[]> {
276292
return this._makeQuery({
277293
path: "v1/lists",
278294
});

0 commit comments

Comments
 (0)