friday-sdk
Version:
Official JavaScript/TypeScript SDK for the Friday API
53 lines (46 loc) • 1.25 kB
text/typescript
import { APIClient } from "../client";
export interface LinkedInProfileResponse {
name?: string;
headline?: string;
about?: string;
location?: string;
experiences?: any[];
education?: any[];
skills?: string[];
[key: string]: any; // extra fields
}
export interface GetProfileOptions {
/**
* LinkedIn profile URL to analyze
*/
profileUrl: string;
/**
* If true, bypasses cache and fetches fresh data
* @default false
*/
realtime?: boolean;
}
/**
* Fetch and analyze a LinkedIn profile with caching support.
*
* @param client - API client instance
* @param options - Profile fetch options
* @returns Promise resolving to profile data
*
* @remarks
* - Cached data is returned if available and less than 2 weeks old
* - Fresh data is fetched and cached if no valid cache exists
* - Setting realtime=true always fetches fresh data
*/
export const getProfile = (
client: APIClient,
options: GetProfileOptions
): Promise<LinkedInProfileResponse> => {
const params = new URLSearchParams({
profile_url: options.profileUrl
});
if (options.realtime) {
params.append('realtime', 'true');
}
return client.request<LinkedInProfileResponse>(`/profile?${params.toString()}`);
};