Skip to content

Commit dba2b27

Browse files
retrieveFeed
1 parent 3e86db5 commit dba2b27

8 files changed

Lines changed: 46 additions & 1 deletion

File tree

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@linkedapi/node",
3-
"version": "2.3.3",
3+
"version": "2.3.4",
44
"description": "Control your LinkedIn accounts and retrieve real-time data, all through this Node.js SDK.",
55
"main": "dist/index.js",
66
"types": "dist/index.d.ts",

src/core/operation.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ export const OPERATION_NAME = {
3939
reactToPost: 'reactToPost',
4040
commentOnPost: 'commentOnPost',
4141
createPost: 'createPost',
42+
retrieveFeed: 'retrieveFeed',
4243
retrieveSSI: 'retrieveSSI',
4344
retrievePerformance: 'retrievePerformance',
4445
nvSendMessage: 'nvSendMessage',

src/index.ts

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ import {
2424
ReactToPost,
2525
RemoveConnection,
2626
RetrieveConnections,
27+
RetrieveFeed,
2728
RetrieveInvitations,
2829
RetrievePendingRequests,
2930
RetrievePerformance,
@@ -126,6 +127,7 @@ class LinkedApi {
126127
this.reactToPost = new ReactToPost(this.httpClient);
127128
this.commentOnPost = new CommentOnPost(this.httpClient);
128129
this.createPost = new CreatePost(this.httpClient);
130+
this.retrieveFeed = new RetrieveFeed(this.httpClient);
129131
this.retrieveSSI = new RetrieveSSI(this.httpClient);
130132
this.retrievePerformance = new RetrievePerformance(this.httpClient);
131133
this.nvSendMessage = new NvSendMessage(this.httpClient);
@@ -163,6 +165,7 @@ class LinkedApi {
163165
this.reactToPost,
164166
this.commentOnPost,
165167
this.createPost,
168+
this.retrieveFeed,
166169
this.retrieveSSI,
167170
this.retrievePerformance,
168171
this.nvSendMessage,
@@ -1421,6 +1424,26 @@ class LinkedApi {
14211424
*/
14221425
public retrievePerformance: RetrievePerformance;
14231426

1427+
/**
1428+
* Retrieve posts from the current account's personalized LinkedIn home feed.
1429+
*
1430+
* @param params - Optional maximum number of posts to retrieve (1-100, default 20)
1431+
* @returns Promise resolving to home-feed posts and their localized feed context
1432+
*
1433+
* @see {@link https://linkedapi.io/docs/action-st-retrieve-feed/ st.retrieveFeed Action Documentation}
1434+
*
1435+
* @example
1436+
* ```typescript
1437+
* const workflow = await linkedapi.retrieveFeed.execute({ limit: 20 });
1438+
* const result = await linkedapi.retrieveFeed.result(workflow.workflowId);
1439+
*
1440+
* for (const post of result.data ?? []) {
1441+
* console.log(post.url, post.feedContext);
1442+
* }
1443+
* ```
1444+
*/
1445+
public readonly retrieveFeed: RetrieveFeed;
1446+
14241447
/**
14251448
* Retrieve basic information about the LinkedIn account associated with the current API tokens.
14261449
*

src/operations/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,5 +31,6 @@ export * from './remove-connection';
3131
export * from './react-to-post';
3232
export * from './comment-on-post';
3333
export * from './create-post';
34+
export * from './retrieve-feed';
3435
export * from './retrieve-ssi';
3536
export * from './retrieve-performance';

src/operations/retrieve-feed.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import { Operation, TOperationName } from '../core';
2+
import { ArrayWorkflowMapper } from '../mappers/array-workflow-mapper';
3+
import { TFeedPost, TRetrieveFeedParams } from '../types';
4+
5+
export class RetrieveFeed extends Operation<TRetrieveFeedParams, Array<TFeedPost>> {
6+
public override readonly operationName: TOperationName = 'retrieveFeed';
7+
protected override readonly mapper = new ArrayWorkflowMapper<TRetrieveFeedParams, TFeedPost>(
8+
'st.retrieveFeed',
9+
);
10+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import type { TPost } from './post';
2+
3+
export interface TFeedPost extends TPost {
4+
feedContext: string | null;
5+
}

src/types/actions/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ export * from './account';
22
export * from './accept-invitation-params.type';
33
export * from './company';
44
export * from './connection';
5+
export * from './feed-post.type';
56
export * from './ignore-invitation-params.type';
67
export * from './invitation-target.type';
78
export * from './invitation-type.type';
@@ -10,6 +11,7 @@ export * from './message';
1011
export * from './network';
1112
export * from './person';
1213
export * from './post';
14+
export * from './retrieve-feed-params.type';
1315
export * from './retrieve-invitations-result.type';
1416
export * from './search-companies';
1517
export * from './search-people';
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import type { TLimitParams } from '../params';
2+
3+
export interface TRetrieveFeedParams extends TLimitParams {}

0 commit comments

Comments
 (0)