@graph8/sdk 0.245.0 → 0.251.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
@@ -53,7 +53,13 @@ import { g8 } from '@graph8/sdk';
53
53
 
54
54
  g8.init({ apiKey: 'YOUR_API_KEY' });
55
55
 
56
- // Contacts CRUD
56
+ // Contacts: create-or-update in one idempotent call (matches work_email, then linkedin_url).
57
+ // Use this when the contact may already exist; it is safe to retry.
58
+ const { action } = await g8.contacts.upsert({ list_id: 42, work_email: 'jane@acme.com', first_name: 'Jane' });
59
+ // action is "created" or "updated"
60
+
61
+ // Contacts CRUD. create() is create-only: a duplicate throws a 409 G8Error
62
+ // whose detail.hint / detail.upsert point back at upsert().
57
63
  const { data: contacts } = await g8.contacts.list({ company_name: 'Acme', limit: 10 });
58
64
  const contact = await g8.contacts.create({ work_email: 'jane@acme.com', first_name: 'Jane' });
59
65
  await g8.contacts.update(contact.id, { job_title: 'VP Sales' });
@@ -225,9 +231,10 @@ Two things to know before reaching for it:
225
231
 
226
232
  | Method | Description |
227
233
  |--------|-------------|
234
+ | `g8.contacts.upsert(contact)` | **Create or update** a contact (`PUT /contacts/assert`). Matches `work_email`, then `linkedin_url`; needs `list_id`. Idempotent, the recommended way to write a contact |
228
235
  | `g8.contacts.list(params?)` | List contacts with filters |
229
236
  | `g8.contacts.get(id)` | Get contact by ID |
230
- | `g8.contacts.create(contact)` | Create a contact |
237
+ | `g8.contacts.create(contact)` | Create a contact. Create-only: a duplicate throws a 409 whose `detail.upsert` names `upsert()` |
231
238
  | `g8.contacts.update(id, fields)` | Update contact (partial) |
232
239
  | `g8.contacts.delete(id)` | Delete contact |
233
240
 
@@ -297,7 +304,7 @@ Two things to know before reaching for it:
297
304
 
298
305
  | Method | Description |
299
306
  |--------|-------------|
300
- | `g8.enrich.person(params)` | Look up a person (1 credit) |
307
+ | `g8.enrich.person(params)` | Look up a person (1 credit). REST: `POST /enrichment/lookup/person` (`POST /enrichment/person` is an alias) |
301
308
  | `g8.enrich.company(params)` | Look up a company (1 credit) |
302
309
  | `g8.enrich.verifyEmail(email)` | Verify email (1 credit) |
303
310
  | `g8.enrich.search(filters)` | Search 700M+ contacts |