@polymindslabs/widget-sdk
Version:
Universal Job Widget SDK for embedding job boards and apply buttons
88 lines (87 loc) • 2.06 kB
TypeScript
/**
* API Client for Job Widget SDK
*/
import type { WidgetConfig, Job, Application, User, PaginatedResponse, AuthToken, ProfileIncompleteData } from './types';
export declare class APIClient {
private config;
private baseUrl;
private headers;
constructor(config: WidgetConfig);
/**
* Make an authenticated API request
*/
private request;
/**
* Get stored authentication token
*/
private getStoredToken;
/**
* Store authentication token
*/
private storeToken;
/**
* Clear stored token
*/
private clearStoredToken;
/**
* Exchange OAuth code for token
*/
exchangeCodeForToken(code: string, _state: string): Promise<AuthToken>;
/**
* Get OAuth client ID
*/
private getOAuthClientId;
/**
* Get OAuth redirect URI
*/
private getOAuthRedirectUri;
/**
* Get list of jobs
*/
getJobs(params?: {
page?: number;
per_page?: number;
department?: string;
location?: string;
search?: string;
}): Promise<PaginatedResponse<Job>>;
/**
* Get single job details
*/
getJob(jobId: string): Promise<Job>;
/**
* Submit job application
*/
applyToJob(jobId: string, tenantId: string, data?: {
cover_letter?: string;
resume_id?: string;
answers?: Record<string, any>;
}): Promise<Application | ProfileIncompleteData | {
status: string;
message: string;
}>;
/**
* Get user profile
*/
getUserProfile(): Promise<User>;
/**
* Get application status
*/
getApplicationStatus(applicationId: string): Promise<Application>;
/**
* Get user's applications
*/
getUserApplications(): Promise<Application[]>;
/**
* Check if user is authenticated
*/
isAuthenticated(): boolean;
/**
* Get OAuth authorization URL
*/
getOAuthUrl(state: string): string;
/**
* Clear all stored data
*/
clearStorage(): void;
}