Appearance
Link
Internal
These endpoints are internal to Hailer and not part of the supported public API.
Links between activities.
Endpoints
| Endpoint | Arguments | Returns |
|---|---|---|
v3.link.create | linkData: { source: string, target: string, type: string, sourceType?: string, targetType?: string, userId?: string } | boolean |
v3.link.get.targets | `targetMap: { [targetId: string]: string | string[] }, options?: { types?: string[] }` |
v3.link.create
Description
Create link from source to target
Parameters
Argument 1 (object, optional):
| Field | Type | Required | Description |
|---|---|---|---|
source | ObjectId | yes | |
target | ObjectId | yes | |
type | reaction | tag | linked-to | in_process | user-mention | apple-id | feed.lastseen | yes | One of: reaction, tag, linked-to, in_process, user-mention, apple-id, feed.lastseen. |
sourceType | feedPost | message | no | One of: feedPost, message. |
targetType | feedPost | poll | message | activity | file | no | One of: feedPost, poll, message, activity, file. |
userId | userId | no | userId |
Example
javascript
const { Client } = require('@hailer/cli');
const client = await Client.create({
host: 'https://api.hailer.com',
username: 'you@example.com',
password: '••••••',
});
const result = await client.request('v3.link.create', [
{
source: '507f1f77bcf86cd799439011',
target: '507f1f77bcf86cd799439011',
type: 'reaction',
},
]);
console.log(result);Returns
boolean
Auth: requires an authenticated session.
Errors: on failure returns the standard Hailer error object { code, msg, details?, debug? }.
v3.link.get.targets
Description
Get links attached to target, e.g. feed post
Parameters
Argument 1 (Record<ObjectId, * \| ObjectId[]>, optional):
Argument 2 (object, optional):
| Field | Type | Required | Description |
|---|---|---|---|
types | array | no |
Example
javascript
const { Client } = require('@hailer/cli');
const client = await Client.create({
host: 'https://api.hailer.com',
username: 'you@example.com',
password: '••••••',
});
const result = await client.request('v3.link.get.targets', [
{
'507f1f77bcf86cd799439012': '*', // fieldId: value
},
{
types: [],
},
]);
console.log(result);Returns
Record<ObjectId, object[]>
Auth: requires an authenticated session.
Errors: on failure returns the standard Hailer error object { code, msg, details?, debug? }.