@@ -35,6 +35,7 @@ import {
3535 SendMessage ,
3636 SyncConversation ,
3737 SyncInbox ,
38+ SyncNetwork ,
3839 WithdrawConnectionRequest ,
3940} from './operations' ;
4041import {
@@ -49,6 +50,8 @@ import {
4950 TInboxPollResult ,
5051 TLinkedApiActionErrorType ,
5152 TLinkedApiErrorType ,
53+ TNetworkPollRequest ,
54+ TNetworkPollResult ,
5255} from './types' ;
5356import type { TLinkedApiConfig } from './types/config' ;
5457import type { TLinkedApiResponse } from './types/responses' ;
@@ -102,6 +105,7 @@ class LinkedApi {
102105 this . sendMessage = new SendMessage ( this . httpClient ) ;
103106 this . syncConversation = new SyncConversation ( this . httpClient ) ;
104107 this . syncInbox = new SyncInbox ( this . httpClient ) ;
108+ this . syncNetwork = new SyncNetwork ( this . httpClient ) ;
105109 this . manageConversation = new ManageConversation ( this . httpClient ) ;
106110 this . checkConnectionStatus = new CheckConnectionStatus ( this . httpClient ) ;
107111 this . sendConnectionRequest = new SendConnectionRequest ( this . httpClient ) ;
@@ -138,6 +142,7 @@ class LinkedApi {
138142 this . sendMessage ,
139143 this . syncConversation ,
140144 this . syncInbox ,
145+ this . syncNetwork ,
141146 this . manageConversation ,
142147 this . checkConnectionStatus ,
143148 this . sendConnectionRequest ,
@@ -288,6 +293,27 @@ class LinkedApi {
288293 */
289294 public syncInbox : SyncInbox ;
290295
296+ /**
297+ * Enable whole-network monitoring for standard LinkedIn.
298+ *
299+ * This method enables background monitoring of your LinkedIn network, preparing it for future
300+ * polling with {@link pollNetwork}. Once enabled, connection activity across your network is
301+ * monitored: accepted connections, newly added connections, and received connection requests.
302+ * This action takes no parameters and returns no data.
303+ *
304+ * @param params - No parameters are required
305+ * @returns Promise resolving to the sync action
306+ *
307+ * @example
308+ * ```typescript
309+ * const workflow = await linkedapi.syncNetwork.execute({});
310+ *
311+ * await linkedapi.syncNetwork.result(workflow.workflowId);
312+ * console.log("Network monitoring enabled and ready for polling");
313+ * ```
314+ */
315+ public syncNetwork : SyncNetwork ;
316+
291317 /**
292318 * Manage a standard LinkedIn conversation thread.
293319 *
@@ -547,6 +573,53 @@ class LinkedApi {
547573 } ;
548574 }
549575
576+ /**
577+ * Poll the monitored network to retrieve connection activity events.
578+ *
579+ * This method reads network events from the network previously enabled for monitoring via
580+ * {@link syncNetwork}, using a direct HTTP request. It returns events across the whole monitored
581+ * network, newest-first. You can optionally filter by `since` timestamp and event `type`.
582+ *
583+ * @param request - Optional filters: `since` timestamp and `type`
584+ * @returns Promise resolving to a response containing the network events
585+ *
586+ * @example
587+ * ```typescript
588+ * const pollResponse = await linkedapi.pollNetwork({
589+ * type: "connectionAccepted",
590+ * since: "2025-01-01T00:00:00Z",
591+ * });
592+ *
593+ * if (pollResponse.data) {
594+ * pollResponse.data.events.forEach((event) => {
595+ * console.log(`${event.type} ${event.personUrl} at ${event.detectedAt}`);
596+ * });
597+ * } else {
598+ * console.error("Polling failed:", pollResponse.errors);
599+ * }
600+ * ```
601+ */
602+ public async pollNetwork (
603+ request : TNetworkPollRequest = { } ,
604+ ) : Promise < TMappedResponse < TNetworkPollResult > > {
605+ const response = await this . httpClient . post < TNetworkPollResult > ( '/network/poll' , request ) ;
606+ if ( response . success && response . result ) {
607+ return {
608+ data : response . result ,
609+ errors : [ ] ,
610+ } ;
611+ }
612+ return {
613+ data : undefined ,
614+ errors : [
615+ {
616+ type : response . error ?. type as TLinkedApiActionErrorType ,
617+ message : response . error ?. message ?? '' ,
618+ } ,
619+ ] ,
620+ } ;
621+ }
622+
550623 /**
551624 * Retrieve detailed information about a LinkedIn person profile.
552625 *
0 commit comments