Skip to content

Commit 9dd9e99

Browse files
committed
Adding 'get profile picture fields' action
1 parent 6c27687 commit 9dd9e99

File tree

1 file changed

+49
-0
lines changed

1 file changed

+49
-0
lines changed
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
import linkedin from "../../linkedin.app.mjs";
2+
import constants from "../../common/constants.mjs";
3+
4+
export default {
5+
key: "linkedin-get-profile-picture-fields",
6+
name: "Get Profile Picture Fields",
7+
description: "Gets the authenticated user's profile picture data including display image and metadata. [See the documentation](https://learn.microsoft.com/en-us/linkedin/shared/references/v2/profile/profile-picture)",
8+
version: "0.0.1",
9+
type: "action",
10+
props: {
11+
linkedin,
12+
includeOriginalImage: {
13+
type: "boolean",
14+
label: "Include Original Image",
15+
description: "Whether to include the original image data in the response (requires special permissions)",
16+
optional: true,
17+
default: false,
18+
},
19+
},
20+
methods: {
21+
getProfilePictureFields(args) {
22+
return this.linkedin._makeRequest({
23+
url: `${constants.BASE_URL}v2/me`,
24+
...args,
25+
});
26+
},
27+
},
28+
async run({ $ }) {
29+
// Build the projection parameter based on user preferences
30+
let projection = "id,profilePicture(displayImage~digitalmediaAsset:playableStreams";
31+
32+
if (this.includeOriginalImage) {
33+
projection += ",originalImage~digitalmediaAsset:playableStreams";
34+
}
35+
36+
projection += ")";
37+
38+
const response = await this.getProfilePictureFields({
39+
$,
40+
params: {
41+
projection: `(${projection})`,
42+
},
43+
});
44+
45+
$.export("$summary", "Successfully retrieved profile picture fields");
46+
47+
return response;
48+
},
49+
};

0 commit comments

Comments
 (0)