Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

upgrade api version #13976

Merged
merged 6 commits into from
Sep 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export default {
key: "linkedin-create-comment",
name: "Create Comment",
description: "Create a comment on a share or user generated content post. [See the docs here](https://docs.microsoft.com/en-us/linkedin/marketing/integrations/community-management/shares/network-update-social-actions#create-comment)",
version: "0.1.4",
version: "0.1.5",
type: "action",
props: {
linkedin,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export default {
key: "linkedin-create-image-post-organization",
name: "Create Image Post (Organization)",
description: "Create an image post on LinkedIn. [See the docs here](https://learn.microsoft.com/en-us/linkedin/marketing/integrations/community-management/shares/images-api?view=li-lms-2023-09&tabs=http#uploading-an-image)",
version: "0.0.1",
version: "0.0.2",
type: "action",
props: {
linkedin,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export default {
key: "linkedin-create-image-post-user",
name: "Create Image Post (User)",
description: "Create an image post on LinkedIn. [See the docs here](https://learn.microsoft.com/en-us/linkedin/marketing/integrations/community-management/shares/images-api?view=li-lms-2023-09&tabs=http#uploading-an-image)",
version: "0.0.1",
version: "0.0.2",
type: "action",
props: {
linkedin,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export default {
key: "linkedin-create-like-on-share",
name: "Create Like On Share",
description: "Creates a like on a share. [See the docs here](https://docs.microsoft.com/en-us/linkedin/marketing/integrations/community-management/shares/network-update-social-actions#create-a-like-on-a-share)",
version: "0.1.4",
version: "0.1.5",
type: "action",
props: {
linkedin,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export default {
key: "linkedin-create-text-post-organization",
name: "Create a Simple Post (Organization)",
description: "Create post on LinkedIn using text, URL or article. [See the docs](https://learn.microsoft.com/en-us/linkedin/marketing/integrations/community-management/shares/posts-api?view=li-lms-2022-11&tabs=http#create-organic-posts) for more information",
version: "0.0.4",
version: "0.0.5",
type: "action",
props: {
linkedin,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export default {
key: "linkedin-create-text-post-user",
name: "Create a Simple Post (User)",
description: "Create post on LinkedIn using text, URL or article. [See the docs](https://learn.microsoft.com/en-us/linkedin/marketing/integrations/community-management/shares/posts-api?view=li-lms-2022-11&tabs=http#create-organic-posts) for more information",
version: "0.0.4",
version: "0.0.5",
type: "action",
props: {
linkedin,
Expand Down
2 changes: 1 addition & 1 deletion components/linkedin/actions/delete-post/delete-post.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export default {
key: "linkedin-delete-post",
name: "Delete Post",
description: "Removes a post from user's wall. [See the docs](https://docs.microsoft.com/en-us/linkedin/marketing/integrations/community-management/shares/share-api?tabs=http#delete-shares) for more information",
version: "0.0.4",
version: "0.0.5",
type: "action",
props: {
linkedin,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export default {
key: "linkedin-fetch-ad-account",
name: "Fetch Ad Account",
description: "Fetches an individual adAccount given its id. [See the docs here](https://docs.microsoft.com/en-us/linkedin/marketing/integrations/ads/account-structure/create-and-manage-accounts#fetch-ad-account)",
version: "0.1.4",
version: "0.1.5",
type: "action",
props: {
linkedin,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export default {
key: "linkedin-get-current-member-profile",
name: "Get Current Member Profile",
description: "Gets the profile of the current authenticated member. [See the docs here](https://docs.microsoft.com/en-us/linkedin/shared/integrations/people/profile-api#retrieve-current-members-profile)",
version: "0.1.4",
version: "0.1.5",
type: "action",
props: {
linkedin,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export default {
key: "linkedin-get-member-organization-access-control",
name: "Get Member's Organization Access Control Information",
description: "Gets the organization access control information of the current authenticated member. [See the docs here](https://docs.microsoft.com/en-us/linkedin/marketing/integrations/community-management/organizations/organization-access-control?context=linkedin/compliance/context#find-a-members-organization-access-control-information)",
version: "0.1.4",
version: "0.1.5",
type: "action",
props: {
linkedin,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export default {
key: "linkedin-get-member-profile",
name: "Get Member Profile",
description: "Gets another member's profile, given its person id. [See the docs here](https://docs.microsoft.com/en-us/linkedin/shared/integrations/people/profile-api#retrieve-other-members-profile)",
version: "0.1.4",
version: "0.1.5",
type: "action",
props: {
linkedin,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export default {
key: "linkedin-get-multiple-member-profiles",
name: "Get Multiple Member Profiles",
description: "Gets multiple member profiles at once. [See the docs here](https://docs.microsoft.com/en-us/linkedin/shared/integrations/people/profile-api#retrieve-other-members-profile)",
version: "0.1.4",
version: "0.1.5",
type: "action",
props: {
linkedin,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export default {
key: "linkedin-get-organization-access-control",
name: "Gets Organization Access Control",
description: "Gets an organization's access control information, given the organization urn. [See the docs here](https://docs.microsoft.com/en-us/linkedin/marketing/integrations/community-management/organizations/organization-access-control?context=linkedin/compliance/context#find-access-control-information)",
version: "0.1.4",
version: "0.1.5",
type: "action",
props: {
linkedin,
Expand All @@ -21,24 +21,20 @@ export default {
},
},
async run({ $ }) {
let start = 0;
const count = 50;
const results = [];

const params = {
q: "organization",
organization: encodeURI(this.organizationUrn),
start: 0,
count,
};
const params = `q=organization&organization=${this.organizationUrn.replace(/:/g, "%3A")}&count=${count}`;

let done = false;
do {
const { elements } = await this.linkedin.getAccessControl({
$,
params,
const { data: { elements } } = await this.linkedin.getAccessControl({
params: params + `&start=${start}`,
});

results.push(...elements);
params.start += count;
start += count;
if (elements?.length < count) {
done = true;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export default {
key: "linkedin-get-organization-administrators",
name: "Get Organization Administrators",
description: "Gets the administator members of an organization, given the organization urn. [See the docs here](https://docs.microsoft.com/en-us/linkedin/marketing/integrations/community-management/organizations/organization-access-control?context=linkedin/compliance/context#find-organization-administrators)",
version: "0.2.4",
version: "0.2.5",
type: "action",
props: {
linkedin,
Expand All @@ -21,26 +21,20 @@ export default {
},
},
async run({ $ }) {
let start = 0;
const count = 50;
const results = [];

const params = {
q: "organization",
organization: encodeURI(this.organizationUrn),
role: "ADMINISTRATOR",
state: "APPROVED",
start: 0,
count,
};
const params = `q=organization&organization=${this.organizationUrn.replace(/:/g, "%3A")}&role=ADMINISTRATOR&state=APPROVED&count=${count}`;

let done = false;
do {
const { elements } = await this.linkedin.getAccessControl({
$,
params,
const { data: { elements } } = await this.linkedin.getAccessControl({
params: params + `&start=${start}`,
});

results.push(...elements);
params.start += count;
start += count;
if (elements?.length < count) {
done = true;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export default {
key: "linkedin-retrieve-comments-on-comments",
name: "Retrieves Comments on Comments",
description: "Retrieves comments on comments, given the parent comment urn. [See the docs here](https://docs.microsoft.com/en-us/linkedin/marketing/integrations/community-management/shares/network-update-social-actions#retrieve-comments-on-comments)",
version: "0.1.4",
version: "0.1.5",
type: "action",
props: {
linkedin,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export default {
key: "linkedin-retrieve-comments-shares",
name: "Retrieve Comments On Shares",
description: "Retrieve comments on shares given the share urn. [See the docs here](https://docs.microsoft.com/en-us/linkedin/marketing/integrations/community-management/shares/network-update-social-actions#retrieve-comments-on-shares)",
version: "0.1.4",
version: "0.1.5",
type: "action",
props: {
linkedin,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export default {
key: "linkedin-search-organization",
name: "Search Organization",
description: "Searches for an organization by vanity name or email domain. [See the docs here](https://docs.microsoft.com/en-us/linkedin/marketing/integrations/community-management/organizations/organization-lookup-api)",
version: "0.1.4",
version: "0.1.5",
type: "action",
props: {
linkedin,
Expand Down
2 changes: 1 addition & 1 deletion components/linkedin/common/constants.mjs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const VERSION_PATH = "rest";
const BASE_URL = "https://api.linkedin.com/";
const VERSION_HEADER = "202309";
const VERSION_HEADER = "202409";

const VISIBILITIES = [
{
Expand Down
27 changes: 18 additions & 9 deletions components/linkedin/linkedin.app.mjs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { axios } from "@pipedream/platform";
import { axios as axiosPD } from "@pipedream/platform";
import axios from "axios";
import constants from "./common/constants.mjs";
michelle0927 marked this conversation as resolved.
Show resolved Hide resolved

export default {
Expand Down Expand Up @@ -45,7 +46,7 @@ export default {
});
return elements?.map((element) => ({
label: element.name,
id: element.id,
value: element.id,
}));
},
},
Expand Down Expand Up @@ -138,13 +139,22 @@ export default {
}) {
const BASE_URL = constants.BASE_URL;

const config = {
return axiosPD($ || this, {
url: url || `${BASE_URL}${constants.VERSION_PATH}${path}`,
headers: this._getHeaders(),
...otherConfig,
};
});
},
async _makeRequestAxios({
url, path, ...otherConfig
}) {
const BASE_URL = constants.BASE_URL;

return axios($ || this, config);
return axios({
url: url || `${BASE_URL}${constants.VERSION_PATH}${path}`,
headers: this._getHeaders(),
...otherConfig,
});
},
michelle0927 marked this conversation as resolved.
Show resolved Hide resolved
async createPost({
data, ...args
Expand Down Expand Up @@ -223,10 +233,9 @@ export default {
...args,
});
},
async getAccessControl(args = {}) {
return this._makeRequest({
path: "/organizationAcls",
...args,
async getAccessControl({ params }) {
return this._makeRequestAxios({
path: `/organizationAcls?${params}`,
});
michelle0927 marked this conversation as resolved.
Show resolved Hide resolved
},
async queryAnaltyics(query, args = {} ) {
Expand Down
2 changes: 1 addition & 1 deletion components/linkedin/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@pipedream/linkedin",
"version": "0.1.0",
"version": "0.1.1",
"description": "Pipedream Linkedin Components",
"main": "linkedin.app.mjs",
"keywords": [
Expand Down
Loading