MCPcopy Create free account
hub / github.com/bewcloud/bewcloud / list

Method list

lib/models/contacts.ts:51–73  ·  view source on GitHub ↗
(
    userId: string,
    addressBookId: string,
  )

Source from the content-addressed store, hash-verified

49
50export class ContactModel {
51 static async list(
52 userId: string,
53 addressBookId: string,
54 ): Promise<Contact[]> {
55 const client = await getClient(userId);
56
57 const addressBookUrl = `${contactsConfig.cardDavUrl}/${userId}/${addressBookId}/`;
58
59 const davContacts: DAVObject[] = await client.fetchVCards({
60 addressBook: {
61 url: addressBookUrl,
62 },
63 });
64
65 const contacts: Contact[] = davContacts.map((davContact) => {
66 return {
67 ...davContact,
68 ...parseVCard(davContact.data || '')[0],
69 };
70 });
71
72 return contacts;
73 }
74
75 static async get(
76 userId: string,

Callers 1

getMethod · 0.95

Calls 3

parseVCardFunction · 0.90
fetchVCardsMethod · 0.80
getClientFunction · 0.70

Tested by

no test coverage detected