@graph8/sdk 0.302.0 → 0.303.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/dist/index.d.mts +297 -5
- package/dist/index.d.ts +297 -5
- package/dist/index.js +8 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +8 -2
- package/dist/index.mjs.map +1 -1
- package/dist/react.d.mts +274 -2
- package/dist/react.d.ts +274 -2
- package/dist/react.js +7 -1
- package/dist/react.js.map +1 -1
- package/dist/react.mjs +7 -1
- package/dist/react.mjs.map +1 -1
- package/dist/types/version.d.ts +2 -2
- package/docs/agents.md +6 -6
- package/docs/api/README.md +2 -2
- package/docs/api/by-path.md +6 -0
- package/docs/api/objects.d.ts +288 -2
- package/docs/api/objects.md +446 -1
- package/package.json +1 -1
package/docs/api/objects.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
# `g8.api.objects`: Objects
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
24 operations (9 read, 11 write, 4 destructive).
|
|
6
6
|
|
|
7
7
|
18 of these also have a hand-written method (`g8.objects`), marked **★** below. Prefer the hand-written method when one exists: it unwraps the `data` envelope and takes friendlier arguments. See [../sdk-clients.md](../sdk-clients.md).
|
|
8
8
|
|
|
@@ -25,16 +25,22 @@ Exact TypeScript types for every operation on this page, and every schema they u
|
|
|
25
25
|
| [`archiveAttribute`](#op-archiveattribute) ★ | `DELETE /api/v1/objects/{object_slug}/attributes/{attr_slug}` | destructive | `objects:manage` | Archive Attribute |
|
|
26
26
|
| [`archiveObject`](#op-archiveobject) ★ | `DELETE /api/v1/objects/{object_slug}` | destructive | `objects:manage` | Archive Object |
|
|
27
27
|
| [`archiveObjectRecord`](#op-archiveobjectrecord) ★ | `DELETE /api/v1/objects/{object_slug}/records/{record_id}` | destructive | `objects:delete` | Archive Object Record |
|
|
28
|
+
| [`bulkUpdateObjectRecords`](#op-bulkupdateobjectrecords) | `PATCH /api/v1/objects/{object_slug}/records/bulk` | write | `objects:write` | Bulk Update Object Records |
|
|
28
29
|
| [`createAttribute`](#op-createattribute) ★ | `POST /api/v1/objects/{object_slug}/attributes` | write | `objects:manage` | Create Attribute |
|
|
29
30
|
| [`createObject`](#op-createobject) ★ | `POST /api/v1/objects` | write | `objects:manage` | Create Object |
|
|
30
31
|
| [`createObjectRecord`](#op-createobjectrecord) ★ | `POST /api/v1/objects/{object_slug}/records` | write | `objects:write` | Create Object Record |
|
|
32
|
+
| [`createObjectRelationship`](#op-createobjectrelationship) | `POST /api/v1/objects/{object_slug}/records/{record_id}/relationships` | write | `objects:write` | Create Object Relationship |
|
|
33
|
+
| [`deleteObjectRelationship`](#op-deleteobjectrelationship) | `DELETE /api/v1/objects/{object_slug}/records/{record_id}/relationships/{relationship_id}` | destructive | `objects:write` | Delete Object Relationship |
|
|
31
34
|
| [`getObject`](#op-getobject) ★ | `GET /api/v1/objects/{object_slug}` | read | `objects:read` | Get Object |
|
|
32
35
|
| [`getObjectRecord`](#op-getobjectrecord) ★ | `GET /api/v1/objects/{object_slug}/records/{record_id}` | read | `objects:read` | Get Object Record |
|
|
33
36
|
| [`getObjectRecordChanges`](#op-getobjectrecordchanges) ★ | `GET /api/v1/objects/{object_slug}/records/{record_id}/changes` | read | `objects:read` | Get Object Record Changes |
|
|
34
37
|
| [`getObjectRecordHistory`](#op-getobjectrecordhistory) ★ | `GET /api/v1/objects/{object_slug}/records/{record_id}/history` | read | `objects:read` | Get Object Record History |
|
|
38
|
+
| [`getObjectRelationshipDefinitions`](#op-getobjectrelationshipdefinitions) | `GET /api/v1/objects/{object_slug}/relationships` | read | `objects:read` | Get Object Relationship Definitions |
|
|
39
|
+
| [`getObjectRelationships`](#op-getobjectrelationships) | `GET /api/v1/objects/{object_slug}/records/{record_id}/relationships` | read | `objects:read` | Get Object Relationships |
|
|
35
40
|
| [`listObjectAttributes`](#op-listobjectattributes) ★ | `GET /api/v1/objects/{object_slug}/attributes` | read | `objects:read` | List Object Attributes |
|
|
36
41
|
| [`listObjectRecords`](#op-listobjectrecords) ★ | `GET /api/v1/objects/{object_slug}/records` | read | `objects:read` | List Object Records |
|
|
37
42
|
| [`listObjects`](#op-listobjects) ★ | `GET /api/v1/objects` | read | `objects:read` | List Objects |
|
|
43
|
+
| [`mergeObjectRecords`](#op-mergeobjectrecords) | `POST /api/v1/objects/{object_slug}/records/merge` | write | `objects:write` | Merge Object Records |
|
|
38
44
|
| [`restoreObjectRecord`](#op-restoreobjectrecord) ★ | `POST /api/v1/objects/{object_slug}/records/{record_id}/restore` | write | `objects:write` | Restore Object Record |
|
|
39
45
|
| [`updateAttribute`](#op-updateattribute) ★ | `PATCH /api/v1/objects/{object_slug}/attributes/{attr_slug}` | write | `objects:manage` | Update Attribute |
|
|
40
46
|
| [`updateObject`](#op-updateobject) ★ | `PATCH /api/v1/objects/{object_slug}` | write | `objects:manage` | Update Object |
|
|
@@ -196,6 +202,63 @@ const result = await g8.api.objects.archiveObjectRecord({ path: { object_slug: "
|
|
|
196
202
|
|
|
197
203
|
---
|
|
198
204
|
|
|
205
|
+
<a id="op-bulkupdateobjectrecords"></a>
|
|
206
|
+
|
|
207
|
+
### `g8.api.objects.bulkUpdateObjectRecords(input)`
|
|
208
|
+
|
|
209
|
+
**Bulk Update Object Records**
|
|
210
|
+
|
|
211
|
+
- HTTP: `PATCH /api/v1/objects/{object_slug}/records/bulk`
|
|
212
|
+
- operationId: `bulk_update_object_records_objects__object_slug__records_bulk_patch` (also callable as `g8.api.call("bulk_update_object_records_objects__object_slug__records_bulk_patch", input)`)
|
|
213
|
+
- Tier: `write`: creates or changes records; the SDK sends an Idempotency-Key and retries transient failures
|
|
214
|
+
- API-key scope: `objects:write`
|
|
215
|
+
|
|
216
|
+
Apply the same values to every record in an explicit or filtered scope.
|
|
217
|
+
|
|
218
|
+
Registered before ``/{object_slug}/records/{record_id}``: routes match by
|
|
219
|
+
path shape, so "bulk" would otherwise bind to ``{record_id}``. Needs
|
|
220
|
+
objects:read as well as objects:write (a filtered scope echoes the ids that
|
|
221
|
+
match caller-chosen predicates). Delegates to the Studio function, so the
|
|
222
|
+
server-side filter resolution, the 500-row cursor, the per-row savepoints
|
|
223
|
+
and the per-org ``records_core`` switch (404 while off) are identical.
|
|
224
|
+
|
|
225
|
+
**Input**
|
|
226
|
+
|
|
227
|
+
| Field | Type | Required | Description |
|
|
228
|
+
|---|---|---|---|
|
|
229
|
+
| `path.object_slug` | `string` | yes | |
|
|
230
|
+
| `body` | `RecordBulkUpdate` | yes | Request body; fields below. |
|
|
231
|
+
|
|
232
|
+
Body fields (`RecordBulkUpdate`):
|
|
233
|
+
|
|
234
|
+
| Field | Type | Required | Description |
|
|
235
|
+
|---|---|---|---|
|
|
236
|
+
| `body.after_record_id` | `string (uuid) \| null` | no | |
|
|
237
|
+
| `body.filters` | `Array<RecordFilter> \| null` | no | max items 10 |
|
|
238
|
+
| `body.record_ids` | `Array<string (uuid)> \| null` | no | max items 500 |
|
|
239
|
+
| `body.values` | `Record<string, unknown>` | no | |
|
|
240
|
+
|
|
241
|
+
**Returns** `ApiResponse_RecordBulkUpdateResponse_`: the envelope `{ data: RecordBulkUpdateResponse, ... }`. `g8.api` returns the envelope as-is, so read `result.data`.
|
|
242
|
+
|
|
243
|
+
Other envelope fields: `pagination` (PaginationMeta).
|
|
244
|
+
|
|
245
|
+
`RecordBulkUpdateResponse` fields:
|
|
246
|
+
|
|
247
|
+
| Field | Type | Required | Description |
|
|
248
|
+
|---|---|---|---|
|
|
249
|
+
| `failed` | `Array<RecordBulkUpdateFailure>` | yes | |
|
|
250
|
+
| `succeeded` | `Array<string (uuid)>` | yes | |
|
|
251
|
+
| `next_after_record_id` | `string (uuid) \| null` | no | |
|
|
252
|
+
| `truncated` | `boolean` | no | default `false` |
|
|
253
|
+
|
|
254
|
+
**Example**
|
|
255
|
+
|
|
256
|
+
```ts
|
|
257
|
+
const result = await g8.api.objects.bulkUpdateObjectRecords({ path: { object_slug: "example" }, body: {} });
|
|
258
|
+
```
|
|
259
|
+
|
|
260
|
+
---
|
|
261
|
+
|
|
199
262
|
<a id="op-createattribute"></a>
|
|
200
263
|
|
|
201
264
|
### `g8.api.objects.createAttribute(input)`
|
|
@@ -388,6 +451,144 @@ const result = await g8.api.objects.createObjectRecord({ path: { object_slug: "e
|
|
|
388
451
|
|
|
389
452
|
---
|
|
390
453
|
|
|
454
|
+
<a id="op-createobjectrelationship"></a>
|
|
455
|
+
|
|
456
|
+
### `g8.api.objects.createObjectRelationship(input)`
|
|
457
|
+
|
|
458
|
+
**Create Object Relationship**
|
|
459
|
+
|
|
460
|
+
- HTTP: `POST /api/v1/objects/{object_slug}/records/{record_id}/relationships`
|
|
461
|
+
- operationId: `create_object_relationship_objects__object_slug__records__record_id__relationships_post` (also callable as `g8.api.call("create_object_relationship_objects__object_slug__records__record_id__relationships_post", input)`)
|
|
462
|
+
- Tier: `write`: creates or changes records; the SDK sends an Idempotency-Key and retries transient failures
|
|
463
|
+
- API-key scope: `objects:write`
|
|
464
|
+
|
|
465
|
+
Link from a custom or canonical native record. The request's expected revisions are
|
|
466
|
+
relative to the route's record; the response is always in the definition's canonical
|
|
467
|
+
direction (source = the custom record, target = the native or custom target).
|
|
468
|
+
|
|
469
|
+
**Input**
|
|
470
|
+
|
|
471
|
+
| Field | Type | Required | Description |
|
|
472
|
+
|---|---|---|---|
|
|
473
|
+
| `path.object_slug` | `string` | yes | |
|
|
474
|
+
| `path.record_id` | `string` | yes | |
|
|
475
|
+
| `body` | `RelationshipCreate` | yes | Request body; fields below. |
|
|
476
|
+
|
|
477
|
+
Body fields (`RelationshipCreate`):
|
|
478
|
+
|
|
479
|
+
| Field | Type | Required | Description |
|
|
480
|
+
|---|---|---|---|
|
|
481
|
+
| `body.definition_id` | `string (uuid)` | yes | |
|
|
482
|
+
| `body.expected_definition_revision` | `integer` | yes | > 0 |
|
|
483
|
+
| `body.expected_source_revision` | `integer` | yes | > 0 |
|
|
484
|
+
| `body.expected_target_revision` | `integer` | yes | > 0 |
|
|
485
|
+
| `body.target_record_id` | `string` | yes | min length 1, max length 255 |
|
|
486
|
+
|
|
487
|
+
**Returns** `ApiResponse_RelationshipResponse_`: the envelope `{ data: RelationshipResponse, ... }`. `g8.api` returns the envelope as-is, so read `result.data`.
|
|
488
|
+
|
|
489
|
+
Other envelope fields: `pagination` (PaginationMeta).
|
|
490
|
+
|
|
491
|
+
`RelationshipResponse` fields:
|
|
492
|
+
|
|
493
|
+
| Field | Type | Required | Description |
|
|
494
|
+
|---|---|---|---|
|
|
495
|
+
| `definition_id` | `string (uuid)` | yes | |
|
|
496
|
+
| `id` | `string (uuid)` | yes | |
|
|
497
|
+
| `source_kind` | `string` | yes | |
|
|
498
|
+
| `source_record_id` | `string` | yes | |
|
|
499
|
+
| `source_revision` | `integer` | yes | |
|
|
500
|
+
| `target_kind` | `string` | yes | |
|
|
501
|
+
| `target_record_id` | `string` | yes | |
|
|
502
|
+
| `target_revision` | `integer` | yes | |
|
|
503
|
+
|
|
504
|
+
**Example**
|
|
505
|
+
|
|
506
|
+
```ts
|
|
507
|
+
const result = await g8.api.objects.createObjectRelationship({
|
|
508
|
+
path: { object_slug: "example", record_id: "id" },
|
|
509
|
+
body: {
|
|
510
|
+
definition_id: "00000000-0000-0000-0000-000000000000",
|
|
511
|
+
expected_definition_revision: 1,
|
|
512
|
+
expected_source_revision: 1,
|
|
513
|
+
expected_target_revision: 1,
|
|
514
|
+
target_record_id: "id",
|
|
515
|
+
},
|
|
516
|
+
});
|
|
517
|
+
```
|
|
518
|
+
|
|
519
|
+
---
|
|
520
|
+
|
|
521
|
+
<a id="op-deleteobjectrelationship"></a>
|
|
522
|
+
|
|
523
|
+
### `g8.api.objects.deleteObjectRelationship(input)`
|
|
524
|
+
|
|
525
|
+
**Delete Object Relationship**
|
|
526
|
+
|
|
527
|
+
- HTTP: `DELETE /api/v1/objects/{object_slug}/records/{record_id}/relationships/{relationship_id}`
|
|
528
|
+
- operationId: `delete_object_relationship_objects__object_slug__records__record_id__relationships__relationship_id__delete` (also callable as `g8.api.call("delete_object_relationship_objects__object_slug__records__record_id__relationships__relationship_id__delete", input)`)
|
|
529
|
+
- Tier: `destructive`: deletes or archives data; confirm with a human before calling
|
|
530
|
+
- API-key scope: `objects:write`
|
|
531
|
+
|
|
532
|
+
Unlink only the edge; both records stay. All three revisions are required.
|
|
533
|
+
|
|
534
|
+
**Input**
|
|
535
|
+
|
|
536
|
+
| Field | Type | Required | Description |
|
|
537
|
+
|---|---|---|---|
|
|
538
|
+
| `path.object_slug` | `string` | yes | |
|
|
539
|
+
| `path.record_id` | `string` | yes | |
|
|
540
|
+
| `path.relationship_id` | `string (uuid)` | yes | |
|
|
541
|
+
| `body` | `RelationshipCreate` | yes | Request body; fields below. |
|
|
542
|
+
|
|
543
|
+
Body fields (`RelationshipCreate`):
|
|
544
|
+
|
|
545
|
+
| Field | Type | Required | Description |
|
|
546
|
+
|---|---|---|---|
|
|
547
|
+
| `body.definition_id` | `string (uuid)` | yes | |
|
|
548
|
+
| `body.expected_definition_revision` | `integer` | yes | > 0 |
|
|
549
|
+
| `body.expected_source_revision` | `integer` | yes | > 0 |
|
|
550
|
+
| `body.expected_target_revision` | `integer` | yes | > 0 |
|
|
551
|
+
| `body.target_record_id` | `string` | yes | min length 1, max length 255 |
|
|
552
|
+
|
|
553
|
+
**Returns** `ApiResponse_RelationshipResponse_`: the envelope `{ data: RelationshipResponse, ... }`. `g8.api` returns the envelope as-is, so read `result.data`.
|
|
554
|
+
|
|
555
|
+
Other envelope fields: `pagination` (PaginationMeta).
|
|
556
|
+
|
|
557
|
+
`RelationshipResponse` fields:
|
|
558
|
+
|
|
559
|
+
| Field | Type | Required | Description |
|
|
560
|
+
|---|---|---|---|
|
|
561
|
+
| `definition_id` | `string (uuid)` | yes | |
|
|
562
|
+
| `id` | `string (uuid)` | yes | |
|
|
563
|
+
| `source_kind` | `string` | yes | |
|
|
564
|
+
| `source_record_id` | `string` | yes | |
|
|
565
|
+
| `source_revision` | `integer` | yes | |
|
|
566
|
+
| `target_kind` | `string` | yes | |
|
|
567
|
+
| `target_record_id` | `string` | yes | |
|
|
568
|
+
| `target_revision` | `integer` | yes | |
|
|
569
|
+
|
|
570
|
+
**Example**
|
|
571
|
+
|
|
572
|
+
```ts
|
|
573
|
+
// destructive: deletes or archives data; confirm with a human before calling.
|
|
574
|
+
const result = await g8.api.objects.deleteObjectRelationship({
|
|
575
|
+
path: {
|
|
576
|
+
object_slug: "example",
|
|
577
|
+
record_id: "id",
|
|
578
|
+
relationship_id: "00000000-0000-0000-0000-000000000000",
|
|
579
|
+
},
|
|
580
|
+
body: {
|
|
581
|
+
definition_id: "00000000-0000-0000-0000-000000000000",
|
|
582
|
+
expected_definition_revision: 1,
|
|
583
|
+
expected_source_revision: 1,
|
|
584
|
+
expected_target_revision: 1,
|
|
585
|
+
target_record_id: "id",
|
|
586
|
+
},
|
|
587
|
+
});
|
|
588
|
+
```
|
|
589
|
+
|
|
590
|
+
---
|
|
591
|
+
|
|
391
592
|
<a id="op-getobject"></a>
|
|
392
593
|
|
|
393
594
|
### `g8.api.objects.getObject(input)`
|
|
@@ -585,6 +786,89 @@ const result = await g8.api.objects.getObjectRecordHistory({ path: { object_slug
|
|
|
585
786
|
|
|
586
787
|
---
|
|
587
788
|
|
|
789
|
+
<a id="op-getobjectrelationshipdefinitions"></a>
|
|
790
|
+
|
|
791
|
+
### `g8.api.objects.getObjectRelationshipDefinitions(input)`
|
|
792
|
+
|
|
793
|
+
**Get Object Relationship Definitions**
|
|
794
|
+
|
|
795
|
+
- HTTP: `GET /api/v1/objects/{object_slug}/relationships`
|
|
796
|
+
- operationId: `get_object_relationship_definitions_objects__object_slug__relationships_get` (also callable as `g8.api.call("get_object_relationship_definitions_objects__object_slug__relationships_get", input)`)
|
|
797
|
+
- Tier: `read`: reads data; safe to call and to retry
|
|
798
|
+
- API-key scope: `objects:read`
|
|
799
|
+
|
|
800
|
+
Definitions involving a custom or native object, narrowed to the credential's native read scopes.
|
|
801
|
+
|
|
802
|
+
**Input**
|
|
803
|
+
|
|
804
|
+
| Field | Type | Required | Description |
|
|
805
|
+
|---|---|---|---|
|
|
806
|
+
| `path.object_slug` | `string` | yes | |
|
|
807
|
+
| `query.limit` | `integer` | no | default `50` |
|
|
808
|
+
| `query.offset` | `integer` | no | default `0` |
|
|
809
|
+
|
|
810
|
+
**Returns** `ApiResponse_RelationshipDefinitionListResponse_`: the envelope `{ data: RelationshipDefinitionListResponse, ... }`. `g8.api` returns the envelope as-is, so read `result.data`.
|
|
811
|
+
|
|
812
|
+
Other envelope fields: `pagination` (PaginationMeta).
|
|
813
|
+
|
|
814
|
+
`RelationshipDefinitionListResponse` fields:
|
|
815
|
+
|
|
816
|
+
| Field | Type | Required | Description |
|
|
817
|
+
|---|---|---|---|
|
|
818
|
+
| `relationships` | `Array<RelationshipDefinitionResponse>` | yes | |
|
|
819
|
+
| `total` | `integer` | yes | |
|
|
820
|
+
|
|
821
|
+
**Example**
|
|
822
|
+
|
|
823
|
+
```ts
|
|
824
|
+
const result = await g8.api.objects.getObjectRelationshipDefinitions({ path: { object_slug: "example" } });
|
|
825
|
+
```
|
|
826
|
+
|
|
827
|
+
---
|
|
828
|
+
|
|
829
|
+
<a id="op-getobjectrelationships"></a>
|
|
830
|
+
|
|
831
|
+
### `g8.api.objects.getObjectRelationships(input)`
|
|
832
|
+
|
|
833
|
+
**Get Object Relationships**
|
|
834
|
+
|
|
835
|
+
- HTTP: `GET /api/v1/objects/{object_slug}/records/{record_id}/relationships`
|
|
836
|
+
- operationId: `get_object_relationships_objects__object_slug__records__record_id__relationships_get` (also callable as `g8.api.call("get_object_relationships_objects__object_slug__records__record_id__relationships_get", input)`)
|
|
837
|
+
- Tier: `read`: reads data; safe to call and to retry
|
|
838
|
+
- API-key scope: `objects:read`
|
|
839
|
+
|
|
840
|
+
Read authorized links of a custom or native record, both endpoints filtered
|
|
841
|
+
before pagination. Needs objects:read plus the native kinds' explicit read
|
|
842
|
+
scopes; an absent and an inaccessible record share a neutral 404.
|
|
843
|
+
|
|
844
|
+
**Input**
|
|
845
|
+
|
|
846
|
+
| Field | Type | Required | Description |
|
|
847
|
+
|---|---|---|---|
|
|
848
|
+
| `path.object_slug` | `string` | yes | |
|
|
849
|
+
| `path.record_id` | `string` | yes | |
|
|
850
|
+
| `query.limit` | `integer` | no | default `50` |
|
|
851
|
+
| `query.offset` | `integer` | no | default `0` |
|
|
852
|
+
|
|
853
|
+
**Returns** `ApiResponse_RecordRelationshipsResponse_`: the envelope `{ data: RecordRelationshipsResponse, ... }`. `g8.api` returns the envelope as-is, so read `result.data`.
|
|
854
|
+
|
|
855
|
+
Other envelope fields: `pagination` (PaginationMeta).
|
|
856
|
+
|
|
857
|
+
`RecordRelationshipsResponse` fields:
|
|
858
|
+
|
|
859
|
+
| Field | Type | Required | Description |
|
|
860
|
+
|---|---|---|---|
|
|
861
|
+
| `next_offset` | `integer \| null` | yes | Next visible page offset; null at the end |
|
|
862
|
+
| `relationships` | `Array<RelatedRecordEdge>` | yes | |
|
|
863
|
+
|
|
864
|
+
**Example**
|
|
865
|
+
|
|
866
|
+
```ts
|
|
867
|
+
const result = await g8.api.objects.getObjectRelationships({ path: { object_slug: "example", record_id: "id" } });
|
|
868
|
+
```
|
|
869
|
+
|
|
870
|
+
---
|
|
871
|
+
|
|
588
872
|
<a id="op-listobjectattributes"></a>
|
|
589
873
|
|
|
590
874
|
### `g8.api.objects.listObjectAttributes(input)`
|
|
@@ -741,6 +1025,67 @@ const result = await g8.api.objects.listObjects();
|
|
|
741
1025
|
|
|
742
1026
|
---
|
|
743
1027
|
|
|
1028
|
+
<a id="op-mergeobjectrecords"></a>
|
|
1029
|
+
|
|
1030
|
+
### `g8.api.objects.mergeObjectRecords(input)`
|
|
1031
|
+
|
|
1032
|
+
**Merge Object Records**
|
|
1033
|
+
|
|
1034
|
+
- HTTP: `POST /api/v1/objects/{object_slug}/records/merge`
|
|
1035
|
+
- operationId: `merge_object_records_objects__object_slug__records_merge_post` (also callable as `g8.api.call("merge_object_records_objects__object_slug__records_merge_post", input)`)
|
|
1036
|
+
- Tier: `write`: creates or changes records; the SDK sends an Idempotency-Key and retries transient failures
|
|
1037
|
+
- API-key scope: `objects:write`
|
|
1038
|
+
|
|
1039
|
+
Eligible merge: resolve fields, archive the secondary (its values closed
|
|
1040
|
+
first), repoint links and associations onto the primary, write the primary.
|
|
1041
|
+
Needs objects:write AND objects:delete — both scope dependencies are real
|
|
1042
|
+
parameters so each carries its own ``required_api_key_scope`` marker.
|
|
1043
|
+
Delegates to the Studio function (same blockers, field resolution, cascade,
|
|
1044
|
+
far-end access rule and ``records_core`` switch).
|
|
1045
|
+
|
|
1046
|
+
**Input**
|
|
1047
|
+
|
|
1048
|
+
| Field | Type | Required | Description |
|
|
1049
|
+
|---|---|---|---|
|
|
1050
|
+
| `path.object_slug` | `string` | yes | |
|
|
1051
|
+
| `body` | `RecordMergeRequest` | yes | Request body; fields below. |
|
|
1052
|
+
|
|
1053
|
+
Body fields (`RecordMergeRequest`):
|
|
1054
|
+
|
|
1055
|
+
| Field | Type | Required | Description |
|
|
1056
|
+
|---|---|---|---|
|
|
1057
|
+
| `body.primary_record_id` | `string (uuid)` | yes | |
|
|
1058
|
+
| `body.secondary_record_id` | `string (uuid)` | yes | |
|
|
1059
|
+
| `body.expected_primary_revision` | `integer \| null` | no | min 1 |
|
|
1060
|
+
| `body.expected_secondary_revision` | `integer \| null` | no | min 1 |
|
|
1061
|
+
| `body.field_overrides` | `Array<RecordMergeFieldOverride>` | no | |
|
|
1062
|
+
|
|
1063
|
+
**Returns** `ApiResponse_RecordMergeResponse_`: the envelope `{ data: RecordMergeResponse, ... }`. `g8.api` returns the envelope as-is, so read `result.data`.
|
|
1064
|
+
|
|
1065
|
+
Other envelope fields: `pagination` (PaginationMeta).
|
|
1066
|
+
|
|
1067
|
+
`RecordMergeResponse` fields:
|
|
1068
|
+
|
|
1069
|
+
| Field | Type | Required | Description |
|
|
1070
|
+
|---|---|---|---|
|
|
1071
|
+
| `cascade` | `RecordMergeCascade` | yes | |
|
|
1072
|
+
| `merge_history_id` | `string (uuid)` | yes | |
|
|
1073
|
+
| `record` | `RecordResponse` | yes | |
|
|
1074
|
+
|
|
1075
|
+
**Example**
|
|
1076
|
+
|
|
1077
|
+
```ts
|
|
1078
|
+
const result = await g8.api.objects.mergeObjectRecords({
|
|
1079
|
+
path: { object_slug: "example" },
|
|
1080
|
+
body: {
|
|
1081
|
+
primary_record_id: "00000000-0000-0000-0000-000000000000",
|
|
1082
|
+
secondary_record_id: "00000000-0000-0000-0000-000000000000",
|
|
1083
|
+
},
|
|
1084
|
+
});
|
|
1085
|
+
```
|
|
1086
|
+
|
|
1087
|
+
---
|
|
1088
|
+
|
|
744
1089
|
<a id="op-restoreobjectrecord"></a>
|
|
745
1090
|
|
|
746
1091
|
### `g8.api.objects.restoreObjectRecord(input)`
|
|
@@ -1065,6 +1410,27 @@ Valid attribute types for the Custom Objects type system.
|
|
|
1065
1410
|
|
|
1066
1411
|
Type: `"text" | "number" | "currency" | "date" | "timestamp" | "checkbox" | "select" | "status" | …`.
|
|
1067
1412
|
|
|
1413
|
+
<a id="type-recordbulkupdatefailure"></a>
|
|
1414
|
+
|
|
1415
|
+
### `RecordBulkUpdateFailure`
|
|
1416
|
+
|
|
1417
|
+
| Field | Type | Required | Description |
|
|
1418
|
+
|---|---|---|---|
|
|
1419
|
+
| `error` | `string` | yes | |
|
|
1420
|
+
| `id` | `string (uuid)` | yes | |
|
|
1421
|
+
|
|
1422
|
+
<a id="type-recordfilter"></a>
|
|
1423
|
+
|
|
1424
|
+
### `RecordFilter`
|
|
1425
|
+
|
|
1426
|
+
Filter parameters for listing records.
|
|
1427
|
+
|
|
1428
|
+
| Field | Type | Required | Description |
|
|
1429
|
+
|---|---|---|---|
|
|
1430
|
+
| `attribute_slug` | `string` | yes | |
|
|
1431
|
+
| `operator` | `"eq" \| "ne" \| "gt" \| "gte" \| "lt" \| "lte" \| "contains" \| "starts_with" \| …` | yes | |
|
|
1432
|
+
| `value` | `unknown \| null` | no | |
|
|
1433
|
+
|
|
1068
1434
|
<a id="type-recordhistoryentry"></a>
|
|
1069
1435
|
|
|
1070
1436
|
### `RecordHistoryEntry`
|
|
@@ -1079,6 +1445,26 @@ One generation of one attribute's value. Values are TEMPORAL rather than mutable
|
|
|
1079
1445
|
| `actor_id` | `string \| null` | no | Opaque id of whoever set it. |
|
|
1080
1446
|
| `value` | `unknown` | no | The value held during this generation. |
|
|
1081
1447
|
|
|
1448
|
+
<a id="type-recordmergecascade"></a>
|
|
1449
|
+
|
|
1450
|
+
### `RecordMergeCascade`
|
|
1451
|
+
|
|
1452
|
+
| Field | Type | Required | Description |
|
|
1453
|
+
|---|---|---|---|
|
|
1454
|
+
| `associations_deleted` | `integer` | yes | |
|
|
1455
|
+
| `associations_repointed` | `integer` | yes | |
|
|
1456
|
+
| `relationships_deleted` | `integer` | yes | |
|
|
1457
|
+
| `relationships_repointed` | `integer` | yes | |
|
|
1458
|
+
|
|
1459
|
+
<a id="type-recordmergefieldoverride"></a>
|
|
1460
|
+
|
|
1461
|
+
### `RecordMergeFieldOverride`
|
|
1462
|
+
|
|
1463
|
+
| Field | Type | Required | Description |
|
|
1464
|
+
|---|---|---|---|
|
|
1465
|
+
| `attribute_slug` | `string` | yes | |
|
|
1466
|
+
| `winner` | `"primary" \| "secondary"` | yes | |
|
|
1467
|
+
|
|
1082
1468
|
<a id="type-recordmutationentry"></a>
|
|
1083
1469
|
|
|
1084
1470
|
### `RecordMutationEntry`
|
|
@@ -1096,3 +1482,62 @@ One generation of one attribute's value. Values are TEMPORAL rather than mutable
|
|
|
1096
1482
|
| `source` | `string` | yes | |
|
|
1097
1483
|
| `was_archived` | `boolean` | yes | |
|
|
1098
1484
|
| `app_id` | `string \| null` | no | |
|
|
1485
|
+
|
|
1486
|
+
<a id="type-recordresponse"></a>
|
|
1487
|
+
|
|
1488
|
+
### `RecordResponse`
|
|
1489
|
+
|
|
1490
|
+
Response for a record with its current attribute values.
|
|
1491
|
+
|
|
1492
|
+
| Field | Type | Required | Description |
|
|
1493
|
+
|---|---|---|---|
|
|
1494
|
+
| `created_at` | `string (date-time)` | yes | |
|
|
1495
|
+
| `id` | `string (uuid)` | yes | |
|
|
1496
|
+
| `is_archived` | `boolean` | yes | |
|
|
1497
|
+
| `object_definition_id` | `string (uuid)` | yes | |
|
|
1498
|
+
| `organization_id` | `string` | yes | |
|
|
1499
|
+
| `updated_at` | `string (date-time)` | yes | |
|
|
1500
|
+
| `values` | `Record<string, unknown>` | yes | |
|
|
1501
|
+
| `revision` | `integer` | no | default `1`, min 1 |
|
|
1502
|
+
|
|
1503
|
+
<a id="type-relatedrecordedge"></a>
|
|
1504
|
+
|
|
1505
|
+
### `RelatedRecordEdge`
|
|
1506
|
+
|
|
1507
|
+
| Field | Type | Required | Description |
|
|
1508
|
+
|---|---|---|---|
|
|
1509
|
+
| `can_unlink` | `boolean` | yes | |
|
|
1510
|
+
| `definition_id` | `string (uuid)` | yes | |
|
|
1511
|
+
| `definition_revision` | `integer` | yes | |
|
|
1512
|
+
| `id` | `string (uuid)` | yes | |
|
|
1513
|
+
| `relationship_label` | `string` | yes | |
|
|
1514
|
+
| `source_kind` | `"custom" \| "contacts" \| "companies" \| "deals"` | yes | |
|
|
1515
|
+
| `source_label` | `string \| null` | yes | |
|
|
1516
|
+
| `source_object_slug` | `string` | yes | |
|
|
1517
|
+
| `source_record_id` | `string` | yes | |
|
|
1518
|
+
| `source_revision` | `integer` | yes | |
|
|
1519
|
+
| `target_kind` | `"custom" \| "contacts" \| "companies" \| "deals"` | yes | |
|
|
1520
|
+
| `target_label` | `string \| null` | yes | |
|
|
1521
|
+
| `target_object_slug` | `string` | yes | |
|
|
1522
|
+
| `target_record_id` | `string` | yes | |
|
|
1523
|
+
| `target_revision` | `integer` | yes | |
|
|
1524
|
+
|
|
1525
|
+
<a id="type-relationshipdefinitionresponse"></a>
|
|
1526
|
+
|
|
1527
|
+
### `RelationshipDefinitionResponse`
|
|
1528
|
+
|
|
1529
|
+
| Field | Type | Required | Description |
|
|
1530
|
+
|---|---|---|---|
|
|
1531
|
+
| `api_slug` | `string` | yes | |
|
|
1532
|
+
| `created_at` | `string (date-time)` | yes | |
|
|
1533
|
+
| `id` | `string (uuid)` | yes | |
|
|
1534
|
+
| `is_archived` | `boolean` | yes | |
|
|
1535
|
+
| `revision` | `integer` | yes | |
|
|
1536
|
+
| `source_kind` | `string` | yes | |
|
|
1537
|
+
| `source_label` | `string` | yes | |
|
|
1538
|
+
| `source_many` | `boolean` | yes | |
|
|
1539
|
+
| `source_object_definition_id` | `string (uuid) \| null` | yes | |
|
|
1540
|
+
| `target_kind` | `string` | yes | |
|
|
1541
|
+
| `target_label` | `string` | yes | |
|
|
1542
|
+
| `target_many` | `boolean` | yes | |
|
|
1543
|
+
| `target_object_definition_id` | `string (uuid) \| null` | yes | |
|
package/package.json
CHANGED