From c9d11d74950804c4f420f943ee966d21d861c00f Mon Sep 17 00:00:00 2001 From: Luan Cazarine Date: Tue, 17 Sep 2024 18:13:00 -0300 Subject: [PATCH 1/3] update api version --- components/linkedin/common/constants.mjs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/linkedin/common/constants.mjs b/components/linkedin/common/constants.mjs index 2d6dd75a13e43..a84bbac4cf002 100644 --- a/components/linkedin/common/constants.mjs +++ b/components/linkedin/common/constants.mjs @@ -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 = [ { From 6fa142b646aa24800e88b0451142def6252cf459 Mon Sep 17 00:00:00 2001 From: Luan Cazarine Date: Wed, 18 Sep 2024 10:06:04 -0300 Subject: [PATCH 2/3] bump versions --- components/linkedin/actions/create-comment/create-comment.mjs | 2 +- .../create-image-post-organization.mjs | 2 +- .../actions/create-image-post-user/create-image-post-user.mjs | 2 +- .../actions/create-like-on-share/create-like-on-share.mjs | 2 +- .../create-text-post-organization.mjs | 2 +- .../actions/create-text-post-user/create-text-post-user.mjs | 2 +- components/linkedin/actions/delete-post/delete-post.mjs | 2 +- .../linkedin/actions/fetch-ad-account/fetch-ad-account.mjs | 2 +- .../get-current-member-profile/get-current-member-profile.mjs | 2 +- .../get-member-organization-access-control.mjs | 2 +- .../linkedin/actions/get-member-profile/get-member-profile.mjs | 2 +- .../get-multiple-member-profiles.mjs | 2 +- .../get-organization-access-control.mjs | 2 +- .../get-organization-administrators.mjs | 2 +- .../retrieve-comments-on-comments.mjs | 2 +- .../retrieve-comments-shares/retrieve-comments-shares.mjs | 2 +- .../actions/search-organization/search-organization.mjs | 2 +- components/linkedin/package.json | 2 +- 18 files changed, 18 insertions(+), 18 deletions(-) diff --git a/components/linkedin/actions/create-comment/create-comment.mjs b/components/linkedin/actions/create-comment/create-comment.mjs index d3e0b05a6c8ce..d4e90266a0e31 100644 --- a/components/linkedin/actions/create-comment/create-comment.mjs +++ b/components/linkedin/actions/create-comment/create-comment.mjs @@ -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, diff --git a/components/linkedin/actions/create-image-post-organization/create-image-post-organization.mjs b/components/linkedin/actions/create-image-post-organization/create-image-post-organization.mjs index bd9b1238ed4f5..1ddb3239e89b8 100644 --- a/components/linkedin/actions/create-image-post-organization/create-image-post-organization.mjs +++ b/components/linkedin/actions/create-image-post-organization/create-image-post-organization.mjs @@ -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, diff --git a/components/linkedin/actions/create-image-post-user/create-image-post-user.mjs b/components/linkedin/actions/create-image-post-user/create-image-post-user.mjs index 61ffa5d4c185d..06471fe9384cc 100644 --- a/components/linkedin/actions/create-image-post-user/create-image-post-user.mjs +++ b/components/linkedin/actions/create-image-post-user/create-image-post-user.mjs @@ -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, diff --git a/components/linkedin/actions/create-like-on-share/create-like-on-share.mjs b/components/linkedin/actions/create-like-on-share/create-like-on-share.mjs index 38ae9457bffe7..90df9492d9cd5 100644 --- a/components/linkedin/actions/create-like-on-share/create-like-on-share.mjs +++ b/components/linkedin/actions/create-like-on-share/create-like-on-share.mjs @@ -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, diff --git a/components/linkedin/actions/create-text-post-organization/create-text-post-organization.mjs b/components/linkedin/actions/create-text-post-organization/create-text-post-organization.mjs index e2af84549748c..ed325d91435bc 100644 --- a/components/linkedin/actions/create-text-post-organization/create-text-post-organization.mjs +++ b/components/linkedin/actions/create-text-post-organization/create-text-post-organization.mjs @@ -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, diff --git a/components/linkedin/actions/create-text-post-user/create-text-post-user.mjs b/components/linkedin/actions/create-text-post-user/create-text-post-user.mjs index 5326acee5f761..197081e14da1d 100644 --- a/components/linkedin/actions/create-text-post-user/create-text-post-user.mjs +++ b/components/linkedin/actions/create-text-post-user/create-text-post-user.mjs @@ -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, diff --git a/components/linkedin/actions/delete-post/delete-post.mjs b/components/linkedin/actions/delete-post/delete-post.mjs index 86352723d639a..0aca5da5e447b 100644 --- a/components/linkedin/actions/delete-post/delete-post.mjs +++ b/components/linkedin/actions/delete-post/delete-post.mjs @@ -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, diff --git a/components/linkedin/actions/fetch-ad-account/fetch-ad-account.mjs b/components/linkedin/actions/fetch-ad-account/fetch-ad-account.mjs index 717b2f2ee10ca..512f0d3e8de06 100644 --- a/components/linkedin/actions/fetch-ad-account/fetch-ad-account.mjs +++ b/components/linkedin/actions/fetch-ad-account/fetch-ad-account.mjs @@ -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, diff --git a/components/linkedin/actions/get-current-member-profile/get-current-member-profile.mjs b/components/linkedin/actions/get-current-member-profile/get-current-member-profile.mjs index 741c8d2f7dae8..1fb95e0f41697 100644 --- a/components/linkedin/actions/get-current-member-profile/get-current-member-profile.mjs +++ b/components/linkedin/actions/get-current-member-profile/get-current-member-profile.mjs @@ -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, diff --git a/components/linkedin/actions/get-member-organization-access-control/get-member-organization-access-control.mjs b/components/linkedin/actions/get-member-organization-access-control/get-member-organization-access-control.mjs index 650ad67d1ebd2..5bcb826d9b68e 100644 --- a/components/linkedin/actions/get-member-organization-access-control/get-member-organization-access-control.mjs +++ b/components/linkedin/actions/get-member-organization-access-control/get-member-organization-access-control.mjs @@ -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, diff --git a/components/linkedin/actions/get-member-profile/get-member-profile.mjs b/components/linkedin/actions/get-member-profile/get-member-profile.mjs index ee3cd1cb40c44..88f3e0d32f4c6 100644 --- a/components/linkedin/actions/get-member-profile/get-member-profile.mjs +++ b/components/linkedin/actions/get-member-profile/get-member-profile.mjs @@ -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, diff --git a/components/linkedin/actions/get-multiple-member-profiles/get-multiple-member-profiles.mjs b/components/linkedin/actions/get-multiple-member-profiles/get-multiple-member-profiles.mjs index 62e34d3d8dd11..4d0e936b07a2a 100644 --- a/components/linkedin/actions/get-multiple-member-profiles/get-multiple-member-profiles.mjs +++ b/components/linkedin/actions/get-multiple-member-profiles/get-multiple-member-profiles.mjs @@ -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, diff --git a/components/linkedin/actions/get-organization-access-control/get-organization-access-control.mjs b/components/linkedin/actions/get-organization-access-control/get-organization-access-control.mjs index 7657b8742abf2..01d179b7231e0 100644 --- a/components/linkedin/actions/get-organization-access-control/get-organization-access-control.mjs +++ b/components/linkedin/actions/get-organization-access-control/get-organization-access-control.mjs @@ -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, diff --git a/components/linkedin/actions/get-organization-administrators/get-organization-administrators.mjs b/components/linkedin/actions/get-organization-administrators/get-organization-administrators.mjs index 63aefbb626211..42c46c56a6345 100644 --- a/components/linkedin/actions/get-organization-administrators/get-organization-administrators.mjs +++ b/components/linkedin/actions/get-organization-administrators/get-organization-administrators.mjs @@ -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, diff --git a/components/linkedin/actions/retrieve-comments-on-comments/retrieve-comments-on-comments.mjs b/components/linkedin/actions/retrieve-comments-on-comments/retrieve-comments-on-comments.mjs index 511f977875973..1275a478c5355 100644 --- a/components/linkedin/actions/retrieve-comments-on-comments/retrieve-comments-on-comments.mjs +++ b/components/linkedin/actions/retrieve-comments-on-comments/retrieve-comments-on-comments.mjs @@ -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, diff --git a/components/linkedin/actions/retrieve-comments-shares/retrieve-comments-shares.mjs b/components/linkedin/actions/retrieve-comments-shares/retrieve-comments-shares.mjs index 4df7261e9bb37..9bf222cf80e1e 100644 --- a/components/linkedin/actions/retrieve-comments-shares/retrieve-comments-shares.mjs +++ b/components/linkedin/actions/retrieve-comments-shares/retrieve-comments-shares.mjs @@ -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, diff --git a/components/linkedin/actions/search-organization/search-organization.mjs b/components/linkedin/actions/search-organization/search-organization.mjs index 8a924d0bda13a..f32f128e3ef60 100644 --- a/components/linkedin/actions/search-organization/search-organization.mjs +++ b/components/linkedin/actions/search-organization/search-organization.mjs @@ -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, diff --git a/components/linkedin/package.json b/components/linkedin/package.json index 1b03f843ecd9f..e5768a8b56aa5 100644 --- a/components/linkedin/package.json +++ b/components/linkedin/package.json @@ -1,6 +1,6 @@ { "name": "@pipedream/linkedin", - "version": "0.1.0", + "version": "0.1.1", "description": "Pipedream Linkedin Components", "main": "linkedin.app.mjs", "keywords": [ From b9be91eaab1e81db249d8d9eaddf6ba1ecd67cff Mon Sep 17 00:00:00 2001 From: Luan Cazarine Date: Thu, 19 Sep 2024 16:59:16 -0300 Subject: [PATCH 3/3] some adjusts --- .../get-organization-access-control.mjs | 16 +++++------ .../get-organization-administrators.mjs | 18 +++++-------- components/linkedin/linkedin.app.mjs | 27 ++++++++++++------- 3 files changed, 30 insertions(+), 31 deletions(-) diff --git a/components/linkedin/actions/get-organization-access-control/get-organization-access-control.mjs b/components/linkedin/actions/get-organization-access-control/get-organization-access-control.mjs index 01d179b7231e0..c4e27df6ca920 100644 --- a/components/linkedin/actions/get-organization-access-control/get-organization-access-control.mjs +++ b/components/linkedin/actions/get-organization-access-control/get-organization-access-control.mjs @@ -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; } diff --git a/components/linkedin/actions/get-organization-administrators/get-organization-administrators.mjs b/components/linkedin/actions/get-organization-administrators/get-organization-administrators.mjs index 42c46c56a6345..d1869d3c75f51 100644 --- a/components/linkedin/actions/get-organization-administrators/get-organization-administrators.mjs +++ b/components/linkedin/actions/get-organization-administrators/get-organization-administrators.mjs @@ -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; } diff --git a/components/linkedin/linkedin.app.mjs b/components/linkedin/linkedin.app.mjs index 2550f28ab1bf5..620ee795e9762 100644 --- a/components/linkedin/linkedin.app.mjs +++ b/components/linkedin/linkedin.app.mjs @@ -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"; export default { @@ -45,7 +46,7 @@ export default { }); return elements?.map((element) => ({ label: element.name, - id: element.id, + value: element.id, })); }, }, @@ -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, + }); }, async createPost({ data, ...args @@ -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}`, }); }, async queryAnaltyics(query, args = {} ) {