@memberjunction/actions-bizapps-social
Version:
Social Media Actions for MemberJunction - Twitter, LinkedIn, Facebook, Instagram, TikTok, YouTube, HootSuite, Buffer
166 lines • 4.76 kB
TypeScript
import { BaseSocialMediaAction, MediaFile, SocialPost, SearchParams, SocialAnalytics } from '../../base/base-social.action';
import { AxiosInstance, AxiosError } from 'axios';
/**
* Base class for all LinkedIn actions.
* Handles LinkedIn-specific authentication, API interactions, and rate limiting.
* Uses LinkedIn Marketing Developer Platform API v2.
*/
export declare abstract class LinkedInBaseAction extends BaseSocialMediaAction {
protected get platformName(): string;
protected get apiBaseUrl(): string;
/**
* Axios instance for making HTTP requests
*/
private _axiosInstance;
/**
* Get or create axios instance with interceptors
*/
protected get axiosInstance(): AxiosInstance;
/**
* Refresh the access token using the refresh token
*/
protected refreshAccessToken(): Promise<void>;
/**
* Get the authenticated user's profile URN
*/
protected getCurrentUserUrn(): Promise<string>;
/**
* Get organizations the user has admin access to
*/
protected getAdminOrganizations(): Promise<LinkedInOrganization[]>;
/**
* Upload media to LinkedIn
*/
protected uploadSingleMedia(file: MediaFile): Promise<string>;
/**
* Validate media file meets LinkedIn requirements
*/
protected validateMediaFile(file: MediaFile): void;
/**
* Create a share (post) on LinkedIn
*/
protected createShare(shareData: LinkedInShareData): Promise<string>;
/**
* Get shares for a specific author (person or organization)
*/
protected getShares(authorUrn: string, count?: number, start?: number): Promise<LinkedInShare[]>;
/**
* Convert LinkedIn share to common format
*/
protected normalizePost(linkedInShare: LinkedInShare): SocialPost;
/**
* Normalize LinkedIn analytics to common format
*/
protected normalizeAnalytics(linkedInAnalytics: LinkedInAnalytics): SocialAnalytics;
/**
* Search for posts - implemented in search action
*/
protected searchPosts(params: SearchParams): Promise<SocialPost[]>;
/**
* Handle LinkedIn-specific errors
*/
protected handleLinkedInError(error: AxiosError): never;
/**
* Parse LinkedIn-specific rate limit headers
*/
protected parseRateLimitHeaders(headers: any): {
remaining: number;
reset: Date;
limit: number;
} | null;
}
/**
* LinkedIn-specific interfaces
*/
export interface LinkedInOrganization {
urn: string;
name: string;
id: string;
}
export interface LinkedInShareData {
author: string;
lifecycleState: 'PUBLISHED' | 'DRAFT';
specificContent: {
'com.linkedin.ugc.ShareContent': {
shareCommentary: {
text: string;
};
shareMediaCategory: 'NONE' | 'ARTICLE' | 'IMAGE' | 'VIDEO' | 'RICH';
media?: Array<{
status: 'READY';
media: string;
title?: {
text: string;
};
description?: {
text: string;
};
}>;
};
};
visibility: {
'com.linkedin.ugc.MemberNetworkVisibility': 'PUBLIC' | 'CONNECTIONS' | 'LOGGED_IN' | 'CONTAINER';
};
distribution?: {
linkedInDistributionTarget?: {
visibleToGuest?: boolean;
};
};
}
export interface LinkedInShare {
id: string;
author: string;
created: {
actor: string;
time: number;
};
firstPublishedAt?: number;
lastModified?: {
actor: string;
time: number;
};
lifecycleState: string;
specificContent: {
'com.linkedin.ugc.ShareContent': {
shareCommentary: {
text: string;
};
shareMediaCategory: string;
media?: Array<{
media: string;
title?: {
text: string;
};
}>;
};
};
visibility: {
'com.linkedin.ugc.MemberNetworkVisibility': string;
};
distribution?: any;
}
export interface LinkedInAnalytics {
totalShareStatistics?: {
impressionCount: number;
clickCount: number;
engagement: number;
likeCount: number;
commentCount: number;
shareCount: number;
uniqueImpressionsCount: number;
};
timeRange?: {
start: number;
end: number;
};
}
export interface LinkedInArticle {
author: string;
publishedAt: number;
coverImage?: string;
title: string;
description?: string;
content: string;
visibility: string;
}
//# sourceMappingURL=linkedin-base.action.d.ts.map