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 = {} ) {