@pipedream/linkedin 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +7 -0
- package/actions/analytics-finder-account-sample/analytics-finder-account-sample.mjs +44 -0
- package/actions/analytics-finder-campaign-sample/analytics-finder-campaign-sample.mjs +44 -0
- package/actions/create-comment/create-comment.mjs +58 -0
- package/actions/create-like-on-share/create-like-on-share.mjs +42 -0
- package/actions/create-text-post-organization/create-text-post-organization.mjs +37 -0
- package/actions/create-text-post-user/create-text-post-user.mjs +36 -0
- package/actions/delete-post/delete-post.mjs +25 -0
- package/actions/fetch-ad-account/fetch-ad-account.mjs +28 -0
- package/actions/get-current-member-profile/get-current-member-profile.mjs +21 -0
- package/actions/get-member-organization-access-control/get-member-organization-access-control.mjs +59 -0
- package/actions/get-member-profile/get-member-profile.mjs +26 -0
- package/actions/get-multiple-member-profiles/get-multiple-member-profiles.mjs +43 -0
- package/actions/get-organization-access-control/get-organization-access-control.mjs +51 -0
- package/actions/get-organization-administrators/get-organization-administrators.mjs +53 -0
- package/actions/post-share/post-share.mjs +53 -0
- package/actions/query-analytics-finder/query-analytics-finder.mjs +197 -0
- package/actions/retrieve-comments-on-comments/retrieve-comments-on-comments.mjs +49 -0
- package/actions/retrieve-comments-shares/retrieve-comments-shares.mjs +49 -0
- package/actions/search-organization/search-organization.mjs +59 -0
- package/actions/share-content/share-content.mjs +59 -0
- package/actions/share-text-mentions/share-text-mentions.mjs +52 -0
- package/common/constants.mjs +88 -0
- package/linkedin.app.mjs +263 -0
- package/package.json +19 -0
package/linkedin.app.mjs
ADDED
|
@@ -0,0 +1,263 @@
|
|
|
1
|
+
import { axios } from "@pipedream/platform";
|
|
2
|
+
import constants from "./common/constants.mjs";
|
|
3
|
+
|
|
4
|
+
export default {
|
|
5
|
+
type: "app",
|
|
6
|
+
app: "linkedin",
|
|
7
|
+
propDefinitions: {
|
|
8
|
+
text: {
|
|
9
|
+
type: "string",
|
|
10
|
+
label: "Text",
|
|
11
|
+
description: "Text to be posted on LinkedIn timeline",
|
|
12
|
+
},
|
|
13
|
+
organizationId: {
|
|
14
|
+
type: "string",
|
|
15
|
+
label: "Organization Id",
|
|
16
|
+
description: "ID of the organization that will author the post",
|
|
17
|
+
async options({ page }) {
|
|
18
|
+
const { elements } = await this.getOrganizations(page);
|
|
19
|
+
|
|
20
|
+
const responseArray = [];
|
|
21
|
+
for (const item of elements) {
|
|
22
|
+
const orgId = item.organization.split(":")[3];
|
|
23
|
+
const orgData = await this.getOrganization(orgId);
|
|
24
|
+
|
|
25
|
+
responseArray.push({
|
|
26
|
+
label: orgData.localizedName,
|
|
27
|
+
value: orgId,
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
return responseArray;
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
adAccountId: {
|
|
34
|
+
type: "string",
|
|
35
|
+
label: "Ad Account Id",
|
|
36
|
+
description: "Sponsored ad account id to match results by",
|
|
37
|
+
async options({ page }) {
|
|
38
|
+
const count = 10;
|
|
39
|
+
const params = {
|
|
40
|
+
count,
|
|
41
|
+
start: count * page,
|
|
42
|
+
};
|
|
43
|
+
const { elements } = await this.searchAdAccounts({
|
|
44
|
+
params,
|
|
45
|
+
});
|
|
46
|
+
return elements?.map((element) => ({
|
|
47
|
+
label: element.name,
|
|
48
|
+
id: element.id,
|
|
49
|
+
}));
|
|
50
|
+
},
|
|
51
|
+
},
|
|
52
|
+
campaignId: {
|
|
53
|
+
type: "string",
|
|
54
|
+
label: "Campaign Id",
|
|
55
|
+
description: "Sponsored campaign account id to match results by",
|
|
56
|
+
async options({ page }) {
|
|
57
|
+
const count = 10;
|
|
58
|
+
const params = {
|
|
59
|
+
count,
|
|
60
|
+
start: count * page,
|
|
61
|
+
};
|
|
62
|
+
const { elements } = await this.searchCampaigns({
|
|
63
|
+
params,
|
|
64
|
+
});
|
|
65
|
+
return elements?.map((element) => ({
|
|
66
|
+
label: element.name,
|
|
67
|
+
id: element.id,
|
|
68
|
+
}));
|
|
69
|
+
},
|
|
70
|
+
},
|
|
71
|
+
type: {
|
|
72
|
+
type: "string",
|
|
73
|
+
label: "Type",
|
|
74
|
+
description: "Type of the post",
|
|
75
|
+
options: constants.TYPES,
|
|
76
|
+
},
|
|
77
|
+
visibility: {
|
|
78
|
+
type: "string",
|
|
79
|
+
label: "Visibility",
|
|
80
|
+
description: "Visibility restrictions on content",
|
|
81
|
+
options: constants.VISIBILITIES,
|
|
82
|
+
},
|
|
83
|
+
postId: {
|
|
84
|
+
type: "string",
|
|
85
|
+
label: "Post Id",
|
|
86
|
+
description: "URN of the post that will be deleted",
|
|
87
|
+
},
|
|
88
|
+
startYear: {
|
|
89
|
+
type: "string",
|
|
90
|
+
label: "Start Year",
|
|
91
|
+
description: "The inclusive start year range of analytics.\nThis action query is set to 1st January, as the day and month of the start range of the analytics.",
|
|
92
|
+
},
|
|
93
|
+
timeGranularity: {
|
|
94
|
+
type: "string",
|
|
95
|
+
label: "Time Granularity",
|
|
96
|
+
description: "Time granularity of results. Valid enum values:\n\n* ALL - Results grouped into a single result across the entire time range of the report.\n* DAILY - Results grouped by day.\n* MONTHLY - Results grouped by month.\n* YEARLY - Results grouped by year.",
|
|
97
|
+
options: constants.TIME_GRANULARITY_OPTIONS,
|
|
98
|
+
},
|
|
99
|
+
pivot: {
|
|
100
|
+
type: "string",
|
|
101
|
+
label: "Pivot",
|
|
102
|
+
description: "Pivot of results, by which each report data point is grouped. The following enum values are supported:\n* COMPANY - Group results by advertiser's company.\n* ACCOUNT - Group results by account.\n* SHARE - Group results by sponsored share.\n* CAMPAIGN - Group results by campaign.\n* CREATIVE - Group results by creative.\n* CAMPAIGN_GROUP - Group results by campaign group.\n* CONVERSION - Group results by conversion.\n* CONVERSATION_NODE - The element row in the conversation will be the information for each individual node of the conversation tree.\n* CONVERSATION_NODE_OPTION_INDEX - Used `actionClicks` are deaggregated and reported at the Node Button level. The second value of the `pivot_values` will be the index of the button in the node.\n* SERVING_LOCATION - Group results by serving location, onsite or offsite.\n* CARD_INDEX - Group results by the index of where a card appears in a carousel ad creative. Metrics are based on the index of the card at the time when the user's action (impression, click, etc.) happened on the creative (Carousel creatives only).\n* MEMBER_COMPANY_SIZE - Group results by member company size.\n* MEMBER_INDUSTRY - Group results by member industry.\n* MEMBER_SENIORITY - Group results by member seniority.\n* MEMBER_JOB_TITLE - Group results by member job title.\n* MEMBER_JOB_FUNCTION - Group results by member job function.\n* MEMBER_COUNTRY_V2 - Group results by member country.\n* MEMBER_REGION_V2 - Group results by member region.\n* MEMBER_COMPANY - Group results by member company.",
|
|
103
|
+
options: constants.PIVOT_OPTIONS,
|
|
104
|
+
},
|
|
105
|
+
role: {
|
|
106
|
+
type: "string",
|
|
107
|
+
label: "Role",
|
|
108
|
+
description: "Limit results to specific roles, such as ADMINISTRATOR or DIRECT_SPONSORED_CONTENT_POSTER.",
|
|
109
|
+
optional: true,
|
|
110
|
+
options: constants.ORGANIZATION_ROLES,
|
|
111
|
+
},
|
|
112
|
+
state: {
|
|
113
|
+
type: "string",
|
|
114
|
+
label: "State",
|
|
115
|
+
description: "Limit results to specific role states, such as APPROVED or REQUESTED.",
|
|
116
|
+
optional: true,
|
|
117
|
+
options: constants.ROLE_STATES,
|
|
118
|
+
},
|
|
119
|
+
max: {
|
|
120
|
+
type: "integer",
|
|
121
|
+
label: "Max",
|
|
122
|
+
description: "Maximum number of results to return",
|
|
123
|
+
optional: true,
|
|
124
|
+
default: 50,
|
|
125
|
+
},
|
|
126
|
+
},
|
|
127
|
+
methods: {
|
|
128
|
+
_getHeaders() {
|
|
129
|
+
return {
|
|
130
|
+
"Authorization": `Bearer ${this.$auth.oauth_access_token}`,
|
|
131
|
+
"Content-Type": "application/json",
|
|
132
|
+
"X-Restli-Protocol-Version": "2.0.0",
|
|
133
|
+
"Linkedin-Version": constants.VERSION_HEADER,
|
|
134
|
+
};
|
|
135
|
+
},
|
|
136
|
+
async _makeRequest({
|
|
137
|
+
$, url, path, ...otherConfig
|
|
138
|
+
}) {
|
|
139
|
+
const BASE_URL = constants.BASE_URL;
|
|
140
|
+
|
|
141
|
+
const config = {
|
|
142
|
+
url: url || `${BASE_URL}${constants.VERSION_PATH}${path}`,
|
|
143
|
+
headers: this._getHeaders(),
|
|
144
|
+
...otherConfig,
|
|
145
|
+
};
|
|
146
|
+
|
|
147
|
+
return axios($ || this, config);
|
|
148
|
+
},
|
|
149
|
+
async createPost({
|
|
150
|
+
data, ...args
|
|
151
|
+
}) {
|
|
152
|
+
data = {
|
|
153
|
+
...data,
|
|
154
|
+
author: `urn:li:${data?.author
|
|
155
|
+
? "organization"
|
|
156
|
+
: "person"}:${data.author || this.$auth.oauth_uid}`,
|
|
157
|
+
lifecycleState: "PUBLISHED",
|
|
158
|
+
distribution: {
|
|
159
|
+
feedDistribution: "MAIN_FEED",
|
|
160
|
+
},
|
|
161
|
+
};
|
|
162
|
+
return this._makeRequest({
|
|
163
|
+
method: "POST",
|
|
164
|
+
path: "/posts",
|
|
165
|
+
data,
|
|
166
|
+
...args,
|
|
167
|
+
});
|
|
168
|
+
},
|
|
169
|
+
async getOrganizations(page) {
|
|
170
|
+
return this._makeRequest({
|
|
171
|
+
method: "GET",
|
|
172
|
+
path: `/organizationAcls?q=roleAssignee&count=5&start=${page * 5}`,
|
|
173
|
+
});
|
|
174
|
+
},
|
|
175
|
+
async getOrganization(organizationId) {
|
|
176
|
+
return this._makeRequest({
|
|
177
|
+
method: "GET",
|
|
178
|
+
path: `/organizations/${organizationId}`,
|
|
179
|
+
});
|
|
180
|
+
},
|
|
181
|
+
async deletePost(postId, args = {}) {
|
|
182
|
+
return this._makeRequest({
|
|
183
|
+
method: "DELETE",
|
|
184
|
+
path: `/posts/${postId}`,
|
|
185
|
+
...args,
|
|
186
|
+
});
|
|
187
|
+
},
|
|
188
|
+
async createComment(urnToComment, args = {}) {
|
|
189
|
+
return this._makeRequest({
|
|
190
|
+
method: "POST",
|
|
191
|
+
path: `/socialActions/${urnToComment}/comments`,
|
|
192
|
+
...args,
|
|
193
|
+
});
|
|
194
|
+
},
|
|
195
|
+
async createLikeOnShare(parentUrn, args = {}) {
|
|
196
|
+
return this._makeRequest({
|
|
197
|
+
method: "POST",
|
|
198
|
+
path: `/socialActions/${parentUrn}/likes`,
|
|
199
|
+
...args,
|
|
200
|
+
});
|
|
201
|
+
},
|
|
202
|
+
async getAdAccount(adAccountId, args = {}) {
|
|
203
|
+
return this._makeRequest({
|
|
204
|
+
path: `/adAccounts/${adAccountId}`,
|
|
205
|
+
...args,
|
|
206
|
+
});
|
|
207
|
+
},
|
|
208
|
+
async getCurrentMemberProfile(args = {}) {
|
|
209
|
+
return this._makeRequest({
|
|
210
|
+
path: "/me",
|
|
211
|
+
...args,
|
|
212
|
+
});
|
|
213
|
+
},
|
|
214
|
+
async getMemberProfile(personId, args = {}) {
|
|
215
|
+
return this._makeRequest({
|
|
216
|
+
path: `/people/(id:${personId})`,
|
|
217
|
+
...args,
|
|
218
|
+
});
|
|
219
|
+
},
|
|
220
|
+
async getMultipleMemberProfiles(args = {}) {
|
|
221
|
+
return this._makeRequest({
|
|
222
|
+
path: "/people",
|
|
223
|
+
...args,
|
|
224
|
+
});
|
|
225
|
+
},
|
|
226
|
+
async getAccessControl(args = {}) {
|
|
227
|
+
return this._makeRequest({
|
|
228
|
+
path: "/organizationAcls",
|
|
229
|
+
...args,
|
|
230
|
+
});
|
|
231
|
+
},
|
|
232
|
+
async queryAnaltyics(query, args = {} ) {
|
|
233
|
+
return this._makeRequest({
|
|
234
|
+
path: `/adAnalytics?q=analytics${query}`,
|
|
235
|
+
...args,
|
|
236
|
+
});
|
|
237
|
+
},
|
|
238
|
+
async getComments(urn, args = {}) {
|
|
239
|
+
return this._makeRequest({
|
|
240
|
+
path: `/socialActions/${urn}/comments`,
|
|
241
|
+
...args,
|
|
242
|
+
});
|
|
243
|
+
},
|
|
244
|
+
async searchOrganizations(query, args = {}) {
|
|
245
|
+
return this._makeRequest({
|
|
246
|
+
path: `/organizations?q=${query}`,
|
|
247
|
+
...args,
|
|
248
|
+
});
|
|
249
|
+
},
|
|
250
|
+
async searchAdAccounts(args = {}) {
|
|
251
|
+
return this._makeRequest({
|
|
252
|
+
path: "/adAccounts?q=search",
|
|
253
|
+
...args,
|
|
254
|
+
});
|
|
255
|
+
},
|
|
256
|
+
async searchCampaigns(args = {}) {
|
|
257
|
+
return this._makeRequest({
|
|
258
|
+
path: "/adCampaigns?q=search",
|
|
259
|
+
...args,
|
|
260
|
+
});
|
|
261
|
+
},
|
|
262
|
+
},
|
|
263
|
+
};
|
package/package.json
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@pipedream/linkedin",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"description": "Pipedream Linkedin Components",
|
|
5
|
+
"main": "linkedin.app.mjs",
|
|
6
|
+
"keywords": [
|
|
7
|
+
"pipedream",
|
|
8
|
+
"linkedin"
|
|
9
|
+
],
|
|
10
|
+
"homepage": "https://pipedream.com/apps/linkedin",
|
|
11
|
+
"author": "Pipedream <support@pipedream.com> (https://pipedream.com/)",
|
|
12
|
+
"license": "MIT",
|
|
13
|
+
"publishConfig": {
|
|
14
|
+
"access": "public"
|
|
15
|
+
},
|
|
16
|
+
"dependencies": {
|
|
17
|
+
"@pipedream/platform": "^1.2.1"
|
|
18
|
+
}
|
|
19
|
+
}
|