Socket
Socket
Sign inDemoInstall

linkedin-private-api

Package Overview
Dependencies
23
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.1.1 to 1.1.2

6

dist/src/core/client.d.ts

@@ -0,6 +1,11 @@

import { AxiosProxyConfig } from 'axios';
import { ConversationRepository, InvitationRepository, MessageRepository, ProfileRepository, SearchRepository } from '../repositories';
import { LinkedInRequest } from './linkedin-request';
import { Login } from './login';
interface ClientOpts {
proxy?: AxiosProxyConfig;
}
export declare class Client {
request: LinkedInRequest;
constructor({ proxy }?: ClientOpts);
login: Login;

@@ -13,1 +18,2 @@ search: SearchRepository;

}
export {};

4

dist/src/core/client.js

@@ -8,4 +8,3 @@ "use strict";

class Client {
constructor() {
this.request = new linkedin_request_1.LinkedInRequest();
constructor({ proxy } = {}) {
this.login = new login_1.Login({ client: this });

@@ -17,2 +16,3 @@ this.search = new repositories_1.SearchRepository({ client: this });

this.message = new repositories_1.MessageRepository({ client: this });
this.request = new linkedin_request_1.LinkedInRequest({ proxy });
}

@@ -19,0 +19,0 @@ }

@@ -1,2 +0,2 @@

import { AxiosInstance, AxiosRequestConfig, AxiosResponse } from 'axios';
import { AxiosInstance, AxiosRequestConfig, AxiosResponse, AxiosProxyConfig } from 'axios';
declare type ConfigFullResponse = AxiosRequestConfig & {

@@ -8,5 +8,8 @@ fullResponse?: true;

};
interface RequestOpts {
proxy?: AxiosProxyConfig;
}
export declare class Request {
request: AxiosInstance;
constructor();
constructor({ proxy }?: RequestOpts);
setHeaders(headers: Record<string, string>): void;

@@ -13,0 +16,0 @@ get<T>(url: string, reqConfig?: ConfigNonFullResponse): Promise<T>;

@@ -13,6 +13,7 @@ "use strict";

class Request {
constructor() {
constructor({ proxy } = {}) {
this.request = axios_1.default.create({
paramsSerializer: paramsSerializer_1.paramsSerializer,
withCredentials: true,
...(proxy && { proxy }),
});

@@ -19,0 +20,0 @@ }

@@ -15,4 +15,5 @@ import { Client } from '../core/client';

}): MessageScroller;
sendMessage({ profileId, text }: {
profileId: ProfileId;
sendMessage({ profileId, conversationId, text, }: {
profileId?: ProfileId;
conversationId?: ConversationId;
text: string;

@@ -19,0 +20,0 @@ }): Promise<MessageEventCreateResponse>;

@@ -16,5 +16,5 @@ "use strict";

}
async sendMessage({ profileId, text }) {
async sendMessage({ profileId, conversationId, text, }) {
var _a;
const response = await this.client.request.message.sendMessage({ profileId, text });
const response = await this.client.request.message.sendMessage({ profileId, conversationId, text });
return { ...(_a = response === null || response === void 0 ? void 0 : response.data) === null || _a === void 0 ? void 0 : _a.value, text };

@@ -21,0 +21,0 @@ }

@@ -11,4 +11,5 @@ import { ProfileId } from 'src/entities';

});
sendMessage({ profileId, text }: {
profileId: ProfileId;
sendMessage({ profileId, conversationId, text }: {
profileId?: ProfileId;
conversationId?: ConversationId;
text: string;

@@ -15,0 +16,0 @@ }): Promise<SendMessageResponse>;

@@ -8,7 +8,7 @@ "use strict";

}
sendMessage({ profileId, text }) {
sendMessage({ profileId, conversationId, text }) {
const queryParams = {
action: 'create',
};
const payload = {
const directMessagePayload = {
keyVersion: 'LEGACY_INBOX',

@@ -31,5 +31,19 @@ conversationCreate: {

};
return this.request.post('messaging/conversations', payload, {
params: queryParams,
});
const conversationPayload = {
eventCreate: {
originToken: '54b3a724-59c5-4cf2-adbd-660483010a87',
value: {
'com.linkedin.voyager.messaging.create.MessageCreate': {
attributedBody: { text, attributes: [] },
attachments: [],
},
},
},
dedupeByClientGeneratedToken: false,
};
const conversationUrl = `messaging/conversations/${conversationId}/events`;
const directMessageUrl = 'messaging/conversations';
const payload = conversationId ? conversationPayload : directMessagePayload;
const url = conversationId ? conversationUrl : directMessageUrl;
return this.request.post(url, payload, { params: queryParams });
}

@@ -36,0 +50,0 @@ getMessages({ conversationId, createdBefore, }) {

{
"name": "linkedin-private-api",
"version": "1.1.1",
"version": "1.1.2",
"description": "",

@@ -35,2 +35,3 @@ "main": "dist/index.js",

"prepublish": "yarn docs && yarn build",
"prepare": "yarn docs && yarn build",
"docs": "rimraf docs && typedoc --plugin typedoc-plugin-markdown --out docs src"

@@ -45,3 +46,3 @@ },

"axios": "^0.21.0",
"cookie": "^0.4.0",
"cookie": "^0.5.0",
"fs": "^0.0.1-security",

@@ -53,8 +54,8 @@ "lodash": "^4.17.15",

"devDependencies": {
"@types/config": "^0.0.39",
"@types/cookie": "^0.4.0",
"@types/config": "^0.0.41",
"@types/cookie": "^0.5.1",
"@types/faker": "^5.1.2",
"@types/jest": "^26.0.14",
"@types/jest": "^27.0.1",
"@types/lodash": "^4.14.161",
"@types/node": "^16.0.0",
"@types/node": "^17.0.4",
"@typescript-eslint/eslint-plugin": "^4.2.0",

@@ -64,7 +65,7 @@ "@typescript-eslint/parser": "^4.2.0",

"eslint": "^7.9.0",
"eslint-config-airbnb-base": "^14.2.0",
"eslint-config-airbnb-typescript": "^12.0.0",
"eslint-config-airbnb-base": "^15.0.0",
"eslint-config-airbnb-typescript": "^14.0.0",
"eslint-config-prettier": "^8.3.0",
"eslint-plugin-import": "^2.22.0",
"eslint-plugin-prettier": "^3.1.4",
"eslint-plugin-prettier": "^4.0.0",
"eslint-plugin-simple-import-sort": "^7.0.0",

@@ -71,0 +72,0 @@ "faked": "^2.1.0",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc