feat: linkedin fix
This commit is contained in:
parent
c8d93aed88
commit
98f6662c5f
|
|
@ -115,7 +115,7 @@ export class LinkedinPageProvider
|
|||
headers: {
|
||||
Authorization: `Bearer ${accessToken}`,
|
||||
'X-Restli-Protocol-Version': '2.0.0',
|
||||
'LinkedIn-Version': '202402',
|
||||
'LinkedIn-Version': '202501',
|
||||
},
|
||||
}
|
||||
)
|
||||
|
|
@ -257,7 +257,7 @@ export class LinkedinPageProvider
|
|||
|
||||
const { elements }: { elements: Root[]; paging: any } = await (
|
||||
await this.fetch(
|
||||
`https://api.linkedin.com/rest/organizationPageStatistics?q=organization&organization=${encodeURIComponent(
|
||||
`https://api.linkedin.com/v2/organizationPageStatistics?q=organization&organization=${encodeURIComponent(
|
||||
`urn:li:organization:${id}`
|
||||
)}&timeIntervals=(timeRange:(start:${startDate},end:${endDate}),timeGranularityType:DAY)`,
|
||||
{
|
||||
|
|
@ -272,7 +272,7 @@ export class LinkedinPageProvider
|
|||
|
||||
const { elements: elements2 }: { elements: Root[]; paging: any } = await (
|
||||
await this.fetch(
|
||||
`https://api.linkedin.com/rest/organizationalEntityFollowerStatistics?q=organizationalEntity&organizationalEntity=${encodeURIComponent(
|
||||
`https://api.linkedin.com/v2/organizationalEntityFollowerStatistics?q=organizationalEntity&organizationalEntity=${encodeURIComponent(
|
||||
`urn:li:organization:${id}`
|
||||
)}&timeIntervals=(timeRange:(start:${startDate},end:${endDate}),timeGranularityType:DAY)`,
|
||||
{
|
||||
|
|
@ -287,7 +287,7 @@ export class LinkedinPageProvider
|
|||
|
||||
const { elements: elements3 }: { elements: Root[]; paging: any } = await (
|
||||
await this.fetch(
|
||||
`https://api.linkedin.com/rest/organizationalEntityShareStatistics?q=organizationalEntity&organizationalEntity=${encodeURIComponent(
|
||||
`https://api.linkedin.com/v2/organizationalEntityShareStatistics?q=organizationalEntity&organizationalEntity=${encodeURIComponent(
|
||||
`urn:li:organization:${id}`
|
||||
)}&timeIntervals=(timeRange:(start:${startDate},end:${endDate}),timeGranularityType:DAY)`,
|
||||
{
|
||||
|
|
@ -404,7 +404,7 @@ export class LinkedinPageProvider
|
|||
headers: {
|
||||
'X-Restli-Protocol-Version': '2.0.0',
|
||||
'Content-Type': 'application/json',
|
||||
'LinkedIn-Version': '202402',
|
||||
'LinkedIn-Version': '202501',
|
||||
Authorization: `Bearer ${integration.token}`,
|
||||
},
|
||||
}
|
||||
|
|
@ -413,7 +413,7 @@ export class LinkedinPageProvider
|
|||
|
||||
if (totalLikes >= +fields.likesAmount) {
|
||||
await timer(2000);
|
||||
await this.fetch(`https://api.linkedin.com/rest/posts`, {
|
||||
await this.fetch(`https://api.linkedin.com/v2/posts`, {
|
||||
body: JSON.stringify({
|
||||
author: `urn:li:organization:${integration.internalId}`,
|
||||
commentary: '',
|
||||
|
|
@ -433,7 +433,7 @@ export class LinkedinPageProvider
|
|||
headers: {
|
||||
'X-Restli-Protocol-Version': '2.0.0',
|
||||
'Content-Type': 'application/json',
|
||||
'LinkedIn-Version': '202402',
|
||||
'LinkedIn-Version': '202501',
|
||||
Authorization: `Bearer ${integration.token}`,
|
||||
},
|
||||
});
|
||||
|
|
@ -482,7 +482,7 @@ export class LinkedinPageProvider
|
|||
headers: {
|
||||
'X-Restli-Protocol-Version': '2.0.0',
|
||||
'Content-Type': 'application/json',
|
||||
'LinkedIn-Version': '202402',
|
||||
'LinkedIn-Version': '202501',
|
||||
Authorization: `Bearer ${integration.token}`,
|
||||
},
|
||||
}
|
||||
|
|
|
|||
|
|
@ -171,13 +171,13 @@ export class LinkedinProvider extends SocialAbstract implements SocialProvider {
|
|||
|
||||
const { elements } = await (
|
||||
await this.fetch(
|
||||
`https://api.linkedin.com/rest/organizations?q=vanityName&vanityName=${getCompanyVanity[1]}`,
|
||||
`https://api.linkedin.com/v2/organizations?q=vanityName&vanityName=${getCompanyVanity[1]}`,
|
||||
{
|
||||
method: 'GET',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'X-Restli-Protocol-Version': '2.0.0',
|
||||
'LinkedIn-Version': '202402',
|
||||
'LinkedIn-Version': '202501',
|
||||
Authorization: `Bearer ${token}`,
|
||||
},
|
||||
}
|
||||
|
|
@ -203,7 +203,7 @@ export class LinkedinProvider extends SocialAbstract implements SocialProvider {
|
|||
value: { uploadUrl, image, video, uploadInstructions, ...all },
|
||||
} = await (
|
||||
await this.fetch(
|
||||
`https://api.linkedin.com/rest/${
|
||||
`https://api.linkedin.com/v2/${
|
||||
fileName.indexOf('mp4') > -1 ? 'videos' : 'images'
|
||||
}?action=initializeUpload`,
|
||||
{
|
||||
|
|
@ -211,7 +211,7 @@ export class LinkedinProvider extends SocialAbstract implements SocialProvider {
|
|||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'X-Restli-Protocol-Version': '2.0.0',
|
||||
'LinkedIn-Version': '202402',
|
||||
'LinkedIn-Version': '202501',
|
||||
Authorization: `Bearer ${accessToken}`,
|
||||
},
|
||||
body: JSON.stringify({
|
||||
|
|
@ -242,7 +242,7 @@ export class LinkedinProvider extends SocialAbstract implements SocialProvider {
|
|||
method: 'PUT',
|
||||
headers: {
|
||||
'X-Restli-Protocol-Version': '2.0.0',
|
||||
'LinkedIn-Version': '202402',
|
||||
'LinkedIn-Version': '202501',
|
||||
Authorization: `Bearer ${accessToken}`,
|
||||
...(fileName.indexOf('mp4') > -1
|
||||
? { 'Content-Type': 'application/octet-stream' }
|
||||
|
|
@ -256,7 +256,7 @@ export class LinkedinProvider extends SocialAbstract implements SocialProvider {
|
|||
|
||||
if (fileName.indexOf('mp4') > -1) {
|
||||
const a = await this.fetch(
|
||||
'https://api.linkedin.com/rest/videos?action=finalizeUpload',
|
||||
'https://api.linkedin.com/v2/videos?action=finalizeUpload',
|
||||
{
|
||||
method: 'POST',
|
||||
body: JSON.stringify({
|
||||
|
|
@ -268,7 +268,7 @@ export class LinkedinProvider extends SocialAbstract implements SocialProvider {
|
|||
}),
|
||||
headers: {
|
||||
'X-Restli-Protocol-Version': '2.0.0',
|
||||
'LinkedIn-Version': '202402',
|
||||
'LinkedIn-Version': '202501',
|
||||
'Content-Type': 'application/json',
|
||||
Authorization: `Bearer ${accessToken}`,
|
||||
},
|
||||
|
|
@ -472,7 +472,7 @@ export class LinkedinProvider extends SocialAbstract implements SocialProvider {
|
|||
isPersonal = true
|
||||
) {
|
||||
try {
|
||||
await this.fetch(`https://api.linkedin.com/rest/posts`, {
|
||||
await this.fetch(`https://api.linkedin.com/v2/posts`, {
|
||||
body: JSON.stringify({
|
||||
author:
|
||||
(isPersonal ? 'urn:li:person:' : `urn:li:organization:`) +
|
||||
|
|
@ -494,7 +494,7 @@ export class LinkedinProvider extends SocialAbstract implements SocialProvider {
|
|||
headers: {
|
||||
'X-Restli-Protocol-Version': '2.0.0',
|
||||
'Content-Type': 'application/json',
|
||||
'LinkedIn-Version': '202402',
|
||||
'LinkedIn-Version': '202501',
|
||||
Authorization: `Bearer ${integration.token}`,
|
||||
},
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in New Issue