File tree Expand file tree Collapse file tree 4 files changed +36
-1
lines changed
Expand file tree Collapse file tree 4 files changed +36
-1
lines changed Original file line number Diff line number Diff line change 11{
22 "name" : " linkedapi-node" ,
3- "version" : " 1.2.14 " ,
3+ "version" : " 1.2.15 " ,
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" ,
Original file line number Diff line number Diff line change @@ -31,6 +31,7 @@ import {
3131import {
3232 HttpClient ,
3333 LinkedApiError ,
34+ TAccountInfo ,
3435 TApiUsageAction ,
3536 TApiUsageParams ,
3637 TConversationPollRequest ,
@@ -1040,6 +1041,35 @@ class LinkedApi {
10401041 */
10411042 public retrievePerformance : RetrievePerformance ;
10421043
1044+ /**
1045+ * Retrieve basic information about the LinkedIn account associated with the current API tokens.
1046+ *
1047+ * This method validates the tokens and returns the account name and LinkedIn profile URL.
1048+ * Use this to verify credentials or display account information.
1049+ *
1050+ * @returns Promise resolving to account info (name and url)
1051+ *
1052+ * @example
1053+ * ```typescript
1054+ * const accountInfo = await linkedapi.getAccountInfo();
1055+ * console.log("Account:", accountInfo.data?.name);
1056+ * console.log("URL:", accountInfo.data?.url);
1057+ * ```
1058+ */
1059+ public async getAccountInfo ( ) : Promise < TMappedResponse < TAccountInfo > > {
1060+ const response = await this . httpClient . get < TAccountInfo > ( '/account' ) ;
1061+ if ( response . success && response . result ) {
1062+ return {
1063+ data : response . result ,
1064+ errors : [ ] ,
1065+ } ;
1066+ }
1067+ throw new LinkedApiError (
1068+ response . error ?. type as TLinkedApiErrorType ,
1069+ response . error ?. message ?? '' ,
1070+ ) ;
1071+ }
1072+
10431073 /**
10441074 * Retrieve Linked API usage statistics for a specific time period.
10451075 *
Original file line number Diff line number Diff line change 1+ export interface TAccountInfo {
2+ name : string ;
3+ url : string ;
4+ }
Original file line number Diff line number Diff line change 1+ export * from './account' ;
12export * from './company' ;
23export * from './connection' ;
34export * from './message' ;
You can’t perform that action at this time.
0 commit comments